cucul.h File Reference

The libcucul public header. More...


Defines

#define CUCUL_API_VERSION_1
#define CUCUL_BLACK   0x00
#define CUCUL_BLUE   0x01
#define CUCUL_GREEN   0x02
#define CUCUL_CYAN   0x03
#define CUCUL_RED   0x04
#define CUCUL_MAGENTA   0x05
#define CUCUL_BROWN   0x06
#define CUCUL_LIGHTGRAY   0x07
#define CUCUL_DARKGRAY   0x08
#define CUCUL_LIGHTBLUE   0x09
#define CUCUL_LIGHTGREEN   0x0a
#define CUCUL_LIGHTCYAN   0x0b
#define CUCUL_LIGHTRED   0x0c
#define CUCUL_LIGHTMAGENTA   0x0d
#define CUCUL_YELLOW   0x0e
#define CUCUL_WHITE   0x0f
#define CUCUL_DEFAULT   0x10
#define CUCUL_TRANSPARENT   0x20
#define CUCUL_BOLD   0x01
#define CUCUL_ITALICS   0x02
#define CUCUL_UNDERLINE   0x04
#define CUCUL_BLINK   0x08
#define CUCUL_MAGIC_FULLWIDTH   0x000ffffe

Typedefs

typedef struct cucul_canvas cucul_canvas_t
typedef struct cucul_dither cucul_dither_t
typedef struct cucul_font cucul_font_t
typedef struct cucul_file cucul_file_t

Functions

__extern cucul_canvas_tcucul_create_canvas (int, int)
 Initialise a libcucul canvas.
__extern int cucul_manage_canvas (cucul_canvas_t *, int(*)(void *), void *)
 Manage a canvas.
__extern int cucul_unmanage_canvas (cucul_canvas_t *, int(*)(void *), void *)
 Unmanage a canvas.
__extern int cucul_set_canvas_size (cucul_canvas_t *, int, int)
 Resize a canvas.
__extern int cucul_get_canvas_width (cucul_canvas_t const *)
 Get the canvas width.
__extern int cucul_get_canvas_height (cucul_canvas_t const *)
 Get the canvas height.
__extern uint8_t const * cucul_get_canvas_chars (cucul_canvas_t const *)
 Get the canvas character array.
__extern uint8_t const * cucul_get_canvas_attrs (cucul_canvas_t const *)
 Get the canvas attribute array.
__extern int cucul_free_canvas (cucul_canvas_t *)
 Uninitialise libcucul.
__extern int cucul_rand (int, int)
 Generate a random integer within a range.
__extern char const * cucul_get_version (void)
 Return the libcucul version.
__extern int cucul_gotoxy (cucul_canvas_t *, int, int)
 Set cursor position.
__extern int cucul_get_cursor_x (cucul_canvas_t const *)
 Get X cursor position.
__extern int cucul_get_cursor_y (cucul_canvas_t const *)
 Get Y cursor position.
__extern int cucul_put_char (cucul_canvas_t *, int, int, uint32_t)
 Print an ASCII or Unicode character.
__extern uint32_t cucul_get_char (cucul_canvas_t const *, int, int)
 Get the Unicode character at the given coordinates.
__extern int cucul_put_str (cucul_canvas_t *, int, int, char const *)
 Print a string.
__extern uint32_t cucul_get_attr (cucul_canvas_t const *, int, int)
 Get the text attribute at the given coordinates.
__extern int cucul_set_attr (cucul_canvas_t *, uint32_t)
 Set the default character attribute.
__extern int cucul_put_attr (cucul_canvas_t *, int, int, uint32_t)
 Set the character attribute at the given coordinates.
__extern int cucul_set_color_ansi (cucul_canvas_t *, uint8_t, uint8_t)
 Set the default colour pair for text (ANSI version).
__extern int cucul_set_color_argb (cucul_canvas_t *, uint16_t, uint16_t)
 Set the default colour pair for text (truecolor version).
__extern int cucul_printf (cucul_canvas_t *, int, int, char const *,...)
 Print a formated string.
__extern int cucul_clear_canvas (cucul_canvas_t *)
 Clear the canvas.
__extern int cucul_set_canvas_handle (cucul_canvas_t *, int, int)
 Set cursor handle.
__extern int cucul_get_canvas_handle_x (cucul_canvas_t const *)
 Get X handle position.
__extern int cucul_get_canvas_handle_y (cucul_canvas_t const *)
 Get Y handle position.
__extern int cucul_blit (cucul_canvas_t *, int, int, cucul_canvas_t const *, cucul_canvas_t const *)
 Blit a canvas onto another one.
__extern int cucul_set_canvas_boundaries (cucul_canvas_t *, int, int, int, int)
 Set a canvas' new boundaries.
__extern int cucul_invert (cucul_canvas_t *)
 Invert a canvas' colours.
__extern int cucul_flip (cucul_canvas_t *)
 Flip a canvas horizontally.
__extern int cucul_flop (cucul_canvas_t *)
 Flip a canvas vertically.
__extern int cucul_rotate_180 (cucul_canvas_t *)
 Rotate a canvas.
__extern int cucul_rotate_left (cucul_canvas_t *)
 Rotate a canvas, 90 degrees counterclockwise.
__extern int cucul_rotate_right (cucul_canvas_t *)
 Rotate a canvas, 90 degrees counterclockwise.
__extern int cucul_stretch_left (cucul_canvas_t *)
 Rotate and stretch a canvas, 90 degrees counterclockwise.
__extern int cucul_stretch_right (cucul_canvas_t *)
 Rotate and stretch a canvas, 90 degrees clockwise.
__extern uint8_t cucul_attr_to_ansi (uint32_t)
 Get DOS ANSI information from attribute.
__extern uint8_t cucul_attr_to_ansi_fg (uint32_t)
 Get ANSI foreground information from attribute.
__extern uint8_t cucul_attr_to_ansi_bg (uint32_t)
 Get ANSI background information from attribute.
__extern uint16_t cucul_attr_to_rgb12_fg (uint32_t)
 Get 12-bit RGB foreground information from attribute.
__extern uint16_t cucul_attr_to_rgb12_bg (uint32_t)
 Get 12-bit RGB background information from attribute.
__extern void cucul_attr_to_argb64 (uint32_t, uint8_t[8])
 Get 64-bit ARGB information from attribute.
__extern uint32_t cucul_utf8_to_utf32 (char const *, size_t *)
 Convert a UTF-8 character to UTF-32.
__extern size_t cucul_utf32_to_utf8 (char *, uint32_t)
 Convert a UTF-32 character to UTF-8.
__extern uint8_t cucul_utf32_to_cp437 (uint32_t)
 Convert a UTF-32 character to CP437.
__extern uint32_t cucul_cp437_to_utf32 (uint8_t)
 Convert a CP437 character to UTF-32.
__extern char cucul_utf32_to_ascii (uint32_t)
 Convert a UTF-32 character to ASCII.
__extern int cucul_utf32_is_fullwidth (uint32_t)
 Tell whether a UTF-32 character is fullwidth.
__extern int cucul_draw_line (cucul_canvas_t *, int, int, int, int, uint32_t)
 Draw a line on the canvas using the given character.
__extern int cucul_draw_polyline (cucul_canvas_t *, int const x[], int const y[], int, uint32_t)
 Draw a polyline.
__extern int cucul_draw_thin_line (cucul_canvas_t *, int, int, int, int)
 Draw a thin line on the canvas, using ASCII art.
__extern int cucul_draw_thin_polyline (cucul_canvas_t *, int const x[], int const y[], int)
 Draw an ASCII art thin polyline.
__extern int cucul_draw_circle (cucul_canvas_t *, int, int, int, uint32_t)
 Draw a circle on the canvas using the given character.
__extern int cucul_draw_ellipse (cucul_canvas_t *, int, int, int, int, uint32_t)
 Draw an ellipse on the canvas using the given character.
__extern int cucul_draw_thin_ellipse (cucul_canvas_t *, int, int, int, int)
 Draw a thin ellipse on the canvas.
__extern int cucul_fill_ellipse (cucul_canvas_t *, int, int, int, int, uint32_t)
 Fill an ellipse on the canvas using the given character.
__extern int cucul_draw_box (cucul_canvas_t *, int, int, int, int, uint32_t)
 Draw a box on the canvas using the given character.
__extern int cucul_draw_thin_box (cucul_canvas_t *, int, int, int, int)
 Draw a thin box on the canvas.
__extern int cucul_draw_cp437_box (cucul_canvas_t *, int, int, int, int)
 Draw a box on the canvas using CP437 characters.
__extern int cucul_fill_box (cucul_canvas_t *, int, int, int, int, uint32_t)
 Fill a box on the canvas using the given character.
__extern int cucul_draw_triangle (cucul_canvas_t *, int, int, int, int, int, int, uint32_t)
 Draw a triangle on the canvas using the given character.
__extern int cucul_draw_thin_triangle (cucul_canvas_t *, int, int, int, int, int, int)
 Draw a thin triangle on the canvas.
__extern int cucul_fill_triangle (cucul_canvas_t *, int, int, int, int, int, int, uint32_t)
 Fill a triangle on the canvas using the given character.
__extern int cucul_get_frame_count (cucul_canvas_t const *)
 Get the number of frames in a canvas.
__extern int cucul_set_frame (cucul_canvas_t *, int)
 Activate a given canvas frame.
__extern char const * cucul_get_frame_name (cucul_canvas_t const *)
 Get the current frame's name.
__extern int cucul_set_frame_name (cucul_canvas_t *, char const *)
 Set the current frame's name.
__extern int cucul_create_frame (cucul_canvas_t *, int)
 Add a frame to a canvas.
__extern int cucul_free_frame (cucul_canvas_t *, int)
 Remove a frame from a canvas.
__extern cucul_dither_tcucul_create_dither (int, int, int, int, uint32_t, uint32_t, uint32_t, uint32_t)
 Create an internal dither object.
__extern int cucul_set_dither_palette (cucul_dither_t *, uint32_t r[], uint32_t g[], uint32_t b[], uint32_t a[])
 Set the palette of an 8bpp dither object.
__extern int cucul_set_dither_brightness (cucul_dither_t *, float)
 Set the brightness of a dither object.
__extern float cucul_get_dither_brightness (cucul_dither_t const *)
 Get the brightness of a dither object.
__extern int cucul_set_dither_gamma (cucul_dither_t *, float)
 Set the gamma of a dither object.
__extern float cucul_get_dither_gamma (cucul_dither_t const *)
 Get the gamma of a dither object.
__extern int cucul_set_dither_contrast (cucul_dither_t *, float)
 Set the contrast of a dither object.
__extern float cucul_get_dither_contrast (cucul_dither_t const *)
 Get the contrast of a dither object.
__extern int cucul_set_dither_antialias (cucul_dither_t *, char const *)
 Set dither antialiasing.
__extern char const *const * cucul_get_dither_antialias_list (cucul_dither_t const *)
 Get available antialiasing methods.
__extern char const * cucul_get_dither_antialias (cucul_dither_t const *)
 Get current antialiasing method.
__extern int cucul_set_dither_color (cucul_dither_t *, char const *)
 Choose colours used for dithering.
__extern char const *const * cucul_get_dither_color_list (cucul_dither_t const *)
 Get available colour modes.
__extern char const * cucul_get_dither_color (cucul_dither_t const *)
 Get current colour mode.
__extern int cucul_set_dither_charset (cucul_dither_t *, char const *)
 Choose characters used for dithering.
__extern char const *const * cucul_get_dither_charset_list (cucul_dither_t const *)
 Get available dither character sets.
__extern char const * cucul_get_dither_charset (cucul_dither_t const *)
 Get current character set.
__extern int cucul_set_dither_algorithm (cucul_dither_t *, char const *)
 Set dithering algorithm.
__extern char const *const * cucul_get_dither_algorithm_list (cucul_dither_t const *)
 Get dithering algorithms.
__extern char const * cucul_get_dither_algorithm (cucul_dither_t const *)
 Get current dithering algorithm.
__extern int cucul_dither_bitmap (cucul_canvas_t *, int, int, int, int, cucul_dither_t const *, void *)
 Dither a bitmap on the canvas.
__extern int cucul_free_dither (cucul_dither_t *)
 Free the memory associated with a dither.
__extern cucul_font_tcucul_load_font (void const *, size_t)
 Load a font from memory for future use.
__extern char const *const * cucul_get_font_list (void)
 Get available builtin fonts.
__extern int cucul_get_font_width (cucul_font_t const *)
 Get a font's standard glyph width.
__extern int cucul_get_font_height (cucul_font_t const *)
 Get a font's standard glyph height.
__extern uint32_t const * cucul_get_font_blocks (cucul_font_t const *)
 Get a font's list of supported glyphs.
__extern int cucul_render_canvas (cucul_canvas_t const *, cucul_font_t const *, void *, int, int, int)
 Render the canvas onto an image buffer.
__extern int cucul_free_font (cucul_font_t *)
 Free a font structure.
__extern int cucul_canvas_set_figfont (cucul_canvas_t *, char const *)
__extern int cucul_put_figchar (cucul_canvas_t *, uint32_t)
__extern int cucul_flush_figlet (cucul_canvas_t *)
__extern cucul_file_tcucul_file_open (char const *, const char *)
__extern int cucul_file_close (cucul_file_t *)
__extern uint64_t cucul_file_tell (cucul_file_t *)
__extern size_t cucul_file_read (cucul_file_t *, void *, size_t)
__extern size_t cucul_file_write (cucul_file_t *, const void *, size_t)
__extern char * cucul_file_gets (cucul_file_t *, char *, int)
__extern int cucul_file_eof (cucul_file_t *)
__extern ssize_t cucul_import_memory (cucul_canvas_t *, void const *, size_t, char const *)
 Import a memory buffer into a canvas.
__extern ssize_t cucul_import_file (cucul_canvas_t *, char const *, char const *)
 Import a file into a canvas.
__extern char const *const * cucul_get_import_list (void)
 Get available import formats.
__extern void * cucul_export_memory (cucul_canvas_t const *, char const *, size_t *)
 Export a canvas into a foreign format.
__extern char const *const * cucul_get_export_list (void)
 Get available export formats.


Detailed Description

Version:
$Id$
Author:
Sam Hocevar <sam@zoy.org> This header contains the public types and functions that applications using libcucul may use.

Define Documentation

#define CUCUL_API_VERSION_1

libcucul API version


Typedef Documentation

typedef struct cucul_canvas cucul_canvas_t

libcucul canvas

typedef struct cucul_dither cucul_dither_t

dither structure

typedef struct cucul_font cucul_font_t

font structure

typedef struct cucul_file cucul_file_t

file handle structure