다음을 통해 공유


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)

Syntax

'Declaration
Public Shared Function FromFile ( _
    device As Device, _
    srcFile As String, _
    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 _
) As Texture
'Usage
Dim device As Device
Dim srcFile As String
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 returnValue As Texture

returnValue = TextureLoader.FromFile(device, _
    srcFile, width, height, mipLevels, _
    usage, format, pool, filter, mipFilter, _
    colorKey)
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
)
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
)
static member FromFile : 
        device:Device * 
        srcFile:string * 
        width:int * 
        height:int * 
        mipLevels:int * 
        usage:Usage * 
        format:Format * 
        pool:Pool * 
        filter:Filter * 
        mipFilter:Filter * 
        colorKey:int -> Texture 

Parameters

  • 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.
  • 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.

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-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.

.NET Framework Security

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

See Also

Reference

TextureLoader Class

TextureLoader Members

FromFile Overload

Microsoft.WindowsMobile.DirectX.Direct3D Namespace