Class Direct3dRMTexture
public class Direct3dRMTexture implements IDirect3dRMTexture
{
// Methods
public void changed(int pixels, int palette);
public int getColors();
public void getDecalOrigin(int[] x, int[] y);
public int getDecalScale();
public void getDecalSize(float[] w, float[] h);
public int getDecalTransparency();
public int getDecalTransparentColor();
public Direct3dRMImage getImage();
public void getImageBuffer(byte[] buffer1);
public void getImagePalette(byte[] pal);
public int getShades();
public void setColors(int c);
public void setDecalOrigin(int x, int y);
public void setDecalScale(int s);
public void setDecalSize(float width, float height);
public void setDecalTransparency(int trans);
public void setDecalTransparentColor(int tcolor);
public void setShades(int s);
}
Applications use the methods of the Direct3dRMTexture class to work with textures, which are rectangular arrays of pixels.
The Direct3dRMTexture class inherits the following methods from the Direct3dRMObject class:
- addDestroyCallback
- duplicate
- deleteDestroyCallback
- getAppData
- getClassName
- getName
- setAppData
- setName
The Direct3dRMTexture object is obtained by calling the createTexture method.
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.
Parameter | Description |
pixels
| If this parameter is true, the pixels have changed.
|
palette
| If this parameter is true, the palette has changed.
|
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 that the texture was created from. Consequently, the number of colors that are returned usually matches the number ofcolors that were set by calling the setDefaultTextureColors method, unless you explicitly used the setColors method to change the colors for the texture.
See Also: setColors
public void getDecalOrigin(int[] x, int[] y);
Retrieves the current origin of the decal.
Return Value:
No return value.
Parameter | Description |
x
| The array variables that receive the x coordinate of the origin of the decal.
|
y
| The array variables that receive the y coordinate of the origin of the decal.
|
See Also: setDecalOrigin
public int getDecalScale();
Retrieves the scaling property of the given decal.
Return Value:
Returns the scaling property if successful; otherwise, returns -1.
See Also: setDecalScale
public void getDecalSize(float[] w, float[] h);
Retrieves the size of the decal.
Return Value:
No return value.
Parameter | Description |
w
| The addresses of variables that will be filled with the width of the decal when the method returns.
|
h
| The addresses of variables that will be filled with the height of the decal when the method returns.
|
See Also: setDecalSize
public int getDecalTransparency();
Retrieves the transparency property of the decal.
Return Value:
Returns true if the decal has a transparent color; otherwise, returns false.
See Also: setDecalTransparency
public int getDecalTransparentColor();
Retrieves the transparent color of the decal.
Return Value:
Returns the value of the transparent color.
See Also: setDecalTransparentColor
public Direct3dRMImage getImage();
Retrieves the image that the texture is created with.
Return Value:
Returns the D3dRMImage object that the current texture was created with.
public void getImageBuffer(byte[] buffer1);
Retrieves the image buffer that the texture is created with.
Return Value:
No return value.
Parameter | Description |
buffer1
| The image buffer.
|
public void getImagePalette(byte[] pal);
Retrieves the image palette that the texture is created with.
Return Value:
No return value.
Parameter | Description |
pal
| The image palette.
|
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
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.
Parameter | Description |
c
| The number of colors.
|
Remarks:
By default, the initial number of colors is 8.
See Also: getColors
public void setDecalOrigin(int x, int y);
Sets the decal origin as an offset from the top left of the decal.
Return Value:
No return value.
Parameter | Description |
x
| The x coordinate of the new origin for the decal.
|
y
| The y coordinate of the new origin for the decal.
|
Remarks:
The decal 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
public void setDecalScale(int s);
Sets the scaling property for a decal.
Return Value:
No return value.
Parameter | Description |
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
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.
Parameter | Description |
width
| The new width of the decal, in model coordinates.
|
height
| The new height of the decal, in model coordinates.
|
Remarks:
By default, the initial decal size is [1, 1].
See Also: getDecalSize
public void setDecalTransparency(int trans);
Sets the transparency property of the decal.
Return Value:
No return value.
Parameter | Description |
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
public void setDecalTransparentColor(int tcolor);
Sets the transparent color for a decal.
Return Value:
No return value.
Parameter | Description |
tcolor
| The new transparent color.
|
Remarks:
By default, the initial transparent color is black.
See Also: getDecalTransparentColor
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.
Parameter | Description |
s
| The 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