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

Last change on this file since 3604 was 3604, checked in by Sam Hocevar, 11 years ago

Since caca.h now exports variables, we need declspec(dllimport), otherwise
they won't be seen by the linker when linking dynamically. Fix caca0.h
accordingly.

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