mirror of https://github.com/axmolengine/axmol.git
Merge branch 'master' of https://github.com/cocos2d/cocos2d-x
This commit is contained in:
commit
5b0f25466a
|
@ -85,7 +85,8 @@ public:
|
|||
void clear(float r, float g, float b, float a);
|
||||
|
||||
/** saves the texture into a file */
|
||||
bool saveBuffer(const char *name);
|
||||
// para szFilePath the absolute path to save
|
||||
bool saveBuffer(const char *szFilePath);
|
||||
/** saves the texture into a file. The format can be JPG or PNG */
|
||||
bool saveBuffer(const char *name, int format);
|
||||
|
||||
|
|
|
@ -216,13 +216,21 @@ void CCRenderTexture::clear(float r, float g, float b, float a)
|
|||
this->end();
|
||||
}
|
||||
|
||||
bool CCRenderTexture::saveBuffer(const char *name)
|
||||
bool CCRenderTexture::saveBuffer(const char *szFilePath)
|
||||
{
|
||||
return this->saveBuffer(name, kCCImageFormatJPG);
|
||||
bool bRet = false;
|
||||
|
||||
CCImage *pImage = new CCImage();
|
||||
if (pImage != NULL && getUIImageFromBuffer(pImage))
|
||||
{
|
||||
bRet = pImage->saveToFile(szFilePath);
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(pImage);
|
||||
return bRet;
|
||||
}
|
||||
bool CCRenderTexture::saveBuffer(const char *fileName, int format)
|
||||
{
|
||||
|
||||
bool bRet = false;
|
||||
CCAssert(format == kCCImageFormatJPG || format == kCCImageFormatPNG,
|
||||
"the image can only be saved as JPG or PNG format");
|
||||
|
|
Loading…
Reference in New Issue