#include <CCImage.h>
|
| enum | EImageFormat {
kFmtJpg = 0,
kFmtPng,
kFmtTiff,
kFmtRawData,
kFmtUnKnown
} |
| |
| enum | ETextAlign {
kAlignCenter = 0x33,
kAlignTop = 0x13,
kAlignTopRight = 0x12,
kAlignRight = 0x32,
kAlignBottomRight = 0x22,
kAlignBottom = 0x23,
kAlignBottomLeft = 0x21,
kAlignLeft = 0x31,
kAlignTopLeft = 0x11
} |
| |
|
| | CCImage () |
| |
| | ~CCImage () |
| |
| bool | initWithImageFile (const char *strPath, EImageFormat imageType=kFmtPng) |
| | Load the image from the specified path.
|
| |
| bool | initWithImageFileThreadSafe (const char *fullpath, EImageFormat imageType=kFmtPng) |
| |
| bool | initWithImageData (void *pData, int nDataLen, EImageFormat eFmt=kFmtUnKnown, int nWidth=0, int nHeight=0, int nBitsPerComponent=8) |
| | Load image from stream buffer.
|
| |
| bool | initWithString (const char *pText, int nWidth=0, int nHeight=0, ETextAlign eAlignMask=kAlignCenter, const char *pFontName=0, int nSize=0) |
| | Create image with specified string.
|
| |
| unsigned char * | getData () |
| |
| int | getDataLen () |
| |
| bool | hasAlpha () |
| |
| bool | isPremultipliedAlpha () |
| |
| bool | saveToFile (const char *pszFilePath, bool bIsToRGB=true) |
| | Save CCImage data to the specified file, with specified format.
|
| |
| virtual unsigned short | getWidth (void) |
| | getWidth
|
| |
| virtual unsigned short | getHeight (void) |
| | getHeight
|
| |
| virtual int | getBitsPerComponent (void) |
| | getBitsPerComponent
|
| |
| | CCObject (void) |
| |
| virtual | ~CCObject (void) |
| |
| void | release (void) |
| |
| void | retain (void) |
| |
| CCObject * | autorelease (void) |
| |
| CCObject * | copy (void) |
| |
| bool | isSingleReference (void) |
| |
| unsigned int | retainCount (void) |
| |
| virtual bool | isEqual (const CCObject *pObject) |
| |
| virtual void | update (float dt) |
| |
| virtual CCObject * | copyWithZone (CCZone *pZone) |
| |
- Enumerator:
| kFmtJpg |
|
| kFmtPng |
|
| kFmtTiff |
|
| kFmtRawData |
|
| kFmtUnKnown |
|
- Enumerator:
| kAlignCenter |
Horizontal center and vertical center.
|
| kAlignTop |
Horizontal center and vertical top.
|
| kAlignTopRight |
Horizontal right and vertical top.
|
| kAlignRight |
Horizontal right and vertical center.
|
| kAlignBottomRight |
Horizontal right and vertical bottom.
|
| kAlignBottom |
Horizontal center and vertical bottom.
|
| kAlignBottomLeft |
Horizontal left and vertical bottom.
|
| kAlignLeft |
Horizontal left and vertical center.
|
| kAlignTopLeft |
Horizontal left and vertical top.
|
| bool _initWithJpgData |
( |
void * |
pData, |
|
|
int |
nDatalen |
|
) |
| |
|
protected |
| bool _initWithPngData |
( |
void * |
pData, |
|
|
int |
nDatalen |
|
) |
| |
|
protected |
| bool _initWithRawData |
( |
void * |
pData, |
|
|
int |
nDatalen, |
|
|
int |
nWidth, |
|
|
int |
nHeight, |
|
|
int |
nBitsPerComponent |
|
) |
| |
|
protected |
| bool _initWithTiffData |
( |
void * |
pData, |
|
|
int |
nDataLen |
|
) |
| |
|
protected |
| bool _saveImageToJPG |
( |
const char * |
pszFilePath | ) |
|
|
protected |
| bool _saveImageToPNG |
( |
const char * |
pszFilePath, |
|
|
bool |
bIsToRGB = true |
|
) |
| |
|
protected |
| virtual int getBitsPerComponent |
( |
void |
| ) |
|
|
virtual |
| unsigned char* getData |
( |
| ) |
|
|
inline |
| virtual unsigned short getHeight |
( |
void |
| ) |
|
|
virtual |
| virtual unsigned short getWidth |
( |
void |
| ) |
|
|
virtual |
| bool initWithImageData |
( |
void * |
pData, |
|
|
int |
nDataLen, |
|
|
EImageFormat |
eFmt = kFmtUnKnown, |
|
|
int |
nWidth = 0, |
|
|
int |
nHeight = 0, |
|
|
int |
nBitsPerComponent = 8 |
|
) |
| |
Load image from stream buffer.
- Warning
- kFmtRawData only supports RGBA8888.
- Parameters
-
| pBuffer | stream buffer which holds the image data. |
| nLength | data length expressed in (number of) bytes. |
| nWidth,nHeight,nBitsPerComponent | are used for kFmtRawData. |
- Returns
- true if loaded correctly.
Load the image from the specified path.
- Parameters
-
| strPath | the absolute file path. |
| imageType | the type of image, currently only supporting two types. |
- Returns
- true if loaded correctly.
| bool initWithString |
( |
const char * |
pText, |
|
|
int |
nWidth = 0, |
|
|
int |
nHeight = 0, |
|
|
ETextAlign |
eAlignMask = kAlignCenter, |
|
|
const char * |
pFontName = 0, |
|
|
int |
nSize = 0 |
|
) |
| |
Create image with specified string.
- Parameters
-
| pText | the text the image will show (cannot be nil). |
| nWidth | the image width, if 0, the width will match the text's width. |
| nHeight | the image height, if 0, the height will match the text's height. |
| eAlignMask | the test Alignment |
| pFontName | the name of the font used to draw the text. If nil, use the default system font. |
| nSize | the font size, if 0, use the system default size. |
| bool isPremultipliedAlpha |
( |
| ) |
|
|
inline |
| bool saveToFile |
( |
const char * |
pszFilePath, |
|
|
bool |
bIsToRGB = true |
|
) |
| |
Save CCImage data to the specified file, with specified format.
- Parameters
-
| pszFilePath | the file's absolute path, including file suffix. |
| bIsToRGB | whether the image is saved as RGB format. |
The documentation for this class was generated from the following files:
- /Users/zhangkoumyou/SourceCode/cocos2d-x/cocos2dx/platform/CCImage.h
- /Users/zhangkoumyou/SourceCode/cocos2d-x/cocos2dx/platform/CCImageCommon_cpp.h