SDL_SetRenderClipRect(3)
β¨ SDL_SetRenderClipRect β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_SetRenderClipRect(3) β the lil function that decides exactly where your renderer is allowed to draw. it's giving "scissors for pixels" π
πΈ NAME πΈ
SDL_SetRenderClipRect β set the clip rectangle for rendering on the specified target. that's it, that's the vibe π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_render.h>
bool SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
π DESCRIPTION π
so here's the tea: every single render target has its own clip rectangle. no sharing, no borrowing, each one has its own. π«Ά
this function sets the cliprect for the current render target. so whatever target you're on right now? that's the one getting the new clip. periodt.
π FUNCTION PARAMETERS π
rendererβ the rendering context. your main character, the one doing the rendering.rectβ anSDL_Rectstructure representing the clip area, and it's relative to the viewport. or passNULLto disable clipping entirely β go wild, no scissors, draw everywhere π¦
β RETURN VALUE β
returns true on success or false on failure. and if it fails? bestie, call SDL_GetError() for more information β it'll tell you what went wrong, i promise π
π THREAD SAFETY π
this function should only be called on the main thread. no cap. don't try to be sneaky from a worker thread, it's not gonna slay.
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on something older, sorry bestie, no clip rect for you π
π SEE ALSO π
and that's the whole page fr fr. sourced straight from the Simple Directmedia Layer, SDL 3.4.18 edition β thanks for scrolling all the way down, you're literally the icon of reading documentation π§β¨π
π¦ 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