|
Axmol 3.0.0-89d6d9a
|
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 | |
| virtual | ~Image () |
| @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. | |
| Public Member Functions inherited from Object | |
| 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. | |
| uint64_t | getObjectID () const noexcept |
| Returns the process-local diagnostic identifier assigned at construction. | |
| 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. | |
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_fs.hlsl (or dualSampler_fs.hlsl). !!!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_fs.hlsl, positionTextureColor_fs.hlsl 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. |