mirror of https://github.com/axmolengine/axmol.git
issue #2430:use Image::Format instead of tImageFormat
This commit is contained in:
parent
2bb577be8b
commit
df48f52aa3
|
@ -145,4 +145,7 @@ const int kCCMenuStateTrackingTouch = Menu::STATE_TRACKING_TOUCH;
|
|||
const int kCCTouchesOneByOne = Layer::TOUCHES_ONE_BY_ONE;
|
||||
const int kCCTouchesAllAtOnce = Layer::TOUCHES_ALL_AT_ONCE;
|
||||
|
||||
const int kCCImageFormatPNG = Image::FORMAT_PNG;
|
||||
const int kCCImageFormatJPEG = Image::FORMAT_JPG;
|
||||
|
||||
NS_CC_END
|
|
@ -902,8 +902,9 @@ CC_DEPRECATED_ATTRIBUTE extern const int kCCTouchesOneByOne;
|
|||
CC_DEPRECATED_ATTRIBUTE extern const int kCCTouchesAllAtOnce;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef enum Layer::TouchesMode ccTouchesMode;
|
||||
|
||||
#define kCCImageFormatPNG kImageFormatPNG
|
||||
#define kCCImageFormatJPEG kImageFormatJPEG
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCImageFormatPNG;
|
||||
CC_DEPRECATED_ATTRIBUTE extern const int kCCImageFormatJPEG;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef enum Image::Format tImageFormat;
|
||||
|
||||
#define kCCTransitionOrientationLeftOver kTransitionOrientationLeftOver
|
||||
#define kCCTransitionOrientationRightOver kTransitionOrientationRightOver
|
||||
|
|
|
@ -550,16 +550,16 @@ bool RenderTexture::saveToFile(const char *szFilePath)
|
|||
Image *pImage = newImage(true);
|
||||
if (pImage)
|
||||
{
|
||||
bRet = pImage->saveToFile(szFilePath, kImageFormatJPEG);
|
||||
bRet = pImage->saveToFile(szFilePath, Image::FORMAT_JPG);
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(pImage);
|
||||
return bRet;
|
||||
}
|
||||
bool RenderTexture::saveToFile(const char *fileName, tImageFormat format)
|
||||
bool RenderTexture::saveToFile(const char *fileName, Image::Format format)
|
||||
{
|
||||
bool bRet = false;
|
||||
CCASSERT(format == kImageFormatJPEG || format == kImageFormatPNG,
|
||||
CCASSERT(format == Image::FORMAT_JPG || format == Image::FORMAT_PNG,
|
||||
"the image can only be saved as JPG or PNG format");
|
||||
|
||||
Image *pImage = newImage(true);
|
||||
|
|
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
|||
#include "base_nodes/CCNode.h"
|
||||
#include "sprite_nodes/CCSprite.h"
|
||||
#include "kazmath/mat4.h"
|
||||
#include "platform/CCImage.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -36,11 +37,6 @@ NS_CC_BEGIN
|
|||
* @{
|
||||
*/
|
||||
|
||||
typedef enum eImageFormat
|
||||
{
|
||||
kImageFormatJPEG = 0,
|
||||
kImageFormatPNG = 1,
|
||||
} tImageFormat;
|
||||
/**
|
||||
@brief RenderTexture is a generic rendering target. To render things into it,
|
||||
simply construct a render target, call begin on it, call visit on any cocos
|
||||
|
@ -117,7 +113,7 @@ public:
|
|||
/** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder.
|
||||
Returns YES if the operation is successful.
|
||||
*/
|
||||
bool saveToFile(const char *name, tImageFormat format);
|
||||
bool saveToFile(const char *name, Image::Format format);
|
||||
|
||||
/** Listen "come to background" message, and save render texture.
|
||||
It only has effect on Android.
|
||||
|
|
|
@ -147,8 +147,8 @@ void RenderTextureSave::saveImage(cocos2d::Object *pSender)
|
|||
char jpg[20];
|
||||
sprintf(jpg, "image-%d.jpg", counter);
|
||||
|
||||
_target->saveToFile(png, kImageFormatPNG);
|
||||
_target->saveToFile(jpg, kImageFormatJPEG);
|
||||
_target->saveToFile(png, Image::FORMAT_PNG);
|
||||
_target->saveToFile(jpg, Image::FORMAT_JPG);
|
||||
|
||||
|
||||
Image *pImage = _target->newImage();
|
||||
|
|
Loading…
Reference in New Issue