cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
#include <CCImage.h>
Public Types | |
enum | EImageFormat { kFmtJpg = 0 , kFmtPng , kFmtTiff , kFmtWebp , kFmtRawData , kFmtUnKnown } |
enum | ETextAlign { kAlignCenter = 0x33 , kAlignTop = 0x13 , kAlignTopRight = 0x12 , kAlignRight = 0x32 , kAlignBottomRight = 0x22 , kAlignBottom = 0x23 , kAlignBottomLeft = 0x21 , kAlignLeft = 0x31 , kAlignTopLeft = 0x11 } |
Public Member Functions | |
CCImage () | |
ctor More... | |
~CCImage () | |
NA NA. More... | |
bool | initWithImageFile (const char *strPath, EImageFormat imageType=kFmtPng) |
Load the image from the specified path. More... | |
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. More... | |
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. More... | |
bool | initWithStringShadowStroke (const char *pText, int nWidth=0, int nHeight=0, ETextAlign eAlignMask=kAlignCenter, 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) |
NA NA. More... | |
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. More... | |
virtual unsigned short | getWidth (void) |
virtual unsigned short | getHeight (void) |
virtual int | getBitsPerComponent (void) |
![]() | |
CCObject (void) | |
virtual | ~CCObject (void) |
NA. More... | |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
CCObject (const CCObject &) | |
CCObject & | operator= (const CCObject &) |
virtual void | encodeWithCoder (DS_Dictionary *) |
virtual bool | canEncode () |
CCObjectType | getObjType () const |
virtual int | getTag () const |
virtual void | setTag (int nTag) |
void | setObjType (CCObjectType) |
![]() | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
Protected Member Functions | |
bool | _initWithJpgData (void *pData, int nDatalen) |
bool | _initWithPngData (void *pData, int nDatalen) |
bool | _initWithTiffData (void *pData, int nDataLen) |
bool | _initWithWebpData (void *pData, int nDataLen) |
bool | _initWithRawData (void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent, bool bPreMulti) |
bool | _saveImageToPNG (const char *pszFilePath, bool bIsToRGB=true) |
bool | _saveImageToJPG (const char *pszFilePath) |
Protected Attributes | |
unsigned short | m_nWidth |
unsigned short | m_nHeight |
int | m_nBitsPerComponent |
unsigned char * | m_pData |
bool | m_bHasAlpha |
bool | m_bPreMulti |
CCFreeTypeFont * | m_ft |
![]() | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
int | m_nTag |
int | m_eObjType |
unsigned int | m_uObjectIdxInArray |
Additional Inherited Members | |
![]() | |
static CCObject * | createWithCoder (DS_Dictionary *) |
![]() | |
unsigned int | m_uID |
int | m_nLuaID |
enum EImageFormat |
enum ETextAlign |
CCImage | ( | ) |
ctor
~CCImage | ( | ) |
NA NA.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
virtual |
|
inline |
|
inline |
|
virtual |
|
virtual |
|
inline |
bool initWithImageData | ( | void * | pData, |
int | nDataLen, | ||
EImageFormat | eFmt = kFmtUnKnown , |
||
int | nWidth = 0 , |
||
int | nHeight = 0 , |
||
int | nBitsPerComponent = 8 |
||
) |
Load image from stream buffer.
pBuffer | stream buffer which holds the image data. |
nLength | data length expressed in (number of) bytes. |
nWidth,nHeight,nBitsPerComponent | are used for kFmtRawData. |
bool initWithImageFile | ( | const char * | strPath, |
EImageFormat | imageType = kFmtPng |
||
) |
Load the image from the specified path.
strPath | the absolute file path. |
imageType | the type of image, currently only supporting two types. |
bool initWithImageFileThreadSafe | ( | const char * | fullpath, |
EImageFormat | imageType = kFmtPng |
||
) |
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.
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. NA |
bool initWithStringShadowStroke | ( | const char * | pText, |
int | nWidth = 0 , |
||
int | nHeight = 0 , |
||
ETextAlign | eAlignMask = kAlignCenter , |
||
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 |
||
) |
NA NA.
|
inline |
bool saveToFile | ( | const char * | pszFilePath, |
bool | bIsToRGB = true |
||
) |
Save CCImage data to the specified file, with specified format.
pszFilePath | the file's absolute path, including file suffix. |
bIsToRGB | whether the image is saved as RGB format. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |