caca_frame(3caca)

πŸŽ€ caca_frame β€” libcaca canvas frame handling πŸŽ€

ok so this is the caca_frame page from the libcaca manual (section 3caca, bestie πŸ’…) and it's literally all about handling frames inside a canvas. yes. frames. like layers. we love a layered queen πŸ‘‘


✨ SYNOPSIS ✨

πŸ¦‹ Topics

  • libcaca bitmap dithering

🌸 Functions

  • __extern int caca_get_frame_count (caca_canvas_t const *) β€” Get the number of frames in a canvas.
  • __extern int caca_set_frame (caca_canvas_t *, int) β€” Activate a given canvas frame.
  • __extern char const * caca_get_frame_name (caca_canvas_t const *) β€” Get the current frame's name.
  • __extern int caca_set_frame_name (caca_canvas_t *, char const *) β€” Set the current frame's name.
  • __extern int caca_create_frame (caca_canvas_t *, int) β€” Add a frame to a canvas.
  • __extern int caca_free_frame (caca_canvas_t *, int) β€” Remove a frame from a canvas.

πŸ’œ Detailed Description

ok so these functions are the high level routines for canvas frame insertion, removal, copying etc. that's the whole vibe. insert, remove, copy. iconic behaviour, no notes 🫢


πŸ‘‘ Function Documentation πŸ‘‘

🌈 __extern int caca_get_frame_count (caca_canvas_t const * cv)

Returns the current canvas' frame count. that's it. that's the function πŸ’–

This function never fails. like, ever. she's reliable.

Parameters

  • cv β€” A libcaca canvas

Returns

  • The frame count

Referenced by caca_set_canvas_boundaries().


⭐ __extern int caca_set_frame (caca_canvas_t * cv, int id)

Sets the active canvas frame. every drawing operation after this one gets performed on that frame 🎨 The current painting context set by caca_set_attr() is inherited β€” yes, inherited, we love a hand-me-down.

If the frame index is outside the canvas' frame range, nothing happens. literally nothing. silence. πŸ’€

If an error occurs, -1 is returned and errno is set accordingly:

  • EINVAL β€” Requested frame is out of range.

Parameters

  • cv β€” A libcaca canvas
  • id β€” The canvas frame to activate

Returns

  • 0 in case of success, -1 if an error occurred.

References caca_add_dirty_rect().

Referenced by caca_set_canvas_boundaries().


🧚 __extern char const * caca_get_frame_name (caca_canvas_t const * cv)

Returns the current frame's name 🏷️ The returned string is valid until the frame is deleted or caca_set_frame_name() is called to change the frame name again β€” so like, don't go holding onto it forever, bestie, it's giving "borrowed, not gifted" πŸ™ˆ

This function never fails.

Parameters

  • cv β€” A libcaca canvas.

Returns

  • The current frame's name.

🌸 __extern int caca_set_frame_name (caca_canvas_t * cv, char const * name)

Sets the current frame's name ✨ Fun fact: upon creation, a frame has a default name of "frame#xxxxxxxx" where xxxxxxxx is a self-incrementing hexadecimal number. so she comes pre-named, but you can absolutely rename her.

If an error occurs, -1 is returned and errno is set accordingly:

  • ENOMEM β€” Not enough memory to allocate new frame.

Parameters

  • cv β€” A libcaca canvas.
  • name β€” The name to give to the current frame.

Returns

  • 0 in case of success, -1 if an error occurred.

πŸ“ __extern int caca_create_frame (caca_canvas_t * cv, int id)

Creates a new frame within the given canvas πŸ†• Its contents and attributes are copied from the currently active frame β€” so it's a whole clone situation, main character duplicating herself.

The frame index indicates where the frame should be inserted. Valid values range from 0 to the current canvas frame count. If the frame index is greater than or equals the current canvas frame count, the new frame is appended at the end of the canvas. If the frame index is less than zero, the new frame is inserted at index 0. so like: too big = end, negative = front. no in-between drama πŸ’…

The active frame does not change, but its index may be renumbered due to the insertion. so watch out, her number might shift and that's not her fault.

If an error occurs, -1 is returned and errno is set accordingly:

  • ENOMEM β€” Not enough memory to allocate new frame.

Parameters

  • cv β€” A libcaca canvas
  • id β€” The index where to insert the new frame

Returns

  • 0 in case of success, -1 if an error occurred.

Referenced by caca_set_canvas_boundaries().


πŸ”₯ __extern int caca_free_frame (caca_canvas_t * cv, int id)

Deletes a frame from a given canvas. goodbye frame, you had a good run 😭

The frame index indicates the frame to delete. Valid values range from 0 to the current canvas frame count minus 1. If the frame index is greater than or equals the current canvas frame count, the last frame is deleted. yes, it just nukes the last one. chaotic but that's the rule.

If the active frame is deleted, frame 0 becomes the new active frame. Otherwise, the active frame does not change, but its index may be renumbered due to the deletion. again with the renumbering, she's always going through something.

If an error occurs, -1 is returned and errno is set accordingly:

  • EINVAL β€” Requested frame is out of range, or attempt to delete the last frame of the canvas.
⚠️ okay important: trying to delete the last frame of the canvas is an error (EINVAL). can't have zero frames, bestie, the canvas would be empty and honestly kind of nothing.

Parameters

  • cv β€” A libcaca canvas
  • id β€” The index of the frame to delete

Returns

  • 0 in case of success, -1 if an error occurred.

References caca_add_dirty_rect().


πŸ’– Author

Generated automatically by Doxygen for libcaca from the source code. (not a human, not a vibe, just doxygen doing doxygen things)


and that's the whole page, bestie 🫢 this one's from libcaca version 0.99.beta20, dated Wed May 13 2026 09:45:08, and it's filed under caca_frame(3caca) for all your frame-handling needs. go forth and slay those frames βœ¨πŸŽ€πŸ’œ

πŸ“¦ where this page comes from