Load the image from the specified path.
Class CCImage
#include <Geode/cocos/platform/CCImage.h>
classCCImage:publiccocos2d::CCObject{ ... }
No description provided
Examples0
Public static methods0
Public member functions12
boolinitWithImageFile(charconst*strPath,cocos2d::CCImage::EImageFormatimageType)
strPath
the absolute file path.
imageType
the type of image, currently only supporting two types.
true if loaded correctly.
boolinitWithImageFileThreadSafe(charconst*fullpath,cocos2d::CCImage::EImageFormatimageType)
No description provided
boolinitWithImageData(void*pData,intnDataLen,,intnWidth,intnHeight,intnBitsPerComponent,intwhoknows)
Load image from stream buffer.
pBuffer
stream buffer which holds the image data.
nLength
data length expressed in (number of) bytes.
nWidth,
nHeight, nBitsPerComponent are used for kFmtRawData.
true if loaded correctly.
⚠️ kFmtRawData only supports RGBA8888.
boolinitWithString(charconst*pText,intnWidth,intnHeight,cocos2d::CCImage::ETextAligneAlignMask,charconst*pFontName,intnSize)
Create image with specified string.
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.
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
Fields3
Protected member functions7
Protected fields3
unsigned shortm_nWidth;
No description provided
unsigned shortm_nHeight;
No description provided
intm_nBitsPerComponent;
No description provided