-
Notifications
You must be signed in to change notification settings - Fork 7.1k
rendertexture's savetoFile problem #16113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
thanks. could you post the code to reproduce it? thanks. |
@ricardoquesada local target = cc.RenderTexture:create(winSize.width, winSize.height, 2) |
Thanks. But I couldn't reproduce it. The image that I got on an iPhone is the following, and it seems to be Ok. is that right? I'm using C++ code instead of Lua though. UPDATE: Image had the letters in white... generating a new one in red (see below) |
@ricardoquesada where is the png file,i can't seen it |
@reasonMix Uploading it again... In case it doesn't work, this is the test case that I created: I couldn't find any white border in this image. |
@ricardoquesada please paste your code,do you create the label with ttf? |
@reasonMix: the code is here, in this Pull Request: #16180 |
@ricardoquesada i am wrong,in mac platform,the png file will have a black border |
@reasonMix this is the image from the Mac: |
@ricardoquesada use the white color,will see the black border |
@reasonMix thanks. I was able to reproduce it. This does not happen on iOS because iOS is using its own function to save to PNG, and it is passing the parameter I think I have to unpremultiplied it manually before saving it. |
@ricardoquesada yes,but if use a sprite to render to target,the PNG file is fine no border,so maybe this is not easy solve this problem |
@reasonMix makes sense what you are saying... I've been trying to fix this bug doing different stuff and I couldn't fix it. I tried to unpremultiplied alpha and other stuff and didn't work. I'll take a look at this again this monday with fresh eyes. |
so the defect is we treat the data (premultiplied) as if it were unpremultiplied. as I confirmed one way to fix it is force set the internal texture of RenderTexture premultiplied value to |
when draw a label to the render texture and call the savetoFile to create the png file.the png file have white border on ios platform. because the label use ALPHA_NON_PREMULTIPLIED blend mode. and on ios platform the image-ios.mm savetoFile only use the kCGImageAlphaPremultipliedLast flag
The text was updated successfully, but these errors were encountered: