Open ankith26 opened 2 months ago
How would your proposed function handle extra data apart from the raw pixel data?
I would like SDL_ConvertSurfaceToPixels
to apply the pallete colour when converting from indexed -> non-indexed. I would like it to convert colorkey alphas and surface alphas to per pixel alphas when the dst format allows for a dedicated alpha channel.
Here is my usecase:
Given an
SDL_Surface
instance, I want toMy current approach is to use
SDL_ConvertSurface
to get a new surface in the desired format, and then manually copy the data into the pixel buffer. This works but the minor issues here are:Then I found out that
SDL_ConvertPixels
exists, which at a first glance seems to be exactly what I want, but now the problem is this function cannot handle any cases where my input surface has extra data apart from the raw pixel data (e.g indexed surfaces, surfaces with colorkey or surface-alpha, etc)It would be very appreciated if I can use a variant of
SDL_ConvertPixels
that takes the src as aSDL_Surface
, basically. The function signature could be something likeIt would also be nice if there was an additional boolean argument called
dst_flip
which controls if the resulting pixel data is vertically flipped or not, but now I realize at this point I may be asking for too much :)The reason this argument would be useful is that some libraries (like
PyOpenGL
) apparently prefer their image data in a flipped format. Atleast this is what a comment in thepygame(-ce)
codebase tells me, I've not verified this information myself.