TextureLoader.FromFile Method (Device, String, Int32, Int32, Int32, Usage, Format, Pool, Filter, Filter, Int32)

[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 from a file.

Namespace:  Microsoft.WindowsMobile.DirectX.Direct3D
Assembly:  Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)

public static Texture FromFile(
	Device device,
	string srcFile,
	int width,
	int height,
	int mipLevels,
	Usage usage,
	Format format,
	Pool pool,
	Filter filter,
	Filter mipFilter,
	int colorKey
)

Parameters

device
Type: Microsoft.WindowsMobile.DirectX.Direct3D.Device
The device to associate with the texture.
srcFile
Type: System.String
The name of the file from which to create the texture.
width
Type: System.Int32
The width of the texture in pixels. If this value is 0 (zero), the dimensions are taken from the file.
height
Type: System.Int32
The height of the texture 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 a Usage value. 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.

Return Value

Type: Microsoft.WindowsMobile.DirectX.Direct3D.Texture
The created texture object.

This method supports the following file formats: .bmp, .dds, .jpg, .png, and .gif.

To get the best performance with this method, consider the following:

  • Doing image scaling and format conversion at load time can be slow. Store images in the format and resolution in which they will be used. If the target hardware requires power-of-two dimensions, use power-of-two dimensions to create and store images.

  • For mipmap image creation at load time, filter by using the Box filter type. A box filter is much faster than some of the other filter types.

  • Consider using DirectDraw surface (DDS) files. Because DDS files can be used to represent any Microsoft DirectX texture format, they are easily read by this method. Also, they can store mipmaps, which means that any mipmap generation algorithm can be used to author the images.

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.

.NET Compact Framework

Supported in: 3.5, 2.0
Show: