-
-
Notifications
You must be signed in to change notification settings - Fork 183
expose low-level colorkey info #2841
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
base: main
Are you sure you want to change the base?
Conversation
5156043
to
3e65f43
Compare
3e65f43
to
a84a2fd
Compare
love to fix merge conflicts
c345ee7
to
2d7a171
Compare
2f0921a
to
4c5a8b0
Compare
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. |
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. |
There was a problem hiding this 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.
result = SDL_SetColorKey(surf, SDL_TRUE, color); | ||
pgSurface_Unprep(self); | ||
|
||
if (result == -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs specify a negative error code, not exactly -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all seem like reasonable functions with straightforward implementation.
- I'd think they should be called get/set_colorkey_mapped, to relate to the other "mapped" Surface functions.
- This needs tests
- Needs docs update to added in 2.5.1
Okay. I'll change the name, fix the check for the return value, and update the docs. |
No description provided.