[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.19.5 Texture object

The texture objects holds a CS iTextureHandle. The only things you can do with a Texture object are Create and Load. The system takes care of destroying them. You may use a Pen to draw on them, or a Gradient to render to them but that is outside the scope of the texture object itself.

The following static methods are available with Texture.

Create(width,height)

Create a new, blank texture widthxheight pixels in area.

Load(filename)

Load any image that CS supports as a texture. The filename must include the VFS path of course.

To create a procedural texture:

 
my_tex = Texture.Create(10,10);

To load an image as a texture:

 
my_tex = Texture.Load("/path/to/image.png");

You may also retrieve the size of texture object by using the GetDimensions method.

GetDimensions()

Returns a TextureDimensions object containing the width and height of the texture.

 
dim = my_tex.GetDimensions()

Sys.Print("Texture width: ", dim.width, " Texture height: ", dim.height);

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated using texi2html 1.76.