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 frstruct 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_HandCACA_KEY_CTRL_IandCACA_KEY_CTRL_Mare not in this list โ0x08isCACA_KEY_BACKSPACE,0x09isCACA_KEY_TAB, and0x0disCACA_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 thatint(*)(void *)and itsvoid *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, alluint32_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 twoints, 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 twocaca_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 wholeints 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, fourint *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 thatuint8_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 thosex[]andy[]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 literallyint coords[6],caca_canvas_t *texandfloat 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, fourints and fouruint32_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'sr[],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 thechar 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)โ DOSconio.hcgets()equivalent ๐__extern void caca_conio_clreol (void)โ DOSconio.hclreol()equivalent โจ__extern void caca_conio_clrscr (void)โ DOSconio.hclrscr()equivalent ๐งผ__extern int caca_conio_cprintf (const char *format,...)โ DOSconio.hcprintf()equivalent ๐จ๏ธ__extern int caca_conio_cputs (const char *str)โ DOSconio.hcputs()equivalent ๐ฌ__extern int caca_conio_cscanf (char *format,...)โ DOSstdio.hcscanf()equivalent ๐ฅ__extern void caca_conio_delay (unsigned int)โ DOSdos.hdelay()equivalent โณ__extern void caca_conio_delline (void)โ DOSconio.hdelline()equivalent โ๏ธ__extern int caca_conio_getch (void)โ DOSconio.hgetch()equivalent โจ๏ธ__extern int caca_conio_getche (void)โ DOSconio.hgetche()equivalent โจ๏ธ__extern char * caca_conio_getpass (const char *prompt)โ DOSconio.hgetpass()equivalent ๐__extern int caca_conio_gettext (int left, int top, int right, int bottom, void *destin)โ DOSconio.hgettext()equivalent ๐__extern void caca_conio_gettextinfo (struct caca_conio_text_info *r)โ DOSconio.hgettextinfo()equivalent ๐๏ธ__extern void caca_conio_gotoxy (int x, int y)โ DOSconio.hgotoxy()equivalent ๐__extern void caca_conio_highvideo (void)โ DOSconio.hhighvideo()equivalent ๐__extern void caca_conio_insline (void)โ DOSconio.hinsline()equivalent โ__extern int caca_conio_kbhit (void)โ DOSconio.hkbhit()equivalent โจ๏ธ__extern void caca_conio_lowvideo (void)โ DOSconio.hlowvideo()equivalent ๐__extern int caca_conio_movetext (int left, int top, int right, int bottom, int destleft, int desttop)โ DOSconio.hmovetext()equivalent ๐__extern void caca_conio_normvideo (void)โ DOSconio.hnormvideo()equivalent ๐๏ธ__extern void caca_conio_nosound (void)โ DOSdos.hnosound()equivalent ๐__extern int caca_conio_printf (const char *format,...)โ DOSstdio.hprintf()equivalent ๐จ๏ธ__extern int caca_conio_putch (int ch)โ DOSconio.hputch()equivalent โ๏ธ__extern int caca_conio_puttext (int left, int top, int right, int bottom, void *destin)โ DOSconio.hputtext()equivalent ๐ค__extern void caca_conio__setcursortype (int cur_t)โ DOSconio.h_setcursortype()equivalent ๐ฑ๏ธ__extern void caca_conio_sleep (unsigned int)โ DOSdos.hsleep()equivalent ๐ด__extern void caca_conio_sound (unsigned int)โ DOSdos.hsound()equivalent ๐__extern void caca_conio_textattr (int newattr)โ DOSconio.htextattr()equivalent ๐จ__extern void caca_conio_textbackground (int newcolor)โ DOSconio.htextbackground()equivalent ๐๏ธ__extern void caca_conio_textcolor (int newcolor)โ DOSconio.htextcolor()equivalent ๐๏ธ__extern void caca_conio_textmode (int newmode)โ DOSconio.htextmode()equivalent ๐ฅ๏ธ__extern int caca_conio_ungetch (int ch)โ DOSconio.hungetch()equivalent โฉ๏ธ__extern int caca_conio_wherex (void)โ DOSconio.hwherex()equivalent ๐__extern int caca_conio_wherey (void)โ DOSconio.hwherey()equivalent ๐__extern void caca_conio_window (int left, int top, int right, int bottom)โ DOSconio.hwindow()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
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 ยท WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 ยท WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 ยท WTFPL
- opensuse-leap 16.0: libcaca-devel 0.99.beta20-160000.3.1 ยท WTFPL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms