Class CCImage

#include <Geode/cocos/platform/CCImage.h>
classCCImage:publiccocos2d::CCObject{ ... }
No description provided
Examples0
Public static methods0
Public member functions12
boolinitWithImageFile(
charconst*strPath
,)

Load the image from the specified path.

Parameters

strPath

the absolute file path.

imageType

the type of image, currently only supporting two types.
Return value
true if loaded correctly.
boolinitWithImageFileThreadSafe(
charconst*fullpath
,)
No description provided
boolinitWithImageData(
void*pData
,
intnDataLen
,,
intnWidth
,
intnHeight
,
intnBitsPerComponent
,
intwhoknows
)

Load image from stream buffer.

Parameters

pBuffer

stream buffer which holds the image data.

nLength

data length expressed in (number of) bytes.

nWidth,

nHeight, nBitsPerComponent are used for kFmtRawData.
Return value
true if loaded correctly.

⚠️ kFmtRawData only supports RGBA8888.

boolinitWithString(,
intnWidth
,
intnHeight
,,
charconst*pFontName
,
intnSize
)

Create image with specified string.

Parameters

pText

the text the image will show (cannot be nil).

nWidth

the image width, if 0, the width will match the text's width.

nHeight

the image height, if 0, the height will match the text's height.

eAlignMask

the test Alignment

pFontName

the name of the font used to draw the text. If nil, use the default system font.

nSize

the font size, if 0, use the system default size.
uchar*getData()
No description provided
intgetDataLen()
No description provided
boolhasAlpha()
No description provided
boolisPremultipliedAlpha()
No description provided
boolsaveToFile(
charconst*pszFilePath
,
boolbIsToRGB
)

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

Parameters

pszFilePath

the file's absolute path, including file suffix.

bIsToRGB

whether the image is saved as RGB format.
unsigned shortgetWidth()const
No description provided
unsigned shortgetHeight()const
No description provided
intgetBitsPerComponent()const
No description provided
Fields0
Protected member functions7
bool_initWithJpgData(
void*pData
,
intnDatalen
)
No description provided
bool_initWithPngData(
void*pData
,
intnDatalen
)
No description provided
bool_initWithTiffData(
void*pData
,
intnDataLen
)
No description provided
bool_initWithWebpData(
void*pData
,
intnDataLen
)
No description provided
bool_initWithRawData(
void*pData
,
intnDatalen
,
intnWidth
,
intnHeight
,
intnBitsPerComponent
,
boolbPreMulti
)
No description provided
bool_saveImageToPNG(
charconst*pszFilePath
,
boolbIsToRGB
)
No description provided
bool_saveImageToJPG(
charconst*pszFilePath
)
No description provided
Protected fields6
;
No description provided
;
No description provided
intm_nBitsPerComponent
;
No description provided
uchar*m_pData
;
No description provided
boolm_bHasAlpha
;
No description provided
boolm_bPreMulti
;
No description provided