TextureLoader.FromStream Method (Device, Stream, Int32, Int32, Int32, Int32, Usage, Format, Pool, Filter, Filter, Int32, array<PaletteEntry[]%)
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Creates a texture with the specified properties, including the color palette, 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, _
<OutAttribute> ByRef palette As PaletteEntry() _
) 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 palette As PaletteEntry()
Dim returnValue As Texture
returnValue = TextureLoader.FromStream(device, _
stream, readBytes, width, height, _
mipLevels, usage, format, pool, filter, _
mipFilter, colorKey, palette)
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,
out PaletteEntry[] palette
)
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,
[OutAttribute] array<PaletteEntry>^% palette
)
static member 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 *
palette:PaletteEntry[] byref -> Texture
Parameters
- device
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Device
The device to associate with the texture.
- stream
Type: System.IO.Stream
The stream from which to create the texture.
- readBytes
Type: System.Int32
The size, in bytes, of the file in memory.
- width
Type: System.Int32
The width in pixels. If this value is 0 (zero), the dimensions are taken from the file.
- height
Type: System.Int32
The height in pixels. If this value is 0 (zero), the dimensions are taken from the file.
- mipLevels
Type: System.Int32
The number of mip levels requested. If this value is 0 (zero), a complete mipmap chain is created.
- usage
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Usage
Specify 0 (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 of 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
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Format
The requested pixel format for the cube texture.
- pool
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Pool
The memory class into which the cube texture should be placed.
- filter
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Filter
One or more flags that control how the image is filtered.
- mipFilter
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Filter
One or more flags that control how the mipmaps are filtered.
- colorKey
Type: System.Int32
A value to replace with transparent black, or 0 (zero) to disable the color key. colorKey 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.
- palette
Type: array<Microsoft.WindowsMobile.DirectX.Direct3D.PaletteEntry[]%
An array of structures that represents a 256-color palette to fill in, or 0 (zero).
Return Value
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Texture
The created texture object.
Exceptions
Exception | Condition |
---|---|
InvalidCallException | The method call is invalid. For example, a method's parameter might contain an invalid value. |
OutOfMemoryException | Direct3D could not allocate sufficient memory to complete the call. |
Remarks
This method supports the following file formats: .bmp, .dds, .jpg, .png, and .gif.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Platforms
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Compact Framework
Supported in: 3.5, 2.0