SDL_GetSurfaceColorspace(3)
β¨ SDL_GetSurfaceColorspace β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages π this one's called SDL_GetSurfaceColorspace, and no cap, it's a lil baby function that just tells you what colorspace a surface is vibing in. super simple, super useful, let's get into it π¦
πΈ NAME πΈ
SDL_GetSurfaceColorspace β get the colorspace used by a surface. that's it. that's the whole job. iconic behavior honestly π
π SYNOPSIS π
#include <SDL3/SDL_surface.h>
SDL_Colorspace SDL_GetSurfaceColorspace(SDL_Surface *surface);
look at her. one include, one function call, zero drama π
π DESCRIPTION π
so here's the tea β β the colorspace of your surface isn't just random, it defaults based on what kind of format the surface is using. the rules are:
- floating point formats β defaults to
SDL_COLORSPACE_SRGB_LINEAR - 10-bit formats β defaults to
SDL_COLORSPACE_HDR10 - other RGB surfaces β defaults to
SDL_COLORSPACE_SRGB - YUV textures β defaults to
SDL_COLORSPACE_BT709_FULL
so yeah, it's giving "the surface already knows what it is" energy π
π«Ά FUNCTION PARAMETERS π«Ά
surfaceβ theSDL_Surfacestructure you wanna query. just hand her over and she'll tell you her colorspace secrets π
β RETURN VALUE β
returns the colorspace used by the surface π ... BUT β and this is the important part bestie β if the surface is NULL, you get SDL_COLORSPACE_UNKNOWN back. so like, don't be surprised, it's not throwing hands, it's just telling you there's nothing there π
π§ THREAD SAFETY π§
good news!! this function can be called on different threads with different surfaces π₯ so as long as you're not poking the same surface from two threads at once, you're chilling. parallel vibes only β¨
π AVAILABILITY π
this function has been around since SDL 3.2.0 π so if you're on anything older, sorry babe, she's not there yet π
π SEE ALSO π
SDL_SetSurfaceColorspace(3)β the setter to this getter, they're a matched set, obsessed π«Ά
reminder bestie: getting a colorspace is read-only, it doesn't change anything. if you wanna change the vibe, go see SDL_SetSurfaceColorspace(3). iykyk π
and that's the whole page, periodt π this little love letter to the colorspace API came to you from Simple Directmedia Layer, SDL 3.4.18, and yeah she's filed under SDL_GetSurfaceColorspace(3) β go forth and query those surfaces, you absolute main character ππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms