libcaca documentation

Main Page | Modules | Directories | File List | Globals

# Character printing

## Functions
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.

## Detailed Description

These functions provide low-level character printing routines.

## Function Documentation

void caca_clear | ( | void |  | ) |

| This function clears the screen using a black background.

enum caca_color caca_get_bg_color | ( | void |  | ) |

| This function returns the current background colour that was set with caca_set_color(). Returns: The current background colour.

char const* caca_get_color_name | ( | enum caca_color | color | ) |

  | This function translates a caca_color enum into a human-readable description string of the associated colour. Parameters:
  | color | The colour value.
Returns: A static string containing the colour's name.

enum caca_color caca_get_fg_color | ( | void |  | ) |

| This function returns the current foreground colour that was set with caca_set_color(). Returns: The current foreground colour.

void caca_printf | ( | int | x,
|  | int | y,
|  | char const * | format,
|  |  | ...
| ) |

  | This function formats a string at the given coordinates, using the default foreground and background values. The coordinates may be outside the screen boundaries (eg. a negative Y coordinate) and the string will be cropped accordingly if it is too long. The syntax of the format string is the same as for the C printf() function. Parameters:
  | x | X coordinate.
  | y | Y coordinate.
  | format | The format string to print.
  | ... | Arguments to the format string.

void caca_putchar | ( | int | x,
|  | int | y,
|  | char | c
| ) |

  | This function prints a character at the given coordinates, using the default foreground and background values. If the coordinates are outside the screen boundaries, nothing is printed. Parameters:
  | x | X coordinate.
  | y | Y coordinate.
  | c | The character to print.

void caca_putstr | ( | int | x,
|  | int | y,
|  | char const * | s
| ) |

  | This function prints a string at the given coordinates, using the default foreground and background values. The coordinates may be outside the screen boundaries (eg. a negative Y coordinate) and the string will be cropped accordingly if it is too long. Parameters:
  | x | X coordinate.
  | y | Y coordinate.
  | s | The string to print.

void caca_set_color | ( | enum caca_color | fgcolor,
|  | enum caca_color | bgcolor
| ) |

  | This function sets the default colour pair. String functions such as caca_printf() and graphical primitive functions such as caca_draw_line() will use these colour pairs. Parameters:
  | fgcolor | The requested foreground colour.
  | bgcolor | The requested background colour.