Axmol Engine 2.4.0-258ceca
|
The Image class for loading all images supported by axmol . More...
#include <Image.h>
Inherits Object.
Public Types | |
enum class | Format { JPG , PNG , BMP , WEBP , PVR , ETC1 , ETC2 , S3TC , ATITC , TGA , ASTC , RAW_DATA , UNKNOWN } |
Supported formats for Image. More... | |
Public Member Functions | |
Image () | |
@js ctor | |
virtual | ~Image () |
@js NA @lua NA | |
bool | initWithImageFile (std::string_view path) |
Load the image from the specified path. | |
bool | initWithImageData (const uint8_t *data, ssize_t dataLen) |
Load image from stream buffer. | |
bool | saveToFile (std::string_view filename, bool isToRGB=true) |
Save Image data to the specified file, with specified format. | |
![]() | |
void | retain () |
Retains the ownership. | |
void | release () |
Releases the ownership immediately. | |
Object * | autorelease () |
Releases the ownership sometime soon automatically. | |
unsigned int | getReferenceCount () const |
Returns the Object's current reference count. | |
virtual | ~Object () |
Destructor. | |
Static Public Member Functions | |
static void | setPNGPremultipliedAlphaEnabled (bool enabled) |
Enables or disables premultiplied alpha for PNG files. | |
static void | setCompressedImagesHavePMA (uint32_t targets, bool havePMA) |
The new APIs to treats (or not) compressed image files as if they have alpha premultiplied. | |
Additional Inherited Members | |
![]() | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
The Image class for loading all images supported by axmol .
|
strong |
Supported formats for Image.
Enumerator | |
---|---|
JPG | JPEG. |
PNG | PNG. |
BMP | BMP,. |
WEBP | WebP. |
PVR | PVR. |
ETC1 | ETC1. |
ETC2 | ETC2. |
S3TC | S3TC. |
ATITC | ATITC. |
TGA | TGA. |
ASTC | ASTC. |
RAW_DATA | Raw Data. |
UNKNOWN | Unknown format. |
|
inlinestatic |
Enables or disables premultiplied alpha for PNG files.
enabled | (default: true) |
|
static |
The new APIs to treats (or not) compressed image files as if they have alpha premultiplied.
By default, ETC1 + ETC1_ALPHA is enabled, because we do PMA at shader etc1.frag !!!IMPORTANT: The spine-runtimes official always regard texture has PMA, so you needs do compressed images PMA at texture convert tools or GPU fragment shader, such as positionTexture.frag, positionTextureColor.frag and others which have texture sampler, otherwise, the spine animations can't be render properly
bool initWithImageFile | ( | std::string_view | path | ) |
Load the image from the specified path.
path | the absolute file path. |
bool initWithImageData | ( | const uint8_t * | data, |
ssize_t | dataLen ) |
Load image from stream buffer.
data | stream buffer which holds the image data. |
dataLen | data length expressed in (number of) bytes. |
ownData | whether take the data memory management. |
bool saveToFile | ( | std::string_view | filename, |
bool | isToRGB = true ) |
Save Image data to the specified file, with specified format.
filePath | the file's absolute path, including file suffix. |
isToRGB | whether the image is saved as RGB format. |