SDL_GetGammaRamp(3)

✨ SDL_GetGammaRamp ✨

okay so bestie, welcome to the SDL API Reference πŸ’– this one's a lil function called SDL_GetGammaRamp, and it's the one that gets the color gamma lookup tables for the display. yes. that's the whole vibe. let's get into it 🫢


🌸 SYNOPSIS 🌸

#include "SDL.h"

int SDL_GetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16
*bluetable);

like, you pull in "SDL.h" first, obviously, and then you hand it three lil pointer besties β€” one for red, one for green, one for blue β€” and it fills them in for you πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So what does it actually do, you ask? It gets the gamma translation lookup tables currently used by the display. That's it, that's the whole thing. It's reading, not writing. It's the "tell me what you've got going on rn" of gamma functions πŸ“–βœ¨

And here's the lil detail that matters, don't skip it: each table is an array of 256 Uint16 values. Two hundred and fifty-six. Not 255, not 1024. 256. and every single entry is a Uint16, so make sure your buffers are actually that big before you pass them in, okay? 😭

🚨 real talk tho: not all display hardware is able to change gamma. So if you're out here expecting every monitor on earth to play along, nope. some of them literally can't, and that's not a you problem, that's a hardware problem πŸ’€

πŸŽ€ RETURN VALUE πŸŽ€

  • Returns -1 on error.

that's the only documented return value, bestie, so treat anything that isn't an error like a win πŸ† and if you get that -1 back, something went sideways.


πŸ‘‘ SEE ALSO πŸ‘‘

  • SDL_SetGamma
  • SDL_SetGammaRamp

go read those two next, they're literally the other half of this whole gamma situation, iykyk πŸ”₯


and that's the page!! mwah πŸ’‹ this was the SDL API Reference, dated Tue 11 Sep 2001, 23:01 β€” yeah, 2001, we're reading vintage lore fr fr πŸ•°οΈβœ¨ slay, go forth and gamma-ramp responsibly, queen πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from