Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 2.0
TextureLoader Class
FromFile Method
 FromFile Method (Device, String)
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
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)

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

returnValue = TextureLoader.FromFile(device, srcFile)
C#
public static Texture FromFile (
    Device device,
    string srcFile
)
C++
public:
static Texture^ FromFile (
    Device^ device, 
    String^ srcFile
)
J#
public static Texture FromFile (
    Device device, 
    String srcFile
)
JScript
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.

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.

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

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.

.NET Compact Framework

Supported in: 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker