caca.h(3caca)

๐Ÿ’– caca.h โ€” The libcaca public header โœจ

okay so bestie, welcome to the manual page for caca.h, aka the whole entire public header of libcaca โ€” the page is literally named caca.h(3caca) and it's giving "here's every type, struct, macro and enum you're allowed to touch" ๐Ÿ‘‘. Think of it as the group chat invite list for the library: if it's not on here, it's not in the club ๐Ÿ’….


โœจ NAME โœจ

caca.h โ€” The libcaca public header. that's it, that's the whole name section, no notes ๐ŸŽ€


๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

๐Ÿงฑ Data Structures

These are the structs that are public, like, officially out here for you:

  • struct caca_event โ€” handling of user events. keys, mouse, resizes, the whole vibe check on what the human just did ๐Ÿ–ฑ๏ธ
  • struct caca_option โ€” option parsing. yes it does your argv homework for you, iconic behavior fr
  • struct caca_conio_text_info โ€” DOS text area information. retro DOS energy, we love a throwback ๐Ÿ’พ

๐Ÿช„ Macros

two macros, both absolute icons:

  • #define CACA_API_VERSION_1 โ€” the API version. you're on version 1, bestie, congrats
  • #define CACA_MAGIC_FULLWIDTH 0x000ffffe โ€” the magic fullwidth value, and honestly the name alone is a serve โœจ

๐Ÿท๏ธ Typedefs

here's the whole squad of opaque types, each one a typedef so you never have to type struct like a peasant:

typedef struct caca_canvas caca_canvas_t
typedef struct caca_dither caca_dither_t
typedef struct caca_charfont caca_charfont_t
typedef struct caca_font caca_font_t
typedef struct caca_file caca_file_t
typedef struct caca_display caca_display_t
typedef struct caca_event caca_event_t

that last one, caca_event_t, is literally struct caca_event wearing a cuter outfit. same struct, shorter name, main character energy ๐Ÿซถ

๐ŸŒŸ Enumerations

okay this is the big one โ€” six whole enums, so many constants, let's go section by section ๐Ÿ’œ

enum caca_color

the colour enum, aka the entire palette in one place:

enum caca_color {
    CACA_BLACK = 0x00, CACA_BLUE = 0x01, CACA_GREEN = 0x02,
    CACA_CYAN = 0x03, CACA_RED = 0x04, CACA_MAGENTA = 0x05,
    CACA_BROWN = 0x06, CACA_LIGHTGRAY = 0x07, CACA_DARKGRAY = 0x08,
    CACA_LIGHTBLUE = 0x09, CACA_LIGHTGREEN = 0x0a, CACA_LIGHTCYAN = 0x0b,
    CACA_LIGHTRED = 0x0c, CACA_LIGHTMAGENTA = 0x0d, CACA_YELLOW = 0x0e,
    CACA_WHITE = 0x0f, CACA_DEFAULT = 0x10, CACA_TRANSPARENT = 0x20
};

note how CACA_DEFAULT and CACA_TRANSPARENT are off doing their own thing on their own values โ€” they're not like the other sixteen ๐Ÿฆ‹

enum caca_style

the style bits, for when you want your text to have a lewk:

enum caca_style {
    CACA_BOLD = 0x01, CACA_ITALICS = 0x02, CACA_UNDERLINE = 0x04,
    CACA_BLINK = 0x08
};

blink is right there at 0x08, use it responsibly ๐Ÿ˜ญ

enum caca_event_type

user event type enumeration โ€” literally the enum that knows what kind of event just happened ๐Ÿ”ฅ:

enum caca_event_type {
    CACA_EVENT_NONE = 0x0000, CACA_EVENT_KEY_PRESS = 0x0001,
    CACA_EVENT_KEY_RELEASE = 0x0002, CACA_EVENT_MOUSE_PRESS = 0x0004,
    CACA_EVENT_MOUSE_RELEASE = 0x0008, CACA_EVENT_MOUSE_MOTION = 0x0010,
    CACA_EVENT_RESIZE = 0x0020, CACA_EVENT_QUIT = 0x0040,
    CACA_EVENT_ANY = 0xffff
};

CACA_EVENT_ANY at 0xffff is that one friend who's down for literally anything ๐Ÿ’€

enum caca_key

special key values โ€” every last one of them, no skipping, we're listing all 55 because every single one matters:

enum caca_key {
    CACA_KEY_UNKNOWN = 0x00, CACA_KEY_CTRL_A = 0x01, CACA_KEY_CTRL_B = 0x02,
    CACA_KEY_CTRL_C = 0x03, CACA_KEY_CTRL_D = 0x04, CACA_KEY_CTRL_E = 0x05,
    CACA_KEY_CTRL_F = 0x06, CACA_KEY_CTRL_G = 0x07, CACA_KEY_BACKSPACE = 0x08,
    CACA_KEY_TAB = 0x09, CACA_KEY_CTRL_J = 0x0a, CACA_KEY_CTRL_K = 0x0b,
    CACA_KEY_CTRL_L = 0x0c, CACA_KEY_RETURN = 0x0d, CACA_KEY_CTRL_N = 0x0e,
    CACA_KEY_CTRL_O = 0x0f, CACA_KEY_CTRL_P = 0x10, CACA_KEY_CTRL_Q = 0x11,
    CACA_KEY_CTRL_R = 0x12, CACA_KEY_PAUSE = 0x13, CACA_KEY_CTRL_T = 0x14,
    CACA_KEY_CTRL_U = 0x15, CACA_KEY_CTRL_V = 0x16, CACA_KEY_CTRL_W = 0x17,
    CACA_KEY_CTRL_X = 0x18, CACA_KEY_CTRL_Y = 0x19, CACA_KEY_CTRL_Z = 0x1a,
    CACA_KEY_ESCAPE = 0x1b, CACA_KEY_DELETE = 0x7f, CACA_KEY_UP = 0x111,
    CACA_KEY_DOWN = 0x112, CACA_KEY_LEFT = 0x113, CACA_KEY_RIGHT = 0x114,
    CACA_KEY_INSERT = 0x115, CACA_KEY_HOME = 0x116, CACA_KEY_END = 0x117,
    CACA_KEY_PAGEUP = 0x118, CACA_KEY_PAGEDOWN = 0x119, CACA_KEY_F1 = 0x11a,
    CACA_KEY_F2 = 0x11b, CACA_KEY_F3 = 0x11c, CACA_KEY_F4 = 0x11d,
    CACA_KEY_F5 = 0x11e, CACA_KEY_F6 = 0x11f, CACA_KEY_F7 = 0x120,
    CACA_KEY_F8 = 0x121, CACA_KEY_F9 = 0x122, CACA_KEY_F10 = 0x123,
    CACA_KEY_F11 = 0x124, CACA_KEY_F12 = 0x125, CACA_KEY_F13 = 0x126,
    CACA_KEY_F14 = 0x127, CACA_KEY_F15 = 0x128
};

iykyk that CACA_KEY_CTRL_C sitting at 0x03 is the one you never want to catch by accident ๐Ÿ˜ณ and yes, F15 is in there, they really did all fifteen, commitment ๐Ÿ’…

tiny heads up: CACA_KEY_CTRL_H and CACA_KEY_CTRL_I and CACA_KEY_CTRL_M are not in this list โ€” 0x08 is CACA_KEY_BACKSPACE, 0x09 is CACA_KEY_TAB, and 0x0d is CACA_KEY_RETURN. same byte, different name, plot twist โœจ

enum CACA_CONIO_COLORS

DOS colours โ€” the full retro sixteen plus blink, because DOS said "what if a colour was also a vibe":

enum CACA_CONIO_COLORS {
    CACA_CONIO_BLINK = 128, CACA_CONIO_BLACK = 0, CACA_CONIO_BLUE = 1,
    CACA_CONIO_GREEN = 2, CACA_CONIO_CYAN = 3, CACA_CONIO_RED = 4,
    CACA_CONIO_MAGENTA = 5, CACA_CONIO_BROWN = 6, CACA_CONIO_LIGHTGRAY = 7,
    CACA_CONIO_DARKGRAY = 8, CACA_CONIO_LIGHTBLUE = 9,
    CACA_CONIO_LIGHTGREEN = 10, CACA_CONIO_LIGHTCYAN = 11,
    CACA_CONIO_LIGHTRED = 12, CACA_CONIO_LIGHTMAGENTA = 13,
    CACA_CONIO_YELLOW = 14, CACA_CONIO_WHITE = 15
};

CACA_CONIO_BLINK = 128 is just out here living its best life at a totally different magnitude than everybody else ๐ŸŽ€

enum CACA_CONIO_CURSOR

DOS cursor modes, three of them, short and sweet:

enum CACA_CONIO_CURSOR {
    CACA_CONIO__NOCURSOR = 0, CACA_CONIO__SOLIDCURSOR = 1,
    CACA_CONIO__NORMALCURSOR = 2
};

yes those are double underscores in the names โ€” CACA_CONIO__NOCURSOR, CACA_CONIO__SOLIDCURSOR, CACA_CONIO__NORMALCURSOR โ€” that's not a typo, that's the actual spelling, do not "fix" it ๐Ÿ™ˆ

enum CACA_CONIO_MODE

DOS video modes, and the values are spicy:

enum CACA_CONIO_MODE {
    CACA_CONIO_LASTMODE = -1, CACA_CONIO_BW40 = 0, CACA_CONIO_C40 = 1,
    CACA_CONIO_BW80 = 2, CACA_CONIO_C80 = 3, CACA_CONIO_MONO = 7,
    CACA_CONIO_C4350 = 64
};

CACA_CONIO_LASTMODE is literally -1 (negative! iconique) and CACA_CONIO_C4350 jumps all the way to 64 like it's got somewhere to be ๐Ÿ’€ the numbers skip around, that's just how DOS rolls, we don't question the king ๐Ÿ‘‘


more parts are coming, bestie, don't go anywhere ๐ŸŒธ

โœจ DESCRIPTION โœจ

okay so this is the actual toolbox part, the main character section ๐Ÿ’… โ€” every function the header exposes, in the exact order the page lists them, and ngl it is a lot. Grab a snack, we're going through all of it ๐Ÿ“


๐ŸŽ€ Functions ๐ŸŽ€

  • __extern caca_canvas_t * caca_create_canvas (int, int) โ€” gets you a fresh, brand-new libcaca canvas โœจ like, the actual starting point for everything.
  • __extern int caca_manage_canvas (caca_canvas_t *, int(*)(void *), void *) โ€” puts a canvas under libcaca's management, callback-style, with that int(*)(void *) and its void * buddy along for the ride ๐Ÿซถ
  • __extern int caca_unmanage_canvas (caca_canvas_t *, int(*)(void *), void *) โ€” unmanages a canvas ๐Ÿ’… same callback + pointer pairing, just going the other way.
  • __extern int caca_set_canvas_size (caca_canvas_t *, int, int) โ€” resizes the canvas, glow-up edition ๐ŸŒธ
  • __extern int caca_get_canvas_width (caca_canvas_t const *) โ€” how wide is it rn ๐Ÿฆ‹
  • __extern int caca_get_canvas_height (caca_canvas_t const *) โ€” and how tall ๐Ÿ’œ
  • __extern uint32_t const * caca_get_canvas_chars (caca_canvas_t const *) โ€” hands you the canvas character array, all uint32_t const * and raw and iconic ๐Ÿ‘‘
  • __extern uint32_t const * caca_get_canvas_attrs (caca_canvas_t const *) โ€” same deal but for the attribute array, no cap โญ
  • __extern int caca_free_canvas (caca_canvas_t *) โ€” frees a libcaca canvas. say bye bestie ๐Ÿ’€
  • __extern int caca_rand (int, int) โ€” the page literally gives this one no description, not even a crumb ๐Ÿ˜ญ so I'm not gonna invent one. it's there, it takes two ints, that's all the manpage is giving us ๐Ÿ™ˆ
  • __extern char const * caca_get_version (void) โ€” returns the libcaca version string, so you can check who you're dealing with ๐Ÿ’…

  • __extern int caca_gotoxy (caca_canvas_t *, int, int) โ€” sets the cursor position ๐ŸŽฏ
  • __extern int caca_wherex (caca_canvas_t const *) โ€” gets the X cursor position ๐Ÿฆ‹
  • __extern int caca_wherey (caca_canvas_t const *) โ€” gets the Y cursor position ๐ŸŒธ
  • __extern int caca_put_char (caca_canvas_t *, int, int, uint32_t) โ€” prints one ASCII or Unicode character, little guy, big impact โœจ
  • __extern uint32_t caca_get_char (caca_canvas_t const *, int, int) โ€” grabs the Unicode character sitting at those coordinates ๐Ÿ”
  • __extern int caca_put_str (caca_canvas_t *, int, int, char const *) โ€” prints a whole string, main character energy ๐Ÿ’–
  • __extern int caca_printf (caca_canvas_t *, int, int, char const *,...) โ€” prints a formated string, printf-style ๐ŸŽ€
  • __extern int caca_vprintf (caca_canvas_t *, int, int, char const *, va_list) โ€” the va_list version of the above, for when you're being fancy ๐Ÿงš
  • __extern int caca_clear_canvas (caca_canvas_t *) โ€” clears the canvas. fresh start, we love a reset ๐ŸŒˆ
  • __extern int caca_set_canvas_handle (caca_canvas_t *, int, int) โ€” sets the cursor handle ๐Ÿซถ
  • __extern int caca_get_canvas_handle_x (caca_canvas_t const *) โ€” gets the X handle position ๐Ÿ’œ
  • __extern int caca_get_canvas_handle_y (caca_canvas_t const *) โ€” gets the Y handle position ๐Ÿ’œ
  • __extern int caca_blit (caca_canvas_t *, int, int, caca_canvas_t const *, caca_canvas_t const *) โ€” blits one canvas onto another one, and yes there are two caca_canvas_t const * params in there, copy the signature exactly bestie ๐Ÿ”ฅ
  • __extern int caca_set_canvas_boundaries (caca_canvas_t *, int, int, int, int) โ€” sets a canvas' new boundaries, four whole ints of it โœจ

  • __extern int caca_disable_dirty_rect (caca_canvas_t *) โ€” disables dirty rectangles ๐Ÿ™ˆ
  • __extern int caca_enable_dirty_rect (caca_canvas_t *) โ€” enables them right back up ๐Ÿ’…
  • __extern int caca_get_dirty_rect_count (caca_canvas_t *) โ€” how many dirty rectangles are in the canvas rn, the vibes count ๐Ÿ”ข
  • __extern int caca_get_dirty_rect (caca_canvas_t *, int, int *, int *, int *, int *) โ€” pulls out one canvas dirty rectangle, four int *s of output, it's giving pointer soup but it slays ๐Ÿซถ
  • __extern int caca_add_dirty_rect (caca_canvas_t *, int, int, int, int) โ€” adds an area to the canvas's dirty rectangle list โœ…
  • __extern int caca_remove_dirty_rect (caca_canvas_t *, int, int, int, int) โ€” removes an area from the dirty rectangle list โŒ
  • __extern int caca_clear_dirty_rect_list (caca_canvas_t *) โ€” nukes the whole canvas dirty rectangle list in one go ๐Ÿงน

  • __extern int caca_invert (caca_canvas_t *) โ€” inverts a canvas' colours, spooky season ๐Ÿ’€
  • __extern int caca_flip (caca_canvas_t *) โ€” flips a canvas horizontally ๐Ÿฆ‹
  • __extern int caca_flop (caca_canvas_t *) โ€” flips a canvas vertically ๐ŸŒธ
  • __extern int caca_rotate_180 (caca_canvas_t *) โ€” rotates a canvas ๐ŸŽก
  • __extern int caca_rotate_left (caca_canvas_t *) โ€” rotates a canvas, 90 degrees counterclockwise ๐Ÿ’ซ
  • __extern int caca_rotate_right (caca_canvas_t *) โ€” rotates a canvas, 90 degrees counterclockwise. yep, that's what the page says for this one too ๐Ÿ‘€ not me editing the docs, I'm just the messenger ๐Ÿ™ˆ
  • __extern int caca_stretch_left (caca_canvas_t *) โ€” rotates and stretches a canvas, 90 degrees counterclockwise โœจ stretch before the rotate, we're flexible ๐Ÿง˜
  • __extern int caca_stretch_right (caca_canvas_t *) โ€” rotates and stretches a canvas, 90 degrees clockwise ๐Ÿ”ฅ

  • __extern uint32_t caca_get_attr (caca_canvas_t const *, int, int) โ€” gets the text attribute at the given coordinates ๐ŸŽ€
  • __extern int caca_set_attr (caca_canvas_t *, uint32_t) โ€” sets the default character attribute, the blueprint of your whole look ๐Ÿ’…
  • __extern int caca_unset_attr (caca_canvas_t *, uint32_t) โ€” unsets specific flags in the default character attribute ๐Ÿซถ
  • __extern int caca_toggle_attr (caca_canvas_t *, uint32_t) โ€” toggles flags in the default character attribute, on-off-on-off ๐Ÿ’–
  • __extern int caca_put_attr (caca_canvas_t *, int, int, uint32_t) โ€” sets the character attribute at the given coordinates, one cell at a time โœจ
  • __extern int caca_set_color_ansi (caca_canvas_t *, uint8_t, uint8_t) โ€” sets the default colour pair for text, ANSI version ๐ŸŒˆ
  • __extern int caca_set_color_argb (caca_canvas_t *, uint16_t, uint16_t) โ€” sets the default colour pair for text, truecolor version, the fancy one ๐Ÿ‘‘
  • __extern uint8_t caca_attr_to_ansi (uint32_t) โ€” gets DOS ANSI information out of an attribute ๐Ÿ”
  • __extern uint8_t caca_attr_to_ansi_fg (uint32_t) โ€” gets just the ANSI foreground information out of an attribute ๐ŸŒธ
  • __extern uint8_t caca_attr_to_ansi_bg (uint32_t) โ€” gets just the ANSI background information out of an attribute ๐ŸŒธ
  • __extern uint16_t caca_attr_to_rgb12_fg (uint32_t) โ€” gets 12-bit RGB foreground information out of an attribute ๐ŸŽจ
  • __extern uint16_t caca_attr_to_rgb12_bg (uint32_t) โ€” gets 12-bit RGB background information out of an attribute ๐ŸŽจ
  • __extern void caca_attr_to_argb64 (uint32_t, uint8_t[8]) โ€” gets 64-bit ARGB information out of an attribute, straight into that uint8_t[8] array ๐Ÿ’พ

  • __extern uint32_t caca_utf8_to_utf32 (char const *, size_t *) โ€” converts a UTF-8 character to UTF-32, glow-up across encodings ๐Ÿฆ‹
  • __extern size_t caca_utf32_to_utf8 (char *, uint32_t) โ€” converts a UTF-32 character to UTF-8, reverse glow-up ๐Ÿ’ซ
  • __extern uint8_t caca_utf32_to_cp437 (uint32_t) โ€” converts a UTF-32 character to CP437, retro era ๐Ÿ•น๏ธ
  • __extern uint32_t caca_cp437_to_utf32 (uint8_t) โ€” converts a CP437 character to UTF-32, back to the future ๐Ÿš€
  • __extern char caca_utf32_to_ascii (uint32_t) โ€” converts a UTF-32 character to ASCII, downsizing but make it chic ๐Ÿ’…
  • __extern int caca_utf32_is_fullwidth (uint32_t) โ€” tells you whether a UTF-32 character is fullwidth, the vibe check for wide characters ๐Ÿซถ

  • __extern int caca_draw_line (caca_canvas_t *, int, int, int, int, uint32_t) โ€” draws a line on the canvas using the character you hand it โœ๏ธ
  • __extern int caca_draw_polyline (caca_canvas_t *, int const x[], int const y[], int, uint32_t) โ€” draws a polyline from those x[] and y[] arrays, multi-point slay ๐Ÿ”ฅ
  • __extern int caca_draw_thin_line (caca_canvas_t *, int, int, int, int) โ€” draws a thin line on the canvas, using ASCII art ๐ŸŽ€
  • __extern int caca_draw_thin_polyline (caca_canvas_t *, int const x[], int const y[], int) โ€” draws an ASCII art thin polyline, delicate little thing ๐ŸŒธ
  • __extern int caca_draw_circle (caca_canvas_t *, int, int, int, uint32_t) โ€” draws a circle on the canvas using the given character โญ•
  • __extern int caca_draw_ellipse (caca_canvas_t *, int, int, int, int, uint32_t) โ€” draws an ellipse on the canvas using the given character ๐Ÿฅš
  • __extern int caca_draw_thin_ellipse (caca_canvas_t *, int, int, int, int) โ€” draws a thin ellipse on the canvas ๐Ÿชถ
  • __extern int caca_fill_ellipse (caca_canvas_t *, int, int, int, int, uint32_t) โ€” fills an ellipse on the canvas using the given character, no hollow vibes allowed ๐Ÿ™…
  • __extern int caca_draw_box (caca_canvas_t *, int, int, int, int, uint32_t) โ€” draws a box on the canvas using the given character ๐Ÿ“ฆ
  • __extern int caca_draw_thin_box (caca_canvas_t *, int, int, int, int) โ€” draws a thin box on the canvas ๐ŸŽ
  • __extern int caca_draw_cp437_box (caca_canvas_t *, int, int, int, int) โ€” draws a box on the canvas using CP437 characters, old-school but iconic ๐Ÿ•น๏ธ
  • __extern int caca_fill_box (caca_canvas_t *, int, int, int, int, uint32_t) โ€” fills a box on the canvas using the given character ๐ŸŸช
  • __extern int caca_draw_triangle (caca_canvas_t *, int, int, int, int, int, int, uint32_t) โ€” draws a triangle on the canvas using the given character ๐Ÿ”บ
  • __extern int caca_draw_thin_triangle (caca_canvas_t *, int, int, int, int, int, int) โ€” draws a thin triangle on the canvas ๐Ÿ“
  • __extern int caca_fill_triangle (caca_canvas_t *, int, int, int, int, int, int, uint32_t) โ€” fills a triangle on the canvas using the given character ๐Ÿ•
  • __extern int caca_fill_triangle_textured (caca_canvas_t *cv, int coords[6], caca_canvas_t *tex, float uv[6]) โ€” fills a triangle on the canvas using an arbitrary-sized texture, and yes the params are literally int coords[6], caca_canvas_t *tex and float uv[6], copy them exactly bestie ๐Ÿ–ผ๏ธ

  • __extern int caca_get_frame_count (caca_canvas_t const *) โ€” how many frames does this canvas have ๐ŸŽž๏ธ
  • __extern int caca_set_frame (caca_canvas_t *, int) โ€” activates a given canvas frame, spotlight time โœจ
  • __extern char const * caca_get_frame_name (caca_canvas_t const *) โ€” gets the current frame's name ๐Ÿท๏ธ
  • __extern int caca_set_frame_name (caca_canvas_t *, char const *) โ€” sets the current frame's name, give it a cute one ๐Ÿ’–
  • __extern int caca_create_frame (caca_canvas_t *, int) โ€” adds a frame to a canvas, more frames more fun ๐ŸŽฌ
  • __extern int caca_free_frame (caca_canvas_t *, int) โ€” removes a frame from a canvas, bye frame ๐Ÿ’€

  • __extern caca_dither_t * caca_create_dither (int, int, int, int, uint32_t, uint32_t, uint32_t, uint32_t) โ€” creates an internal dither object, four ints and four uint32_ts of it, lowkey a lot but she works ๐ŸŽจ
  • __extern int caca_set_dither_palette (caca_dither_t *, uint32_t r[], uint32_t g[], uint32_t b[], uint32_t a[]) โ€” sets the palette of an 8bpp dither object, that's r[], g[], b[], a[] in that order ๐ŸŒˆ
  • __extern int caca_set_dither_brightness (caca_dither_t *, float) โ€” sets the brightness of a dither object โ˜€๏ธ
  • __extern float caca_get_dither_brightness (caca_dither_t const *) โ€” gets the brightness of a dither object ๐ŸŒค๏ธ
  • __extern int caca_set_dither_gamma (caca_dither_t *, float) โ€” sets the gamma of a dither object ๐ŸŽš๏ธ
  • __extern float caca_get_dither_gamma (caca_dither_t const *) โ€” gets the gamma of a dither object ๐Ÿ“Š
  • __extern int caca_set_dither_contrast (caca_dither_t *, float) โ€” sets the contrast of a dither object ๐ŸŒ—
  • __extern float caca_get_dither_contrast (caca_dither_t const *) โ€” gets the contrast of a dither object ๐ŸŒ“
  • __extern int caca_set_dither_antialias (caca_dither_t *, char const *) โ€” sets dither antialiasing ๐Ÿช„
  • __extern char const *const * caca_get_dither_antialias_list (caca_dither_t const *) โ€” gets the available antialiasing methods, note the char const *const * return, type it exactly ๐Ÿ’…
  • __extern char const * caca_get_dither_antialias (caca_dither_t const *) โ€” gets the current antialiasing method ๐Ÿ”Ž
  • __extern int caca_set_dither_color (caca_dither_t *, char const *) โ€” chooses the colours used for dithering ๐ŸŽจ
  • __extern char const *const * caca_get_dither_color_list (caca_dither_t const *) โ€” gets the available colour modes ๐ŸŒˆ
  • __extern char const * caca_get_dither_color (caca_dither_t const *) โ€” gets the current colour mode ๐Ÿ–๏ธ
  • __extern int caca_set_dither_charset (caca_dither_t *, char const *) โ€” chooses the characters used for dithering ๐Ÿ”ค
  • __extern char const *const * caca_get_dither_charset_list (caca_dither_t const *) โ€” gets the available dither character sets ๐Ÿ“š
  • __extern char const * caca_get_dither_charset (caca_dither_t const *) โ€” gets the current character set โœจ

and that's the whole function wall bestie, every single one, nothing skipped ๐Ÿ˜ค keep reading, there's more coming ๐Ÿ’–

Dithering time ๐Ÿ’… these are the ones that make your bitmaps look all retro-gorgeous:

  • __extern int caca_set_dither_algorithm (caca_dither_t *, char const *) โ€” picks the dithering algorithm for your dither, slay โœจ
  • __extern char const *const * caca_get_dither_algorithm_list (caca_dither_t const *) โ€” hands you the whole list of dithering algorithms ๐ŸŽ€
  • __extern char const * caca_get_dither_algorithm (caca_dither_t const *) โ€” which algorithm is it using rn ๐Ÿ‘€
  • __extern int caca_dither_bitmap (caca_canvas_t *, int, int, int, int, caca_dither_t const *, void const *) โ€” dithers a whole bitmap onto the canvas</b>, iconic ๐Ÿฆ‹
  • __extern int caca_free_dither (caca_dither_t *) โ€” frees the memory tied to a dither, bye bestie ๐Ÿ‘‹

Fonts and glyphs, aka the glow-up section ๐Ÿ’œ:

  • __extern caca_charfont_t * caca_load_charfont (void const *, size_t)
  • __extern int caca_free_charfont (caca_charfont_t *)
  • __extern caca_font_t * caca_load_font (void const *, size_t) โ€” loads a font straight outta memory so it's ready for later โœจ
  • __extern char const *const * caca_get_font_list (void) โ€” the builtin fonts you've got available ๐ŸŽ€
  • __extern int caca_get_font_width (caca_font_t const *) โ€” the font's standard glyph width, no cap ๐Ÿ“
  • __extern int caca_get_font_height (caca_font_t const *) โ€” the font's standard glyph height ๐Ÿ“
  • __extern uint32_t const * caca_get_font_blocks (caca_font_t const *) โ€” the list of glyphs that font actually supports ๐Ÿซถ
  • __extern int caca_render_canvas (caca_canvas_t const *, caca_font_t const *, void *, int, int, int) โ€” renders the canvas onto an image buffer, literally art ๐Ÿ”ฅ
  • __extern int caca_free_font (caca_font_t *) โ€” frees a font structure ๐ŸŽ€

Figlet-adjacent era ๐Ÿงš (yes these are all exactly what they sound like):

  • __extern int caca_canvas_set_figfont (caca_canvas_t *, char const *) โ€” loads a figfont and attaches it to a canvas โœจ
  • __extern int caca_set_figfont_smush (caca_canvas_t *, char const *) โ€” sets the smushing mode for the figfont rendering ๐Ÿ’…
  • __extern int caca_set_figfont_width (caca_canvas_t *, int) โ€” sets the width of the figfont rendering ๐ŸŽ€
  • __extern int caca_put_figchar (caca_canvas_t *, uint32_t) โ€” pastes a character using the current figfont ๐Ÿฆ‹
  • __extern int caca_flush_figlet (caca_canvas_t *) โ€” flushes the figlet context, periodt ๐ŸŒธ

File handling, because sometimes you just gotta read a file ๐Ÿ˜ญ:

  • __extern caca_file_t * caca_file_open (char const *, const char *) โ€” opens a file for reading or writing ๐Ÿ“‚
  • __extern int caca_file_close (caca_file_t *) โ€” closes a file handle ๐Ÿ‘‹
  • __extern uint64_t caca_file_tell (caca_file_t *) โ€” where you at in the file handle ๐Ÿ“
  • __extern size_t caca_file_read (caca_file_t *, void *, size_t) โ€” reads data out of a file handle ๐Ÿ“–
  • __extern size_t caca_file_write (caca_file_t *, const void *, size_t) โ€” writes data into a file handle โœ๏ธ
  • __extern char * caca_file_gets (caca_file_t *, char *, int) โ€” reads one line from a file handle ๐Ÿ“
  • __extern int caca_file_eof (caca_file_t *) โ€” tells you if the file handle hit end of file ๐Ÿ

Import/export ๐Ÿฆ‹ the trading-cards arc:

  • __extern ssize_t caca_import_canvas_from_memory (caca_canvas_t *, void const *, size_t, char const *) โ€” imports a memory buffer into a canvas โœจ
  • __extern ssize_t caca_import_canvas_from_file (caca_canvas_t *, char const *, char const *) โ€” imports a file into a canvas ๐Ÿ“ฅ
  • __extern ssize_t caca_import_area_from_memory (caca_canvas_t *, int, int, void const *, size_t, char const *) โ€” imports a memory buffer into a canvas area ๐ŸŽฏ
  • __extern ssize_t caca_import_area_from_file (caca_canvas_t *, int, int, char const *, char const *) โ€” imports a file into a canvas area ๐Ÿ“ฅ
  • __extern char const *const * caca_get_import_list (void) โ€” all the import formats you can use ๐Ÿ’…
  • __extern void * caca_export_canvas_to_memory (caca_canvas_t const *, char const *, size_t *) โ€” exports a canvas into a foreign format, main character energy ๐Ÿ‘‘
  • __extern void * caca_export_area_to_memory (caca_canvas_t const *, int, int, int, int, char const *, size_t *) โ€” exports just a portion of a canvas into a foreign format ๐Ÿ“
  • __extern char const *const * caca_get_export_list (void) โ€” all the export formats you can use ๐ŸŒˆ

Display stuff ๐Ÿ–ฅ๏ธ the whole vibe check of libcaca:

  • __extern caca_display_t * caca_create_display (caca_canvas_t *) โ€” attaches a caca graphical context to a caca canvas โœจ
  • __extern caca_display_t * caca_create_display_with_driver (caca_canvas_t *, char const *) โ€” same thing but with a specific caca graphical context ๐ŸŽ€
  • __extern char const *const * caca_get_display_driver_list (void) โ€” the display drivers you've got available ๐Ÿ’…
  • __extern char const * caca_get_display_driver (caca_display_t *) โ€” which output driver a caca graphical context is currently on ๐Ÿ‘€
  • __extern int caca_set_display_driver (caca_display_t *, char const *) โ€” sets the output driver ๐Ÿ› ๏ธ
  • __extern int caca_free_display (caca_display_t *) โ€” detaches a caca graphical context from a caca backend context ๐Ÿ‘‹
  • __extern caca_canvas_t * caca_get_canvas (caca_display_t *) โ€” grabs the canvas attached to a caca graphical context ๐ŸŽจ
  • __extern int caca_refresh_display (caca_display_t *) โ€” flushes pending changes and redraws the screen ๐Ÿ”„
  • __extern int caca_set_display_time (caca_display_t *, int) โ€” sets the refresh delay โฑ๏ธ
  • __extern int caca_get_display_time (caca_display_t const *) โ€” the display's average rendering time ๐Ÿ“Š
  • __extern int caca_get_display_width (caca_display_t const *) โ€” the display width ๐Ÿ“
  • __extern int caca_get_display_height (caca_display_t const *) โ€” the display height ๐Ÿ“
  • __extern int caca_set_display_title (caca_display_t *, char const *) โ€” sets the display title ๐Ÿท๏ธ
  • __extern int caca_set_mouse (caca_display_t *, int) โ€” shows or hides the mouse pointer ๐Ÿ–ฑ๏ธ
  • __extern int caca_set_cursor (caca_display_t *, int) โ€” shows or hides the cursor โœจ

Events ๐ŸŽฎ input goes in, input goes out:

  • __extern int caca_get_event (caca_display_t *, int, caca_event_t *, int) โ€” grabs the next mouse or keyboard input event โŒจ๏ธ
  • __extern int caca_get_mouse_x (caca_display_t const *) โ€” the X mouse coordinate ๐Ÿ–ฑ๏ธ
  • __extern int caca_get_mouse_y (caca_display_t const *) โ€” the Y mouse coordinate ๐Ÿ–ฑ๏ธ
  • __extern enum caca_event_type caca_get_event_type (caca_event_t const *) โ€” what type an event is ๐Ÿท๏ธ
  • __extern int caca_get_event_key_ch (caca_event_t const *) โ€” a key press or key release event's value โŒจ๏ธ
  • __extern uint32_t caca_get_event_key_utf32 (caca_event_t const *) โ€” a key press or key release event's Unicode value ๐ŸŒ
  • __extern int caca_get_event_key_utf8 (caca_event_t const *, char *) โ€” a key press or key release event's UTF-8 value ๐ŸŒˆ
  • __extern int caca_get_event_mouse_button (caca_event_t const *) โ€” a mouse press or mouse release event's button ๐Ÿ–ฑ๏ธ
  • __extern int caca_get_event_mouse_x (caca_event_t const *) โ€” a mouse motion event's X coordinate ๐Ÿ“
  • __extern int caca_get_event_mouse_y (caca_event_t const *) โ€” a mouse motion event's Y coordinate ๐Ÿ“
  • __extern int caca_get_event_resize_width (caca_event_t const *) โ€” a resize event's display width value ๐Ÿ“
  • __extern int caca_get_event_resize_height (caca_event_t const *) โ€” a resize event's display height value ๐Ÿ“

  • __extern int caca_getopt (int, char *const[], char const *, struct caca_option const *, int *)

And now ๐Ÿ˜ญ the DOS conio.h emulation section, which is honestly such a serve โ€” every single one of these is a DOS equivalent:

  • __extern char * caca_conio_cgets (char *str) โ€” DOS conio.h cgets() equivalent ๐Ÿ’…
  • __extern void caca_conio_clreol (void) โ€” DOS conio.h clreol() equivalent โœจ
  • __extern void caca_conio_clrscr (void) โ€” DOS conio.h clrscr() equivalent ๐Ÿงผ
  • __extern int caca_conio_cprintf (const char *format,...) โ€” DOS conio.h cprintf() equivalent ๐Ÿ–จ๏ธ
  • __extern int caca_conio_cputs (const char *str) โ€” DOS conio.h cputs() equivalent ๐Ÿ’ฌ
  • __extern int caca_conio_cscanf (char *format,...) โ€” DOS stdio.h cscanf() equivalent ๐Ÿ“ฅ
  • __extern void caca_conio_delay (unsigned int) โ€” DOS dos.h delay() equivalent โณ
  • __extern void caca_conio_delline (void) โ€” DOS conio.h delline() equivalent โœ‚๏ธ
  • __extern int caca_conio_getch (void) โ€” DOS conio.h getch() equivalent โŒจ๏ธ
  • __extern int caca_conio_getche (void) โ€” DOS conio.h getche() equivalent โŒจ๏ธ
  • __extern char * caca_conio_getpass (const char *prompt) โ€” DOS conio.h getpass() equivalent ๐Ÿ”
  • __extern int caca_conio_gettext (int left, int top, int right, int bottom, void *destin) โ€” DOS conio.h gettext() equivalent ๐Ÿ“‹
  • __extern void caca_conio_gettextinfo (struct caca_conio_text_info *r) โ€” DOS conio.h gettextinfo() equivalent ๐Ÿ—‚๏ธ
  • __extern void caca_conio_gotoxy (int x, int y) โ€” DOS conio.h gotoxy() equivalent ๐Ÿ“
  • __extern void caca_conio_highvideo (void) โ€” DOS conio.h highvideo() equivalent ๐Ÿ”†
  • __extern void caca_conio_insline (void) โ€” DOS conio.h insline() equivalent โž•
  • __extern int caca_conio_kbhit (void) โ€” DOS conio.h kbhit() equivalent โŒจ๏ธ
  • __extern void caca_conio_lowvideo (void) โ€” DOS conio.h lowvideo() equivalent ๐Ÿ”…
  • __extern int caca_conio_movetext (int left, int top, int right, int bottom, int destleft, int desttop) โ€” DOS conio.h movetext() equivalent ๐Ÿšš
  • __extern void caca_conio_normvideo (void) โ€” DOS conio.h normvideo() equivalent ๐ŸŽš๏ธ
  • __extern void caca_conio_nosound (void) โ€” DOS dos.h nosound() equivalent ๐Ÿ”‡
  • __extern int caca_conio_printf (const char *format,...) โ€” DOS stdio.h printf() equivalent ๐Ÿ–จ๏ธ
  • __extern int caca_conio_putch (int ch) โ€” DOS conio.h putch() equivalent โœ๏ธ
  • __extern int caca_conio_puttext (int left, int top, int right, int bottom, void *destin) โ€” DOS conio.h puttext() equivalent ๐Ÿ“ค
  • __extern void caca_conio__setcursortype (int cur_t) โ€” DOS conio.h _setcursortype() equivalent ๐Ÿ–ฑ๏ธ
  • __extern void caca_conio_sleep (unsigned int) โ€” DOS dos.h sleep() equivalent ๐Ÿ˜ด
  • __extern void caca_conio_sound (unsigned int) โ€” DOS dos.h sound() equivalent ๐Ÿ”Š
  • __extern void caca_conio_textattr (int newattr) โ€” DOS conio.h textattr() equivalent ๐ŸŽจ
  • __extern void caca_conio_textbackground (int newcolor) โ€” DOS conio.h textbackground() equivalent ๐Ÿ–Œ๏ธ
  • __extern void caca_conio_textcolor (int newcolor) โ€” DOS conio.h textcolor() equivalent ๐Ÿ–๏ธ
  • __extern void caca_conio_textmode (int newmode) โ€” DOS conio.h textmode() equivalent ๐Ÿ–ฅ๏ธ
  • __extern int caca_conio_ungetch (int ch) โ€” DOS conio.h ungetch() equivalent โ†ฉ๏ธ
  • __extern int caca_conio_wherex (void) โ€” DOS conio.h wherex() equivalent ๐Ÿ“
  • __extern int caca_conio_wherey (void) โ€” DOS conio.h wherey() equivalent ๐Ÿ“
  • __extern void caca_conio_window (int left, int top, int right, int bottom) โ€” DOS conio.h window() equivalent ๐ŸชŸ

๐ŸŽ€ Variables ๐ŸŽ€

The globals bestie, they're just sitting there being variables:

  • __extern int caca_optind
  • __extern char * caca_optarg
  • __extern int caca_conio_directvideo โ€” DOS direct video control ๐Ÿ“บ
  • __extern int caca_conio__wscroll โ€” DOS scrolling control ๐Ÿ“œ

๐Ÿ’– Detailed Description ๐Ÿ’–

Okay so the actual tea on this header ๐Ÿซ–:

๐ŸŒธ Author ๐ŸŒธ

Sam Hocevar sam@hocevar.net โ€” king behaviour honestly ๐Ÿ‘‘

โœจ What it is โœจ

This header contains the public types and functions that applications using libcaca may use. That's it, that's the whole lore ๐Ÿ’…

๐Ÿฆ‹ Macro Definition Documentation ๐Ÿฆ‹

๐ŸŽ€ #define CACA_API_VERSION_1 ๐ŸŽ€

libcaca API version โœจ fr fr that's what it is, no cap ๐Ÿซถ

โœจ Typedef Documentation โœจ

okay bestie so this is the part where libcaca hands you a bunch of cute lil' typedefs โ€” think of them as the nicknames it gave to its structs so you don't have to type struct every single time ๐Ÿ’… like they're all basically "this is the handle, go wild with it" and you don't ever touch the actual guts of them. periodt.


  • typedef struct caca_canvas caca_canvas_t โ€” the libcaca canvas. that's your whole drawing surface, your main character energy ๐Ÿ’– everything you print, paint, or blit lives here.
  • typedef struct caca_dither caca_dither_t โ€” the dither structure. dithering is the vibe where you fake a bunch of colours using fewer colours, and this is the handle for that ๐ŸŽ€
  • typedef struct caca_charfont caca_charfont_t โ€” the character font structure. fonty business, but the character kind โœจ
  • typedef struct caca_font caca_font_t โ€” the bitmap font structure. the classic bitmap kind of font, iconic, no notes.
  • typedef struct caca_file caca_file_t โ€” the file handle structure. yup, it's a file, and yes it's a handle ๐Ÿซถ
  • typedef struct caca_file caca_file_t โ€” (already said it, but like, bestie, it's the file handle structure, that's the whole thing ๐Ÿ˜ญ)
  • typedef struct caca_display caca_display_t โ€” the libcaca display context. this is your window to the world, literally โ€” the thing that shows your canvas on screen ๐ŸŒˆ
  • typedef struct caca_event caca_event_t โ€” the libcaca event structure. every keypress, mouse wiggle, and resize lands here, lowkey the gossip channel of the whole library ๐Ÿ’€
ngl these are all opaque handles โ€” the docs above literally describe what each typedef is, so don't go poking at the struct fields, that's not the assignment bestie ๐Ÿ™ˆ

๐Ÿ‘‘ Author ๐Ÿ‘‘

okay and who wrote all this? the manpage says it straight up:

Generated automatically by Doxygen for libcaca from the source code.

so like, no human author to thank for this exact page โ€” the Doxygen robot did it, and it ate ๐Ÿ”ฅ (the library itself is another story, but that's not what this bit says, so we're not gonna pretend it does โœจ).


and that's a wrap on caca.h(3caca), bestie!! ๐ŸŽ€๐Ÿ’– this page is from Version 0.99.beta20, dated Wed May 13 2026 09:45:08 โ€” screenshot it, cite it, love it, and go make something iconic with libcaca ๐Ÿ’…๐Ÿฆ‹๐ŸŒธ byeee ๐ŸŒˆโญ

๐Ÿ“ฆ where this page comes from