Representation of a GPU texture. More...
Public Member Functions | |
| Texture | Create (integer width, integer height) |
| Creates a texture with the given dimensions. | |
| void | Copy (Texture destTexture, Drawable srcDrawable) |
| Copies pixels from srcDrawable into destTexture. | |
| void | Convert (Drawable srcDrawable, array destPixels, TEXTUREFORMAT targetFormat, array palette) |
| Converts the format of the pixels in srcPixels from srcFormat into targetFormat. If srcFormat and targetFormat are the same, this just copies the pixels from srcDrawable into destPixels. | |
| void | Convert (array srcPixels, TEXTUREFORMAT srcFormat, array destPixels, TEXTUREFORMAT targetFormat, array palette) |
| Converts the format of the pixels in srcPixels from srcFormat into targetFormat. If srcFormat and targetFormat are the same, this just copies the pixels from srcPixels into destPixels. | |
| integer | Convert (integer color, TEXTUREFORMAT srcFormat, TEXTUREFORMAT targetFormat, array palette) |
| Converts color from srcFormat into targetFormat. If srcFormat and targetFormat are the same, this just returns color. | |
| boolean | CanConvertBetweenFormats (TEXTUREFORMAT srcFormat, TEXTUREFORMAT targetFormat) |
| Returns whether srcFormat can be converted into targetFormat. | |
| boolean | FormatHasAlphaChannel (TEXTUREFORMAT format) |
| Returns whether format has an alpha channel. | |
| void | SetSize (integer width, integer height) |
| Changes the dimensions of the texture, without scaling the pixels. | |
| void | Scale (integer width, integer height) |
| Scales the texture to the given dimensions, using nearest neighbor interpolation. | |
| integer | GetPixel (integer x, integer y) |
| Gets the pixel at the specified coordinates. | |
| array | GetPixelData (integer x=0, integer y=0, integer width, integer height) |
| Gets an array of pixels of the given dimensions at the specified coordinates. | |
| void | SetPixel (integer x, integer y, integer color) |
| Sets the pixel at the specified coordinates. | |
| void | CopyPixels (Drawable srcDrawable, array srcPalette) |
| Copies pixels from a Drawable into the specified coordinates. The formats must be compatible. | |
| void | CopyPixels (Drawable srcDrawable, integer destX, integer destY, array srcPalette) |
| Copies pixels from a Drawable into the specified coordinates. The formats must be compatible. | |
| void | CopyPixels (Drawable srcDrawable, integer srcX, integer srcY, integer destX, integer destY, integer destWidth, integer destHeight, array srcPalette) |
| Copies a region of pixels from a Drawable into the specified coordinates. The formats must be compatible. | |
| void | CopyPixels (array srcPixels, array srcPalette) |
| Copies pixels from an array into the specified coordinates. | |
| void | CopyPixels (array srcPixels, TEXTUREFORMAT srcFormat, array srcPalette) |
| Copies pixels from an array into the specified coordinates. | |
| void | CopyPixels (array srcPixels, TEXTUREFORMAT srcFormat, integer srcWidth, integer srcHeight, array srcPalette) |
| Copies pixels from an array into the specified coordinates. | |
| void | CopyPixels (array srcPixels, TEXTUREFORMAT srcFormat, integer srcWidth, integer srcHeight, integer destX, integer destY, array srcPalette) |
| Copies a region of pixels from an array into the specified coordinates. | |
| void | CopyPixels (array srcPixels, TEXTUREFORMAT srcFormat, integer srcX, integer srcY, integer srcWidth, integer srcHeight, integer destX, integer destY, integer destWidth, integer destHeight, array srcPalette) |
| Copies a region of pixels from an array into the specified coordinates. | |
| void | Apply () |
| Uploads all changes made to the texture to the GPU. This is an expensive operation, so change the most amount of pixels as possible before calling this. | |
| void | Delete () |
| Deletes the texture. It can no longer be used after this function is called. | |
| Texture (integer width, integer height, TEXTUREACCESS access, TEXTUREFORMAT format, array pixels, array palette) | |
| Creates a texture with the given dimensions, access mode, and format. | |
| Texture (integer width, integer height, TEXTUREACCESS access, TEXTUREFORMAT format, Drawable source, array palette) | |
| Creates a texture with the given dimensions, access mode, and format. | |
Public Attributes | |
| integer | Width |
| The width of the texture. | |
| integer | Height |
| The height of the texture. | |
| TEXTUREFORMAT | Format |
| The format of the texture. | |
| TEXTUREACCESS | Access |
| The access mode of the texture. | |
Representation of a GPU texture.
| Texture.Texture | ( | integer | width, |
| integer | height, | ||
| TEXTUREACCESS | access, | ||
| TEXTUREFORMAT | format, | ||
| array | pixels, | ||
| array | palette ) |
Creates a texture with the given dimensions, access mode, and format.
| width | The width of the texture. |
| height | The height of the texture. |
| access | The access mode of the texture. (default: TEXTUREACCESS_STATIC) |
| format | The format of the texture. The default is TEXTUREFORMAT_RGB888, or TEXTUREFORMAT_NATIVE for render target textures. |
| pixels | An array of pixels to initialize the texture with. The length of the array must match the dimensions of the texture (e.g., for a 64x64 texture, you must pass an array of exactly 4096 values.) |
| palette | The palette of the texture, format 0xRRGGBB. |
| Texture.Texture | ( | integer | width, |
| integer | height, | ||
| TEXTUREACCESS | access, | ||
| TEXTUREFORMAT | format, | ||
| Drawable | source, | ||
| array | palette ) |
Creates a texture with the given dimensions, access mode, and format.
| width | The width of the texture. |
| height | The height of the texture. |
| access | The access mode of the texture. (default: TEXTUREACCESS_STATIC) |
| format | The format of the texture. The default is TEXTUREFORMAT_RGB888, or TEXTUREFORMAT_NATIVE for render target textures. |
| source | The Drawable to initialize the texture with. |
| palette | The palette of the Drawable, format 0xRRGGBB. |
| boolean Texture.CanConvertBetweenFormats | ( | TEXTUREFORMAT | srcFormat, |
| TEXTUREFORMAT | targetFormat ) |
Returns whether srcFormat can be converted into targetFormat.
| srcFormat | The source format. |
| targetFormat | The target format. |
| void Texture.Convert | ( | array | srcPixels, |
| TEXTUREFORMAT | srcFormat, | ||
| array | destPixels, | ||
| TEXTUREFORMAT | targetFormat, | ||
| array | palette ) |
Converts the format of the pixels in srcPixels from srcFormat into targetFormat. If srcFormat and targetFormat are the same, this just copies the pixels from srcPixels into destPixels.
| srcPixels | An array of pixels. |
| srcFormat | The source format. |
| destPixels | The destination array. |
| targetFormat | The target format. |
| palette | The palette of the source if srcFormat is TEXTUREFORMAT_INDEXED, or the palette of the target if targetFormat is TEXTUREFORMAT_INDEXED. Format 0xRRGGBB. Required if srcFormat is TEXTUREFORMAT_INDEXED. |
| void Texture.Convert | ( | Drawable | srcDrawable, |
| array | destPixels, | ||
| TEXTUREFORMAT | targetFormat, | ||
| array | palette ) |
Converts the format of the pixels in srcPixels from srcFormat into targetFormat. If srcFormat and targetFormat are the same, this just copies the pixels from srcDrawable into destPixels.
| srcDrawable | The Drawable to convert. |
| destPixels | The destination array. |
| targetFormat | The target format. |
| palette | The palette of the source if srcFormat is TEXTUREFORMAT_INDEXED, or the palette of the target if targetFormat is TEXTUREFORMAT_INDEXED. Format 0xRRGGBB. |
| integer Texture.Convert | ( | integer | color, |
| TEXTUREFORMAT | srcFormat, | ||
| TEXTUREFORMAT | targetFormat, | ||
| array | palette ) |
Converts color from srcFormat into targetFormat. If srcFormat and targetFormat are the same, this just returns color.
| color | The color to convert. |
| srcFormat | The source format. |
| targetFormat | The target format. |
| palette | The palette of the source if srcFormat is TEXTUREFORMAT_INDEXED, or the palette of the target if targetFormat is TEXTUREFORMAT_INDEXED. Format 0xRRGGBB. Required if srcFormat is TEXTUREFORMAT_INDEXED. |
| void Texture.Copy | ( | Texture | destTexture, |
| Drawable | srcDrawable ) |
Copies pixels from srcDrawable into destTexture.
| destTexture | The texture to copy pixels into. |
| srcDrawable | The drawable to copy pixels from. |
| void Texture.CopyPixels | ( | array | srcPixels, |
| array | srcPalette ) |
Copies pixels from an array into the specified coordinates.
| srcPixels | An array of pixels in the pixel format of the texture. |
| srcPalette | The palette of the source, format 0xRRGGBB. |
| void Texture.CopyPixels | ( | array | srcPixels, |
| TEXTUREFORMAT | srcFormat, | ||
| array | srcPalette ) |
Copies pixels from an array into the specified coordinates.
| srcPixels | An array of pixels in the pixel format of the texture. |
| srcFormat | The format of the pixels in the array. |
| srcPalette | The palette of the source, format 0xRRGGBB. Required if srcFormat is TEXTUREFORMAT_INDEXED, and the format of the destination texture is not TEXTUREFORMAT_INDEXED. |
| void Texture.CopyPixels | ( | array | srcPixels, |
| TEXTUREFORMAT | srcFormat, | ||
| integer | srcWidth, | ||
| integer | srcHeight, | ||
| array | srcPalette ) |
Copies pixels from an array into the specified coordinates.
| srcPixels | An array of pixels in the pixel format of the texture. |
| srcFormat | The format of the pixels in the array. |
| srcWidth | The width of the source. |
| srcHeight | The height of the source. |
| srcPalette | The palette of the source, format 0xRRGGBB. Required if srcFormat is TEXTUREFORMAT_INDEXED, and the format of the destination texture is not TEXTUREFORMAT_INDEXED. |
| void Texture.CopyPixels | ( | array | srcPixels, |
| TEXTUREFORMAT | srcFormat, | ||
| integer | srcWidth, | ||
| integer | srcHeight, | ||
| integer | destX, | ||
| integer | destY, | ||
| array | srcPalette ) |
Copies a region of pixels from an array into the specified coordinates.
| srcPixels | An array of pixels in the pixel format of the texture. |
| srcFormat | The format of the pixels in the array. |
| srcWidth | The width of the source. |
| srcHeight | The height of the source. |
| destX | The X coordinate in the destination to copy the pixels to. |
| destY | The Y coordinate in the destination to copy the pixels to. |
| srcPalette | The palette of the source, format 0xRRGGBB. Required if srcFormat is TEXTUREFORMAT_INDEXED, and the format of the destination texture is not TEXTUREFORMAT_INDEXED. |
| void Texture.CopyPixels | ( | array | srcPixels, |
| TEXTUREFORMAT | srcFormat, | ||
| integer | srcX, | ||
| integer | srcY, | ||
| integer | srcWidth, | ||
| integer | srcHeight, | ||
| integer | destX, | ||
| integer | destY, | ||
| integer | destWidth, | ||
| integer | destHeight, | ||
| array | srcPalette ) |
Copies a region of pixels from an array into the specified coordinates.
| srcPixels | An array of pixels in the pixel format of the texture. |
| srcFormat | The format of the pixels in the array. |
| srcX | The X coordinate in the source to start copying the pixels from. |
| srcY | The Y coordinate in the source to start copying the pixels from. |
| srcWidth | The width of the source. |
| srcHeight | The height of the source. |
| destX | The X coordinate in the destination to copy the pixels to. |
| destY | The Y coordinate in the destination to copy the pixels to. |
| destWidth | The width of the region to copy. |
| destHeight | The height of the region to copy. |
| srcPalette | The palette of the source, format 0xRRGGBB. Required if srcFormat is TEXTUREFORMAT_INDEXED, and the format of the destination texture is not TEXTUREFORMAT_INDEXED. |
| void Texture.CopyPixels | ( | Drawable | srcDrawable, |
| array | srcPalette ) |
Copies pixels from a Drawable into the specified coordinates. The formats must be compatible.
| srcDrawable | The Drawable to copy pixels from. |
| srcPalette | The palette of the source, format 0xRRGGBB. |
| void Texture.CopyPixels | ( | Drawable | srcDrawable, |
| integer | destX, | ||
| integer | destY, | ||
| array | srcPalette ) |
Copies pixels from a Drawable into the specified coordinates. The formats must be compatible.
| srcDrawable | The Drawable to copy pixels from. |
| destX | The X coordinate in the destination to copy the pixels to. |
| destY | The Y coordinate in the destination to copy the pixels to. |
| srcPalette | The palette of the source, format 0xRRGGBB. |
| void Texture.CopyPixels | ( | Drawable | srcDrawable, |
| integer | srcX, | ||
| integer | srcY, | ||
| integer | destX, | ||
| integer | destY, | ||
| integer | destWidth, | ||
| integer | destHeight, | ||
| array | srcPalette ) |
Copies a region of pixels from a Drawable into the specified coordinates. The formats must be compatible.
| srcDrawable | The Drawable to copy pixels from. |
| srcX | The X coordinate in the source to start copying the pixels from. |
| srcY | The Y coordinate in the source to start copying the pixels from. |
| destX | The X coordinate in the destination to copy the pixels to. |
| destY | The Y coordinate in the destination to copy the pixels to. |
| destWidth | The width of the region to copy. |
| destHeight | The height of the region to copy. |
| srcPalette | The palette of the source, format 0xRRGGBB. |
| Texture Texture.Create | ( | integer | width, |
| integer | height ) |
Creates a texture with the given dimensions.
| width | The width of the texture. |
| height | The height of the texture. |
| boolean Texture.FormatHasAlphaChannel | ( | TEXTUREFORMAT | format | ) |
Returns whether format has an alpha channel.
| format | The texture format to check. |
| integer Texture.GetPixel | ( | integer | x, |
| integer | y ) |
Gets the pixel at the specified coordinates.
| x | The X coordinate of the pixel to get. |
| y | The Y coordinate of the pixel to get. |
| array Texture.GetPixelData | ( | integer | x = 0, |
| integer | y = 0, | ||
| integer | width, | ||
| integer | height ) |
Gets an array of pixels of the given dimensions at the specified coordinates.
| x | The X coordinate of the region. |
| y | The Y coordinate of the region. |
| width | The width of the region. (default: width of texture) |
| height | The height of the region. (default: height of texture) |
| void Texture.Scale | ( | integer | width, |
| integer | height ) |
Scales the texture to the given dimensions, using nearest neighbor interpolation.
| width | The new width of the texture. |
| height | The new height of the texture. |
| void Texture.SetPixel | ( | integer | x, |
| integer | y, | ||
| integer | color ) |
Sets the pixel at the specified coordinates.
| x | The X coordinate of the pixel to set. |
| y | The Y coordinate of the pixel to set. |
| color | The color in the pixel format of the texture. |
| void Texture.SetSize | ( | integer | width, |
| integer | height ) |
Changes the dimensions of the texture, without scaling the pixels.
| width | The new width of the texture. |
| height | The new height of the texture. |