TICKIT_RENDERBUFFER_SAVEPEN(3)

✨ TICKIT_RENDERBUFFER_SAVE(3) ✨ β€” Library Functions Manual, bestie edition πŸŽ€

okay so this is the page for the tickit_renderbuffer_save family of functions, from the Library Functions Manual, and no cap it's giving "save your game before the boss fight" energy. Let's get into it πŸ’…


🌸 NAME 🌸

tickit_renderbuffer_save, tickit_renderbuffer_restore, tickit_renderbuffer_savepen β€” save and restore auxiliary state

like... it's the undo button but make it ✨deliberate✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <tickit.h>

void tickit_renderbuffer_save(TickitRenderBuffer *rb);
void tickit_renderbuffer_restore(TickitRenderBuffer *rb);
void tickit_renderbuffer_savepen(TickitRenderBuffer *rb);

Link with -ltickit.

bestie do NOT forget the -ltickit at link time, the linker will simply not know her and it will be embarrassing πŸ’€

πŸ’– DESCRIPTION πŸ’–

tickit_renderbuffer_save() pushes a new entry onto the buffer's saved state stack. So basically it goes "okay, snapshotting the current values of the auxiliary state right now" β€” and later you can bring those values back with tickit_renderbuffer_restore(). it's literally a save point. iconic behaviour fr fr.

tickit_renderbuffer_restore() pops the most recent entry off that saved state stack and reverts the auxiliary state values right back to whatever was saved. the way it just... rewinds. obsessed. 😭

tickit_renderbuffer_savepen() is the lowkey special one β€” it pushes a new entry onto the stack containing just the current pen value. so when it gets restored, it only restores the pen, and the other attributes stay completely unaffected. pen-only, no notes, main character energy. ✨


πŸŽ€ AUXILIARY STATE πŸŽ€

here's exactly what these functions save and restore, the whole vibe check:

  • the virtual cursor position
  • the translation offset
  • the clipping rectangle
  • the current pen
  • the set of masked regions

the pending content is not part of the state stack, okay? like she's not invited to this party.

the whole point β€” the intended use β€” is that the state stack helps you implement recursive drawing operations inside your application, by splitting it into separate independent areas, so you can save and restore the state between component parts. it's giving nesting, it's giving componentised rendering, it's giving structure. πŸ’…


🌈 RETURN VALUE 🌈

None of these functions return a value. not a single one. they just do the thing and leave. periodt. πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie 🫢 go forth and save your state before you draw anything recursive, your future self will thank you πŸ’œ

sign-off cuteness: this was page TICKIT_RENDERBUFFER_SAVE(3) from the Library Functions Manual β€” mwah, slay, stay hydrated, and remember to pop that stack when you're done ✨