Skip to content
9miao Mobile Game edited this page Jul 1, 2014 · 4 revisions

CAImage Detailed Description

Class Description

CAImage texture class (namely the texture in memory) is mainly used to create texture object and load image into memory. It’s the base of all related texture class.

Base Class

CAObject

Method

Access modifier

Method name

Description

public

create

Create texture

public

description

Texture description

public

releaseData

Release data

public

keepData

Save data

public

drawAtPoint

Draw texture at appointed position

public

drawInRect

Draw appointed region on texture

public

stringForFormat

Pixel format

public

bitsPerPixelForFormat

Pixel bit depth

public

bitsPerPixelForFormat

Pixel depth of appointed format

public

getContentSizeInPixels

Obtain pixel size

## Method Description **static CAImage* create(const char* file)**
Return value: CAImage*
Parameter:

Type

Parameter

Description

const char*

file

Use to create texture file name

Description: create a texture object via appointed file name and generally we directly use image name.

const char description(void)*
Return value: const char*
Description: text description

void releaseData(void *data)
Return value: void
Parameter:

Type

Parameter name

Description

void*

data

Any pointer type

void keepData(void *data, unsigned int length)*
Return value: void
Parameter:

Type

Parameter name

Description

Void*

Data

Any pointer type

void drawAtPoint(const CCPoint& point)
Return value: void
Parameter:

Type

Parameter name

Description

const CCPoint

point

point

**void drawInRect(const CCRect& rect)**
Return value: void
Parameter:

Type

Parameter name

Description

const CCRect

rect

Draw-required region on texture

const char stringForFormat()*
Return value: const char*
Description: obtain texture pixel format

unsigned int bitsPerPixelForFormat()
Return value: unsigned int
Description: obtain pixel bit depth, namely the bit number for each pixel.

unsigned int bitsPerPixelForFormat(CCTexture2DPixelFormat format)
Return value: unsigned int
Parameter:

Type

Parameter name

Description

CCTexture2DPixelFormat

format

Appointed pixel format

Description: obtain appointed pixel format’s bit depth.

const CCSize& getContentSizeInPixels()
Return value: const CCSize
Description: obtain texture pixel’s width and height

Clone this wiki locally