libcaca documentation

Main Page | Modules | Directories | File List | Globals

# caca.h File Reference

The libcaca public header. More...

Go to the source code of this file.

## Defines
#define | CACA_BACKGROUND_MIN 0x11
#define | CACA_BACKGROUND_MAX 0x12
#define | CACA_ANTIALIASING_MIN 0x21
#define | CACA_ANTIALIASING_MAX 0x22
#define | CACA_DITHERING_MIN 0x31
#define | CACA_DITHERING_MAX 0x35
## Enumerations
enum | caca_color { CACA_COLOR_BLACK = 0, CACA_COLOR_BLUE = 1, CACA_COLOR_GREEN = 2, CACA_COLOR_CYAN = 3, CACA_COLOR_RED = 4, CACA_COLOR_MAGENTA = 5, CACA_COLOR_BROWN = 6, CACA_COLOR_LIGHTGRAY = 7, CACA_COLOR_DARKGRAY = 8, CACA_COLOR_LIGHTBLUE = 9, CACA_COLOR_LIGHTGREEN = 10, CACA_COLOR_LIGHTCYAN = 11, CACA_COLOR_LIGHTRED = 12, CACA_COLOR_LIGHTMAGENTA = 13, CACA_COLOR_YELLOW = 14, CACA_COLOR_WHITE = 15 }
| Colour definitions. More...
enum | caca_feature { CACA_BACKGROUND = 0x10, CACA_BACKGROUND_BLACK = 0x11, CACA_BACKGROUND_SOLID = 0x12, CACA_ANTIALIASING = 0x20, CACA_ANTIALIASING_NONE = 0x21, CACA_ANTIALIASING_PREFILTER = 0x22, CACA_DITHERING = 0x30, CACA_DITHERING_NONE = 0x31, CACA_DITHERING_ORDERED2 = 0x32, CACA_DITHERING_ORDERED4 = 0x33, CACA_DITHERING_ORDERED8 = 0x34, CACA_DITHERING_RANDOM = 0x35, CACA_FEATURE_UNKNOWN = 0xffff }
| Internal features. More...
enum | caca_event { CACA_EVENT_NONE = 0x00000000, CACA_EVENT_KEY_PRESS = 0x01000000, CACA_EVENT_KEY_RELEASE = 0x02000000, CACA_EVENT_MOUSE_PRESS = 0x04000000, CACA_EVENT_MOUSE_RELEASE = 0x08000000, CACA_EVENT_MOUSE_MOTION = 0x10000000, CACA_EVENT_RESIZE = 0x20000000, CACA_EVENT_ANY = 0xff000000 }
| User events. More...
enum | caca_key { CACA_KEY_UNKNOWN = 0, CACA_KEY_BACKSPACE = 8, CACA_KEY_TAB = 9, CACA_KEY_RETURN = 13, CACA_KEY_PAUSE = 19, CACA_KEY_ESCAPE = 27, CACA_KEY_DELETE = 127, CACA_KEY_UP = 273, CACA_KEY_DOWN = 274, CACA_KEY_LEFT = 275, CACA_KEY_RIGHT = 276, CACA_KEY_INSERT = 277, CACA_KEY_HOME = 278, CACA_KEY_END = 279, CACA_KEY_PAGEUP = 280, CACA_KEY_PAGEDOWN = 281, CACA_KEY_F1 = 282, CACA_KEY_F2 = 283, CACA_KEY_F3 = 284, CACA_KEY_F4 = 285, CACA_KEY_F5 = 286, CACA_KEY_F6 = 287, CACA_KEY_F7 = 288, CACA_KEY_F8 = 289, CACA_KEY_F9 = 290, CACA_KEY_F10 = 291, CACA_KEY_F11 = 292, CACA_KEY_F12 = 293, CACA_KEY_F13 = 294, CACA_KEY_F14 = 295, CACA_KEY_F15 = 296 }
| Special key values. More...
## Functions
int | caca_init (void)
| Initialise libcaca.
void | caca_set_delay (unsigned int)
| Set the refresh delay.
enum caca_feature | caca_get_feature (enum caca_feature)
| Get the current value of a feature.
void | caca_set_feature (enum caca_feature)
| Set a feature.
char const * | caca_get_feature_name (enum caca_feature)
| Translate a feature value into the feature's name.
unsigned int | caca_get_rendertime (void)
| Get the average rendering time.
unsigned int | caca_get_width (void)
| Get the screen width.
unsigned int | caca_get_height (void)
| Get the screen height.
int | caca_set_window_title (char const *)
| Set the window title.
unsigned int | caca_get_window_width (void)
| Get the window width.
unsigned int | caca_get_window_height (void)
| Get the window height.
void | caca_refresh (void)
| Flush pending changes and redraw the screen.
void | caca_end (void)
| Uninitialise libcaca.
unsigned int | caca_get_event (unsigned int)
| Get the next mouse or keyboard input event.
unsigned int | caca_wait_event (unsigned int)
| Wait for the next mouse or keyboard input event.
unsigned int | caca_get_mouse_x (void)
| Return the X mouse coordinate.
unsigned int | caca_get_mouse_y (void)
| Return the Y mouse coordinate.
void | caca_set_color (enum caca_color, enum caca_color)
| Set the default colour pair.
enum caca_color | caca_get_fg_color (void)
| Get the current foreground colour.
enum caca_color | caca_get_bg_color (void)
| Get the current background colour.
char const * | caca_get_color_name (enum caca_color)
| Translate a colour index into the colour's name.
void | caca_putchar (int, int, char)
| Print a character.
void | caca_putstr (int, int, char const *)
| Print a string.
void | caca_printf (int, int, char const *,...)
| Format a string.
void | caca_clear (void)
| Clear the screen.
void | caca_draw_line (int, int, int, int, char)
| Draw a line on the screen using the given character.
void | caca_draw_polyline (int const x[], int const y[], int, char)
| Draw a polyline on the screen using the given character and coordinate arrays. The first and last points are not connected, so in order to draw a polygon you need to specify the starting point at the end of the list as well.
void | caca_draw_thin_line (int, int, int, int)
| Draw a thin line on the screen, using ASCII art.
void | caca_draw_thin_polyline (int const x[], int const y[], int)
| Draw a thin polyline on the screen using the given coordinate arrays and with ASCII art. The first and last points are not connected, so in order to draw a polygon you need to specify the starting point at the end of the list as well.
void | caca_draw_circle (int, int, int, char)
| Draw a circle on the screen using the given character.
void | caca_draw_ellipse (int, int, int, int, char)
| Draw an ellipse on the screen using the given character.
void | caca_draw_thin_ellipse (int, int, int, int)
| Draw a thin ellipse on the screen.
void | caca_fill_ellipse (int, int, int, int, char)
| Fill an ellipse on the screen using the given character.
void | caca_draw_box (int, int, int, int, char)
| Draw a box on the screen using the given character.
void | caca_draw_thin_box (int, int, int, int)
| Draw a thin box on the screen.
void | caca_fill_box (int, int, int, int, char)
| Fill a box on the screen using the given character.
void | caca_draw_triangle (int, int, int, int, int, int, char)
| Draw a triangle on the screen using the given character.
void | caca_draw_thin_triangle (int, int, int, int, int, int)
| Draw a thin triangle on the screen.
void | caca_fill_triangle (int, int, int, int, int, int, char)
| Fill a triangle on the screen using the given character.
int | caca_rand (int, int)
| Generate a random integer within a range.
unsigned int | caca_sqrt (unsigned int)
| Approximate a square root, using Newton's method to avoid costly floating point calculations.
caca_sprite * | caca_load_sprite (char const *)
| Allocate a sprite loaded from a file.
int | caca_get_sprite_frames (struct caca_sprite const *)
| Return the number of frames in a sprite.
int | caca_get_sprite_width (struct caca_sprite const *, int)
| Return the width of a sprite.
int | caca_get_sprite_height (struct caca_sprite const *, int)
| Return the height of a sprite.
int | caca_get_sprite_dx (struct caca_sprite const *, int)
| Return the X coordinate of a sprite's handle.
int | caca_get_sprite_dy (struct caca_sprite const *, int)
| Return the Y coordinate of a sprite's handle.
void | caca_draw_sprite (int, int, struct caca_sprite const *, int)
| Draw a sprite's specific frame at the given coordinates. If the frame does not exist, nothing is displayed.
void | caca_free_sprite (struct caca_sprite *)
| Free the memory associated with a sprite.
caca_bitmap * | caca_create_bitmap (unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
| Create an internal bitmap object.
void | caca_set_bitmap_palette (struct caca_bitmap *, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[])
| Set the palette of an 8bpp bitmap object.
void | caca_draw_bitmap (int, int, int, int, struct caca_bitmap const *, void *)
| Draw a bitmap on the screen.
void | caca_free_bitmap (struct caca_bitmap *)
| Free the memory associated with a bitmap.

## Detailed Description

Version:
  $Id: caca.h 249 2004-01-17 22:32:39Z sam $

Author:
  Sam Hocevar <sam@zoy.org>

This header contains the public types and functions that applications using libcaca may use.

## Enumeration Type Documentation

enum caca_color

  | Colours that can be used with caca_set_color(). Enumerator:
  CACA_COLOR_BLACK | The colour index for black.
  CACA_COLOR_BLUE | The colour index for blue.
  CACA_COLOR_GREEN | The colour index for green.
  CACA_COLOR_CYAN | The colour index for cyan.
  CACA_COLOR_RED | The colour index for red.
  CACA_COLOR_MAGENTA | The colour index for magenta.
  CACA_COLOR_BROWN | The colour index for brown.
  CACA_COLOR_LIGHTGRAY | The colour index for light gray.
  CACA_COLOR_DARKGRAY | The colour index for dark gray.
  CACA_COLOR_LIGHTBLUE | The colour index for blue.
  CACA_COLOR_LIGHTGREEN | The colour index for light green.
  CACA_COLOR_LIGHTCYAN | The colour index for light cyan.
  CACA_COLOR_LIGHTRED | The colour index for light red.
  CACA_COLOR_LIGHTMAGENTA | The colour index for light magenta.
  CACA_COLOR_YELLOW | The colour index for yellow.
  CACA_COLOR_WHITE | The colour index for white.

enum caca_event

  | Event types returned by caca_get_event(). Enumerator:
  CACA_EVENT_NONE | No event.
  CACA_EVENT_KEY_PRESS | A key was pressed.
  CACA_EVENT_KEY_RELEASE | A key was released.
  CACA_EVENT_MOUSE_PRESS | A mouse button was pressed.
  CACA_EVENT_MOUSE_RELEASE | A mouse button was released.
  CACA_EVENT_MOUSE_MOTION | The mouse was moved.
  CACA_EVENT_RESIZE | The window was resized.
  CACA_EVENT_ANY | Bitmask for any event.

enum caca_feature

  | Internal libcaca features such as the rendering method or the dithering mode. Enumerator:
  CACA_BACKGROUND | Properties of background characters.
  CACA_BACKGROUND_BLACK | Draw only black backgrounds.
  CACA_BACKGROUND_SOLID | Draw coloured solid backgorunds.
  CACA_ANTIALIASING | First background property Last background property Antialiasing features.
  CACA_ANTIALIASING_NONE | No antialiasing.
  CACA_ANTIALIASING_PREFILTER | Prefilter antialiasing.
  CACA_DITHERING | First antialiasing feature. Last antialiasing feature. Dithering methods
  CACA_DITHERING_NONE | No dithering.
  CACA_DITHERING_ORDERED2 | Ordered 2x2 Bayer dithering.
  CACA_DITHERING_ORDERED4 | Ordered 4x4 Bayer dithering.
  CACA_DITHERING_ORDERED8 | Ordered 8x8 Bayer dithering.
  CACA_DITHERING_RANDOM | Random dithering.
  CACA_FEATURE_UNKNOWN | First dithering feature. Last dithering feature. Unknown feature.

enum caca_key

  | Special key values returned by caca_get_event() for which there is no ASCII equivalent. Enumerator:
  CACA_KEY_UNKNOWN | Unknown key.
  CACA_KEY_BACKSPACE | The backspace key.
  CACA_KEY_TAB | The tabulation key.
  CACA_KEY_RETURN | The return key.
  CACA_KEY_PAUSE | The pause key.
  CACA_KEY_ESCAPE | The escape key.
  CACA_KEY_DELETE | The delete key.
  CACA_KEY_UP | The up arrow key.
  CACA_KEY_DOWN | The down arrow key.
  CACA_KEY_LEFT | The left arrow key.
  CACA_KEY_RIGHT | The right arrow key.
  CACA_KEY_INSERT | The insert key.
  CACA_KEY_HOME | The home key.
  CACA_KEY_END | The end key.
  CACA_KEY_PAGEUP | The page up key.
  CACA_KEY_PAGEDOWN | The page down key.
  CACA_KEY_F1 | The F1 key.
  CACA_KEY_F2 | The F2 key.
  CACA_KEY_F3 | The F3 key.
  CACA_KEY_F4 | The F4 key.
  CACA_KEY_F5 | The F5 key.
  CACA_KEY_F6 | The F6 key.
  CACA_KEY_F7 | The F7 key.
  CACA_KEY_F8 | The F8 key.
  CACA_KEY_F9 | The F9 key.
  CACA_KEY_F10 | The F10 key.
  CACA_KEY_F11 | The F11 key.
  CACA_KEY_F12 | The F12 key.
  CACA_KEY_F13 | The F13 key.
  CACA_KEY_F14 | The F14 key.
  CACA_KEY_F15 | The F15 key.