SDL_GetWindowICCProfile(3)

πŸ’– SDL_GetWindowICCProfile πŸ’–

okay so bestie, this is a page from the SDL3 FUNCTIONS manual β€” the SDL_GetWindowICCProfile(3) one β€” and it's genuinely one of the cutest little utility calls ever. let's get into it 🫢


✨ NAME ✨

SDL_GetWindowICCProfile β€” grab the raw ICC profile data for the screen your window is currently chillin' on. that's it, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

void * SDL_GetWindowICCProfile(SDL_Window *window, size_t *size);

like yes, it returns a void *, we know, we know, it's giving mysterious but it's fine 😭


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • window β€” the window you wanna query. that's your girl, that's the one you're asking about πŸ’–
  • size β€” the size of the ICC profile. it's a size_t *, so she writes the size back out to you ✨

πŸ¦‹ RETURN VALUE πŸ¦‹

on success? you get the raw ICC profile data. slay. πŸŽ‰

on failure? you get NULL. and not to be dramatic but you should then call SDL_GetError() for more info, because otherwise you're just standing there with a NULL and no answers 😭

real talk: when you're done with that data, you have to free it with SDL_free(). no cap. don't just leave it sitting there, that's a leak and leaks are not iconic πŸ’€

πŸ”₯ THREAD SAFETY πŸ”₯

this function should only be called on the main thread. that's the vibe check. do not bring your worker threads to this party, it will not go well πŸ™ˆ


⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. so if you're on something older... bestie, upgrade 🧚


πŸ‘‘ SEE ALSO πŸ‘‘

(no SEE ALSO section on this one, she's a standalone queen, we move 🌈)


mwah πŸ’œ that's the whole page. go get that ICC profile, free your memory, and only call it from the main thread, periodt. πŸ“

β€” with love, from the Simple Directmedia Layer crew, SDL 3.4.18 edition of SDL_GetWindowICCProfile(3) πŸŽ€βœ¨

πŸ“¦ where this page comes from