#include <CCImage.h>
Public Types | |
| enum | Format { JPG, PNG, TIFF, WEBP, PVR, ETC, S3TC, ATITC, RAW_DATA, UNKOWN } |
| Supported formats for Image. More... | |
| enum | TextAlign { CENTER = 0x33, TOP = 0x13, TOP_RIGHT = 0x12, RIGHT = 0x32, BOTTOM_RIGHT = 0x22, BOTTOM = 0x23, BOTTOM_LEFT = 0x21, LEFT = 0x31, TOP_LEFT = 0x11 } |
Public Member Functions | |
| Image () | |
| virtual | ~Image () |
| bool | initWithImageFile (const char *path) |
| Load the image from the specified path. More... | |
| bool | initWithImageData (const unsigned char *data, int dataLen) |
| Load image from stream buffer. More... | |
| bool | initWithRawData (const unsigned char *data, int dataLen, int width, int height, int bitsPerComponent, bool preMulti=false) |
| bool | initWithString (const char *text, int width=0, int height=0, TextAlign alignMask=TextAlign::CENTER, const char *fontName=0, int size=0) |
| Create image with specified string. More... | |
| bool | initWithStringShadowStroke (const char *pText, int nWidth=0, int nHeight=0, TextAlign eAlignMask=TextAlign::CENTER, const char *pFontName=0, int nSize=0, float textTintR=1, float textTintG=1, float textTintB=1, bool shadow=false, float shadowOffsetX=0.0, float shadowOffsetY=0.0, float shadowOpacity=0.0, float shadowBlur=0.0, bool stroke=false, float strokeR=1, float strokeG=1, float strokeB=1, float strokeSize=1) |
| unsigned char * | getData () |
| int | getDataLen () |
| Format | getFileType () |
| Texture2D::PixelFormat | getRenderFormat () |
| int | getWidth () |
| int | getHeight () |
| bool | isPremultipliedAlpha () |
| int | getNumberOfMipmaps () |
| MipmapInfo * | getMipmaps () |
| bool | hasPremultipliedAlpha () |
| int | getBitPerPixel () |
| bool | hasAlpha () |
| bool | isCompressed () |
| bool | saveToFile (const char *filePath, bool isToRGB=true) |
| Save Image data to the specified file, with specified format. More... | |
Public Member Functions inherited from Object | |
| Object () | |
| Constructor. More... | |
| virtual | ~Object () |
| void | release () |
| Release the ownership immediately. More... | |
| void | retain () |
| Retains the ownership. More... | |
| Object * | autorelease () |
| Release the ownership sometime soon automatically. More... | |
| bool | isSingleReference () const |
| Returns a boolean value that indicates whether there is only one reference to the object. More... | |
| unsigned int | retainCount () const |
| Returns the object's current reference count. More... | |
| virtual bool | isEqual (const Object *object) |
| Returns a boolean value that indicates whether this object and a given object are equal. More... | |
| virtual void | acceptVisitor (DataVisitor &visitor) |
| virtual void | update (float dt) |
Protected Member Functions | |
| bool | initWithJpgData (const unsigned char *data, int dataLen) |
| bool | initWithPngData (const unsigned char *data, int dataLen) |
| bool | initWithTiffData (const unsigned char *data, int dataLen) |
| bool | initWithWebpData (const unsigned char *data, int dataLen) |
| bool | initWithPVRData (const unsigned char *data, int dataLen) |
| bool | initWithPVRv2Data (const unsigned char *data, int dataLen) |
| bool | initWithPVRv3Data (const unsigned char *data, int dataLen) |
| bool | initWithETCData (const unsigned char *data, int dataLen) |
| bool | initWithS3TCData (const unsigned char *data, int dataLen) |
| bool | initWithATITCData (const unsigned char *data, int dataLen) |
| bool | saveImageToPNG (const char *filePath, bool isToRGB=true) |
| bool | saveImageToJPG (const char *filePath) |
Friends | |
| class | TextureCache |
Additional Inherited Members | |
Public Attributes inherited from Object | |
| unsigned int | _ID |
| object id, ScriptSupport need public _ID More... | |
| int | _luaID |
| Lua reference id. More... | |
Protected Attributes inherited from Object | |
| unsigned int | _reference |
| count of references More... | |
| var | _reference |
| count of references More... | |
| local | _reference |
| count of references More... | |
| unsigned int | _autoReleaseCount |
| count of autorelease More... | |
| var | _autoReleaseCount |
| count of autorelease More... | |
| local | _autoReleaseCount |
| count of autorelease More... | |
|
strong |
|
strong |
| Image | ( | ) |
|
virtual |
| int getBitPerPixel | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| bool hasAlpha | ( | ) |
|
inline |
|
protected |
|
protected |
| bool initWithImageData | ( | const unsigned char * | data, |
| int | 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 char * | path) |
Load the image from the specified path.
| path | the absolute file path. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| bool initWithRawData | ( | const unsigned char * | data, |
| int | dataLen, | ||
| int | width, | ||
| int | height, | ||
| int | bitsPerComponent, | ||
| bool | preMulti = false |
||
| ) |
|
protected |
| bool initWithString | ( | const char * | text, |
| int | width = 0, |
||
| int | height = 0, |
||
| TextAlign | alignMask = TextAlign::CENTER, |
||
| const char * | fontName = 0, |
||
| int | size = 0 |
||
| ) |
Create image with specified string.
| text | the text the image will show (cannot be nil). |
| width | the image width, if 0, the width will match the text's width. |
| height | the image height, if 0, the height will match the text's height. |
| alignMask | the test Alignment |
| fontName | the name of the font used to draw the text. If nil, use the default system font. |
| size | the font size, if 0, use the system default size. |
| bool initWithStringShadowStroke | ( | const char * | pText, |
| int | nWidth = 0, |
||
| int | nHeight = 0, |
||
| TextAlign | eAlignMask = TextAlign::CENTER, |
||
| const char * | pFontName = 0, |
||
| int | nSize = 0, |
||
| float | textTintR = 1, |
||
| float | textTintG = 1, |
||
| float | textTintB = 1, |
||
| bool | shadow = false, |
||
| float | shadowOffsetX = 0.0, |
||
| float | shadowOffsetY = 0.0, |
||
| float | shadowOpacity = 0.0, |
||
| float | shadowBlur = 0.0, |
||
| bool | stroke = false, |
||
| float | strokeR = 1, |
||
| float | strokeG = 1, |
||
| float | strokeB = 1, |
||
| float | strokeSize = 1 |
||
| ) |
|
protected |
|
protected |
| bool isCompressed | ( | ) |
|
inline |
|
protected |
|
protected |
| bool saveToFile | ( | const char * | filePath, |
| 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. |
|
friend |