Set image orientation after screenshot

Hi all. I’m using e new function captureScreen for take a screen shot and save it into file.

http://www.cocos2d-x.org/wiki/How_to_Save_a_Screenshot

I have a problem for this. How can i change orientation image (meta data or execute rotations)? Thank you

I don’t know of a built in way to do this (http://www.cocos2d-x.org/reference/native-cpp/V3.2/d0/d1e/namespacecocos2d_1_1utils.html)

You could probably use libpng to do this, although I haven’t checked. Maybe also, since you can get a Sprite from the RenderTexture you could rotate it using setRotation(). I’m just talking out loud.

in this way when i use RenderTexture->saveToFile not always save the last screen and it not rewrite newest files.

in utils captureScreen, save screen in this way:

std::shared_ptr<GLubyte> buffer(new GLubyte[width * height * 4], [](GLubyte* p) {CC_SAFE_DELETE_ARRAY(p);});
		glPixelStorei(GL_PACK_ALIGNMENT, 1);
		glReadPixels(0, h / 8, width,height, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get());

then flip the image correctly:

std::shared_ptr<GLubyte> flippedBuffer(new GLubyte[width * height * 4], [](GLubyte* p) {CC_SAFE_DELETE_ARRAY(p);});
		for (int row = 0; row < height; ++row)
		{
			memcpy(flippedBuffer.get() + (height - row - 1) * width * 4, buffer.get() + row * width * 4, width * 4);
		}

then save buffer in image type:

std::shared_ptr<Image> image(new Image);
image->initWithRawData(flippedBuffer.get(), width * height * 4, width, height, 8);
image->saveToFile(outputFile);

is there a way for rotate the image? in this method screenshot are always saved perfect without bugs. Thanks

I think that this has been fixed in GitHub if you pull from that.

3.3 is a beta version? how can i update my version in cmd? i’ve installed cocos with phyton and for create new project i use command:

cocos new project -p package -l cpp

is it correct?

you would need to clone from GitHub and then run ./download-deps.py. Then you can simply do git pull origin to always bring down the latest and be up to date. It is the development branch.

what is his functionality? thank you…