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

no colorkey in surfaces loaded from *.png #55

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

no colorkey in surfaces loaded from *.png #55

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: unspecified
Reported for operating system, platform: All, x86_64

Comments on the original bug report:

On 2013-03-21 08:41:07 +0000, Peter Kosyh wrote:

Created attachment 1075
indexed png

While linking with SDL 2.0 (taken from hg) i got a problem.

After loading indexed (not RGB!) png, i found, that SDL_GetColorKey is always returns -1. I attached png, that gives the problem. Just load it and do SDL_GetColorKey. So, while blitting such Surface we will get black background, instead of transparency.

I tried to debug SDL_image, but all what i got is no SDL_COPY_COLORKEY in surface->map->info.flags just after loading from png.

Of course, if i manually set colorkey with SDL_SetColorKey (for example, taking pixel from 0,0), all is fine, but without knowing png structure i can not found what color key is transparent.

I have no problem with SDL 1.2. Hope, my report will help.

On 2013-03-23 16:40:02 +0000, Sam Lantinga wrote:

I think this is fixed, can you check it?
http://hg.libsdl.org/SDL_image/rev/326a602521f2

Thanks!

On 2013-03-24 01:37:44 +0000, Peter Kosyh wrote:

Thank you! I have pulled from hg and found, that image is transparent now, but, currently only white color is visible. I do not see black borders in image that i attached.

Just see image in gimp, there are two colors (black, white) and transparent. While blitting i see only white. I am not sure if it is another bug?

On 2013-03-24 11:53:57 +0000, Sam Lantinga wrote:

It's because there are three entries in the palette and only two distinct RGB colors. I'll have to think about the best fix for this.

On 2013-03-24 12:58:27 +0000, Sam Lantinga wrote:

Okay, this is fixed! This required changes both in SDL and SDL_image.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant