SDL_GetSurfaceProperties(3)

πŸ’– SDL_GetSurfaceProperties β€” the manual page, bestie edition πŸ’–

okay so you're deep in the SDL3 FUNCTIONS section, page SDL_GetSurfaceProperties(3), and you need the tea on what properties a surface is holding. sit down, hydrate, let's go ✨


🌸 NAME 🌸

SDL_GetSurfaceProperties β€” grab the properties that are associated with a surface. that's it, that's the whole vibe 🫢


✨ SYNOPSIS ✨

#include <SDL3/SDL_surface.h>

SDL_PropertiesID SDL_GetSurfaceProperties(SDL_Surface *surface);

πŸ¦‹ DESCRIPTION πŸ¦‹

so SDL understands these properties, and here's the full rundown, no skips, no cuts πŸ’…

  • SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT β€” for HDR10 and floating point surfaces, this defines the value of 100% diffuse white, with higher values being displayed in the High Dynamic Range headroom. it defaults to 203 for HDR10 surfaces and 1.0 for floating point surfaces. the range, she is ranging 🌈
  • SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT β€” for HDR10 and floating point surfaces, this defines the maximum dynamic range used by the content, in terms of the SDR white point. defaults to 0.0, which disables tone mapping. so like, off by default, periodt πŸ’€
  • SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING β€” the tone mapping operator used when compressing from a surface with high dynamic range to another with lower dynamic range. currently this supports "chrome", which uses the same tone mapping that Chrome uses for HDR content, the form "*=N", where N is a floating point scale factor applied in linear space, and "none", which disables tone mapping. defaults to "chrome". three whole options and they're all iconic πŸ‘‘
  • SDL_PROP_SURFACE_HOTSPOT_X_NUMBER β€” the hotspot pixel offset from the left edge of the image, if this surface is being used as a cursor. cursor girlies, this one's for you πŸŽ€
  • SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER β€” the hotspot pixel offset from the top edge of the image, if this surface is being used as a cursor. yeah it's the Y twin, they're a matching set πŸ’œ
  • SDL_PROP_SURFACE_ROTATION_FLOAT β€” the number of degrees a surface's data is meant to be rotated clockwise to make the image right-side up. default 0. this is used by the camera API, if a mobile device is oriented differently than what its camera provides (i.e. - the camera always provides portrait images but the phone is being held in landscape orientation). since SDL 3.4.0. not me rotating my whole phone just to read this 😭

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • surface β€” the SDL_Surface structure to query. that's the one you're asking about, bestie 🫢

πŸ’… RETURN VALUE πŸ’…

returns a valid property ID on success or 0 on failure. if it flops, call SDL_GetError() for more information. 0 is giving "we have nothing to say to you" energy πŸ™ˆ


🧚 THREAD SAFETY 🧚

it is safe to call this function from any thread. yes bestie, ANY thread. go wild, no cap ⭐


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. old enough to be trusted, young enough to be cute πŸ’–


lowkey reminder: every single one of those property names is literal, character for character. copy them exactly or the compiler will simply not know her πŸ”₯

and that's the whole page, you ate it up. this came to you from Simple Directmedia Layer, SDL 3.4.18, SDL_GetSurfaceProperties(3) β€” mwah, go query something gorgeous, bestie πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from