Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (11 years ago)
Author:
Sam Hocevar
Message:

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca.h

    r2305 r2821  
    2525#define __CACA_H__
    2626
    27 #include <cucul.h>
     27#include <caca_types.h>
    2828
    2929#undef __extern
     
    4343#endif
    4444
     45/** \e libcaca canvas */
     46typedef struct caca_canvas caca_canvas_t;
     47/** dither structure */
     48typedef struct caca_dither caca_dither_t;
     49/** font structure */
     50typedef struct caca_font caca_font_t;
     51/** file handle structure */
     52typedef struct caca_file caca_file_t;
    4553/** \e libcaca display context */
    4654typedef struct caca_display caca_display_t;
    4755/** \e libcaca event structure */
    4856typedef 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/*  @} */
    4987
    5088/** \brief User event type enumeration.
     
    159197/** \defgroup libcaca libcaca basic functions
    160198 *
    161  *  These functions provide the basic \e libcaca routines for driver
     199 *  These functions provide the basic \e libcaca routines for library
    162200 *  initialisation, system information retrieval and configuration.
    163201 *
    164202 *  @{ */
    165 __extern caca_display_t * caca_create_display(cucul_canvas_t *);
    166 __extern caca_display_t * caca_create_display_with_driver(cucul_canvas_t *,
     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 uint32_t caca_get_attr(caca_canvas_t const *, int, int);
     230__extern int caca_set_attr(caca_canvas_t *, uint32_t);
     231__extern int caca_put_attr(caca_canvas_t *, int, int, uint32_t);
     232__extern int caca_set_color_ansi(caca_canvas_t *, uint8_t, uint8_t);
     233__extern int caca_set_color_argb(caca_canvas_t *, uint16_t, uint16_t);
     234__extern int caca_printf(caca_canvas_t *, int, int, char const *, ...);
     235__extern int caca_clear_canvas(caca_canvas_t *);
     236__extern int caca_set_canvas_handle(caca_canvas_t *, int, int);
     237__extern int caca_get_canvas_handle_x(caca_canvas_t const *);
     238__extern int caca_get_canvas_handle_y(caca_canvas_t const *);
     239__extern int caca_blit(caca_canvas_t *, int, int, caca_canvas_t const *,
     240                        caca_canvas_t const *);
     241__extern int caca_set_canvas_boundaries(caca_canvas_t *, int, int, int, int);
     242/*  @} */
     243
     244/** \defgroup caca_transform libcaca canvas transformation
     245 *
     246 *  These functions perform horizontal and vertical canvas flipping.
     247 *
     248 *  @{ */
     249__extern int caca_invert(caca_canvas_t *);
     250__extern int caca_flip(caca_canvas_t *);
     251__extern int caca_flop(caca_canvas_t *);
     252__extern int caca_rotate_180(caca_canvas_t *);
     253__extern int caca_rotate_left(caca_canvas_t *);
     254__extern int caca_rotate_right(caca_canvas_t *);
     255__extern int caca_stretch_left(caca_canvas_t *);
     256__extern int caca_stretch_right(caca_canvas_t *);
     257/*  @} */
     258
     259/** \defgroup caca_attributes libcaca attribute conversions
     260 *
     261 *  These functions perform conversions between attribute values.
     262 *
     263 *  @{ */
     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 *,
    167434                                                          char const *);
    168435__extern char const * const * caca_get_display_driver_list(void);
     
    170437__extern int caca_set_display_driver(caca_display_t *, char const *);
    171438__extern int caca_free_display(caca_display_t *);
    172 __extern cucul_canvas_t * caca_get_canvas(caca_display_t *);
     439__extern caca_canvas_t * caca_get_canvas(caca_display_t *);
    173440__extern int caca_refresh_display(caca_display_t *);
    174441__extern int caca_set_display_time(caca_display_t *, int);
     
    179446__extern int caca_set_mouse(caca_display_t *, int);
    180447__extern int caca_set_cursor(caca_display_t *, int);
    181 __extern char const * caca_get_version(void);
    182448/*  @} */
    183449
     
    202468/*  @} */
    203469
     470#if !defined(_DOXYGEN_SKIP_ME)
     471    /* Legacy stuff from beta versions, will probably disappear in 1.0 */
     472typedef struct cucul_buffer cucul_buffer_t;
     473#define cucul_canvas_t caca_canvas_t
     474#define cucul_dither_t caca_dither_t
     475#define cucul_font_t caca_font_t
     476#define cucul_file_t caca_file_t
     477#define cucul_display_t caca_display_t
     478#define cucul_event_t caca_event_t
     479
     480#   if defined __GNUC__ && __GNUC__ >= 3
     481#       define CACA_DEPRECATED __attribute__ ((__deprecated__))
     482#   else
     483#       define CACA_DEPRECATED
     484#   endif
     485__extern int cucul_putchar(cucul_canvas_t *, int, int,
     486                           unsigned long int) CACA_DEPRECATED;
     487__extern unsigned long int cucul_getchar(cucul_canvas_t *,
     488                                         int, int) CACA_DEPRECATED;
     489__extern int cucul_putstr(cucul_canvas_t *, int, int,
     490                          char const *) CACA_DEPRECATED;
     491__extern int cucul_set_color(cucul_canvas_t *, unsigned char,
     492                             unsigned char) CACA_DEPRECATED;
     493__extern int cucul_set_truecolor(cucul_canvas_t *, unsigned int,
     494                                 unsigned int) CACA_DEPRECATED;
     495__extern unsigned int cucul_get_canvas_frame_count(cucul_canvas_t *)
     496                                                   CACA_DEPRECATED;
     497__extern int cucul_set_canvas_frame(cucul_canvas_t *,
     498                                    unsigned int) CACA_DEPRECATED;
     499__extern int cucul_create_canvas_frame(cucul_canvas_t *,
     500                                       unsigned int) CACA_DEPRECATED;
     501__extern int cucul_free_canvas_frame(cucul_canvas_t *,
     502                                     unsigned int) CACA_DEPRECATED;
     503__extern cucul_buffer_t *cucul_load_memory(void *,
     504                                           unsigned long int) CACA_DEPRECATED;
     505__extern cucul_buffer_t *cucul_load_file(char const *) CACA_DEPRECATED;
     506__extern unsigned long int cucul_get_buffer_size(cucul_buffer_t *)
     507                                                 CACA_DEPRECATED;
     508__extern void * cucul_get_buffer_data(cucul_buffer_t *) CACA_DEPRECATED;
     509__extern int cucul_free_buffer(cucul_buffer_t *) CACA_DEPRECATED;
     510__extern cucul_buffer_t * cucul_export_canvas(cucul_canvas_t *,
     511                                              char const *) CACA_DEPRECATED;
     512__extern cucul_canvas_t * cucul_import_canvas(cucul_buffer_t *,
     513                                              char const *) CACA_DEPRECATED;
     514__extern int cucul_rotate(cucul_canvas_t *) CACA_DEPRECATED;
     515__extern int cucul_set_dither_invert(cucul_dither_t *, int) CACA_DEPRECATED;
     516__extern int cucul_set_dither_mode(cucul_dither_t *,
     517                                   char const *) CACA_DEPRECATED;
     518__extern char const * const * cucul_get_dither_mode_list(cucul_dither_t
     519                                                         const *)
     520                                                         CACA_DEPRECATED;
     521#   define CUCUL_COLOR_BLACK CACA_BLACK
     522#   define CUCUL_COLOR_BLUE CACA_BLUE
     523#   define CUCUL_COLOR_GREEN CACA_GREEN
     524#   define CUCUL_COLOR_CYAN CACA_CYAN
     525#   define CUCUL_COLOR_RED CACA_RED
     526#   define CUCUL_COLOR_MAGENTA CACA_MAGENTA
     527#   define CUCUL_COLOR_BROWN CACA_BROWN
     528#   define CUCUL_COLOR_LIGHTGRAY CACA_LIGHTGRAY
     529#   define CUCUL_COLOR_DARKGRAY CACA_DARKGRAY
     530#   define CUCUL_COLOR_LIGHTBLUE CACA_LIGHTBLUE
     531#   define CUCUL_COLOR_LIGHTGREEN CACA_LIGHTGREEN
     532#   define CUCUL_COLOR_LIGHTCYAN CACA_LIGHTCYAN
     533#   define CUCUL_COLOR_LIGHTRED CACA_LIGHTRED
     534#   define CUCUL_COLOR_LIGHTMAGENTA CACA_LIGHTMAGENTA
     535#   define CUCUL_COLOR_YELLOW CACA_YELLOW
     536#   define CUCUL_COLOR_WHITE CACA_YELLOW
     537#   define CUCUL_COLOR_DEFAULT CACA_DEFAULT
     538#   define CUCUL_COLOR_TRANSPARENT CACA_TRANSPARENT
     539#endif
     540
    204541#ifdef __cplusplus
    205542}
Note: See TracChangeset for help on using the changeset viewer.