Skip to content
9miao Mobile Game edited this page Aug 29, 2014 · 3 revisions

CAImageView

Class Description

Image control that display image on screen.

Base Class

CAView

Attribute

Access modifier

Attribute name

Description

public

Image

image that imageView displays

public

ImageViewScaleType

imageView’s scale mode

Method

public

create

create an imageView object

 

public

createWithImage

create imageView by using CAImage to load texture

public

 

createWithSpriteFrame

use CAImageFrame image frame to create imageView

public

setDisplayFrame

set current displayed image frame

 

public

isFrameDisplayed

judge appointed image frame is displayed or not

public

displayFrame

obtain current displayed image frame

 

public

setDisplayFrameWithAnimationName

set a frame in animation frame as current displayed image frame

public

setImageAsyncWithFile

load texture by adopting asynchronous mode

 

Attribute Description

Image
Type: CAImage*
Description: imageView’s image attribute, namely the displayed content, public get/set{}.

ImageViewScaleType
Type: CAImageViewScaleType

Description: set imageView’s scale mode, including five types: fitImageXY by default, fully populated; fitImageCrop, fully populated in no-distortion condition and auto-cut excess part; fitImageInside, fully populated, no distortion; fitViewByHorizontal, fully displayed and horizontal adaptive in no-distortion condition; fitViewByVertical, fully displayed and vertical adaptive in no-distortion condition. public get/set{}.

1

2

3

4

5

6

7

8

typedef enum

{

         CAImageViewScaleTypeFitImageXY=0,

         CAImageViewScaleTypeFitImageCrop,

         CAImageViewScaleTypeFitImageInside,

         CAImageViewScaleTypeFitViewByHorizontal,

         CAImageViewScaleTypeFitViewByVertical,

}CAImageViewScaleType;

Method Description

static CAImageView create()*
Return value: static CAImageView*
Description: create an imageView, there is no display content in imageView at this moment.

static CAImageView createWithImage(CAImage image)**
Return value: static CAImageView*
Parameter name

Type

Parameter name

Description

CAImage*

image

texture object that we use

Descripiton: create an imageView and use CAImage as display content.

static CAImageView createWithSpriteFrame(CAImageFrame *pSpriteFrame)*
Return value: static CAImageView*
Parameter:

Type

Parameter name

Description

CAImageFrame*

pSpriteFrame

image frame

Description: use image frame to create imageView

virtual void setDisplayFrame(CAImageFrame *pNewFrame)
Return value: void
Parameter:

Type

Parameter name

Description

CAImageFrame*

pNewFrame

image frame

Description: set currrent displayed image frame by using the imported pNewFrame parameter.

virtual bool isFrameDisplayed(CAImageFrame *pFrame)
Return value: bool
Parameter:

Type

Parameter name

Description

CAImageFrame*

pSpriteFrame

image frame

Description: the imported pFrame is current displayed frame or not

virtual CAImageFrame displayFrame(void)*
Return value: CAImageFrame*
Description: obtain current displayed image frame

virtual void setDisplayFrameWithAnimationName(const char *animationName, int frameIndex)
Return value: void
Parameter:

Type

Parameter name

Description

const char *

animationName

animation sequential frame

int

frameIndex

frame index

Description: set current displayed frame according to transferred animation frame and index value.

virtual void setImageAsyncWithFile(const char fileName)*
Return value: void
Parameter:

Type

Parameter name

Description

const char*

fileName

image name

Descripiton: load appointed texture by adopting asynchronous mode
Clone this wiki locally