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