SDL_BLITSURFACETILEDWITHSCALE(3)
π SDL_BlitSurfaceTiledWithScale(3) π
okay bestie, so you know how there's a whole family of blit functions in SDL3? This one is the scale AND tile AND format-convert girlie, and she ate fr fr. She lives in the SDL3 functions, and the manual page for her is literally right here. Let's get into it. π«Ά
β¨ NAME β¨
SDL_BlitSurfaceTiledWithScale β do a scaled and tiled blit onto a destination surface, and lowkey that destination can be a completely different format. no cap. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_surface.h>
bool SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
look at that signature. six whole arguments. she's high maintenance but she's worth it π
π DESCRIPTION π
The pixels sitting inside srcrect get scaled and then repeated as many times as it takes to completely fill dstrect. That's the whole vibe. Like wallpaper. Like a cute repeating pattern. Except it's pixels and you're a programmer. β¨
not me filling a whole rectangle with one tiny tile and calling it design. obsessed.
πΈ FUNCTION PARAMETERS πΈ
srcβ theSDL_Surfacestructure you're copying from. your source of truth, your origin story πsrcrectβ theSDL_Rectstructure representing the rectangle you wanna copy. or passNULLif you just want the entire surface, because sometimes you don't have the energy to be specific and that's valid πscaleβ the scale used to transformsrcrectinto the destination rectangle. bestie, picture a 32x32 texture with ascaleof 2 β that fills 64x64 tiles. math is math. π₯scaleModeβ the scale algorithm to be used. that's anSDL_ScaleMode, and you pick your fighter βdstβ theSDL_Surfacestructure that is the blit target. the destination. the final boss. the canvas π¨dstrectβ theSDL_Rectstructure representing the target rectangle in the destination surface. orNULLto fill the entire surface, which is giving main character energy honestly π
π« RETURN VALUE π«
Returns true on success or false on failure β and if it's a flop, call SDL_GetError() for more information. she will tell you what went wrong, you just have to ask π
π§ THREAD SAFETY π§
Only one thread should be using the src and dst surfaces at any given time. one. thread. at a time. sharing is not caring here, it's undefined-behavior-coded. protect your surfaces π«Ά
π AVAILABILITY π
This function is available since SDL 3.2.0. if your SDL is older than that, she simply is not there, and no amount of manifesting will summon her. upgrade bestie π
π SEE ALSO π
and that's the page!! π written by the Simple Directmedia Layer girlies, shipping as part of SDL 3.4.18, and yes the doc page itself is literally named SDL_BlitSurfaceTiledWithScale(3) because the header and the footer are both just her name in different outfits. slay. bye bestie, go tile something cute πΈβ¨π¦
π¦ 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