#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) |
var | initWithStringShadowStroke ( var pText, var 0, var 0, var CENTER, var 0, var 0, var 1, var 1, var 1, var false, var 0, var 0, var 0, var 0, var false, var 1, var 1, var 1, var 1) |
local | initWithStringShadowStroke ( local pText, local 0, local 0, local CENTER, local 0, local 0, local 1, local 1, local 1, local false, local 0, local 0, local 0, local 0, local false, local 1, local 1, local 1, local 1) |
unsigned char * | getData () |
ssize_t | getDataLen () |
Format | getFileType () |
Texture2D::PixelFormat | getRenderFormat () |
local | getRenderFormat () |
int | getWidth () |
int | getHeight () |
bool | isPremultipliedAlpha () |
var | isPremultipliedAlpha () |
local | isPremultipliedAlpha () |
int | getNumberOfMipmaps () |
MipmapInfo * | getMipmaps () |
bool | hasPremultipliedAlpha () |
local | 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... | |
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... | |
unsigned int | getReferenceCount () const |
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) |
local | initWithTiffData ( local data, local 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) |
local | initWithPVRv2Data ( local data, local 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 | |
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 | _referenceCount |
count of references More... | |
|
protected |
|
protected |
|
protected |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Image | ( | ) |
var ctor | ( | ) |
local Image | ( | ) |
|
virtual |
int getBitPerPixel | ( | ) |
var getBitPerPixel | ( | ) |
local getBitPerPixel | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
bool hasAlpha | ( | ) |
var hasAlpha | ( | ) |
local hasAlpha | ( | ) |
|
inline |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
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 |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool initWithRawData | ( | const unsigned char * | data, |
ssize_t | dataLen, | ||
int | width, | ||
int | height, | ||
int | bitsPerComponent, | ||
bool | preMulti = false |
||
) |
var initWithRawData | ( | var | data, |
var | dataLen, | ||
var | width, | ||
var | height, | ||
var | bitsPerComponent, | ||
var | preMulti = false |
||
) |
local initWithRawData | ( | local | data, |
local | dataLen, | ||
local | width, | ||
local | height, | ||
local | bitsPerComponent, | ||
local | preMulti = false |
||
) |
|
protected |
|
protected |
|
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 |
||
) |
var initWithStringShadowStroke | ( | var | pText, |
var | nWidth = 0 , |
||
var | nHeight = 0 , |
||
var | eAlignMask = TextAlign::CENTER , |
||
var | pFontName = 0 , |
||
var | nSize = 0 , |
||
var | textTintR = 1 , |
||
var | textTintG = 1 , |
||
var | textTintB = 1 , |
||
var | shadow = false , |
||
var | shadowOffsetX = 0.0 , |
||
var | shadowOffsetY = 0.0 , |
||
var | shadowOpacity = 0.0 , |
||
var | shadowBlur = 0.0 , |
||
var | stroke = false , |
||
var | strokeR = 1 , |
||
var | strokeG = 1 , |
||
var | strokeB = 1 , |
||
var | strokeSize = 1 |
||
) |
local initWithStringShadowStroke | ( | local | pText, |
local | nWidth = 0 , |
||
local | nHeight = 0 , |
||
local | eAlignMask = TextAlign::CENTER , |
||
local | pFontName = 0 , |
||
local | nSize = 0 , |
||
local | textTintR = 1 , |
||
local | textTintG = 1 , |
||
local | textTintB = 1 , |
||
local | shadow = false , |
||
local | shadowOffsetX = 0.0 , |
||
local | shadowOffsetY = 0.0 , |
||
local | shadowOpacity = 0.0 , |
||
local | shadowBlur = 0.0 , |
||
local | stroke = false , |
||
local | strokeR = 1 , |
||
local | strokeG = 1 , |
||
local | strokeB = 1 , |
||
local | strokeSize = 1 |
||
) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool isCompressed | ( | ) |
var isCompressed | ( | ) |
local isCompressed | ( | ) |
|
inline |
|
inline |
|
inline |
|
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. |
var saveToFile | ( | var | filename, |
var | 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. |
local saveToFile | ( | local | filename, |
local | 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 |
|
friend |
|
friend |