You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

697 regels
30 KiB

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