TICKIT_RENDERBUFFER_CLIP(3)

✨ TICKIT_RENDERBUFFER_CLIP(3) ✨

okay bestie, gather round, because this is a page from the Library Functions Manual and it's literally about telling your drawing functions where they're allowed to draw πŸ’… it's giving "stay in your lane" but make it C.


🌸 NAME 🌸

tickit_renderbuffer_clip, tickit_renderbuffer_mask β€” restrict the drawing area of output functions

like. the whole point. they fence in your output functions so they can't just wander off and redecorate the entire screen πŸ™ˆ


πŸŽ€ SYNOPSIS πŸŽ€

#include <tickit.h>

void tickit_renderbuffer_clip(TickitRenderBuffer *rb, TickitRect *rect);
void tickit_renderbuffer_mask(TickitRenderBuffer *rb, TickitRect *mask);

Link with -ltickit.

(yeah, that -ltickit is not optional, she's required, no cap πŸ”₯)


πŸ’– DESCRIPTION πŸ’–

okay so, two functions, two whole vibes:

tickit_renderbuffer_clip() restricts the clipping rectangle to the limits given, within the existing limits already set. and here's the tea: this function cannot make the clipping region larger than it already was. it only ever shrinks. it's a one-way door, a glow-down only, she does not expand πŸ”’

tickit_renderbuffer_mask() applies a rectangular mask within the clipping region, masking off extra cells that can no longer be modified by the output functions. and unlike tickit_renderbuffer_clip(), these regions can be arbitrarily positioned and discontinuous β€” like, she does not need to be a neat little rectangle attached to anything, she's free πŸ¦‹ each new call adds another masking region, rather than affecting the existing ones. so they stack. they accumulate. they're a collection, not a replacement, periodt ✨

so how do you undo any of this?? bestie you do not undo it directly. to undo the effects of any of these functions, they should be used within nested pairs of calls to tickit_renderbuffer_save(3) and tickit_renderbuffer_restore(3). that's the move. nested pairs. save, do the thing, restore, back to normal 🫢

and important: both functions only affect the subsequent drawing operations. they do not affect existing stored content, and they also do not affect the behaviour of tickit_renderbuffer_flush_to_term(3). so your already-drawn stuff is safe, untouched, thriving, main character energy πŸ‘‘

lowkey the biggest glow-up here is remembering that clip only shrinks and mask just keeps piling up. if you forget the save/restore nesting you're gonna have a bad time 😭

⭐ RETURN VALUE ⭐

These functions return no value. that's it. void. they simply do the thing and leave πŸ’… no error codes, no little treat, nothing.


🌈 SEE ALSO 🌈


and that's the whole page fr fr πŸ’– this was TICKIT_RENDERBUFFER_CLIP(3) from the Library Functions Manual, part of the tickit library β€” iykyk 🧚✨ go forth and clip responsibly, bestie πŸŽ€