-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Milestone
Description
- cocos2d-x version: 3.15.1
- devices test on: Windows
Steps to Reproduce:
Take any image that has transparent pixels in it and try to save it as a png using renderTexture. The transparent pixels will get added with the background color of the renderTexture despite setting the background's alpha channel to zero with clear(0,0,0,0). Below is the code I used:
auto sprite = Sprite::create("original.png");
auto renderTexture = RenderTexture::create(64, 64, Texture2D::PixelFormat::RGBA8888);
renderTexture->clear(0,0,0,0);
renderTexture->begin();
sprite->setAnchorPoint(Vec2(0, 0));
sprite->setPosition(Vec2(0,0));
sprite->visit();
renderTexture->end();
renderTexture->saveToFile("rendertexture.png", Image::Format::PNG);
So in the above case because I cleared with rgba(0,0,0,0), my transparent pixels will end up being darker. One would assume that having an alpha of zero shouldn't change the image at all.
I posted an example image on the forums:
http://discuss.cocos2d-x.org/t/rendertexture-savetofile-bugged-for-image-alpha-values/38810
Metadata
Metadata
Assignees
Labels
No labels