Texture.FromBitmap(Device,Bitmap,Usage,Pool) Method (Microsoft.DirectX.Direct3D)

Creates a texture resource from a bitmap.

Definition

Visual BasicPublic Shared Function FromBitmap( _
    ByVal device As Device, _
    ByVal image As BitmapLeave Site, _
    ByVal usage As Usage, _
    ByVal pool As Pool _
) As Texture
C#public static Texture FromBitmap(
    Device device,
    BitmapLeave Site image,
    Usage usage,
    Pool pool
);
C++public:
static TextureFromBitmap(
    Devicedevice,
    BitmapLeave Siteimage,
    Usage usage,
    Pool pool
);
JScriptpublic static function FromBitmap(
    device : Device,
    image : BitmapLeave Site,
    usage : Usage,
    pool : Pool
) : Texture;

Parameters

device Microsoft.DirectX.Direct3D.Device
A Device object to associate with the Texture.
image System.Drawing.Bitmap
A BitmapLeave Site used to create the texture.
usage Microsoft.DirectX.Direct3D.Usage
Usage can be 0, which indicates no usage value. However, if usage is desired, use one or more Usage constants. It is good practice to match the usage parameter with the CreateFlags in the Device constructor.
pool Microsoft.DirectX.Direct3D.Pool
Member of the Pool enumerated type that describes the memory class into which the texture should be placed.

Return Value

Remarks

An application can discover support for automatic generation of mipmaps in a particular format by calling Manager.CheckDeviceFormat with Usage.AutoGenerateMipMap. If Manager.CheckDeviceFormat returns false, the Texture constructor succeeds, but returns a single-level texture.

Exceptions
InvalidCallException The method call is invalid. For example, a parameter might contain an invalid value.
OutOfVideoMemoryException Microsoft Direct3D does not have enough display memory to perform the operation.
OutOfMemoryExceptionLeave Site Direct3D could not allocate sufficient memory to complete the call.

See Also

Show: