pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

expose low-level colorkey info

Open robertpfeiffer opened this issue 1 year ago • 4 comments
trafficstars

robertpfeiffer avatar May 05 '24 08:05 robertpfeiffer

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 avatar May 23 '24 15:05 robertpfeiffer

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 avatar May 23 '24 15:05 robertpfeiffer

Okay. I'll change the name, fix the check for the return value, and update the docs.

robertpfeiffer avatar Jul 02 '24 18:07 robertpfeiffer