SDL_ClearSurface(3)
β¨ SDL_ClearSurface β bestie edition π
okay so this is SDL_ClearSurface(3), a lil function from the SDL3 FUNCTIONS gang, and it's here to wipe a surface clean with a color β but like, with floating point precision. fancy. we love that for us. π
πΈ NAME πΈ
SDL_ClearSurface β Clear a surface with a specific color, with floating point precision.
π¦ SYNOPSIS π¦
#include <SDL3/SDL_surface.h>
bool SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a);
π DESCRIPTION π
so here's the tea, bestie: this function handles all surface formats. every single one. it does not care. it's giving main character energy that way. β¨
it also ignores any clip rectangle. like, the clip rect is literally not invited to this party. set it, don't set it, doesn't matter β this function is not looking at it. π
if the surface is YUV, the color is assumed to be in the sRGB colorspace. otherwise (not YUV, just vibing), the color is assumed to be in the colorspace of the surface itself. no cap. π«Ά
π FUNCTION PARAMETERS π
surfaceβ theSDL_Surfaceto clear. this is the one getting the glow-up. πrβ the red component of the pixel, normally in the range0-1. yes,0-1, not0-255. it's float o'clock. πgβ the green component of the pixel, normally in the range0-1. πbβ the blue component of the pixel, normally in the range0-1. πaβ the alpha component of the pixel, normally in the range0-1. translucency era. π«οΈ
β RETURN VALUE β
Returns true on success or false on failure. if it fails, call SDL_GetError() for more information β that's your little gossip source telling you what went wrong. π
π₯ THREAD SAFETY π₯
This function can be called on different threads with different surfaces. so like, multitask, queen. just keep the surfaces separate, okay? different surface per thread, no fighting. π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older... bestie, upgrade. π¦
and that's the whole page, periodt. brought to you by Simple Directmedia Layer, SDL 3.4.18, dated SDL_ClearSurface(3). go clear something gorgeous. ππβ¨
π¦ 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