SDL_FillSurfaceRect(3)
π SDL_FillSurfaceRect(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, where today's main character is SDL_FillSurfaceRect π¨β¨
π NAME π
SDL_FillSurfaceRect β the way to do a fast fill of a rectangle with one specific color. no cap, that's literally the whole job π«Ά
β¨ SYNOPSIS β¨
#include <SDL3/SDL_surface.h>
bool SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
π DESCRIPTION π
so color has to be a pixel in the format that the surface is using, okay? like, it's gotta match. you can make one with SDL_MapRGB() or SDL_MapRGBA() and that's the move π
and here's the tea: if that color value has an alpha component in it, the destination just gets straight-up filled with that alpha info. no blending happens. none. zero. it's giving "we're not mixing, we're replacing" π
also!! if there's a clip rectangle set on the destination (you'd set that with SDL_SetSurfaceClipRect()), then this function fills based on the intersection of the clip rectangle and rect. so it's not just rect on its own β it's where rect and the clip overlap πΈ
π¦ FUNCTION PARAMETERS π¦
dstβ theSDL_Surfacestructure that is the drawing target. this is the canvas you're painting on π¨rectβ theSDL_Rectstructure representing the rectangle to fill, orNULLto fill the entire surface. yep,NULL= fill everything, one big vibe β¨colorβ the color to fill with π
π RETURN VALUE π
returns true on success or false on failure. and if it fails? call SDL_GetError() for more information, bestie, don't just sit there guessing π
π§ THREAD SAFETY π§
this function can be called on different threads with different surfaces. so like, parallel vibes are fine β just keep the surfaces separate, iykyk π₯
π AVAILABILITY π
this function is available since SDL 3.2.0. periodt π
π SEE ALSO π
SDL_FillSurfaceRects(3)β the plural one, go look π
ok that's the whole page, you ate that π«Ά go fill some rectangles, they're waiting π
Simple Directmedia Layer β that's who brought you this, version SDL 3.4.18, and the page itself is SDL_FillSurfaceRect(3). mwah, bye bestie, slay responsibly β¨ππ
π¦ 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