Class CCScale9Sprite

#include <Geode/cocos/extensions/GUI/CCControlExtension/CCScale9Sprite.h>
classCCScale9Sprite:publiccocos2d::CCNodeRGBA{ ... }

A 9-slice sprite for cocos2d.

9-slice scaling allows you to specify how scaling is applied to specific areas of a sprite. With 9-slice scaling (3x3 grid), you can ensure that the sprite does not become distorted when scaled.

Examples0
Public static methods9
staticcocos2d::extension::CCScale9Sprite*create(,,)

Creates a 9-slice sprite with a texture file, a delimitation zone and with the specified cap insets.

staticcocos2d::extension::CCScale9Sprite*create(,)

Creates a 9-slice sprite with a texture file and a delimitation zone. The texture will be broken down into a 3×3 grid of equal blocks.

staticcocos2d::extension::CCScale9Sprite*create(,)

Creates a 9-slice sprite with a texture file. The whole texture will be broken down into a 3×3 grid of equal blocks.

staticcocos2d::extension::CCScale9Sprite*create()

Creates a 9-slice sprite with a texture file. The whole texture will be broken down into a 3×3 grid of equal blocks.

staticcocos2d::extension::CCScale9Sprite*createWithSpriteFrame(,)

Creates a 9-slice sprite with an sprite frame and the centre of its zone. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

staticcocos2d::extension::CCScale9Sprite*createWithSpriteFrame()

Creates a 9-slice sprite with an sprite frame. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

staticcocos2d::extension::CCScale9Sprite*createWithSpriteFrameName(
charconst*spriteFrameName
,)

Creates a 9-slice sprite with an sprite frame name and the centre of its zone. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

staticcocos2d::extension::CCScale9Sprite*createWithSpriteFrameName(
charconst*spriteFrameName
)

Creates a 9-slice sprite with an sprite frame name. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

staticcocos2d::extension::CCScale9Sprite*create()
No description provided
Public member functions37
cocos2d::CCSizegetOriginalSize()const

Original sprite’s size.

virtualcocos2d::CCSizegetPreferredSize()

Prefered sprite’s size. By default the prefered size is the original size.

virtualvoidsetPreferredSize()

Prefered sprite’s size. By default the prefered size is the original size.

virtualcocos2d::CCRectgetCapInsets()

The end-cap insets. On a non-resizeable sprite, this property is set to CGRectZero; the sprite does not use end caps and the entire sprite is subject to stretching.

virtualvoidsetCapInsets()

The end-cap insets. On a non-resizeable sprite, this property is set to CGRectZero; the sprite does not use end caps and the entire sprite is subject to stretching.

virtualfloatgetInsetLeft()

Sets the left side inset

virtualvoidsetInsetLeft()

Sets the left side inset

virtualfloatgetInsetTop()

Sets the top side inset

virtualvoidsetInsetTop()

Sets the top side inset

virtualfloatgetInsetRight()

Sets the right side inset

virtualvoidsetInsetRight()

Sets the right side inset

virtualfloatgetInsetBottom()

Sets the bottom side inset

virtualvoidsetInsetBottom()

Sets the bottom side inset

virtualvoidsetContentSize()
No description provided
virtualvoidvisit()
No description provided
virtualboolinit()
No description provided
virtualboolinitWithBatchNode(,,
boolrotated
,)
No description provided
virtualboolinitWithBatchNode(,,)
No description provided
virtualboolinitWithFile(,,)

Initializes a 9-slice sprite with a texture file, a delimitation zone and with the specified cap insets. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

file

The name of the texture file.

rect

The rectangle that describes the sub-part of the texture that is the whole image. If the shape is the whole texture, set this to the texture's full rect.

capInsets

The values to use for the cap insets.
virtualboolinitWithFile(,)

Initializes a 9-slice sprite with a texture file and a delimitation zone. The texture will be broken down into a 3×3 grid of equal blocks. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

file

The name of the texture file.

rect

The rectangle that describes the sub-part of the texture that is the whole image. If the shape is the whole texture, set this to the texture's full rect.
virtualboolinitWithFile(,)

Initializes a 9-slice sprite with a texture file and with the specified cap insets. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

file

The name of the texture file.

capInsets

The values to use for the cap insets.
virtualboolinitWithFile()

Initializes a 9-slice sprite with a texture file. The whole texture will be broken down into a 3×3 grid of equal blocks. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

file

The name of the texture file.
virtualboolinitWithSpriteFrame(,)

Initializes a 9-slice sprite with an sprite frame and with the specified cap insets. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

spriteFrame

The sprite frame object.

capInsets

The values to use for the cap insets.
virtualboolinitWithSpriteFrame()

Initializes a 9-slice sprite with an sprite frame. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

spriteFrame

The sprite frame object.
virtualboolinitWithSpriteFrameName(
charconst*spriteFrameName
,)

Initializes a 9-slice sprite with an sprite frame name and with the specified cap insets. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

spriteFrameName

The sprite frame name.

capInsets

The values to use for the cap insets.
virtualboolinitWithSpriteFrameName(
charconst*spriteFrameName
)

Initializes a 9-slice sprite with an sprite frame name. Once the sprite is created, you can then call its “setContentSize:” method to resize the sprite will all it’s 9-slice goodness intract. It respects the anchorPoint too.

Parameters

spriteFrameName

The sprite frame name.
cocos2d::extension::CCScale9Sprite*resizableSpriteWithCapInsets()

Creates and returns a new sprite object with the specified cap insets. You use this method to add cap insets to a sprite or to change the existing cap insets of a sprite. In both cases, you get back a new image and the original sprite remains untouched.

Parameters

capInsets

The values to use for the cap insets.
virtualvoidsetOpacityModifyRGB(
boolbValue
)

Since v0.8

sets the premultipliedAlphaOpacity property. If set to NO then opacity will be applied as: glColor(R,G,B,opacity); If set to YES then oapcity will be applied as: glColor(opacity, opacity, opacity, opacity ); Textures with premultiplied alpha will have this property by default on YES. Otherwise the default value is NO

virtualboolisOpacityModifyRGB()

Since v0.8

returns whether or not the opacity will be applied using glColor(R,G,B,opacity) or glColor(opacity, opacity, opacity, opacity);

virtualvoidsetOpacity(
GLubyteopacity
)
No description provided
virtualGLubytegetOpacity()
No description provided
virtualvoidsetColor()
No description provided
virtualcocos2d::ccColor3Bconst&getColor()
No description provided
virtualboolupdateWithBatchNode(,,
boolrotated
,)
No description provided
virtualvoidsetSpriteFrame()
No description provided
virtualvoidupdateDisplayedOpacity(
GLubyteparentOpacity
)
No description provided
virtualvoidupdateDisplayedColor()
No description provided
Fields18
boolm_bSpritesGenerated
;
No description provided
cocos2d::CCRectm_spriteRect
;
No description provided
boolm_bSpriteFrameRotated
;
No description provided
cocos2d::CCRectm_capInsetsInternal
;
No description provided
boolm_positionsAreDirty
;
No description provided
;
No description provided
;
No description provided
;
No description provided
;
No description provided
;
No description provided
;
No description provided
;
No description provided
;
No description provided
;
No description provided
cocos2d::CCSprite*_bottomRight
;
No description provided
bool_opacityModifyRGB
;
No description provided
GLubyte_opacity
;
No description provided
;
No description provided
Protected member functions2
voidupdateCapInset()
No description provided
voidupdatePositions()
No description provided
Protected fields7
cocos2d::CCSizem_originalSize
;

Original sprite’s size.

cocos2d::CCSizem_preferredSize
;

Prefered sprite’s size. By default the prefered size is the original size.

cocos2d::CCRectm_capInsets
;

The end-cap insets. On a non-resizeable sprite, this property is set to CGRectZero; the sprite does not use end caps and the entire sprite is subject to stretching.

floatm_insetLeft
;

Sets the left side inset

floatm_insetTop
;

Sets the top side inset

floatm_insetRight
;

Sets the right side inset

floatm_insetBottom
;

Sets the bottom side inset