@alderwick I was thinking maybe the screen pixels should be the palette data instead of RGBA.

@foura @neauoire They do! But I think the link that takes us from an indexed surface to what's displayed on the screen has been severed since SDL 2 was released. The most important piece I never found was associating a palette with the indices.

I'm super happy to be proven wrong though, the SDL indexed drawing code would be very optimised! 😊

@foura @neauoire Aha, here seems to be the missing link.

SDL_SetPaletteColors works with an SDL_Palette rather than a SDL_Surface directly… I never found an API to say “now associate this palette with this surface”.

Searching for both these SDL functions brought me to a specific code example in wiki.libsdl.org/SDL_PixelForma:

> we use that index to read the SDL_Color structure from surface->format->palette->colors

So I can access the palette with surface->format->palette. Hurray! Thanks a bunch 😊

Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko