source: libcaca/trunk/caca/caca.h @ 3586

Last change on this file since 3586 was 3586, checked in by Sam Hocevar, 10 years ago

Implement caca_vprintf() to allow third-party variadic functions to call us.

  • Property svn:keywords set to Id
File size: 32.1 KB
Line 
1/*
2 *  libcaca       Colour ASCII-Art library
3 *  Copyright (c) 2002-2009 Sam Hocevar <sam@hocevar.net>
4 *                All Rights Reserved
5 *
6 *  $Id: caca.h 3586 2009-07-26 23:26:08Z sam $
7 *
8 *  This library is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15/** \file caca.h
16 *  \version \$Id: caca.h 3586 2009-07-26 23:26:08Z sam $
17 *  \author Sam Hocevar <sam@hocevar.net>
18 *  \brief The \e libcaca public header.
19 *
20 *  This header contains the public types and functions that applications
21 *  using \e libcaca may use.
22 */
23
24#ifndef __CACA_H__
25#define __CACA_H__
26
27#include <caca_types.h>
28
29#if !defined(__KERNEL__)
30#   include <stdarg.h>
31#endif
32
33#undef __extern
34#if defined(_DOXYGEN_SKIP_ME)
35#elif defined(_WIN32) && defined(__LIBCACA__)
36#   define __extern extern __declspec(dllexport)
37#else
38#   define __extern extern
39#endif
40
41/** libcaca API version */
42#define CACA_API_VERSION_1
43
44#ifdef __cplusplus
45extern "C"
46{
47#endif
48
49/** \e libcaca canvas */
50typedef struct caca_canvas caca_canvas_t;
51/** dither structure */
52typedef struct caca_dither caca_dither_t;
53/** font structure */
54typedef struct caca_font caca_font_t;
55/** file handle structure */
56typedef struct caca_file caca_file_t;
57/** \e libcaca display context */
58typedef struct caca_display caca_display_t;
59/** \e libcaca event structure */
60typedef struct caca_event caca_event_t;
61
62/** \defgroup caca_attr libcaca attribute definitions
63 *
64 *  Colours and styles that can be used with caca_set_attr().
65 *
66 *  @{ */
67#define CACA_BLACK 0x00 /**< The colour index for black. */
68#define CACA_BLUE 0x01 /**< The colour index for blue. */
69#define CACA_GREEN 0x02 /**< The colour index for green. */
70#define CACA_CYAN 0x03 /**< The colour index for cyan. */
71#define CACA_RED 0x04 /**< The colour index for red. */
72#define CACA_MAGENTA 0x05 /**< The colour index for magenta. */
73#define CACA_BROWN 0x06 /**< The colour index for brown. */
74#define CACA_LIGHTGRAY 0x07 /**< The colour index for light gray. */
75#define CACA_DARKGRAY 0x08 /**< The colour index for dark gray. */
76#define CACA_LIGHTBLUE 0x09 /**< The colour index for blue. */
77#define CACA_LIGHTGREEN 0x0a /**< The colour index for light green. */
78#define CACA_LIGHTCYAN 0x0b /**< The colour index for light cyan. */
79#define CACA_LIGHTRED 0x0c /**< The colour index for light red. */
80#define CACA_LIGHTMAGENTA 0x0d /**< The colour index for light magenta. */
81#define CACA_YELLOW 0x0e /**< The colour index for yellow. */
82#define CACA_WHITE 0x0f /**< The colour index for white. */
83#define CACA_DEFAULT 0x10 /**< The output driver's default colour. */
84#define CACA_TRANSPARENT 0x20 /**< The transparent colour. */
85
86#define CACA_BOLD 0x01 /**< The style mask for bold. */
87#define CACA_ITALICS 0x02 /**< The style mask for italics. */
88#define CACA_UNDERLINE 0x04 /**< The style mask for underline. */
89#define CACA_BLINK 0x08 /**< The style mask for blink. */
90/*  @} */
91
92/** \brief User event type enumeration.
93 *
94 *  This enum serves two purposes:
95 *  - Build listening masks for caca_get_event().
96 *  - Define the type of a \e caca_event_t.
97 */
98enum caca_event_type
99{
100    CACA_EVENT_NONE =          0x0000, /**< No event. */
101
102    CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
103    CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
104    CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
105    CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
106    CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
107    CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
108    CACA_EVENT_QUIT =          0x0040, /**< The user requested to quit. */
109
110    CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
111};
112
113/** \brief Handling of user events.
114 *
115 *  This structure is filled by caca_get_event() when an event is received.
116 *  It is an opaque structure that should only be accessed through
117 *  caca_event_get_type() and similar functions. The struct members may no
118 *  longer be directly accessible in future versions.
119 */
120struct caca_event
121{
122    enum caca_event_type type;
123    union
124    {
125        struct { int x, y, button; } mouse;
126        struct { int w, h; } resize;
127        struct { int ch; uint32_t utf32; char utf8[8]; } key;
128    } data;
129    uint8_t padding[16];
130};
131
132/** \brief Special key values.
133 *
134 *  Special key values returned by caca_get_event() for which there is no
135 *  printable ASCII equivalent.
136 */
137enum caca_key
138{
139    CACA_KEY_UNKNOWN = 0x00, /**< Unknown key. */
140
141    /* The following keys have ASCII equivalents */
142    CACA_KEY_CTRL_A =    0x01, /**< The Ctrl-A key. */
143    CACA_KEY_CTRL_B =    0x02, /**< The Ctrl-B key. */
144    CACA_KEY_CTRL_C =    0x03, /**< The Ctrl-C key. */
145    CACA_KEY_CTRL_D =    0x04, /**< The Ctrl-D key. */
146    CACA_KEY_CTRL_E =    0x05, /**< The Ctrl-E key. */
147    CACA_KEY_CTRL_F =    0x06, /**< The Ctrl-F key. */
148    CACA_KEY_CTRL_G =    0x07, /**< The Ctrl-G key. */
149    CACA_KEY_BACKSPACE = 0x08, /**< The backspace key. */
150    CACA_KEY_TAB =       0x09, /**< The tabulation key. */
151    CACA_KEY_CTRL_J =    0x0a, /**< The Ctrl-J key. */
152    CACA_KEY_CTRL_K =    0x0b, /**< The Ctrl-K key. */
153    CACA_KEY_CTRL_L =    0x0c, /**< The Ctrl-L key. */
154    CACA_KEY_RETURN =    0x0d, /**< The return key. */
155    CACA_KEY_CTRL_N =    0x0e, /**< The Ctrl-N key. */
156    CACA_KEY_CTRL_O =    0x0f, /**< The Ctrl-O key. */
157    CACA_KEY_CTRL_P =    0x10, /**< The Ctrl-P key. */
158    CACA_KEY_CTRL_Q =    0x11, /**< The Ctrl-Q key. */
159    CACA_KEY_CTRL_R =    0x12, /**< The Ctrl-R key. */
160    CACA_KEY_PAUSE =     0x13, /**< The pause key. */
161    CACA_KEY_CTRL_T =    0x14, /**< The Ctrl-T key. */
162    CACA_KEY_CTRL_U =    0x15, /**< The Ctrl-U key. */
163    CACA_KEY_CTRL_V =    0x16, /**< The Ctrl-V key. */
164    CACA_KEY_CTRL_W =    0x17, /**< The Ctrl-W key. */
165    CACA_KEY_CTRL_X =    0x18, /**< The Ctrl-X key. */
166    CACA_KEY_CTRL_Y =    0x19, /**< The Ctrl-Y key. */
167    CACA_KEY_CTRL_Z =    0x1a, /**< The Ctrl-Z key. */
168    CACA_KEY_ESCAPE =    0x1b, /**< The escape key. */
169    CACA_KEY_DELETE =    0x7f, /**< The delete key. */
170
171    /* The following keys do not have ASCII equivalents but have been
172     * chosen to match the SDL equivalents */
173    CACA_KEY_UP =    0x111, /**< The up arrow key. */
174    CACA_KEY_DOWN =  0x112, /**< The down arrow key. */
175    CACA_KEY_LEFT =  0x113, /**< The left arrow key. */
176    CACA_KEY_RIGHT = 0x114, /**< The right arrow key. */
177
178    CACA_KEY_INSERT =   0x115, /**< The insert key. */
179    CACA_KEY_HOME =     0x116, /**< The home key. */
180    CACA_KEY_END =      0x117, /**< The end key. */
181    CACA_KEY_PAGEUP =   0x118, /**< The page up key. */
182    CACA_KEY_PAGEDOWN = 0x119, /**< The page down key. */
183
184    CACA_KEY_F1 =  0x11a, /**< The F1 key. */
185    CACA_KEY_F2 =  0x11b, /**< The F2 key. */
186    CACA_KEY_F3 =  0x11c, /**< The F3 key. */
187    CACA_KEY_F4 =  0x11d, /**< The F4 key. */
188    CACA_KEY_F5 =  0x11e, /**< The F5 key. */
189    CACA_KEY_F6 =  0x11f, /**< The F6 key. */
190    CACA_KEY_F7 =  0x120, /**< The F7 key. */
191    CACA_KEY_F8 =  0x121, /**< The F8 key. */
192    CACA_KEY_F9 =  0x122, /**< The F9 key. */
193    CACA_KEY_F10 = 0x123, /**< The F10 key. */
194    CACA_KEY_F11 = 0x124, /**< The F11 key. */
195    CACA_KEY_F12 = 0x125, /**< The F12 key. */
196    CACA_KEY_F13 = 0x126, /**< The F13 key. */
197    CACA_KEY_F14 = 0x127, /**< The F14 key. */
198    CACA_KEY_F15 = 0x128  /**< The F15 key. */
199};
200
201/** \defgroup libcaca libcaca basic functions
202 *
203 *  These functions provide the basic \e libcaca routines for library
204 *  initialisation, system information retrieval and configuration.
205 *
206 *  @{ */
207__extern caca_canvas_t * caca_create_canvas(int, int);
208__extern int caca_manage_canvas(caca_canvas_t *, int (*)(void *), void *);
209__extern int caca_unmanage_canvas(caca_canvas_t *, int (*)(void *), void *);
210__extern int caca_set_canvas_size(caca_canvas_t *, int, int);
211__extern int caca_get_canvas_width(caca_canvas_t const *);
212__extern int caca_get_canvas_height(caca_canvas_t const *);
213__extern uint8_t const * caca_get_canvas_chars(caca_canvas_t const *);
214__extern uint8_t const * caca_get_canvas_attrs(caca_canvas_t const *);
215__extern int caca_free_canvas(caca_canvas_t *);
216__extern int caca_rand(int, int);
217__extern char const * caca_get_version(void);
218/*  @} */
219
220/** \defgroup caca_canvas libcaca canvas drawing
221 *
222 *  These functions provide low-level character printing routines and
223 *  higher level graphics functions.
224 *
225 *  @{ */
226#define CACA_MAGIC_FULLWIDTH 0x000ffffe /**< Used to indicate that the previous character was a fullwidth glyph. */
227__extern int caca_gotoxy(caca_canvas_t *, int, int);
228__extern int caca_get_cursor_x(caca_canvas_t const *);
229__extern int caca_get_cursor_y(caca_canvas_t const *);
230__extern int caca_put_char(caca_canvas_t *, int, int, uint32_t);
231__extern uint32_t caca_get_char(caca_canvas_t const *, int, int);
232__extern int caca_put_str(caca_canvas_t *, int, int, char const *);
233__extern int caca_printf(caca_canvas_t *, int, int, char const *, ...);
234__extern int caca_vprintf(caca_canvas_t *, int, int, char const *, va_list);
235__extern int caca_clear_canvas(caca_canvas_t *);
236__extern int caca_set_canvas_handle(caca_canvas_t *, int, int);
237__extern int caca_get_canvas_handle_x(caca_canvas_t const *);
238__extern int caca_get_canvas_handle_y(caca_canvas_t const *);
239__extern int caca_blit(caca_canvas_t *, int, int, caca_canvas_t const *,
240                       caca_canvas_t const *);
241__extern int caca_set_canvas_boundaries(caca_canvas_t *, int, int, int, int);
242/*  @} */
243
244/** \defgroup caca_dirty libcaca dirty rectangle manipulation
245 *
246 *  These functions manipulate dirty rectangles for optimised blitting.
247 *  @{ */
248__extern int caca_disable_dirty_rect(caca_canvas_t *);
249__extern int caca_enable_dirty_rect(caca_canvas_t *);
250__extern int caca_get_dirty_rect_count(caca_canvas_t *);
251__extern int caca_get_dirty_rect(caca_canvas_t *, int, int *, int *,
252                                 int *, int *);
253__extern int caca_add_dirty_rect(caca_canvas_t *, int, int, int, int);
254__extern int caca_remove_dirty_rect(caca_canvas_t *, int, int, int, int);
255__extern int caca_clear_dirty_rect_list(caca_canvas_t *);
256/*  @} */
257
258/** \defgroup caca_transform libcaca canvas transformation
259 *
260 *  These functions perform horizontal and vertical canvas flipping.
261 *
262 *  @{ */
263__extern int caca_invert(caca_canvas_t *);
264__extern int caca_flip(caca_canvas_t *);
265__extern int caca_flop(caca_canvas_t *);
266__extern int caca_rotate_180(caca_canvas_t *);
267__extern int caca_rotate_left(caca_canvas_t *);
268__extern int caca_rotate_right(caca_canvas_t *);
269__extern int caca_stretch_left(caca_canvas_t *);
270__extern int caca_stretch_right(caca_canvas_t *);
271/*  @} */
272
273/** \defgroup caca_attributes libcaca attribute conversions
274 *
275 *  These functions perform conversions between attribute values.
276 *
277 *  @{ */
278__extern uint32_t caca_get_attr(caca_canvas_t const *, int, int);
279__extern int caca_set_attr(caca_canvas_t *, uint32_t);
280__extern int caca_put_attr(caca_canvas_t *, int, int, uint32_t);
281__extern int caca_set_color_ansi(caca_canvas_t *, uint8_t, uint8_t);
282__extern int caca_set_color_argb(caca_canvas_t *, uint16_t, uint16_t);
283__extern uint8_t caca_attr_to_ansi(uint32_t);
284__extern uint8_t caca_attr_to_ansi_fg(uint32_t);
285__extern uint8_t caca_attr_to_ansi_bg(uint32_t);
286__extern uint16_t caca_attr_to_rgb12_fg(uint32_t);
287__extern uint16_t caca_attr_to_rgb12_bg(uint32_t);
288__extern void caca_attr_to_argb64(uint32_t, uint8_t[8]);
289/*  @} */
290
291/** \defgroup caca_charset libcaca character set conversions
292 *
293 *  These functions perform conversions between usual character sets.
294 *
295 *  @{ */
296__extern uint32_t caca_utf8_to_utf32(char const *, size_t *);
297__extern size_t caca_utf32_to_utf8(char *, uint32_t);
298__extern uint8_t caca_utf32_to_cp437(uint32_t);
299__extern uint32_t caca_cp437_to_utf32(uint8_t);
300__extern char caca_utf32_to_ascii(uint32_t);
301__extern int caca_utf32_is_fullwidth(uint32_t);
302/*  @} */
303
304/** \defgroup caca_primitives libcaca primitives drawing
305 *
306 *  These functions provide routines for primitive drawing, such as lines,
307 *  boxes, triangles and ellipses.
308 *
309 *  @{ */
310__extern int caca_draw_line(caca_canvas_t *, int, int, int, int, uint32_t);
311__extern int caca_draw_polyline(caca_canvas_t *, int const x[],
312                                 int const y[], int, uint32_t);
313__extern int caca_draw_thin_line(caca_canvas_t *, int, int, int, int);
314__extern int caca_draw_thin_polyline(caca_canvas_t *, int const x[],
315                                      int const y[], int);
316
317__extern int caca_draw_circle(caca_canvas_t *, int, int, int, uint32_t);
318__extern int caca_draw_ellipse(caca_canvas_t *, int, int, int, int, uint32_t);
319__extern int caca_draw_thin_ellipse(caca_canvas_t *, int, int, int, int);
320__extern int caca_fill_ellipse(caca_canvas_t *, int, int, int, int, uint32_t);
321
322__extern int caca_draw_box(caca_canvas_t *, int, int, int, int, uint32_t);
323__extern int caca_draw_thin_box(caca_canvas_t *, int, int, int, int);
324__extern int caca_draw_cp437_box(caca_canvas_t *, int, int, int, int);
325__extern int caca_fill_box(caca_canvas_t *, int, int, int, int, uint32_t);
326
327__extern int caca_draw_triangle(caca_canvas_t *, int, int, int, int, int,
328                                 int, uint32_t);
329__extern int caca_draw_thin_triangle(caca_canvas_t *, int, int, int, int,
330                                      int, int);
331__extern int caca_fill_triangle(caca_canvas_t *, int, int, int, int, int,
332                                 int, uint32_t);
333/*  @} */
334
335/** \defgroup caca_frame libcaca canvas frame handling
336 *
337 *  These functions provide high level routines for canvas frame insertion,
338 *  removal, copying etc.
339 *
340 *  @{ */
341__extern int caca_get_frame_count(caca_canvas_t const *);
342__extern int caca_set_frame(caca_canvas_t *, int);
343__extern char const *caca_get_frame_name(caca_canvas_t const *);
344__extern int caca_set_frame_name(caca_canvas_t *, char const *);
345__extern int caca_create_frame(caca_canvas_t *, int);
346__extern int caca_free_frame(caca_canvas_t *, int);
347/*  @} */
348
349/** \defgroup caca_dither libcaca bitmap dithering
350 *
351 *  These functions provide high level routines for dither allocation and
352 *  rendering.
353 *
354 *  @{ */
355__extern caca_dither_t *caca_create_dither(int, int, int, int,
356                                             uint32_t, uint32_t,
357                                             uint32_t, uint32_t);
358__extern int caca_set_dither_palette(caca_dither_t *,
359                                      uint32_t r[], uint32_t g[],
360                                      uint32_t b[], uint32_t a[]);
361__extern int caca_set_dither_brightness(caca_dither_t *, float);
362__extern float caca_get_dither_brightness(caca_dither_t const *);
363__extern int caca_set_dither_gamma(caca_dither_t *, float);
364__extern float caca_get_dither_gamma(caca_dither_t const *);
365__extern int caca_set_dither_contrast(caca_dither_t *, float);
366__extern float caca_get_dither_contrast(caca_dither_t const *);
367__extern int caca_set_dither_antialias(caca_dither_t *, char const *);
368__extern char const * const * caca_get_dither_antialias_list(caca_dither_t
369                                                              const *);
370__extern char const * caca_get_dither_antialias(caca_dither_t const *);
371__extern int caca_set_dither_color(caca_dither_t *, char const *);
372__extern char const * const * caca_get_dither_color_list(caca_dither_t
373                                                          const *);
374__extern char const * caca_get_dither_color(caca_dither_t const *);
375__extern int caca_set_dither_charset(caca_dither_t *, char const *);
376__extern char const * const * caca_get_dither_charset_list(caca_dither_t
377                                                            const *);
378__extern char const * caca_get_dither_charset(caca_dither_t const *);
379__extern int caca_set_dither_algorithm(caca_dither_t *, char const *);
380__extern char const * const * caca_get_dither_algorithm_list(caca_dither_t
381                                                              const *);
382__extern char const * caca_get_dither_algorithm(caca_dither_t const *);
383__extern int caca_dither_bitmap(caca_canvas_t *, int, int, int, int,
384                         caca_dither_t const *, void *);
385__extern int caca_free_dither(caca_dither_t *);
386/*  @} */
387
388/** \defgroup caca_font libcaca font handling
389 *
390 *  These functions provide font handling routines and high quality
391 *  canvas to bitmap rendering.
392 *
393 *  @{ */
394__extern caca_font_t *caca_load_font(void const *, size_t);
395__extern char const * const * caca_get_font_list(void);
396__extern int caca_get_font_width(caca_font_t const *);
397__extern int caca_get_font_height(caca_font_t const *);
398__extern uint32_t const *caca_get_font_blocks(caca_font_t const *);
399__extern int caca_render_canvas(caca_canvas_t const *, caca_font_t const *,
400                                 void *, int, int, int);
401__extern int caca_free_font(caca_font_t *);
402/*  @} */
403
404/** \defgroup caca_figfont libcaca FIGfont handling
405 *
406 *  These functions provide FIGlet and TOIlet font handling routines.
407 *
408 *  @{ */
409__extern int caca_canvas_set_figfont(caca_canvas_t *, char const *);
410__extern int caca_put_figchar(caca_canvas_t *, uint32_t);
411__extern int caca_flush_figlet(caca_canvas_t *);
412/*  @} */
413
414/** \defgroup caca_file libcaca file IO
415 *
416 *  These functions allow to read and write files in a platform-independent
417 *  way.
418 *  @{ */
419__extern caca_file_t *caca_file_open(char const *, const char *);
420__extern int caca_file_close(caca_file_t *);
421__extern uint64_t caca_file_tell(caca_file_t *);
422__extern size_t caca_file_read(caca_file_t *, void *, size_t);
423__extern size_t caca_file_write(caca_file_t *, const void *, size_t);
424__extern char * caca_file_gets(caca_file_t *, char *, int);
425__extern int caca_file_eof(caca_file_t *);
426/*  @} */
427
428/** \defgroup caca_importexport libcaca importers/exporters from/to various
429 *  formats
430 *
431 *  These functions import various file formats into a new canvas, or export
432 *  the current canvas to various text formats.
433 *
434 *  @{ */
435__extern ssize_t caca_import_canvas_from_memory(caca_canvas_t *, void const *,
436                                                size_t, char const *);
437__extern ssize_t caca_import_canvas_from_file(caca_canvas_t *, char const *,
438                                              char const *);
439__extern ssize_t caca_import_area_from_memory(caca_canvas_t *, int, int,
440                                              void const *, size_t,
441                                              char const *);
442__extern ssize_t caca_import_area_from_file(caca_canvas_t *, int, int,
443                                            char const *, char const *);
444__extern char const * const * caca_get_import_list(void);
445__extern void *caca_export_canvas_to_memory(caca_canvas_t const *,
446                                            char const *, size_t *);
447__extern void *caca_export_area_to_memory(caca_canvas_t const *, int, int,
448                                          int, int, char const *, size_t *);
449__extern char const * const * caca_get_export_list(void);
450/*  @} */
451
452/** \defgroup caca_display libcaca display functions
453 *
454 *  These functions provide the basic \e libcaca routines for display
455 *  initialisation, system information retrieval and configuration.
456 *
457 *  @{ */
458__extern caca_display_t * caca_create_display(caca_canvas_t *);
459__extern caca_display_t * caca_create_display_with_driver(caca_canvas_t *,
460                                                          char const *);
461__extern char const * const * caca_get_display_driver_list(void);
462__extern char const * caca_get_display_driver(caca_display_t *);
463__extern int caca_set_display_driver(caca_display_t *, char const *);
464__extern int caca_free_display(caca_display_t *);
465__extern caca_canvas_t * caca_get_canvas(caca_display_t *);
466__extern int caca_refresh_display(caca_display_t *);
467__extern int caca_set_display_time(caca_display_t *, int);
468__extern int caca_get_display_time(caca_display_t const *);
469__extern int caca_get_display_width(caca_display_t const *);
470__extern int caca_get_display_height(caca_display_t const *);
471__extern int caca_set_display_title(caca_display_t *, char const *);
472__extern int caca_set_mouse(caca_display_t *, int);
473__extern int caca_set_cursor(caca_display_t *, int);
474/*  @} */
475
476/** \defgroup caca_event libcaca event handling
477 *
478 *  These functions handle user events such as keyboard input and mouse
479 *  clicks.
480 *
481 *  @{ */
482__extern int caca_get_event(caca_display_t *, int, caca_event_t *, int);
483__extern int caca_get_mouse_x(caca_display_t const *);
484__extern int caca_get_mouse_y(caca_display_t const *);
485__extern enum caca_event_type caca_get_event_type(caca_event_t const *);
486__extern int caca_get_event_key_ch(caca_event_t const *);
487__extern uint32_t caca_get_event_key_utf32(caca_event_t const *);
488__extern int caca_get_event_key_utf8(caca_event_t const *, char *);
489__extern int caca_get_event_mouse_button(caca_event_t const *);
490__extern int caca_get_event_mouse_x(caca_event_t const *);
491__extern int caca_get_event_mouse_y(caca_event_t const *);
492__extern int caca_get_event_resize_width(caca_event_t const *);
493__extern int caca_get_event_resize_height(caca_event_t const *);
494/*  @} */
495
496#if !defined(_DOXYGEN_SKIP_ME)
497    /* Legacy stuff from beta versions, will probably disappear in 1.0 */
498typedef struct cucul_buffer cucul_buffer_t;
499
500#   if defined __GNUC__ && __GNUC__ >= 3
501#       define CACA_DEPRECATED __attribute__ ((__deprecated__))
502#       define CACA_ALIAS(x) __attribute__ ((weak, alias(#x)))
503#   else
504#       define CACA_DEPRECATED
505#       define CACA_ALIAS(x)
506#   endif
507
508
509/* Aliases from old libcucul functions */
510__extern int cucul_putchar(caca_canvas_t *, int, int,
511                           unsigned long int) CACA_DEPRECATED;
512__extern unsigned long int cucul_getchar(caca_canvas_t *,
513                                         int, int) CACA_DEPRECATED;
514__extern int cucul_putstr(caca_canvas_t *, int, int,
515                          char const *) CACA_DEPRECATED;
516__extern int cucul_set_color(caca_canvas_t *, unsigned char,
517                             unsigned char) CACA_DEPRECATED;
518__extern int cucul_set_truecolor(caca_canvas_t *, unsigned int,
519                                 unsigned int) CACA_DEPRECATED;
520__extern unsigned int cucul_get_canvas_frame_count(caca_canvas_t *)
521                                                   CACA_DEPRECATED;
522__extern int cucul_set_canvas_frame(caca_canvas_t *,
523                                    unsigned int) CACA_DEPRECATED;
524__extern int cucul_create_canvas_frame(caca_canvas_t *,
525                                       unsigned int) CACA_DEPRECATED;
526__extern int cucul_free_canvas_frame(caca_canvas_t *,
527                                     unsigned int) CACA_DEPRECATED;
528__extern cucul_buffer_t *cucul_load_memory(void *,
529                                           unsigned long int) CACA_DEPRECATED;
530__extern cucul_buffer_t *cucul_load_file(char const *) CACA_DEPRECATED;
531__extern unsigned long int cucul_get_buffer_size(cucul_buffer_t *)
532                                                 CACA_DEPRECATED;
533__extern void * cucul_get_buffer_data(cucul_buffer_t *) CACA_DEPRECATED;
534__extern int cucul_free_buffer(cucul_buffer_t *) CACA_DEPRECATED;
535__extern cucul_buffer_t * cucul_export_canvas(caca_canvas_t *,
536                                              char const *) CACA_DEPRECATED;
537__extern caca_canvas_t * cucul_import_canvas(cucul_buffer_t *,
538                                              char const *) CACA_DEPRECATED;
539__extern ssize_t caca_import_memory(caca_canvas_t *, void const *, size_t,
540                                    char const *) CACA_DEPRECATED;
541__extern ssize_t caca_import_file(caca_canvas_t *, char const *,
542                                  char const *) CACA_DEPRECATED;
543__extern void *caca_export_memory(caca_canvas_t const *, char const *,
544                                  size_t *) CACA_DEPRECATED;
545__extern int cucul_rotate(caca_canvas_t *) CACA_DEPRECATED;
546__extern int cucul_set_dither_invert(caca_dither_t *, int) CACA_DEPRECATED;
547__extern int cucul_set_dither_mode(caca_dither_t *,
548                                   char const *) CACA_DEPRECATED;
549__extern char const * const * cucul_get_dither_mode_list(caca_dither_t const *)
550                                                         CACA_DEPRECATED;
551#   define CUCUL_COLOR_BLACK CACA_BLACK
552#   define CUCUL_COLOR_BLUE CACA_BLUE
553#   define CUCUL_COLOR_GREEN CACA_GREEN
554#   define CUCUL_COLOR_CYAN CACA_CYAN
555#   define CUCUL_COLOR_RED CACA_RED
556#   define CUCUL_COLOR_MAGENTA CACA_MAGENTA
557#   define CUCUL_COLOR_BROWN CACA_BROWN
558#   define CUCUL_COLOR_LIGHTGRAY CACA_LIGHTGRAY
559#   define CUCUL_COLOR_DARKGRAY CACA_DARKGRAY
560#   define CUCUL_COLOR_LIGHTBLUE CACA_LIGHTBLUE
561#   define CUCUL_COLOR_LIGHTGREEN CACA_LIGHTGREEN
562#   define CUCUL_COLOR_LIGHTCYAN CACA_LIGHTCYAN
563#   define CUCUL_COLOR_LIGHTRED CACA_LIGHTRED
564#   define CUCUL_COLOR_LIGHTMAGENTA CACA_LIGHTMAGENTA
565#   define CUCUL_COLOR_YELLOW CACA_YELLOW
566#   define CUCUL_COLOR_WHITE CACA_YELLOW
567#   define CUCUL_COLOR_DEFAULT CACA_DEFAULT
568#   define CUCUL_COLOR_TRANSPARENT CACA_TRANSPARENT
569
570/* Aliases from the libcucul/libcaca merge */
571#   define cucul_canvas_t caca_canvas_t
572#   define cucul_dither_t caca_dither_t
573#   define cucul_font_t caca_font_t
574#   define cucul_file_t caca_file_t
575#   define cucul_display_t caca_display_t
576#   define cucul_event_t caca_event_t
577
578#   define CUCUL_BLACK CACA_BLACK
579#   define CUCUL_BLUE CACA_BLUE
580#   define CUCUL_GREEN CACA_GREEN
581#   define CUCUL_CYAN CACA_CYAN
582#   define CUCUL_RED CACA_RED
583#   define CUCUL_MAGENTA CACA_MAGENTA
584#   define CUCUL_BROWN CACA_BROWN
585#   define CUCUL_LIGHTGRAY CACA_LIGHTGRAY
586#   define CUCUL_DARKGRAY CACA_DARKGRAY
587#   define CUCUL_LIGHTBLUE CACA_LIGHTBLUE
588#   define CUCUL_LIGHTGREEN CACA_LIGHTGREEN
589#   define CUCUL_LIGHTCYAN CACA_LIGHTCYAN
590#   define CUCUL_LIGHTRED CACA_LIGHTRED
591#   define CUCUL_LIGHTMAGENTA CACA_LIGHTMAGENTA
592#   define CUCUL_YELLOW CACA_YELLOW
593#   define CUCUL_WHITE CACA_YELLOW
594#   define CUCUL_DEFAULT CACA_DEFAULT
595#   define CUCUL_TRANSPARENT CACA_TRANSPARENT
596
597#   define CUCUL_BOLD CACA_BOLD
598#   define CUCUL_ITALICS CACA_ITALICS
599#   define CUCUL_UNDERLINE CACA_UNDERLINE
600#   define CUCUL_BLINK CACA_BLINK
601
602#   if !defined __LIBCACA__
603#       define cucul_draw_triangle caca_draw_triangle
604#       define cucul_draw_thin_triangle caca_draw_thin_triangle
605#       define cucul_fill_triangle caca_fill_triangle
606#       define cucul_load_font caca_load_font
607#       define cucul_get_font_list caca_get_font_list
608#       define cucul_get_font_width caca_get_font_width
609#       define cucul_get_font_height caca_get_font_height
610#       define cucul_get_font_blocks caca_get_font_blocks
611#       define cucul_render_canvas caca_render_canvas
612#       define cucul_free_font caca_free_font
613#       define cucul_gotoxy caca_gotoxy
614#       define cucul_get_cursor_x caca_get_cursor_x
615#       define cucul_get_cursor_y caca_get_cursor_y
616#       define cucul_put_char caca_put_char
617#       define cucul_get_char caca_get_char
618#       define cucul_put_str caca_put_str
619#       define cucul_printf caca_printf
620#       define cucul_clear_canvas caca_clear_canvas
621#       define cucul_set_canvas_handle caca_set_canvas_handle
622#       define cucul_get_canvas_handle_x caca_get_canvas_handle_x
623#       define cucul_get_canvas_handle_y caca_get_canvas_handle_y
624#       define cucul_blit caca_blit
625#       define cucul_set_canvas_boundaries caca_set_canvas_boundaries
626#       define cucul_import_memory caca_import_memory
627#       define cucul_import_file caca_import_file
628#       define cucul_get_import_list caca_get_import_list
629#       define cucul_create_canvas caca_create_canvas
630#       define cucul_manage_canvas caca_manage_canvas
631#       define cucul_unmanage_canvas caca_unmanage_canvas
632#       define cucul_set_canvas_size caca_set_canvas_size
633#       define cucul_get_canvas_width caca_get_canvas_width
634#       define cucul_get_canvas_height caca_get_canvas_height
635#       define cucul_get_canvas_chars caca_get_canvas_chars
636#       define cucul_get_canvas_attrs caca_get_canvas_attrs
637#       define cucul_free_canvas caca_free_canvas
638#       define cucul_rand caca_rand
639#       define cucul_export_memory caca_export_memory
640#       define cucul_get_export_list caca_get_export_list
641#       define cucul_get_version caca_get_version
642#       define cucul_utf8_to_utf32 caca_utf8_to_utf32
643#       define cucul_utf32_to_utf8 caca_utf32_to_utf8
644#       define cucul_utf32_to_cp437 caca_utf32_to_cp437
645#       define cucul_cp437_to_utf32 caca_cp437_to_utf32
646#       define cucul_utf32_to_ascii caca_utf32_to_ascii
647#       define cucul_utf32_is_fullwidth caca_utf32_is_fullwidth
648#       define cucul_draw_circle caca_draw_circle
649#       define cucul_draw_ellipse caca_draw_ellipse
650#       define cucul_draw_thin_ellipse caca_draw_thin_ellipse
651#       define cucul_fill_ellipse caca_fill_ellipse
652#       define cucul_canvas_set_figfont caca_canvas_set_figfont
653#       define cucul_put_figchar caca_put_figchar
654#       define cucul_flush_figlet caca_flush_figlet
655#       define cucul_putchar caca_putchar
656#       define cucul_getchar caca_getchar
657#       define cucul_get_attr caca_get_attr
658#       define cucul_set_attr caca_set_attr
659#       define cucul_put_attr caca_put_attr
660#       define cucul_set_color_ansi caca_set_color_ansi
661#       define cucul_set_color_argb caca_set_color_argb
662#       define cucul_attr_to_ansi caca_attr_to_ansi
663#       define cucul_attr_to_ansi_fg caca_attr_to_ansi_fg
664#       define cucul_attr_to_ansi_bg caca_attr_to_ansi_bg
665#       define cucul_attr_to_rgb12_fg caca_attr_to_rgb12_fg
666#       define cucul_attr_to_rgb12_bg caca_attr_to_rgb12_bg
667#       define cucul_attr_to_argb64 caca_attr_to_argb64
668#       define cucul_invert caca_invert
669#       define cucul_flip caca_flip
670#       define cucul_flop caca_flop
671#       define cucul_rotate_180 caca_rotate_180
672#       define cucul_rotate_left caca_rotate_left
673#       define cucul_rotate_right caca_rotate_right
674#       define cucul_stretch_left caca_stretch_left
675#       define cucul_stretch_right caca_stretch_right
676#       define cucul_file_open caca_file_open
677#       define cucul_file_close caca_file_close
678#       define cucul_file_tell caca_file_tell
679#       define cucul_file_read caca_file_read
680#       define cucul_file_write caca_file_write
681#       define cucul_file_gets caca_file_gets
682#       define cucul_file_eof caca_file_eof
683#       define cucul_create_dither caca_create_dither
684#       define cucul_set_dither_palette caca_set_dither_palette
685#       define cucul_set_dither_brightness caca_set_dither_brightness
686#       define cucul_get_dither_brightness caca_get_dither_brightness
687#       define cucul_set_dither_gamma caca_set_dither_gamma
688#       define cucul_get_dither_gamma caca_get_dither_gamma
689#       define cucul_set_dither_contrast caca_set_dither_contrast
690#       define cucul_get_dither_contrast caca_get_dither_contrast
691#       define cucul_set_dither_antialias caca_set_dither_antialias
692#       define cucul_get_dither_antialias_list caca_get_dither_antialias_list
693#       define cucul_get_dither_antialias caca_get_dither_antialias
694#       define cucul_set_dither_color caca_set_dither_color
695#       define cucul_get_dither_color_list caca_get_dither_color_list
696#       define cucul_get_dither_color caca_get_dither_color
697#       define cucul_set_dither_charset caca_set_dither_charset
698#       define cucul_get_dither_charset_list caca_get_dither_charset_list
699#       define cucul_get_dither_charset caca_get_dither_charset
700#       define cucul_set_dither_algorithm caca_set_dither_algorithm
701#       define cucul_get_dither_algorithm_list caca_get_dither_algorithm_list
702#       define cucul_get_dither_algorithm caca_get_dither_algorithm
703#       define cucul_dither_bitmap caca_dither_bitmap
704#       define cucul_free_dither caca_free_dither
705#       define cucul_draw_line caca_draw_line
706#       define cucul_draw_polyline caca_draw_polyline
707#       define cucul_draw_thin_line caca_draw_thin_line
708#       define cucul_draw_thin_polyline caca_draw_thin_polyline
709#       define cucul_draw_box caca_draw_box
710#       define cucul_draw_thin_box caca_draw_thin_box
711#       define cucul_draw_cp437_box caca_draw_cp437_box
712#       define cucul_fill_box caca_fill_box
713#       define cucul_get_frame_count caca_get_frame_count
714#       define cucul_set_frame caca_set_frame
715#       define cucul_get_frame_name caca_get_frame_name
716#       define cucul_set_frame_name caca_set_frame_name
717#       define cucul_create_frame caca_create_frame
718#       define cucul_free_frame caca_free_frame
719#   endif
720#endif
721
722#ifdef __cplusplus
723}
724#endif
725
726#undef __extern
727
728#endif /* __CACA_H__ */
Note: See TracBrowser for help on using the repository browser.