Texture

Return to Introduction  Previous page  Next page

A texture represents any bitmap based resource.

 

Properties

 

filename

A read only string that specifies the filename the current texture was loaded from.

mipmap

A boolean value, if true the texture has mipmaps (smaller versions of the texture designed for distance views).  You can set this to false to destroy the automatically generated mipmaps.

width

A read only integer for the texture width.

height

A read only integer for the texture height.

 

Methods

 

loadFromFile(filename)

Replaces any references to this texture map with a new texture from the given image file.  This may be a file on disk or a URL.

reload()

Reloads the original resource.

setPixel(x, y, col)

Sets the pixel at the x,y position in the texture to the given Color value.  Returns true if successful.

getPixel(x, y)

Returns the Color value at the x,y position in the texture or null if not found.

animationFramesGet(animId)

Returns a string listing the filename and duration pair values for the given texture animation (comma separated).

animationFramesSet(animId, frameString)

Allows you to set a string listing the filename and duration pair values for the given texture animation (comma separated).  e.g. "smoke1.png,3.5,smoke2.png,1.5" would show smoke1.png for 3.5 seconds, then smoke2.png for 1.5 seconds.

 

Examples

 

textures.find("mychair.jpg").loadFromFile("http://www.dxstudio.com/examples/latestshot.jpg");

 

See Also

 

Script Reference



Copyright ©2004 Worldweaver Ltd. DX Studio Home