new AxTexture2D(context)
Creates a new 2D texture
Parameters:
Name | Type | Description |
---|---|---|
context |
Axis | The context to use for the texture |
Methods
DeserializeChunk(reader) → {Boolean}
Reads the data of a chunk. The chunk header is already read by the reader and this method deserializes the contents of the chunk. Called continuously for each of the texture's chunks
Parameters:
Name | Type | Description |
---|---|---|
reader |
AxHierarchyStreamReader | Reader to use for reading the serialized data. |
Returns:
True if a chunk was successfully deserialized
- Type
- Boolean
Dispose()
Explicitly dispose of the resources allocated by the object
Load(arg1, arg2, arg3) → {undefined}
Loads a texture from either raw data, image, stream or file name
This methods combines methods Load_1(), Load_2(), Load_3() and Load_4
Parameters:
Name | Type | Description |
---|---|---|
arg1 |
* | AxImage | AxStream | AxString | In case of loading from raw data it is the raw data source. In case of loading from an image it is the image. In case of loading from a stream, it is the stream. In case of loading from a file, it is the file name. |
arg2 |
Integer | * | In case of loading from raw data it is the raw data width. In case of loading from an image, this parameter is not used.. In case of loading from a stream, it is a callback context. In case of loading from a file, it is a callback context. |
arg3 |
Integer | AxTexture2DLoadedCallback | In case of loading from raw data it is the raw data height. In case of loading from an image, this parameter is not used. In case of loading from a stream, it is a callback function. In case of loading from a file, it is a callback function. |
Returns:
- Type
- undefined
Load_1(data, width, height)
Loads a texture from raw-encoded data in the graphics device pixel format
Parameters:
Name | Type | Description |
---|---|---|
data |
* | A buffer which contains the data for the texture |
width |
Integer | Width of the texture |
height |
Integer | Height of the texture |
Load_2(sourceImage)
Loads a texture from an image. The image data must be in the pixel format of the graphics device
Parameters:
Name | Type | Description |
---|---|---|
sourceImage |
AxImage | The image source for the texture |
Load_3(source, callbackContext, callback)
Loads a texture from a stream which contains an image encoded in any of the supported formats
Parameters:
Name | Type | Description |
---|---|---|
source |
AxStream | A stream containing the source image, encoded in any of the supported formats |
callbackContext |
* | An object which is to be passed to the callback. It can be used to serve as a context for the callback or just to pass any relevant data |
callback |
AxTexture2DLoadedCallback | A callback method which is to be called when the loading has finished |
Load_4(fileName, callbackContext, callback)
Loads a texture from a given file
Parameters:
Name | Type | Description |
---|---|---|
fileName |
AxString | Name of the file to open and use as a texture |
callbackContext |
* | An object which is to be passed to the callback. It can be used to serve as a context for the callback or just to pass any relevant data |
callback |
AxTexture2DLoadedCallback | A callback method which is to be called when the loading has finished |
Read() → {AxImage}
Reads the texture data and returns it as an image
Returns:
The image representing the texture
- Type
- AxImage
SerializeChunks(writer)
Writes chunks for all the data which is needed to serialize the texture.
Parameters:
Name | Type | Description |
---|---|---|
writer |
AxHierarchyStreamWriter | Writer to use for writing the serialization data |
ToImage() → {AxImage}
Converts the texture data to an image
Returns:
The image
- Type
- AxImage
UpdateToProperties()
Updates the texture according to its properties