source: libcaca/trunk/cucul/cucul.h @ 711

Last change on this file since 711 was 711, checked in by Sam Hocevar, 15 years ago
  • Removed CUCUL_BACKGROUND, CUCUL_ANTIALIASING and CUCUL_DITHERING environment variables handling. Replaced that with three per-bitmap functions: cucul_set_bitmap_antialias(), cucul_set_bitmap_color() and cucul_set_bitmap_dithering().
  • Added cucul_set_bitmap_brightness() and cucul_set_bitmap_contrast() prototypes (but did not implement them yet).
  • Added cucul_set_bitmap_charset() to choose what characters are going to be used for the bitmap rendering.
  • Removed the now useless cucul_get_feature(), cucul_set_feature() etc.
  • Property svn:keywords set to Id
File size: 7.7 KB
Line 
1/*
2 *  libcucul      Canvas for ultrafast compositing of Unicode letters
3 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  This library is free software; you can redistribute it and/or
7 *  modify it under the terms of the Do What The Fuck You Want To
8 *  Public License, Version 2, as published by Sam Hocevar. See
9 *  http://sam.zoy.org/wtfpl/COPYING for more details.
10 */
11
12/** \file cucul.h
13 *  \version \$Id: cucul.h 711 2006-04-01 15:02:05Z sam $
14 *  \author Sam Hocevar <sam@zoy.org>
15 *  \brief The \e libcucul public header.
16 *
17 *  This header contains the public types and functions that applications
18 *  using \e libcucul may use.
19 */
20
21#ifndef __CUCUL_H__
22#define __CUCUL_H__
23
24#define CUCUL_API_VERSION_1
25
26#ifdef __cplusplus
27extern "C"
28{
29#endif
30
31/** \brief Colour definitions.
32 *
33 *  Colours that can be used with cucul_set_color().
34 */
35enum cucul_color
36{
37    CUCUL_COLOR_BLACK = 0x0, /**< The colour index for black. */
38    CUCUL_COLOR_BLUE = 0x1, /**< The colour index for blue. */
39    CUCUL_COLOR_GREEN = 0x2, /**< The colour index for green. */
40    CUCUL_COLOR_CYAN = 0x3, /**< The colour index for cyan. */
41    CUCUL_COLOR_RED = 0x4, /**< The colour index for red. */
42    CUCUL_COLOR_MAGENTA = 0x5, /**< The colour index for magenta. */
43    CUCUL_COLOR_BROWN = 0x6, /**< The colour index for brown. */
44    CUCUL_COLOR_LIGHTGRAY = 0x7, /**< The colour index for light gray. */
45    CUCUL_COLOR_DARKGRAY = 0x8, /**< The colour index for dark gray. */
46    CUCUL_COLOR_LIGHTBLUE = 0x9, /**< The colour index for blue. */
47    CUCUL_COLOR_LIGHTGREEN = 0xa, /**< The colour index for light green. */
48    CUCUL_COLOR_LIGHTCYAN = 0xb, /**< The colour index for light cyan. */
49    CUCUL_COLOR_LIGHTRED = 0xc, /**< The colour index for light red. */
50    CUCUL_COLOR_LIGHTMAGENTA = 0xd, /**< The colour index for light magenta. */
51    CUCUL_COLOR_YELLOW = 0xe, /**< The colour index for yellow. */
52    CUCUL_COLOR_WHITE = 0xf, /**< The colour index for white. */
53
54    CUCUL_COLOR_TRANSPARENT = 0xfe, /**< The transparent colour. */
55    CUCUL_COLOR_DEFAULT = 0xff, /**< The output driver's default colour. */
56};
57
58typedef struct cucul_context cucul_t;
59
60/** \defgroup basic Basic functions
61 *
62 *  These functions provide the basic \e libcaca routines for library
63 *  initialisation, system information retrieval and configuration.
64 *
65 *  @{ */
66cucul_t * cucul_create(unsigned int, unsigned int);
67cucul_t * cucul_load(void *, unsigned int);
68void cucul_set_size(cucul_t *, unsigned int, unsigned int);
69unsigned int cucul_get_width(cucul_t *);
70unsigned int cucul_get_height(cucul_t *);
71void cucul_free(cucul_t *);
72/*  @} */
73
74/** \defgroup canvas Canvas drawing
75 *
76 *  These functions provide low-level character printing routines and
77 *  higher level graphics functions.
78 *
79 *  @{ */
80void cucul_set_color(cucul_t *, enum cucul_color, enum cucul_color);
81enum cucul_color cucul_get_fg_color(cucul_t const *);
82enum cucul_color cucul_get_bg_color(cucul_t const *);
83char const *cucul_get_color_name(enum cucul_color);
84void cucul_putchar(cucul_t *, int, int, char);
85void cucul_putstr(cucul_t *, int, int, char const *);
86void cucul_printf(cucul_t *, int, int, char const *, ...);
87void cucul_get_screen(cucul_t const *, char *);
88void cucul_clear(cucul_t *);
89void cucul_blit(cucul_t *, int, int, cucul_t const *, cucul_t const *);
90/*  @} */
91
92/** \defgroup transform Canvas transformation
93 *
94 *  These functions perform horizontal and vertical canvas flipping.
95 *
96 *  @{ */
97void cucul_invert(cucul_t *);
98void cucul_flip(cucul_t *);
99void cucul_flop(cucul_t *);
100void cucul_rotate(cucul_t *);
101/*  @} */
102
103/** \defgroup prim Primitives drawing
104 *
105 *  These functions provide routines for primitive drawing, such as lines,
106 *  boxes, triangles and ellipses.
107 *
108 *  @{ */
109void cucul_draw_line(cucul_t *, int, int, int, int, char const *);
110void cucul_draw_polyline(cucul_t *, int const x[], int const y[], int, char const *);
111void cucul_draw_thin_line(cucul_t *, int, int, int, int);
112void cucul_draw_thin_polyline(cucul_t *, int const x[], int const y[], int);
113
114void cucul_draw_circle(cucul_t *, int, int, int, char const *);
115void cucul_draw_ellipse(cucul_t *, int, int, int, int, char const *);
116void cucul_draw_thin_ellipse(cucul_t *, int, int, int, int);
117void cucul_fill_ellipse(cucul_t *, int, int, int, int, char const *);
118
119void cucul_draw_box(cucul_t *, int, int, int, int, char const *);
120void cucul_draw_thin_box(cucul_t *, int, int, int, int);
121void cucul_fill_box(cucul_t *, int, int, int, int, char const *);
122
123void cucul_draw_triangle(cucul_t *, int, int, int, int, int, int, char const *);
124void cucul_draw_thin_triangle(cucul_t *, int, int, int, int, int, int);
125void cucul_fill_triangle(cucul_t *, int, int, int, int, int, int, char const *);
126/*  @} */
127
128/** \defgroup math Mathematical functions
129 *
130 *  These functions provide a few useful math-related routines.
131 *
132 *  @{ */
133int cucul_rand(int, int);
134unsigned int cucul_sqrt(unsigned int);
135/*  @} */
136
137/** \defgroup sprite Sprite handling
138 *
139 *  These functions provide high level routines for sprite loading, animation
140 *  and rendering.
141 *
142 *  @{ */
143struct cucul_sprite;
144struct cucul_sprite * cucul_load_sprite(cucul_t *, char const *);
145int cucul_get_sprite_frames(cucul_t *, struct cucul_sprite const *);
146int cucul_get_sprite_width(cucul_t *, struct cucul_sprite const *, int);
147int cucul_get_sprite_height(cucul_t *, struct cucul_sprite const *, int);
148int cucul_get_sprite_dx(cucul_t *, struct cucul_sprite const *, int);
149int cucul_get_sprite_dy(cucul_t *, struct cucul_sprite const *, int);
150void cucul_draw_sprite(cucul_t *, int, int, struct cucul_sprite const *, int);
151void cucul_free_sprite(struct cucul_sprite *);
152/*  @} */
153
154/** \defgroup bitmap Bitmap handling
155 *
156 *  These functions provide high level routines for bitmap allocation and
157 *  rendering.
158 *
159 *  @{ */
160struct cucul_bitmap;
161struct cucul_bitmap *cucul_create_bitmap(unsigned int, unsigned int,
162                                         unsigned int, unsigned int,
163                                         unsigned int, unsigned int,
164                                         unsigned int, unsigned int);
165void cucul_set_bitmap_palette(struct cucul_bitmap *,
166                              unsigned int r[], unsigned int g[],
167                              unsigned int b[], unsigned int a[]);
168void cucul_set_bitmap_brightness(struct cucul_bitmap *, float);
169void cucul_set_bitmap_gamma(struct cucul_bitmap *, float);
170void cucul_set_bitmap_contrast(struct cucul_bitmap *, float);
171void cucul_set_bitmap_invert(struct cucul_bitmap *, int);
172void cucul_set_bitmap_antialias(struct cucul_bitmap *, int);
173void cucul_set_bitmap_color(struct cucul_bitmap *, char const *);
174char const * const * cucul_get_bitmap_color_list(struct cucul_bitmap const *);
175void cucul_set_bitmap_charset(struct cucul_bitmap *, char const *);
176char const * const * cucul_get_bitmap_charset_list(struct cucul_bitmap
177                                                   const *);
178void cucul_set_bitmap_dithering(struct cucul_bitmap *, char const *);
179char const * const * cucul_get_bitmap_dithering_list(struct cucul_bitmap
180                                                     const *);
181void cucul_draw_bitmap(cucul_t *, int, int, int, int,
182                       struct cucul_bitmap const *, void *);
183void cucul_free_bitmap(struct cucul_bitmap *);
184/*  @} */
185
186/** \defgroup exporter Exporters to various formats
187 *
188 *  These functions export the current canvas to various text formats. It
189 *  is necessary to call cucul_free_export() to dispose of the data.
190 *
191 *  @{ */
192struct cucul_export
193{
194    unsigned int size;
195    char *buffer;
196};
197
198struct cucul_export * cucul_create_export(cucul_t *, char const *);
199char const * const * cucul_get_export_list(void);
200void cucul_free_export(struct cucul_export *);
201
202/*  @} */
203
204#ifdef __cplusplus
205}
206#endif
207
208#endif /* __CUCUL_H__ */
Note: See TracBrowser for help on using the repository browser.