Compartir a través de


TextureLoader.FromFile Method (Device, String)

Creates a texture from a file.

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

Syntax

'Declaration
Public Shared Function FromFile ( _
    device As Device, _
    srcFile As String _
) As Texture
'Usage
Dim device As Device
Dim srcFile As String
Dim returnValue As Texture

returnValue = TextureLoader.FromFile(device, srcFile)
public static Texture FromFile (
    Device device,
    string srcFile
)
public:
static Texture^ FromFile (
    Device^ device, 
    String^ srcFile
)
public static Texture FromFile (
    Device device, 
    String srcFile
)
public static function FromFile (
    device : Device, 
    srcFile : String
) : Texture
Not applicable.

Parameters

  • device
    A Device that represents the device to associate with the texture.
  • srcFile
    String that specifies the file name.

Return Value

A Texture that represents the created texture object.

Remarks

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 2 dimensions, use it to create and store images.

  • For mipmap image creation at load time, filter using Box. A box filter is much faster than other filter types such as Triangle.

  • Consider using DDS files. Since they 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 algorithms can be used to author the images.

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