SDL_GetSurfaceClipRect(3)

πŸ’– SDL_GetSurfaceClipRect πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, page SDL_GetSurfaceClipRect(3) β€” yes that's a whole mouthful, we're gonna get through it together 🫢


✨ NAME ✨

SDL_GetSurfaceClipRect β€” get the clipping rectangle for a surface, no cap πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_surface.h>

bool SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);

✨ DESCRIPTION ✨

so here's the vibe: when surface is the destination of a blit, only the area within the clip rectangle is drawn into. that's it. that's the whole lore. everything outside that lil rectangle just doesn't get touched, periodt πŸŽ€


✨ FUNCTION PARAMETERS ✨

  • surface β€” the SDL_Surface structure representing the surface to be clipped. she's the main character here πŸ‘‘
  • rect β€” an SDL_Rect structure that gets filled in with the clipping rectangle for the surface. note the direction: it fills your rect in, you don't hand it one and it reads it. iykyk 🌸

✨ RETURN VALUE ✨

returns true on success or false on failure 😭 and if it's giving failure, 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, go off, parallelize, be that girl β€” just keep each thread on its own surface, bestie 🌈


✨ AVAILABILITY ✨

this function is available since SDL 3.2.0 ✨


✨ SEE ALSO ✨


not me getting emotional over a clip rect. anyway. πŸ₯Ή

and that's the page!! brought to you by Simple Directmedia Layer, SDL version 3.4.18, filed under SDL_GetSurfaceClipRect(3) β€” mwah, slay, goodbye πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from