Creates a texture from a file.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)

Syntax
Visual Basic (Declaration)
Public Shared Function FromFile ( _
device As Device, _
srcFile As String _
) As Texture
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
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.

.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information
.NET Compact Framework
Supported in: 2.0

See Also