SDL_SetGamma(3)

πŸ’– SDL_SetGamma(3) πŸ’–

okay bestie, welcome to the SDL API Reference β€” we're doing SDL_SetGamma today and honestly? it's giving brightness slider but make it ✨science✨.


🌸 NAME 🌸

SDL_SetGamma β€” sets the color gamma function for the display πŸŽ€


✨ SYNOPSIS ✨

#include "SDL.h"

int SDL_SetGamma(float redgamma, float greengamma, float bluegamma);

πŸ¦‹ DESCRIPTION πŸ¦‹

so what this does is it sets the "gamma function" for the display of each color component. and what IS gamma, you ask? it's the thing that controls the brightness/contrast of the colors showing up on your screen. a gamma value of 1.0 is the identity β€” meaning literally no adjustment happens, you get exactly what you put in. periodt. πŸ’…

this function adjusts the gamma based on that "gamma function" parameter. but bestie, if you want to go full control-freak mode and directly specify lookup tables for your gamma adjustment, that's what SDL_SetGammaRamp is for. different vibe, same glow-up energy. ✨

⚠️ heads up: not all display hardware is able to change gamma. some screens simply said "no πŸ’€" and there is nothing you can do about it.

🫢 RETURN VALUE 🫢

returns -1 on error β€” or if gamma adjustment just isn't supported by your hardware at all. so yeah, -1 is the "it didn't work, bestie 😭" signal.


πŸ‘‘ SEE ALSO πŸ‘‘

  • SDL_GetGammaRamp
  • SDL_SetGammaRamp

and that's the whole page, gorgeous 🌈 this one came straight out of the SDL library, dated Tue 11 Sep 2001, 23:01 β€” a true vintage icon, and you just read the entire thing. slay πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from