Skip to content
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

PNG decoding does not currently support transparency #195

Open
illusion0001 opened this issue Jan 14, 2022 · 5 comments
Open

PNG decoding does not currently support transparency #195

illusion0001 opened this issue Jan 14, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@illusion0001
Copy link
Contributor

No description provided.

@bucanero
Copy link
Contributor

which library or code have you used to load a png?

I have used the stbi image library without issues. (png with alpha channel, etc.)

@victorrjimenezz
Copy link

victorrjimenezz commented Jan 14, 2022

I think the problem is that the PNG class does not currently use the alpha value. You can solve it by adding uint8_t alpha = (uint8_t)(encodedColor >> 24); to the Draw function in the PNG class, and only drawing the pixel if(alpha> someValue). But this does not take into account when the pixel isn‘t completely transparent.

@illusion0001
Copy link
Contributor Author

which library or code have you used to load a png?

I have used the stbi image library without issues. (png with alpha channel, etc.)

@bucanero you can change background of included sample to anything but black and the logo will have black background on it. Texture is rgba. https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain/tree/master/samples/pngdec

@bucanero
Copy link
Contributor

I think that the PNG.cpp in common is just a quick example and shouldn't be taken as a full featured graphics library.

I've been using the SDL2 library to render pngs with alpha without issues. You might want to check the SDL2 samples as an alternative.

@Cryptogenic
Copy link
Member

While this is true and common/ is just quick examples, it would be nice to support transparency there, especially where we already do so for fonts.

@Cryptogenic Cryptogenic self-assigned this Feb 1, 2022
@Cryptogenic Cryptogenic added the enhancement New feature or request label Feb 1, 2022
@Cryptogenic Cryptogenic added this to the V0.6 milestone Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants