Package com.ms.com.directX Previous
Previous
Microsoft Packages
Microsoft Packages
Index
Index
Next
Next

Class d3drmTexture

Applications use the methods of the d3drmTexture class to work with textures, which are rectangular arrays of pixels.

public class d3drmTexture implements Id3drmTexture
{
  public void InternalSetObject(IUnknown lpdd);
  public IUnknown InternalGetObject();
  public d3drmTexture Clone();
  public void AddDestroyCallback(Id3drmCallback fn, IUnknown Arg);
  public void DeleteDestroyCallback(Id3drmCallback fn, IUnknown args);
  public void SetAppData(int data);
  public int GetAppData();
  public void SetName(String name);
  public String GetName();
  public String GetClassName();
  public void InitFromFile(String filename);
  public void InitFromSurface(ddSurface ddS);
  public void InitFromResource(int rs);
  public void Changed(int pixels, int palette);
  public void SetColors(int c);
  public void SetShades(int s);
  public void SetDecalSize(float width, float height);
  public void SetDecalOrigin(int x, int y);
  public void SetDecalScale(int s);
  public void SetDecalTransparency(int trans);
  public void SetDecalTransparentColor(int tcolor);
  public void GetDecalSize(float[] w, float[] h);
  public void GetDecalOrigin(int[] x, int[] y);
  public d3drmImage GetImage();
  public int GetShades();
  public int GetColors();
  public int GetDecalScale();
  public int GetDecalTransparency();
  public int GetDecalTransparentColor();
}

The methods 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

In addition, the d3drmTexture class inherits the following methods from the d3drmObject class:
AddDestroyCallback
Clone
DeleteDestroyCallback
GetAppData
GetClassName
GetName
SetAppData
SetName

The d3drmTexture object is obtained by calling the CreateTexture method.

Changed

public void Changed(int pixels, int palette);

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

Return Value:

No return value.

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


GetColors

public int GetColors();

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

Return Value:

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 calling the SetDefaultTextureColors method, unless you used the SetColors method explicitly to change the colors for the texture.

See Also: SetColors


GetDecalOrigin

public void GetDecalOrigin(int[] x, int[] y);

Retrieves the current origin of the decal.

Return Value:

No return value.

ParameterDescription
x and y Array variables that receive the origin of the decal.

See Also: SetDecalOrigin


GetDecalScale

public int GetDecalScale();

Retrieves the scaling property of the given decal.

Return Value:

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

See Also: SetDecalScale


GetDecalSize

public void GetDecalSize(float[] w, float[] h);

Retrieves the size of the decal.

Return Value:

No return value.

ParameterDescription
w and h Addresses of variables that will be filled with the width and height of the decal when the method returns.

See Also: SetDecalSize


GetDecalTransparency

public int GetDecalTransparency();

Retrieves the transparency property of the decal.

Return Value:

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

See Also: SetDecalTransparency


GetDecalTransparentColor

public int GetDecalTransparentColor();

Retrieves the transparent color of the decal.

Return Value:

Returns the value of the transparent color.

See Also: SetDecalTransparentColor


GetImage

public d3drmImage GetImage();

Returns the image that the texture was created with.

Return Value:

Returns the d3drmImage object that the current texture was created with.


GetShades

public int GetShades();

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

Return Value:

Returns the number of shades.

See Also: SetShades


InitFromFile

public void InitFromFile(String filename);

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

Return Value:

No return value.

ParameterDescription
filename Name of the file from which initialization information is drawn.

Remarks:

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

See Also: InitFromResource, InitFromSurface


InitFromResource

public void InitFromResource(int rs);

Initializes a d3drmTexture object from a specified resource.

Return Value:

No return value.

ParameterDescription
rs Handle of the specified resource.

See Also: InitFromFile, InitFromSurface


InitFromSurface

public void InitFromSurface(ddSurface ddS);

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

Return Value:

No return value.

ParameterDescription
ddS The DirectDraw surface (ddSurface) from which initialization information is drawn.

See Also: InitFromFile, InitFromResource


SetColors

public void SetColors(int c);

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

Return Value:

No return value.

ParameterDescription
c Number of colors.

Remarks:

By default, the initial number of colors is 8.

See Also: GetColors


SetDecalOrigin

public void SetDecalOrigin(int x, int y);

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

Return Value:

No return value.

ParameterDescription
x and y New origin, in decal coordinates, for the decal.

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.

By default, the initial decal origin is [0, 0].

See Also: GetDecalOrigin


SetDecalScale

public void SetDecalScale(int s);

Sets the scaling property for a decal.

Return Value:

No return value.

ParameterDescription
s If this parameter is TRUE, depth is taken into account when the decal is scaled. If it is FALSE, depth information is ignored.

Remarks:

By default, the initial decal scaling property is TRUE.

See Also: GetDecalScale


SetDecalSize

public void SetDecalSize(float width, float height);

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

Return Value:

No return value.

ParameterDescription
width and height New width and height, in model coordinates, of the decal.

Remarks:

By default, the initial decal size is [1, 1].

See Also: GetDecalSize


SetDecalTransparency

public void SetDecalTransparency(int trans);

Sets the transparency property of the decal.

Return Value:

No return value.

ParameterDescription
trans If this parameter is TRUE, the decal has a transparent color. If it is FALSE, it has an opaque color.

Remarks:

By default, the initial transparency property is FALSE.

See Also: GetDecalTransparency


SetDecalTransparentColor

public void SetDecalTransparentColor(int tcolor);

Sets the transparent color for a decal.

Return Value:

No return value.

ParameterDescription
tcolor New transparent color.

Remarks:

By default., the initial transparent color is black.

See Also: GetDecalTransparentColor


SetShades

public void SetShades(int s);

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

Return Value:

No return value.

ParameterDescription
s New number of shades. This value must be a power of 2.

Remarks:

By default, the initial number of shades is 16.

See Also: GetShades



Top© 1996 Microsoft Corporation. All rights reserved.