cocos2d-x  3.0-rc0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Image Class Reference

#include <CCImage.h>

Inheritance diagram for Image:
Ref

Public Types

enum  Format {
  JPG, PNG, TIFF, WEBP,
  PVR, ETC, S3TC, ATITC,
  TGA, RAW_DATA, UNKOWN
}
 Supported formats for Image. More...
 

Public Member Functions

 Image ()
 ctor ()
 Image ()
virtual ~Image ()
bool initWithImageFile (const std::string &path)
 Load the image from the specified path. More...
 
var initWithImageFile ( var 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)
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 ()
MipmapInfogetMipmaps ()
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 Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Release the ownership immediately. More...
 
Refautorelease ()
 Release the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()

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)
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 

Friends

class TextureCache

Additional Inherited Members

- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Member Typedef Documentation

typedef struct sImageTGA tImageTGA
protected
var tImageTGA
protected
local tImageTGA
protected

Member Enumeration Documentation

enum Format
strong

Supported formats for Image.

Enumerator
JPG 

JPEG.

PNG 

PNG.

TIFF 

TIFF.

WEBP 

WebP.

PVR 

PVR.

ETC 

ETC.

S3TC 

S3TC.

ATITC 

ATITC.

TGA 

TGA.

RAW_DATA 

Raw Data.

UNKOWN 

Unknown format.

var Format
strong

Supported formats for Image.

Enumerator
JPG 

JPEG.

PNG 

PNG.

TIFF 

TIFF.

WEBP 

WebP.

PVR 

PVR.

ETC 

ETC.

S3TC 

S3TC.

ATITC 

ATITC.

TGA 

TGA.

RAW_DATA 

Raw Data.

UNKOWN 

Unknown format.

local Format
strong

Supported formats for Image.

Enumerator
JPG 

JPEG.

PNG 

PNG.

TIFF 

TIFF.

WEBP 

WebP.

PVR 

PVR.

ETC 

ETC.

S3TC 

S3TC.

ATITC 

ATITC.

TGA 

TGA.

RAW_DATA 

Raw Data.

UNKOWN 

Unknown format.

Constructor & Destructor Documentation

Image ( )
var ctor ( )
local Image ( )
virtual ~Image ( )
virtual

Member Function Documentation

int getBitPerPixel ( )
var getBitPerPixel ( )
local getBitPerPixel ( )
unsigned char* getData ( )
inline
var getData ( )
inline
local getData ( )
inline
ssize_t getDataLen ( )
inline
var getDataLen ( )
inline
local getDataLen ( )
inline
Format getFileType ( )
inline
var getFileType ( )
inline
local getFileType ( )
inline
int getHeight ( )
inline
var getHeight ( )
inline
local getHeight ( )
inline
MipmapInfo* getMipmaps ( )
inline
var getMipmaps ( )
inline
local getMipmaps ( )
inline
int getNumberOfMipmaps ( )
inline
var getNumberOfMipmaps ( )
inline
local getNumberOfMipmaps ( )
inline
Texture2D::PixelFormat
getRenderFormat
( )
inline
var getRenderFormat ( )
inline
local getRenderFormat ( )
inline
int getWidth ( )
inline
var getWidth ( )
inline
local getWidth ( )
inline
bool hasAlpha ( )
var hasAlpha ( )
local hasAlpha ( )
bool hasPremultipliedAlpha ( )
inline
var hasPremultipliedAlpha ( )
inline
local hasPremultipliedAlpha ( )
inline
bool initWithATITCData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithATITCData ( var  data,
var  dataLen 
)
protected
local initWithATITCData ( local  data,
local  dataLen 
)
protected
bool initWithETCData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithETCData ( var  data,
var  dataLen 
)
protected
local initWithETCData ( local  data,
local  dataLen 
)
protected
bool initWithImageData ( const unsigned char *  data,
ssize_t  dataLen 
)

Load image from stream buffer.

Parameters
datastream buffer which holds the image data.
dataLendata length expressed in (number of) bytes.
Returns
true if loaded correctly.
bool initWithImageFile ( const std::string &  path)

Load the image from the specified path.

Parameters
paththe absolute file path.
Returns
true if loaded correctly.
var initWithImageFile ( var  path)

Load the image from the specified path.

Parameters
paththe absolute file path.
Returns
true if loaded correctly.
bool initWithJpgData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithJpgData ( var  data,
var  dataLen 
)
protected
local initWithJpgData ( local  data,
local  dataLen 
)
protected
bool initWithPngData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithPngData ( var  data,
var  dataLen 
)
protected
local initWithPngData ( local  data,
local  dataLen 
)
protected
bool initWithPVRData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithPVRData ( var  data,
var  dataLen 
)
protected
local initWithPVRData ( local  data,
local  dataLen 
)
protected
bool initWithPVRv2Data ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithPVRv2Data ( var  data,
var  dataLen 
)
protected
local initWithPVRv2Data ( local  data,
local  dataLen 
)
protected
bool initWithPVRv3Data ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithPVRv3Data ( var  data,
var  dataLen 
)
protected
local initWithPVRv3Data ( local  data,
local  dataLen 
)
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 
)
bool initWithS3TCData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithS3TCData ( var  data,
var  dataLen 
)
protected
local initWithS3TCData ( local  data,
local  dataLen 
)
protected
bool initWithTGAData ( tImageTGA tgaData)
protected
var initWithTGAData ( var  tgaData)
protected
local initWithTGAData ( local  tgaData)
protected
bool initWithTiffData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithTiffData ( var  data,
var  dataLen 
)
protected
local initWithTiffData ( local  data,
local  dataLen 
)
protected
bool initWithWebpData ( const unsigned char *  data,
ssize_t  dataLen 
)
protected
var initWithWebpData ( var  data,
var  dataLen 
)
protected
local initWithWebpData ( local  data,
local  dataLen 
)
protected
bool isCompressed ( )
var isCompressed ( )
local isCompressed ( )
bool isPremultipliedAlpha ( )
inline
var isPremultipliedAlpha ( )
inline
local isPremultipliedAlpha ( )
inline
bool saveImageToJPG ( const std::string &  filePath)
protected
var saveImageToJPG ( var  filePath)
protected
local saveImageToJPG ( local  filePath)
protected
bool saveImageToPNG ( const std::string &  filePath,
bool  isToRGB = true 
)
protected
var saveImageToPNG ( var  filePath,
var  isToRGB = true 
)
protected
local saveImageToPNG ( local  filePath,
local  isToRGB = true 
)
protected
bool saveToFile ( const std::string &  filename,
bool  isToRGB = true 
)

Save Image data to the specified file, with specified format.

Parameters
filePaththe file's absolute path, including file suffix.
isToRGBwhether the image is saved as RGB format.
var saveToFile ( var  filename,
var  isToRGB = true 
)

Save Image data to the specified file, with specified format.

Parameters
filePaththe file's absolute path, including file suffix.
isToRGBwhether the image is saved as RGB format.
local saveToFile ( local  filename,
local  isToRGB = true 
)

Save Image data to the specified file, with specified format.

Parameters
filePaththe file's absolute path, including file suffix.
isToRGBwhether the image is saved as RGB format.

Friends And Related Function Documentation

friend class TextureCache
friend
var TextureCache
friend
local TextureCache
friend

The documentation for this class was generated from the following file: