## IDirect3DRMTexture

Applications use the methods of the IDirect3DRMTexture interface to work with textures, which are rectangular arrays of pixels. This section is a reference to the methods of this interface. For a conceptual overview, see IDirect3DRMTexture and IDirect3DRMTexture2 Interfaces.

To avoid unnecessary delays when creating textures, hold onto textures you want to use again, instead of creating them each time they're needed. For optimal performance, use a texture surface format that is supported by the device you are using. This will avoid a costly format conversion when the texture is created and any time it changes.

See the remarks in IDirect3DRM::LoadTexture for an example showing how to keep a reference to textures loaded in a texture callback through IDirect3DRM::LoadTexture.

The methods of the IDirect3DRMTexture interface can be organized into the following groups:

Color | GetColors
| SetColors
Decals | GetDecalOrigin
| GetDecalScale
| GetDecalSize
| GetDecalTransparency
| GetDecalTransparentColor
| SetDecalOrigin
| SetDecalScale
| SetDecalSize
| SetDecalTransparency
| SetDecalTransparentColor
Images | GetImage
Initialization | InitFromFile
| InitFromResource
| InitFromSurface
Renderer notification | Changed
Shading | GetShades
| SetShades

The IDirect3DRMTexture interface, like all Component Object Model (COM) interfaces, inherits the IUnknown interface methods. The IUnknown interface supports the following three methods:

AddRef
QueryInterface
Release

In addition, the IDirect3DRMTexture interface inherits the following methods from the IDirect3DRMObject interface:

AddDestroyCallback
Clone
DeleteDestroyCallback
GetAppData
GetClassName
GetName
SetAppData
SetName

The Direct3DRMTexture object is obtained by using the IDirect3DRM::CreateTexture method.

###

IDirect3DRMTexture::Changed

IDirect3DRMTexture

Informs the renderer that the application has changed the pixels or the palette of a texture.

HRESULT Changed(
BOOL bPixels,
BOOL bPalette
);

##### Parameters

bPixels
  If this parameter is TRUE, the pixels have changed.
bPalette
  If this parameter is TRUE, the palette has changed.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMTexture::GetColors

IDirect3DRMTexture

Retrieves the maximum number of colors used for rendering a texture.

DWORD GetColors( );

##### Return Values

Returns the number of colors.

##### Remarks

This method returns the number of colors that the texture has been quantized to, not the number of colors in the image from which the texture was created. Consequently, the number of colors that are returned usually matches the colors that were set by using the IDirect3DRM::SetDefaultTextureColors method—unless you used the IDirect3DRMTexture::SetColors method explicitly to change the colors for the texture.

##### See Also

IDirect3DRMTexture::SetColors

###

IDirect3DRMTexture::GetDecalOrigin

IDirect3DRMTexture

Retrieves the current origin of the decal.

HRESULT GetDecalOrigin(
LONG * lplX,
LONG * lplY
);

##### Parameters

lplX and lplY
  Addresses of variables that will be filled with the origin of the decal when the method returns.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::SetDecalOrigin

###

IDirect3DRMTexture::GetDecalScale

IDirect3DRMTexture

Retrieves the scaling property of the given decal.

DWORD GetDecalScale( );

##### Return Values

Returns the scaling property if successful, or -1 otherwise.

##### See Also

IDirect3DRMTexture::SetDecalScale

###

IDirect3DRMTexture::GetDecalSize

IDirect3DRMTexture

Retrieves the size of the decal.

HRESULT GetDecalSize(
D3DVALUE *lprvWidth,
D3DVALUE *lprvHeight
);

##### Parameters

lprvWidth and lprvHeight
  Addresses of variables that will be filled with the width and height of the decal when the method returns.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::SetDecalSize

###

IDirect3DRMTexture::GetDecalTransparency

IDirect3DRMTexture

Retrieves the transparency property of the decal.

BOOL GetDecalTransparency( );

##### Return Values

Returns TRUE if the decal has a transparent color, FALSE otherwise.

##### See Also

IDirect3DRMTexture::SetDecalTransparency

###

IDirect3DRMTexture::GetDecalTransparentColor

IDirect3DRMTexture

Retrieves the transparent color of the decal.

D3DCOLOR GetDecalTransparentColor( );

##### Return Values

Returns the value of the transparent color.

##### See Also

IDirect3DRMTexture::SetDecalTransparentColor

###

IDirect3DRMTexture::GetImage

IDirect3DRMTexture

Retrieves an address of the image that the texture was created with. Returns a NULL pointer if the current texture was created with a DirectDraw surface.

D3DRMIMAGE * GetImage( );

##### Return Values

Returns the address of the D3DRMIMAGE structure that the current texture was created with.

###

IDirect3DRMTexture::GetShades

IDirect3DRMTexture

Retrieves the number of shades used for each color in the texture when rendering.

DWORD GetShades( );

##### Return Values

Returns the number of shades.

##### See Also

IDirect3DRMTexture::SetShades

###

IDirect3DRMTexture::InitFromFile

IDirect3DRMTexture

Initializes a texture by using the information in a given file.

HRESULT InitFromFile(
const char *filename
);

##### Parameters

filename
  Address of a string specifying the file from which initialization information is drawn.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### Remarks

You must have created the texture to be initialized using the IDirect3DRM::CreateObject method.

##### See Also

IDirect3DRMTexture::InitFromResource, IDirect3DRMTexture::InitFromSurface

###

IDirect3DRMTexture::InitFromResource

IDirect3DRMTexture

Initializes a Direct3DRMTexture object from a specified resource.

HRESULT InitFromResource(
HRSRC rs
);

##### Parameters

rs
  Handle of the specified resource.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::InitFromFile, IDirect3DRMTexture::InitFromSurface

###

IDirect3DRMTexture::InitFromSurface

IDirect3DRMTexture

Initializes a texture by using the data from a given DirectDraw surface.

HRESULT InitFromSurface(
LPDIRECTDRAWSURFACE lpDDS
);

##### Parameters

lpDDS
  Address of a DirectDraw surface from which initialization information is drawn.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::InitFromFile, IDirect3DRMTexture::InitFromResource

###

IDirect3DRMTexture::SetColors

IDirect3DRMTexture

Sets the maximum number of colors used for rendering a texture. This method is required only in the ramp color model.

HRESULT SetColors(
DWORD ulColors
);

##### Parameters

ulColors
  Number of colors. The default value is 8.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::GetColors

###

IDirect3DRMTexture::SetDecalOrigin

IDirect3DRMTexture

Sets the origin of the decal as an offset from the top left of the decal.

HRESULT SetDecalOrigin(
LONG lX,
LONG lY
);

##### Parameters

lX and lY
  New origin, in decal coordinates, for the decal. The default origin is [0, 0].

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### Remarks

The decal's origin is mapped to its frame's position when rendering. For example, the origin of a decal of a cross would be set to the middle of the decal, and the origin of an arrow pointing down would be set to midway along the bottom edge.

This method is also used to add a decal origin key to a Direct3DRMTextureInterpolator object.

##### See Also

IDirect3DRMTexture::GetDecalOrigin

###

IDirect3DRMTexture::SetDecalScale

IDirect3DRMTexture

Sets the scaling property for a decal.

HRESULT SetDecalScale(
DWORD dwScale
);

##### Parameters

dwScale
  If this parameter is TRUE, depth is taken into account when the decal is scaled. If it is FALSE, depth information is ignored. The default value is TRUE.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::GetDecalScale

###

IDirect3DRMTexture::SetDecalSize

IDirect3DRMTexture

Sets the size of the decal to be used if the decal is being scaled according to its depth in the scene.

HRESULT SetDecalSize(
D3DVALUE rvWidth,
D3DVALUE rvHeight
);

##### Parameters

rvWidth and rvHeight
  New width and height, in model coordinates, of the decal. The default size is [1, 1].

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### Remarks

This method is also used to add a decal size key to a Direct3DRMTextureInterpolator object.

##### See Also

IDirect3DRMTexture::GetDecalSize

###

IDirect3DRMTexture::SetDecalTransparency

IDirect3DRMTexture

Sets the transparency property of the decal.

HRESULT SetDecalTransparency(
BOOL bTransp
);

##### Parameters

bTransp
  If this parameter is TRUE, the decal has a transparent color. If it is FALSE, it has an opaque color. The default value is FALSE.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::GetDecalTransparency

###

IDirect3DRMTexture::SetDecalTransparentColor

IDirect3DRMTexture

Sets the transparent color for a decal.

HRESULT SetDecalTransparentColor(
D3DCOLOR rcTransp
);

##### Parameters

rcTransp
  New transparent color. The default transparent color is black.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### Remarks

This method is also used to add a decal transparent color key to a Direct3DRMTextureInterpolator object.

##### See Also

IDirect3DRMTexture::GetDecalTransparentColor

###

IDirect3DRMTexture::SetShades

IDirect3DRMTexture

Sets the maximum number of shades to use for each color of the texture when rendering. This method is required only in the ramp color model.

HRESULT SetShades(
DWORD ulShades
);

##### Parameters

ulShades
  New number of shades. This value must be a power of 2. The default value is 16.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMTexture::GetShades

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.