SDL_FillSurfaceRects(3)
β¨ SDL_FillSurfaceRects β the SDL3 FUNCTIONS era β¨
okay bestie, sit down, hydrate, because we're about to talk about SDL_FillSurfaceRects(3) β yes, the plural one, the one that eats a whole ARRAY of rectangles for breakfast π
π NAME π
SDL_FillSurfaceRects β do a fast fill of a whole set of rectangles with one specific color. like, one color, many rects, zero drama. periodt.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_surface.h>
bool SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
look at her. four arguments. so clean. so iconic. π«Ά
π¦ DESCRIPTION π¦
so color has to be a pixel in the format that the surface actually uses, okay? don't just make up numbers. you can generate it with SDL_MapRGB() or SDL_MapRGBA() β those are your besties for this. β¨
and here's the tea π: if that color value has an alpha component in it, then the destination is simply filled with that alpha information. no blending takes place. like, none. zero. the alpha just gets written straight in. not a vibe check, just a fact.
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 gonna go wild outside your clip zone. it knows its boundaries. main character with manners. π
π FUNCTION PARAMETERS π
dstβ theSDL_Surfacestructure that is the drawing target. this is where the paint goes, bestie.rectsβ an array ofSDL_Rects representing the rectangles to fill. yes, an array. plural energy. π₯countβ the number of rectangles in the array. don't lie to her, she counts. πcolorβ the color to fill with. the whole point, honestly.
β RETURN VALUE β
returns true on success or false on failure π β and if it fails, call SDL_GetError() for more information. she will tell you what went wrong, just ask her.
π THREAD SAFETY π
this function can be called on different threads with different surfaces. so yes, you can parallelize β just keep each surface to its own thread, iykyk. π§
π AVAILABILITY π
this function is available since SDL 3.2.0. if you're on something older, no she's not there yet. sorry bestie. π
π SEE ALSO π
SDL_FillSurfaceRect(3)β the singular version, for when you only have one rect and you're being lowkey about it.
ok that's the whole page, go fill some rectangles, you're gonna slay π«Άβ¨
Simple Directmedia Layer π SDL 3.4.18 β mwah, sending you and your surfaces all the love, catch you in the next manpage bestie! πΈππ¦
π¦ 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