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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose low-level colorkey info #2841

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

robertpfeiffer
Copy link
Contributor

No description provided.

@robertpfeiffer robertpfeiffer requested a review from a team as a code owner May 5, 2024 08:44
@yunline yunline added enhancement Surface pygame.Surface labels May 8, 2024
@robertpfeiffer
Copy link
Contributor Author

My goal with this branch was to implement a different kind of converting for indexed surfaces, but at this point I am content to just have this so I can handle converted surfaces this way. If you need to know why this is exposed, it's because the PNG loading in SDL_image can load a palette with two identical colours and assign the correct one as the colour key.

I have encountered this behaviour in one of my games already, it's annoying.

I wanted to have a "reverse convert" to convert an 8-bit surface for receiving blits from indexed surfaces. Then I could convert all surfaces to the same palette and color key. Unfortunately, this doesn't work 100% reliably, at least not without assumptions about the palette the png file was saved with, and the palette SDL_image constructs when loading an indexed png.

@robertpfeiffer
Copy link
Contributor Author

Anyway, it is probably better to expose this so I can write my palette-normaliser in python than to implement the palette-normaliser in C. I should probably check if it's actually faster to do it this way than just 32bit RGBA.

@robertpfeiffer robertpfeiffer changed the title WIP: Improved Palette and Colorkey handling expose low-level colorkey info May 23, 2024
Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions seem reasonable to me, albeit unlikely to be widely used.

Sometimes you do just need to know what SDL is doing under the hood to track down weird bugs.

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

Successfully merging this pull request may close these issues.

None yet

3 participants