TextureLoader.FromStream Method (Device, Stream, Int32, Int32, Int32, Int32, Usage, Format, Pool, Filter, Filter, Int32)
Creates a texture from a file in memory.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)
Syntax
'Declaration
Public Shared Function FromStream ( _
device As Device, _
stream As Stream, _
readBytes As Integer, _
width As Integer, _
height As Integer, _
mipLevels As Integer, _
usage As Usage, _
format As Format, _
pool As Pool, _
filter As Filter, _
mipFilter As Filter, _
colorKey As Integer _
) As Texture
'Usage
Dim device As Device
Dim stream As Stream
Dim readBytes As Integer
Dim width As Integer
Dim height As Integer
Dim mipLevels As Integer
Dim usage As Usage
Dim format As Format
Dim pool As Pool
Dim filter As Filter
Dim mipFilter As Filter
Dim colorKey As Integer
Dim returnValue As Texture
returnValue = TextureLoader.FromStream(device, stream, readBytes, width, height, mipLevels, usage, format, pool, filter, mipFilter, colorKey)
public static Texture FromStream (
Device device,
Stream stream,
int readBytes,
int width,
int height,
int mipLevels,
Usage usage,
Format format,
Pool pool,
Filter filter,
Filter mipFilter,
int colorKey
)
public:
static Texture^ FromStream (
Device^ device,
Stream^ stream,
int readBytes,
int width,
int height,
int mipLevels,
Usage usage,
Format format,
Pool pool,
Filter filter,
Filter mipFilter,
int colorKey
)
public static Texture FromStream (
Device device,
Stream stream,
int readBytes,
int width,
int height,
int mipLevels,
Usage usage,
Format format,
Pool pool,
Filter filter,
Filter mipFilter,
int colorKey
)
public static function FromStream (
device : Device,
stream : Stream,
readBytes : int,
width : int,
height : int,
mipLevels : int,
usage : Usage,
format : Format,
pool : Pool,
filter : Filter,
mipFilter : Filter,
colorKey : int
) : Texture
Not applicable.
Parameters
- device
A Device that represents the device to associate with the texture.
- stream
A Stream from which to create the texture.
- readBytes
Size, in bytes, of the file in memory.
- width
Width in pixels. If this value is 0, the dimensions are taken from the file.
- height
Height in pixels. If this value is 0, the dimensions are taken from the file.
- mipLevels
Number of mip levels requested. If this value is 0, a complete mipmap chain is created.
usage
Specify zero or Usage values. Specify RenderTarget to indicate that the surface will be used as a render target. The resource can then be passed to the renderTarget parameter for the SetRenderTarget method of a Device. The application should determine whether the device supports this operation by using the CheckDeviceFormat method of a Manager.Specify Dynamic to indicate that the surface should be handled dynamically.
- format
Format value that describes the requested pixel format for the cube texture.
- pool
Pool value that describes the memory class into which the cube texture should be placed.
- filter
One or more Filter flags that control how the image is filtered.
- mipFilter
One or more Filter flags that control how the mipmaps are filtered.
- colorKey
A value to replace with transparent black, or 0 to disable the color key. This is always a 32-bit ARGB color that is independent of the source image format. Alpha is significant, and usually should be set to FF for opaque color keys. For example, for opaque black, the value is equal to 0xFF000000.
Return Value
A Texture that represents the created texture object.
Exceptions
Exception type | Condition |
---|---|
The method call is invalid. For example, a method's parameter might contain an invalid value. |
|
Direct3D could not allocate sufficient memory to complete the call. |
Remarks
This method supports the following file formats: .bmp, .dds, .jpg, .png, and .gif.
Platforms
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Version Information
.NET Compact Framework
Supported in: 2.0
See Also
Reference
TextureLoader Class
TextureLoader Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace