ImageFormat
The
Constants
| Name | Value |
|---|---|
WRITABLE_NO |
0 |
WRITABLE_YES |
1 |
WRITABLE_NEEDS_CONVERSION |
2 |
Properties
| Property | Type | Description |
|---|---|---|
| The format id | ||
| The name of the image format | ||
| The file extension to use for images of this type |
Constructors
No Constructors
This type can not be created directly in scripts.
See:
Functions
Overview
General
IsThisFormat
Checks if the given
Parameters
data (DataBlock ): The image data to check
Returns
boolean :trueif the givendata is an image of this format
LoadImage
Loads
Parameters
image (Image ): The target image to load the data intodata (DataBlock ): The data to load[index] (integer ): The index of the image in the data (for cases where the image format contains multiple images, eg. Duke3D ART). Default is0
Returns
boolean :trueon success
SaveImage
Saves the given
Parameters
image (Image ): The image to writedataOut (DataBlock ): The data block to write to[palette] (Palette ): The palette to use ifimage is 8-bit indexed but does not contain its own internal palette. Default isnil[index] (integer ): The index to write the image to in the data (for cases where the image format contains multiple images, eg. Duke3D ART). Default is0
Returns
boolean :trueon success
CanWrite
Checks if the given
Parameters
image (Image ): The image to check
Returns
integer : Whether the given image can be saved as this format:WRITABLE_NO: Can't be writtenWRITABLE_YES: Can be writtenWRITABLE_NEEDS_CONVERSION: Can't be written as-is, requires conversion to a supported pixel format first (seeConvertWritable )
CanWritePixelFormat
Parameters
pixelFormat (integer ): The image pixel format to check (seeImage .PIXELFORMAT_constants)
Returns
boolean :trueif this image format supports the givenpixelFormat
ConvertWritable
Converts the given
Parameters
image (Image ): The image to convertconvertOptions (ImageConvertOptions ): Options for converting the image to this format
Returns
boolean :trueif the image was converted successfully and can now be written in this format