#include <CCImage.h>
Public Types | |
enum | Format { JPG, PNG, TIFF, WEBP, PVR, ETC, S3TC, ATITC, TGA, 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 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) |
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 () |
ssize_t | 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 std::string &filename, bool isToRGB=true) |
Save Image data to the specified file, with specified format. More... | |
![]() | |
Object () | |
Constructor. More... | |
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... | |
local | retainCount () |
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 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) |
Friends | |
class | TextureCache |
Additional Inherited Members | |
![]() | |
unsigned int | _ID |
object id, ScriptSupport need public _ID More... | |
int | _luaID |
Lua reference id. More... | |
var | _luaID |
Lua reference id. More... | |
local | _luaID |
Lua reference id. More... | |
![]() | |
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... | |
|
protected |
|
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, |
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 |
bool initWithRawData | ( | const unsigned char * | data, |
ssize_t | 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 |
|
protected |
bool isCompressed | ( | ) |
|
inline |
|
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. |
|
friend |