I want to take screenshots and save it in the gallery. What I have tried:
CCSize size = CCDirector::sharedDirector()->getWinSize(); CCRenderTexture* texture = CCRenderTexture::create((int)size.width, (int)size.height, kCCTexture2DPixelFormat_RGBA8888); texture->setPosition(ccp(size.width/2, size.height/2)); texture->begin(); CCDirector::sharedDirector()->getRunningScene()->visit(); texture->end(); texture->saveToFile("scrshot.png", kCCImageFormatJPEG);
in iOS it is working perfectly and am able to save image in to documents, but the problem is in android :
There are two possibilities
1) texture->saveToFile("scrshot.png", kCCImageFormatJPEG); or texture->saveToFile("My path"); -> It compiles but where is the image saved?
2) Use JNI to save Bitmap file -> problem is how to cast CCRenderTexture to Bitmap and parse it.