#include <CCImage.h>
Public Types | |
enum | Format { JPG, PNG, TIFF, WEBP, PVR, ETC, S3TC, ATITC, TGA, RAW_DATA, UNKOWN } |
Supported formats for Image. More... | |
Public Member Functions | |
Image () | |
virtual | ~Image () |
bool | initWithImageFile (const std::string &path) |
Load the image from the specified path. More... | |
bool | initWithImageData (const unsigned char *data, ssize_t dataLen) |
Load image from stream buffer. More... | |
bool | initWithRawData (const unsigned char *data, ssize_t dataLen, int width, int height, int bitsPerComponent, bool preMulti=false) |
unsigned char * | getData () |
ssize_t | getDataLen () |
Format | getFileType () |
Texture2D::PixelFormat | getRenderFormat () |
int | getWidth () |
int | getHeight () |
int | getNumberOfMipmaps () |
MipmapInfo * | getMipmaps () |
bool | hasPremultipliedAlpha () |
bool | isPremultipliedAlpha () |
int | getBitPerPixel () |
bool | hasAlpha () |
bool | isCompressed () |
bool | saveToFile (const std::string &filename, bool isToRGB=true) |
Save Image data to the specified file, with specified format. More... | |
![]() | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. More... | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. More... | |
local | getReferenceCount () |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
Static Public Member Functions | |
static void | setPVRImagesHavePremultipliedAlpha (bool haveAlphaPremultiplied) |
treats (or not) PVR files as if they have alpha premultiplied. More... | |
Protected Types | |
typedef struct sImageTGA | tImageTGA |
Protected Member Functions | |
bool | initWithJpgData (const unsigned char *data, ssize_t dataLen) |
bool | initWithPngData (const unsigned char *data, ssize_t dataLen) |
bool | initWithTiffData (const unsigned char *data, ssize_t dataLen) |
bool | initWithWebpData (const unsigned char *data, ssize_t dataLen) |
bool | initWithPVRData (const unsigned char *data, ssize_t dataLen) |
bool | initWithPVRv2Data (const unsigned char *data, ssize_t dataLen) |
bool | initWithPVRv3Data (const unsigned char *data, ssize_t dataLen) |
bool | initWithETCData (const unsigned char *data, ssize_t dataLen) |
bool | initWithS3TCData (const unsigned char *data, ssize_t dataLen) |
bool | initWithATITCData (const unsigned char *data, ssize_t dataLen) |
bool | initWithTGAData (tImageTGA *tgaData) |
bool | saveImageToPNG (const std::string &filePath, bool isToRGB=true) |
bool | saveImageToJPG (const std::string &filePath) |
void | premultipliedAlpha () |
Image (const Image &rImg) | |
Image & | operator= (const Image &) |
bool | initWithImageFileThreadSafe (const std::string &fullpath) |
Format | detectFormat (const unsigned char *data, ssize_t dataLen) |
bool | isPng (const unsigned char *data, ssize_t dataLen) |
bool | isJpg (const unsigned char *data, ssize_t dataLen) |
bool | isTiff (const unsigned char *data, ssize_t dataLen) |
bool | isWebp (const unsigned char *data, ssize_t dataLen) |
bool | isPvr (const unsigned char *data, ssize_t dataLen) |
bool | isEtc (const unsigned char *data, ssize_t dataLen) |
bool | isS3TC (const unsigned char *data, ssize_t dataLen) |
bool | isATITC (const unsigned char *data, ssize_t dataLen) |
![]() | |
Ref () | |
Constructor. More... | |
Ref () | |
Constructor. More... | |
Protected Attributes | |
unsigned char * | _data |
ssize_t | _dataLen |
int | _width |
int | _height |
bool | _unpack |
Format | _fileType |
Texture2D::PixelFormat | _renderFormat |
MipmapInfo | _mipmaps [MIPMAP_MAX] |
int | _numberOfMipmaps |
bool | _hasPremultipliedAlpha |
std::string | _filePath |
![]() | |
unsigned int | _referenceCount |
count of references More... | |
local | _referenceCount |
count of references More... | |
Static Protected Attributes | |
static const int | MIPMAP_MAX = 16 |
Determine how many mipmaps can we have. More... | |
Friends | |
class | TextureCache |
|
protected |
Image | ( | ) |
|
virtual |
int getBitPerPixel | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool hasAlpha | ( | ) |
|
inline |
|
protected |
|
protected |
bool initWithImageData | ( | const unsigned char * | 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. |
bool initWithImageFile | ( | const std::string & | path | ) |
Load the image from the specified path.
path | the absolute file path. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool initWithRawData | ( | const unsigned char * | data, |
ssize_t | dataLen, | ||
int | width, | ||
int | height, | ||
int | bitsPerComponent, | ||
bool | preMulti = false |
||
) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool isCompressed | ( | ) |
|
protected |
|
protected |
|
protected |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool saveToFile | ( | const std::string & | 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. |
|
static |
treats (or not) PVR files as if they have alpha premultiplied.
Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is possible load them as if they have (or not) the alpha channel premultiplied.
By default it is disabled.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
Determine how many mipmaps can we have.
Its same as define but it respects namespaces