SDL_ScaleSurface(3)
π SDL_ScaleSurface(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the group chat, where today's main character is SDL_ScaleSurface β she makes a brand new surface that's identical to the one you already have, except scaled to the size you want. glow up, but for pixels. β¨
πΈ NAME πΈ
SDL_ScaleSurface β creates a new surface identical to the existing surface, scaled to the desired size. literally a copy of your surface but resized, no cap π
π SYNOPSIS π
#include <SDL3/SDL_surface.h>
SDL_Surface * SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode);
π¦ DESCRIPTION π¦
so you hand her a surface and a target size and she hands you back a whole new surface, scaled. iconic.
β οΈ important bestie!! the returned surface should be freed with SDL_DestroySurface(). she is NOT a borrow, she's yours to clean up. don't ghost her, free her. π
β¨ FUNCTION PARAMETERS β¨
surfaceβ the surface to duplicate and scale. your OG. the blueprint. π«Άwidthβ the width of the new surface. how wide we're going. πheightβ the height of the new surface. how tall we're going. πscaleModeβ theSDL_ScaleModeto be used. pick your scaling vibe. π
π RETURN VALUE π
Returns a copy of the surface, or NULL on failure. and if she fails? call SDL_GetError() for more information β she'll tell you what went wrong, fr fr. π
π§ THREAD SAFETY π§
This function can be called on different threads with different surfaces. so like, multitask queen energy β just keep the surfaces different and you're golden. π₯
β AVAILABILITY β
This function is available since SDL 3.2.0. vintage-ish but make it fresh. π
π SEE ALSO π
SDL_DestroySurface(3)β the cleanup bestie. go say hi. π
Simple Directmedia Layer made this one, and this page is riding with SDL 3.4.18 β mwah, that's the whole manual page for SDL_ScaleSurface(3), drink some water, free your surfaces, and slay the rest of your day π
β¨π¦
π¦ 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