Changeset 777
- Timestamp:
- Apr 16, 2006, 8:28:47 PM (16 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/caca.h
r773 r777 88 88 #endif 89 89 90 /** \brief User event types. 91 * 92 * Event types returned by caca_get_event(). 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 105 CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */ 106 }; 90 /** \e libcaca context */ 91 typedef struct caca caca_t; 92 /** event structure */ 93 typedef struct caca_event caca_event_t; 107 94 108 95 /** \brief User events. … … 139 126 struct caca_event 140 127 { 141 enum caca_event_type type; 128 enum caca_event_type 129 { 130 CACA_EVENT_NONE = 0x0000, /**< No event. */ 131 132 CACA_EVENT_KEY_PRESS = 0x0001, /**< A key was pressed. */ 133 CACA_EVENT_KEY_RELEASE = 0x0002, /**< A key was released. */ 134 CACA_EVENT_MOUSE_PRESS = 0x0004, /**< A mouse button was pressed. */ 135 CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */ 136 CACA_EVENT_MOUSE_MOTION = 0x0010, /**< The mouse was moved. */ 137 CACA_EVENT_RESIZE = 0x0020, /**< The window was resized. */ 138 139 CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */ 140 } type; 141 142 142 union 143 143 { … … 195 195 }; 196 196 197 typedef struct caca_context caca_t; 198 199 /** \defgroup basic Basic functions 197 /** \defgroup caca Basic libcaca functions 200 198 * 201 199 * These functions provide the basic \e libcaca routines for driver … … 219 217 * 220 218 * @{ */ 221 int caca_get_event(caca_t *kk, unsigned int, struct caca_event *, int);219 int caca_get_event(caca_t *kk, unsigned int, caca_event_t *, int); 222 220 unsigned int caca_get_mouse_x(caca_t *kk); 223 221 unsigned int caca_get_mouse_y(caca_t *kk); -
libcaca/trunk/caca/caca_internals.h
r775 r777 25 25 typedef long unsigned int uintptr_t; 26 26 #endif 27 28 typedef struct caca_timer caca_timer_t; 27 29 28 30 #if !defined(_DOXYGEN_SKIP_ME) … … 89 91 90 92 /* Internal caca context */ 91 struct caca _context93 struct caca 92 94 { 93 95 /* A link to our cucul canvas */ … … 107 109 void (* display) (caca_t *); 108 110 void (* handle_resize) (caca_t *); 109 int (* get_event) (caca_t *, struct caca_event *);111 int (* get_event) (caca_t *, caca_event_t *); 110 112 void (* set_mouse) (caca_t *, int); 111 113 } drv; … … 126 128 /* Framerate handling */ 127 129 unsigned int delay, rendertime; 128 struct caca_timertimer;130 caca_timer_t timer; 129 131 int lastticks; 130 132 … … 132 134 { 133 135 #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL) 134 struct caca_event buf[EVENTBUF_LEN];136 caca_event_t buf[EVENTBUF_LEN]; 135 137 int queue; 136 138 #endif 137 139 #if defined(USE_SLANG) || defined(USE_NCURSES) 138 struct caca_timerkey_timer;140 caca_timer_t key_timer; 139 141 unsigned int last_key_ticks; 140 142 unsigned int autorepeat_ticks; 141 struct caca_event last_key_event;143 caca_event_t last_key_event; 142 144 #endif 143 145 #if defined(USE_WIN32) … … 149 151 /* Internal timer functions */ 150 152 extern void _caca_sleep(unsigned int); 151 extern unsigned int _caca_getticks( struct caca_timer*);153 extern unsigned int _caca_getticks(caca_timer_t *); 152 154 153 155 /* Internal event functions */ 154 156 extern void _caca_handle_resize(caca_t *); 155 157 #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL) 156 extern void _push_event(caca_t *, struct caca_event *);157 extern int _pop_event(caca_t *, struct caca_event *);158 extern void _push_event(caca_t *, caca_event_t *); 159 extern int _pop_event(caca_t *, caca_event_t *); 158 160 #endif 159 161 -
libcaca/trunk/caca/driver_conio.c
r769 r777 120 120 } 121 121 122 static int conio_get_event(caca_t *kk, struct caca_event *ev)122 static int conio_get_event(caca_t *kk, caca_event_t *ev) 123 123 { 124 124 unsigned char ch; 125 struct caca_event release;125 caca_event_t release; 126 126 127 127 if(!_conio_kbhit()) -
libcaca/trunk/caca/driver_gl.c
r769 r777 324 324 } 325 325 326 static int gl_get_event(caca_t *kk, struct caca_event *ev)326 static int gl_get_event(caca_t *kk, caca_event_t *ev) 327 327 { 328 328 #ifdef HAVE_GLUTCHECKLOOP -
libcaca/trunk/caca/driver_ncurses.c
r769 r777 225 225 } 226 226 227 static int ncurses_get_event(caca_t *kk, struct caca_event *ev)227 static int ncurses_get_event(caca_t *kk, caca_event_t *ev) 228 228 { 229 229 int intkey; -
libcaca/trunk/caca/driver_raw.c
r769 r777 85 85 } 86 86 87 static int raw_get_event(caca_t *kk, struct caca_event *ev)87 static int raw_get_event(caca_t *kk, caca_event_t *ev) 88 88 { 89 89 ev->type = CACA_EVENT_NONE; -
libcaca/trunk/caca/driver_slang.c
r769 r777 253 253 } 254 254 255 static int slang_get_event(caca_t *kk, struct caca_event *ev)255 static int slang_get_event(caca_t *kk, caca_event_t *ev) 256 256 { 257 257 int intkey; -
libcaca/trunk/caca/driver_vga.c
r769 r777 133 133 } 134 134 135 static int vga_get_event(caca_t *kk, struct caca_event *ev)135 static int vga_get_event(caca_t *kk, caca_event-t *ev) 136 136 { 137 137 /* FIXME */ -
libcaca/trunk/caca/driver_win32.c
r769 r777 234 234 } 235 235 236 static int win32_get_event(caca_t *kk, struct caca_event *ev)236 static int win32_get_event(caca_t *kk, caca_event_t *ev) 237 237 { 238 238 INPUT_RECORD rec; -
libcaca/trunk/caca/driver_x11.c
r769 r777 405 405 } 406 406 407 static int x11_get_event(caca_t *kk, struct caca_event *ev)407 static int x11_get_event(caca_t *kk, caca_event_t *ev) 408 408 { 409 409 XEvent xevent; -
libcaca/trunk/caca/event.c
r773 r777 27 27 #include "caca_internals.h" 28 28 29 static int _get_next_event(caca_t *, struct caca_event *);30 static int _lowlevel_event(caca_t *, struct caca_event *);29 static int _get_next_event(caca_t *, caca_event_t *); 30 static int _lowlevel_event(caca_t *, caca_event_t *); 31 31 32 32 #if !defined(_DOXYGEN_SKIP_ME) … … 58 58 */ 59 59 int caca_get_event(caca_t *kk, unsigned int event_mask, 60 struct caca_event *ev, int timeout)61 { 62 struct caca_timertimer;60 caca_event_t *ev, int timeout) 61 { 62 caca_timer_t timer; 63 63 int usec = 0; 64 64 … … 142 142 */ 143 143 144 static int _get_next_event(caca_t *kk, struct caca_event *ev)144 static int _get_next_event(caca_t *kk, caca_event_t *ev) 145 145 { 146 146 #if defined(USE_SLANG) || defined(USE_NCURSES) … … 224 224 } 225 225 226 static int _lowlevel_event(caca_t *kk, struct caca_event *ev)226 static int _lowlevel_event(caca_t *kk, caca_event_t *ev) 227 227 { 228 228 #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) … … 237 237 238 238 #if defined(USE_SLANG) || defined(USE_NCURSES) || defined(USE_CONIO) || defined(USE_GL) 239 void _push_event(caca_t *kk, struct caca_event *ev)239 void _push_event(caca_t *kk, caca_event_t *ev) 240 240 { 241 241 if(!ev->type || kk->events.queue == EVENTBUF_LEN) … … 245 245 } 246 246 247 int _pop_event(caca_t *kk, struct caca_event *ev)247 int _pop_event(caca_t *kk, caca_event_t *ev) 248 248 { 249 249 int i; -
libcaca/trunk/caca/time.c
r769 r777 46 46 } 47 47 48 unsigned int _caca_getticks( struct caca_timer*timer)48 unsigned int _caca_getticks(caca_timer_t *timer) 49 49 { 50 50 #if defined(HAVE_GETTIMEOFDAY) -
libcaca/trunk/cucul/cucul.c
r773 r777 73 73 } 74 74 75 /** \brief Load a memory area into a canvas. 76 * 77 * This function loads a memory area containing an exported canvas into 78 * a new \e libcucul canvas. 79 * 80 * \param data The memory area to be loaded into a canvas. 81 * \param size The length of the memory area. 82 * \return A libcucul canvas, or NULL in case of error. 83 */ 75 84 cucul_t *cucul_load(void *data, unsigned int size) 76 85 { … … 228 237 } 229 238 230 struct cucul_buffer * cucul_create_export(cucul_t *qq, char const *format) 231 { 232 struct cucul_buffer *ex; 233 234 ex = malloc(sizeof(struct cucul_buffer)); 239 /** \brief Export a canvas into a foreign format. 240 * 241 * This function exports a libcucul canvas into various foreign formats such 242 * as ANSI art, HTML, IRC colours, etc. One should use cucul_get_buffer_data() 243 * and cucul_get_buffer_size() to access the buffer contents. The allocated 244 * data is valid until cucul_free_buffer() is called. 245 * 246 * Valid values for \e format are: 247 * 248 * \li \e "ansi": export ANSI art (CP437 charset with ANSI colour codes). 249 * 250 * \li \e "html": export an HTML page with CSS information. 251 * 252 * \li \e "html3": export an HTML table that should be compatible with 253 * most navigators, including textmode ones. 254 * 255 * \li \e "irc": export UTF-8 text with mIRC colour codes. 256 * 257 * \li \e "ps": export a PostScript document. 258 * 259 * \li \e "svg": export an SVG document. 260 * 261 * \param qq A libcucul canvas 262 * \param format A string describing the requested output format. 263 */ 264 cucul_buffer_t * cucul_create_export(cucul_t *qq, char const *format) 265 { 266 cucul_buffer_t *ex; 267 268 ex = malloc(sizeof(cucul_buffer_t)); 235 269 236 270 if(!strcasecmp("ansi", format)) … … 280 314 } 281 315 282 void cucul_free_export(struct cucul_buffer *ex) 283 { 284 free(ex->data); 285 free(ex); 316 /** \brief Get the buffer size. 317 * 318 * This function returns the length (in bytes) of the memory area stored 319 * in the given \e libcucul buffer. 320 * 321 * \param buf A \e libcucul buffer 322 * \return The buffer data length. 323 */ 324 unsigned long int cucul_get_buffer_size(cucul_buffer_t *buf) 325 { 326 return buf->size; 327 } 328 329 /** \brief Get the buffer data. 330 * 331 * This function returns a pointer to the memory area stored in the given 332 * \e libcucul buffer. 333 * 334 * \param buf A \e libcucul buffer 335 * \return A pointer to the buffer memory area. 336 */ 337 void * cucul_get_buffer_data(cucul_buffer_t *buf) 338 { 339 return buf->data; 340 } 341 342 /** \brief Free a buffer. 343 * 344 * This function frees the structures associated with the given 345 * \e libcucul buffer. 346 * 347 * \param buf A \e libcucul buffer 348 */ 349 void cucul_free_buffer(cucul_buffer_t *buf) 350 { 351 free(buf->data); 352 free(buf); 286 353 } 287 354 -
libcaca/trunk/cucul/cucul.h
r773 r777 32 32 #endif 33 33 34 typedef struct cucul_context cucul_t; 35 36 struct cucul_buffer 37 { 38 unsigned int size; 39 char *data; 40 }; 34 /** \e libcucul context */ 35 typedef struct cucul cucul_t; 36 /** sprite structure */ 37 typedef struct cucul_sprite cucul_sprite_t; 38 /** dither structure */ 39 typedef struct cucul_dither cucul_dither_t; 40 /** data buffer structure */ 41 typedef struct cucul_buffer cucul_buffer_t; 42 /** font structure */ 43 typedef struct cucul_font cucul_font_t; 41 44 42 45 /** \defgroup colour Colour definitions … … 65 68 /* @} */ 66 69 67 /** \defgroup basic Basicfunctions70 /** \defgroup cucul Basic libcucul functions 68 71 * 69 72 * These functions provide the basic \e libcaca routines for library … … 77 80 unsigned int cucul_get_height(cucul_t *); 78 81 void cucul_free(cucul_t *); 82 /* @} */ 83 84 /** \defgroup buffer Buffer handling 85 * 86 * These functions provide methods to handle libcucul buffers. 87 * 88 * @{ */ 89 unsigned long int cucul_get_buffer_size(cucul_buffer_t *); 90 void * cucul_get_buffer_data(cucul_buffer_t *); 91 void cucul_free_buffer(cucul_buffer_t *); 79 92 /* @} */ 80 93 … … 145 158 * 146 159 * @{ */ 147 struct cucul_sprite; 148 struct cucul_sprite * cucul_load_sprite(char const *); 149 int cucul_get_sprite_frames(struct cucul_sprite const *); 150 int cucul_get_sprite_width(struct cucul_sprite const *, int); 151 int cucul_get_sprite_height(struct cucul_sprite const *, int); 152 int cucul_get_sprite_dx(struct cucul_sprite const *, int); 153 int cucul_get_sprite_dy(struct cucul_sprite const *, int); 154 void cucul_draw_sprite(cucul_t *, int, int, struct cucul_sprite const *, int); 155 void cucul_free_sprite(struct cucul_sprite *); 160 cucul_sprite_t * cucul_load_sprite(char const *); 161 int cucul_get_sprite_frames(cucul_sprite_t const *); 162 int cucul_get_sprite_width(cucul_sprite_t const *, int); 163 int cucul_get_sprite_height(cucul_sprite_t const *, int); 164 int cucul_get_sprite_dx(cucul_sprite_t const *, int); 165 int cucul_get_sprite_dy(cucul_sprite_t const *, int); 166 void cucul_draw_sprite(cucul_t *, int, int, cucul_sprite_t const *, int); 167 void cucul_free_sprite(cucul_sprite_t *); 156 168 /* @} */ 157 169 … … 162 174 * 163 175 * @{ */ 164 struct cucul_dither; 165 struct cucul_dither *cucul_create_dither(unsigned int, unsigned int, 176 cucul_dither_t *cucul_create_dither(unsigned int, unsigned int, 166 177 unsigned int, unsigned int, 167 178 unsigned int, unsigned int, 168 179 unsigned int, unsigned int); 169 void cucul_set_dither_palette( struct cucul_dither*,180 void cucul_set_dither_palette(cucul_dither_t *, 170 181 unsigned int r[], unsigned int g[], 171 182 unsigned int b[], unsigned int a[]); 172 void cucul_set_dither_brightness( struct cucul_dither*, float);173 void cucul_set_dither_gamma( struct cucul_dither*, float);174 void cucul_set_dither_contrast( struct cucul_dither*, float);175 void cucul_set_dither_invert( struct cucul_dither*, int);176 void cucul_set_dither_antialias( struct cucul_dither*, char const *);177 char const * const * cucul_get_dither_antialias_list( struct cucul_ditherconst *);178 void cucul_set_dither_color( struct cucul_dither*, char const *);179 char const * const * cucul_get_dither_color_list( struct cucul_ditherconst *);180 void cucul_set_dither_charset( struct cucul_dither*, char const *);181 char const * const * cucul_get_dither_charset_list( struct cucul_ditherconst *);182 void cucul_set_dither_mode( struct cucul_dither*, char const *);183 char const * const * cucul_get_dither_mode_list( struct cucul_ditherconst *);183 void cucul_set_dither_brightness(cucul_dither_t *, float); 184 void cucul_set_dither_gamma(cucul_dither_t *, float); 185 void cucul_set_dither_contrast(cucul_dither_t *, float); 186 void cucul_set_dither_invert(cucul_dither_t *, int); 187 void cucul_set_dither_antialias(cucul_dither_t *, char const *); 188 char const * const * cucul_get_dither_antialias_list(cucul_dither_t const *); 189 void cucul_set_dither_color(cucul_dither_t *, char const *); 190 char const * const * cucul_get_dither_color_list(cucul_dither_t const *); 191 void cucul_set_dither_charset(cucul_dither_t *, char const *); 192 char const * const * cucul_get_dither_charset_list(cucul_dither_t const *); 193 void cucul_set_dither_mode(cucul_dither_t *, char const *); 194 char const * const * cucul_get_dither_mode_list(cucul_dither_t const *); 184 195 void cucul_dither_bitmap(cucul_t *, int, int, int, int, 185 struct cucul_ditherconst *, void *);186 void cucul_free_dither( struct cucul_dither*);196 cucul_dither_t const *, void *); 197 void cucul_free_dither(cucul_dither_t *); 187 198 /* @} */ 188 199 … … 193 204 * 194 205 * @{ */ 195 struct cucul_font; 196 struct cucul_font *cucul_load_font(void const *, unsigned int); 206 cucul_font_t *cucul_load_font(void const *, unsigned int); 197 207 char const * const * cucul_get_font_list(void); 198 unsigned int cucul_get_font_width( struct cucul_font *);199 unsigned int cucul_get_font_height( struct cucul_font *);200 void cucul_render_canvas(cucul_t *, struct cucul_font *, unsigned char *,208 unsigned int cucul_get_font_width(cucul_font_t *); 209 unsigned int cucul_get_font_height(cucul_font_t *); 210 void cucul_render_canvas(cucul_t *, cucul_font_t *, unsigned char *, 201 211 unsigned int, unsigned int, unsigned int); 202 void cucul_free_font( struct cucul_font *);212 void cucul_free_font(cucul_font_t *); 203 213 /* @} */ 204 214 … … 206 216 * 207 217 * These functions export the current canvas to various text formats. It 208 * is necessary to call cucul_free_ export() to dispose of the data.209 * 210 * @{ */ 211 struct cucul_buffer* cucul_create_export(cucul_t *, char const *);218 * is necessary to call cucul_free_buffer() to dispose of the data. 219 * 220 * @{ */ 221 cucul_buffer_t * cucul_create_export(cucul_t *, char const *); 212 222 char const * const * cucul_get_export_list(void); 213 void cucul_free_export(struct cucul_buffer *);214 223 /* @} */ 215 224 -
libcaca/trunk/cucul/cucul_internals.h
r769 r777 26 26 #endif 27 27 28 struct cucul _context28 struct cucul 29 29 { 30 30 /* Context size */ … … 39 39 40 40 unsigned int refcount; 41 }; 42 43 struct cucul_buffer 44 { 45 unsigned long int size; 46 char *data; 41 47 }; 42 48 … … 63 69 64 70 /* Export functions */ 65 extern void _cucul_get_ansi(cucul_t *, struct cucul_buffer*);66 extern void _cucul_get_html(cucul_t *, struct cucul_buffer*);67 extern void _cucul_get_html3(cucul_t *, struct cucul_buffer*);68 extern void _cucul_get_irc(cucul_t *, struct cucul_buffer*);69 extern void _cucul_get_ps(cucul_t *, struct cucul_buffer*);70 extern void _cucul_get_svg(cucul_t *, struct cucul_buffer*);71 extern void _cucul_get_ansi(cucul_t *, cucul_buffer_t *); 72 extern void _cucul_get_html(cucul_t *, cucul_buffer_t *); 73 extern void _cucul_get_html3(cucul_t *, cucul_buffer_t *); 74 extern void _cucul_get_irc(cucul_t *, cucul_buffer_t *); 75 extern void _cucul_get_ps(cucul_t *, cucul_buffer_t *); 76 extern void _cucul_get_svg(cucul_t *, cucul_buffer_t *); 71 77 72 78 #endif /* __CUCUL_INTERNALS_H__ */ -
libcaca/trunk/cucul/dither.c
r773 r777 119 119 int rright, gright, bright, aright; 120 120 int rleft, gleft, bleft, aleft; 121 void (*get_hsv)( struct cucul_dither*, char *, int, int);121 void (*get_hsv)(cucul_dither_t *, char *, int, int); 122 122 int red[256], green[256], blue[256], alpha[256]; 123 123 float gamma; … … 164 164 static float gammapow(float x, float y); 165 165 166 static void get_rgba_default( struct cucul_ditherconst *, uint8_t *, int, int,166 static void get_rgba_default(cucul_dither_t const *, uint8_t *, int, int, 167 167 unsigned int *); 168 168 … … 246 246 * \return Dither object, or NULL upon error. 247 247 */ 248 struct cucul_dither*cucul_create_dither(unsigned int bpp, unsigned int w,249 250 251 252 { 253 struct cucul_dither*d;248 cucul_dither_t *cucul_create_dither(unsigned int bpp, unsigned int w, 249 unsigned int h, unsigned int pitch, 250 unsigned int rmask, unsigned int gmask, 251 unsigned int bmask, unsigned int amask) 252 { 253 cucul_dither_t *d; 254 254 int i; 255 255 … … 258 258 return NULL; 259 259 260 d = malloc(sizeof( struct cucul_dither));260 d = malloc(sizeof(cucul_dither_t)); 261 261 if(!d) 262 262 return NULL; … … 331 331 * \param alpha Array of 256 alpha values. 332 332 */ 333 void cucul_set_dither_palette( struct cucul_dither*d,333 void cucul_set_dither_palette(cucul_dither_t *d, 334 334 unsigned int red[], unsigned int green[], 335 335 unsigned int blue[], unsigned int alpha[]) … … 368 368 * \param brightness brightness value. 369 369 */ 370 void cucul_set_dither_brightness( struct cucul_dither*d, float brightness)370 void cucul_set_dither_brightness(cucul_dither_t *d, float brightness) 371 371 { 372 372 /* FIXME */ … … 380 380 * \param gamma Gamma value. 381 381 */ 382 void cucul_set_dither_gamma( struct cucul_dither*d, float gamma)382 void cucul_set_dither_gamma(cucul_dither_t *d, float gamma) 383 383 { 384 384 /* FIXME: we don't need 4096 calls to gammapow(), we can just compute … … 403 403 * \param value 0 for normal behaviour, 1 for invert 404 404 */ 405 void cucul_set_dither_invert( struct cucul_dither*d, int value)405 void cucul_set_dither_invert(cucul_dither_t *d, int value) 406 406 { 407 407 d->invert = value ? 1 : 0; … … 415 415 * \param contrast contrast value. 416 416 */ 417 void cucul_set_dither_contrast( struct cucul_dither*d, float contrast)417 void cucul_set_dither_contrast(cucul_dither_t *d, float contrast) 418 418 { 419 419 /* FIXME */ … … 434 434 * for the dithering. 435 435 */ 436 void cucul_set_dither_antialias( struct cucul_dither*d, char const *str)436 void cucul_set_dither_antialias(cucul_dither_t *d, char const *str) 437 437 { 438 438 if(!strcasecmp(str, "none")) … … 454 454 */ 455 455 char const * const * 456 cucul_get_dither_antialias_list( struct cucul_ditherconst *d)456 cucul_get_dither_antialias_list(cucul_dither_t const *d) 457 457 { 458 458 static char const * const list[] = … … 492 492 * for the dithering. 493 493 */ 494 void cucul_set_dither_color( struct cucul_dither*d, char const *str)494 void cucul_set_dither_color(cucul_dither_t *d, char const *str) 495 495 { 496 496 if(!strcasecmp(str, "mono")) … … 522 522 */ 523 523 char const * const * 524 cucul_get_dither_color_list( struct cucul_ditherconst *d)524 cucul_get_dither_color_list(cucul_dither_t const *d) 525 525 { 526 526 static char const * const list[] = … … 557 557 * for the dithering. 558 558 */ 559 void cucul_set_dither_charset( struct cucul_dither*d, char const *str)559 void cucul_set_dither_charset(cucul_dither_t *d, char const *str) 560 560 { 561 561 if(!strcasecmp(str, "shades")) … … 587 587 * \return An array of strings. 588 588 */ 589 char const * const * 590 cucul_get_dither_charset_list(struct cucul_dither const *d) 589 char const * const * cucul_get_dither_charset_list(cucul_dither_t const *d) 591 590 { 592 591 static char const * const list[] = … … 623 622 * for the dithering. 624 623 */ 625 void cucul_set_dither_mode( struct cucul_dither*d, char const *str)624 void cucul_set_dither_mode(cucul_dither_t *d, char const *str) 626 625 { 627 626 if(!strcasecmp(str, "none")) … … 674 673 * \return An array of strings. 675 674 */ 676 char const * const * 677 cucul_get_dither_mode_list(struct cucul_dither const *d) 675 char const * const * cucul_get_dither_mode_list(cucul_dither_t const *d) 678 676 { 679 677 static char const * const list[] = … … 705 703 */ 706 704 void cucul_dither_bitmap(cucul_t *qq, int x1, int y1, int x2, int y2, 707 struct cucul_ditherconst *d, void *pixels)705 cucul_dither_t const *d, void *pixels) 708 706 { 709 707 int *floyd_steinberg, *fs_r, *fs_g, *fs_b; … … 956 954 * \param d Dither object. 957 955 */ 958 void cucul_free_dither( struct cucul_dither*d)956 void cucul_free_dither(cucul_dither_t *d) 959 957 { 960 958 if(!d) … … 1057 1055 } 1058 1056 1059 static void get_rgba_default( struct cucul_ditherconst *d, uint8_t *pixels,1057 static void get_rgba_default(cucul_dither_t const *d, uint8_t *pixels, 1060 1058 int x, int y, unsigned int *rgba) 1061 1059 { -
libcaca/trunk/cucul/export_ansi.c
r769 r777 36 36 * \return buffer containing generated ANSI codes as a big string 37 37 */ 38 void _cucul_get_ansi(cucul_t *qq, struct cucul_buffer*ex)38 void _cucul_get_ansi(cucul_t *qq, cucul_buffer_t *ex) 39 39 { 40 40 static int const palette[] = -
libcaca/trunk/cucul/export_html.c
r769 r777 33 33 * the current image. 34 34 */ 35 void _cucul_get_html(cucul_t *qq, struct cucul_buffer*ex)35 void _cucul_get_html(cucul_t *qq, cucul_buffer_t *ex) 36 36 { 37 37 static int const palette[] = … … 112 112 * a correct header. 113 113 */ 114 void _cucul_get_html3(cucul_t *qq, struct cucul_buffer*ex)114 void _cucul_get_html3(cucul_t *qq, cucul_buffer_t *ex) 115 115 { 116 116 static int const palette[] = -
libcaca/trunk/cucul/export_irc.c
r769 r777 33 33 * the current image. 34 34 */ 35 void _cucul_get_irc(cucul_t *qq, struct cucul_buffer*ex)35 void _cucul_get_irc(cucul_t *qq, cucul_buffer_t *ex) 36 36 { 37 37 static int const palette[] = -
libcaca/trunk/cucul/export_ps.c
r769 r777 58 58 * the current image. 59 59 */ 60 void _cucul_get_ps(cucul_t *qq, struct cucul_buffer*ex)60 void _cucul_get_ps(cucul_t *qq, cucul_buffer_t *ex) 61 61 { 62 62 static char const * const palette[] = -
libcaca/trunk/cucul/export_svg.c
r769 r777 43 43 * the current image. 44 44 */ 45 void _cucul_get_svg(cucul_t *qq, struct cucul_buffer*ex)45 void _cucul_get_svg(cucul_t *qq, cucul_buffer_t *ex) 46 46 { 47 47 static int const palette[] = -
libcaca/trunk/cucul/font.c
r775 r777 107 107 * \return A font handle or NULL in case of error. 108 108 */ 109 struct cucul_font *cucul_load_font(void const *data, unsigned int size)110 { 111 struct cucul_font *f;109 cucul_font_t *cucul_load_font(void const *data, unsigned int size) 110 { 111 cucul_font_t *f; 112 112 unsigned int i; 113 113 … … 125 125 return NULL; 126 126 127 f = malloc(sizeof( struct cucul_font));127 f = malloc(sizeof(cucul_font_t)); 128 128 f->private = (void *)(uintptr_t)data; 129 129 … … 222 222 * \return The maximum glyph width. 223 223 */ 224 unsigned int cucul_get_font_width( struct cucul_font *f)224 unsigned int cucul_get_font_width(cucul_font_t *f) 225 225 { 226 226 return f->header.width; … … 234 234 * \return The maximum glyph height. 235 235 */ 236 unsigned int cucul_get_font_height( struct cucul_font *f)236 unsigned int cucul_get_font_height(cucul_font_t *f) 237 237 { 238 238 return f->header.height; … … 248 248 * \param f The font, as returned by \e cucul_load_font() 249 249 */ 250 void cucul_free_font( struct cucul_font *f)250 void cucul_free_font(cucul_font_t *f) 251 251 { 252 252 free(f->glyph_list); … … 274 274 * \param pitch The pitch (in bytes) of an image buffer line. 275 275 */ 276 void cucul_render_canvas(cucul_t *qq, struct cucul_font *f,276 void cucul_render_canvas(cucul_t *qq, cucul_font_t *f, 277 277 unsigned char *buf, unsigned int width, 278 278 unsigned int height, unsigned int pitch) -
libcaca/trunk/cucul/sprite.c
r773 r777 48 48 * \return The sprite, or NULL if an error occured. 49 49 */ 50 struct cucul_sprite*cucul_load_sprite(char const *file)50 cucul_sprite_t *cucul_load_sprite(char const *file) 51 51 { 52 52 char buf[BUFSIZ]; 53 struct cucul_sprite*sprite;53 cucul_sprite_t *sprite; 54 54 FILE *fd; 55 55 … … 58 58 return NULL; 59 59 60 sprite = malloc(sizeof( struct cucul_sprite));60 sprite = malloc(sizeof(cucul_sprite_t)); 61 61 if(sprite == NULL) 62 62 goto sprite_alloc_failed; … … 168 168 * \return The number of frames. 169 169 */ 170 int cucul_get_sprite_frames( struct cucul_spriteconst *sprite)170 int cucul_get_sprite_frames(cucul_sprite_t const *sprite) 171 171 { 172 172 if(sprite == NULL) … … 182 182 * \return The width of the given frame of the sprite. 183 183 */ 184 int cucul_get_sprite_width( struct cucul_spriteconst *sprite, int f)184 int cucul_get_sprite_width(cucul_sprite_t const *sprite, int f) 185 185 { 186 186 if(sprite == NULL) … … 199 199 * \return The height of the given frame of the sprite. 200 200 */ 201 int cucul_get_sprite_height( struct cucul_spriteconst *sprite, int f)201 int cucul_get_sprite_height(cucul_sprite_t const *sprite, int f) 202 202 { 203 203 if(sprite == NULL) … … 216 216 * \return The X coordinate of the given frame's handle. 217 217 */ 218 int cucul_get_sprite_dx( struct cucul_spriteconst *sprite, int f)218 int cucul_get_sprite_dx(cucul_sprite_t const *sprite, int f) 219 219 { 220 220 if(sprite == NULL) … … 233 233 * \return The Y coordinate of the given frame's handle. 234 234 */ 235 int cucul_get_sprite_dy( struct cucul_spriteconst *sprite, int f)235 int cucul_get_sprite_dy(cucul_sprite_t const *sprite, int f) 236 236 { 237 237 if(sprite == NULL) … … 254 254 * \return void 255 255 */ 256 void cucul_draw_sprite(cucul_t *qq, int x, int y, struct cucul_spriteconst *sprite, int f)256 void cucul_draw_sprite(cucul_t *qq, int x, int y, cucul_sprite_t const *sprite, int f) 257 257 { 258 258 int i, j; … … 293 293 * \return void 294 294 */ 295 void cucul_free_sprite( struct cucul_sprite*sprite)295 void cucul_free_sprite(cucul_sprite_t *sprite) 296 296 { 297 297 int i; -
libcaca/trunk/src/aafire.c
r734 r777 43 43 static caca_t *kk; 44 44 static int XSIZ, YSIZ; 45 static struct cucul_dither*cucul_dither;45 static cucul_dither_t *cucul_dither; 46 46 static char *bitmap; 47 47 static int pause = 0; … … 266 266 { 267 267 #ifdef LIBCACA 268 struct caca_event ev;268 caca_event_t ev; 269 269 if(caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, 0)) 270 270 { -
libcaca/trunk/src/cacaball.c
r734 r777 47 47 float d[METABALLS], di[METABALLS], dj[METABALLS], dk[METABALLS]; 48 48 unsigned int x[METABALLS], y[METABALLS]; 49 struct cucul_dither*cucul_dither;49 cucul_dither_t *cucul_dither; 50 50 float i = 10.0, j = 17.0, k = 11.0; 51 51 int p, frame = 0, pause = 0; … … 93 93 for(;;) 94 94 { 95 struct caca_event ev;95 caca_event_t ev; 96 96 if(caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, 0)) 97 97 { -
libcaca/trunk/src/cacamoir.c
r734 r777 40 40 cucul_t *qq; caca_t *kk; 41 41 unsigned int red[256], green[256], blue[256], alpha[256]; 42 struct cucul_dither*dither;42 cucul_dither_t *dither; 43 43 int i, x, y, frame = 0, pause = 0; 44 44 … … 69 69 for(;;) 70 70 { 71 struct caca_event ev;71 caca_event_t ev; 72 72 if(caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, 0)) 73 73 { -
libcaca/trunk/src/cacaplas.c
r769 r777 44 44 unsigned int red[256], green[256], blue[256], alpha[256]; 45 45 double r[3], R[6]; 46 struct cucul_dither*dither;46 cucul_dither_t *dither; 47 47 int i, x, y, frame = 0, pause = 0; 48 48 … … 85 85 for(;;) 86 86 { 87 struct caca_event ev;87 caca_event_t ev; 88 88 if(caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, 0)) 89 89 { -
libcaca/trunk/src/cacaplay.c
r710 r777 27 27 { 28 28 struct stat statbuf; 29 struct caca_event ev;29 caca_event_t ev; 30 30 cucul_t *qq; 31 31 caca_t *kk; -
libcaca/trunk/src/cacaserver.c
r769 r777 106 106 107 107 cucul_t *qq; 108 struct cucul_buffer *ex; 108 cucul_buffer_t *buffer; 109 unsigned long int buflen; 110 void *bufdata; 109 111 110 112 int client_count; … … 184 186 185 187 server->qq = NULL; 186 server-> ex= NULL;188 server->buffer = NULL; 187 189 188 190 /* Ignore SIGPIPE */ … … 231 233 232 234 /* Free the previous export buffer, if any */ 233 if(server-> ex)234 { 235 cucul_free_ export(server->ex);236 server-> ex= NULL;235 if(server->buffer) 236 { 237 cucul_free_buffer(server->buffer); 238 server->buffer = NULL; 237 239 } 238 240 239 241 /* Get ANSI representation of the image and skip the end-of buffer 240 242 * linefeed ("\r\n\0", 3 bytes) */ 241 server-> ex= cucul_create_export(server->qq, "ansi");242 server-> ex->size-= 3;243 server->buffer = cucul_create_export(server->qq, "ansi"); 244 server->buflen -= 3; 243 245 244 246 for(i = 0; i < server->client_count; i++) … … 267 269 } 268 270 269 if(server-> ex)270 cucul_free_ export(server->ex);271 if(server->buffer) 272 cucul_free_buffer(server->buffer); 271 273 272 274 /* Restore SIGPIPE handler */ … … 396 398 397 399 /* No error, there's just nothing to send yet */ 398 if(!server-> ex)400 if(!server->buffer) 399 401 return 0; 400 402 … … 421 423 c->start += ret; 422 424 423 if(c->stop - c->start + strlen(ANSI_PREFIX) + server-> ex->size425 if(c->stop - c->start + strlen(ANSI_PREFIX) + server->buflen 424 426 > OUTBUFFER) 425 427 { … … 432 434 433 435 /* Need to move? */ 434 if(c->stop + strlen(ANSI_PREFIX) + server-> ex->size> OUTBUFFER)436 if(c->stop + strlen(ANSI_PREFIX) + server->buflen > OUTBUFFER) 435 437 { 436 438 memmove(c->outbuf, c->outbuf + c->start, c->stop - c->start); … … 441 443 memcpy(c->outbuf + c->stop, ANSI_PREFIX, strlen(ANSI_PREFIX)); 442 444 c->stop += strlen(ANSI_PREFIX); 443 memcpy(c->outbuf + c->stop, server-> ex->data, server->ex->size);444 c->stop += server-> ex->size;445 memcpy(c->outbuf + c->stop, server->bufdata, server->buflen); 446 c->stop += server->buflen; 445 447 446 448 return 0; … … 462 464 if(ret < (ssize_t)strlen(ANSI_PREFIX)) 463 465 { 464 if(strlen(ANSI_PREFIX) + server-> ex->size> OUTBUFFER)466 if(strlen(ANSI_PREFIX) + server->buflen > OUTBUFFER) 465 467 { 466 468 /* Overflow! Empty buffer and start again */ … … 473 475 memcpy(c->outbuf, ANSI_PREFIX, strlen(ANSI_PREFIX) - ret); 474 476 c->stop = strlen(ANSI_PREFIX) - ret; 475 memcpy(c->outbuf + c->stop, server-> ex->data, server->ex->size);476 c->stop += server-> ex->size;477 memcpy(c->outbuf + c->stop, server->bufdata, server->buflen); 478 c->stop += server->buflen; 477 479 478 480 return 0; … … 480 482 481 483 /* Send actual data */ 482 ret = nonblock_write(c->fd, server-> ex->data, server->ex->size);484 ret = nonblock_write(c->fd, server->bufdata, server->buflen); 483 485 if(ret == -1) 484 486 { … … 489 491 } 490 492 491 if(ret < (int)server-> ex->size)492 { 493 if(server-> ex->size> OUTBUFFER)493 if(ret < (int)server->buflen) 494 { 495 if(server->buflen > OUTBUFFER) 494 496 { 495 497 /* Overflow! Empty buffer and start again */ … … 500 502 } 501 503 502 memcpy(c->outbuf, server-> ex->data, server->ex->size- ret);503 c->stop = server-> ex->size- ret;504 memcpy(c->outbuf, server->bufdata, server->buflen - ret); 505 c->stop = server->buflen - ret; 504 506 505 507 return 0; -
libcaca/trunk/src/cacaview.c
r769 r777 124 124 while(!quit) 125 125 { 126 struct caca_event ev;126 caca_event_t ev; 127 127 unsigned int const event_mask = CACA_EVENT_KEY_PRESS 128 128 | CACA_EVENT_RESIZE -
libcaca/trunk/src/img2irc.c
r757 r777 25 25 /* libcucul context */ 26 26 cucul_t *qq; 27 struct cucul_buffer*export;27 cucul_buffer_t *export; 28 28 struct image *i; 29 29 int cols = 56, lines; … … 60 60 61 61 export = cucul_create_export(qq, "irc"); 62 fwrite(export->data, export->size, 1, stdout); 63 cucul_free_export(export); 62 fwrite(cucul_get_buffer_data(export), 63 cucul_get_buffer_size(export), 1, stdout); 64 cucul_free_buffer(export); 64 65 65 66 cucul_free(qq); -
libcaca/trunk/test/colors.c
r710 r777 25 25 cucul_t *qq; 26 26 caca_t *kk; 27 struct caca_event ev;27 caca_event_t ev; 28 28 int i, j; 29 29 -
libcaca/trunk/test/demo.c
r774 r777 36 36 int outline = 0; 37 37 int dithering = 0; 38 struct cucul_sprite*sprite = NULL;38 cucul_sprite_t *sprite = NULL; 39 39 40 40 cucul_t *qq; … … 72 72 while(!quit) 73 73 { 74 struct caca_event ev;74 caca_event_t ev; 75 75 int menu = 0, mouse = 0, xmouse = 0, ymouse = 0; 76 76 … … 484 484 static void demo_render(void) 485 485 { 486 struct cucul_dither*dither;486 cucul_dither_t *dither; 487 487 //short buffer[256*256]; 488 488 //short *dest = buffer; … … 514 514 static void demo_render(void) 515 515 { 516 struct cucul_dither*dither;516 cucul_dither_t *dither; 517 517 int buffer[256*256]; 518 518 int *dest; -
libcaca/trunk/test/dithering.c
r733 r777 35 35 int main(void) 36 36 { 37 struct caca_event ev;37 caca_event_t ev; 38 38 cucul_t *qq; 39 39 caca_t *kk; -
libcaca/trunk/test/event.c
r710 r777 24 24 static caca_t *kk; 25 25 26 static void print_event(int, int, struct caca_event *);26 static void print_event(int, int, caca_event_t *); 27 27 28 28 int main(int argc, char **argv) 29 29 { 30 struct caca_event *events;30 caca_event_t *events; 31 31 int i, h, quit; 32 32 … … 48 48 caca_display(kk); 49 49 50 events = malloc(h * sizeof( struct caca_event));51 memset(events, 0, h * sizeof( struct caca_event));50 events = malloc(h * sizeof(caca_event_t)); 51 memset(events, 0, h * sizeof(caca_event_t)); 52 52 53 53 for(quit = 0; quit < 4; ) 54 54 { 55 struct caca_event ev;55 caca_event_t ev; 56 56 static char const * quit_string[] = { "", "q", "qu", "qui", "quit" }; 57 57 int ret = caca_get_event(kk, CACA_EVENT_ANY, &ev, -1); … … 75 75 } 76 76 77 memmove(events + 1, events, (h - 1) * sizeof( struct caca_event));77 memmove(events + 1, events, (h - 1) * sizeof(caca_event_t)); 78 78 events[0] = ev; 79 79 … … 107 107 } 108 108 109 static void print_event(int x, int y, struct caca_event *ev)109 static void print_event(int x, int y, caca_event_t *ev) 110 110 { 111 111 int character; -
libcaca/trunk/test/export.c
r757 r777 36 36 { 37 37 cucul_t *qq; 38 struct cucul_dither*dither;39 struct cucul_buffer*buffer;38 cucul_dither_t *dither; 39 cucul_buffer_t *buffer; 40 40 int x, y; 41 41 … … 91 91 92 92 buffer = cucul_create_export(qq, argv[1]); 93 fwrite(buffer->data, buffer->size, 1, stdout); 94 cucul_free_export(buffer); 93 fwrite(cucul_get_buffer_data(buffer), 94 cucul_get_buffer_size(buffer), 1, stdout); 95 cucul_free_buffer(buffer); 95 96 96 97 cucul_free(qq); -
libcaca/trunk/test/font.c
r767 r777 37 37 cucul_t *qq; 38 38 caca_t *kk; 39 struct cucul_font *f;40 struct cucul_dither*d;41 struct caca_event ev;39 cucul_font_t *f; 40 cucul_dither_t *d; 41 caca_event_t ev; 42 42 unsigned char *buf; 43 43 unsigned int w, h; -
libcaca/trunk/test/gamma.c
r734 r777 34 34 int main(void) 35 35 { 36 struct caca_event ev;36 caca_event_t ev; 37 37 cucul_t *qq, *gg, *mask; 38 38 caca_t *kk; 39 struct cucul_dither*left, *right;39 cucul_dither_t *left, *right; 40 40 float gam = 1.0; 41 41 int x; -
libcaca/trunk/test/hsv.c
r766 r777 29 29 int main(void) 30 30 { 31 struct caca_event ev;31 caca_event_t ev; 32 32 cucul_t *qq; 33 33 caca_t *kk; 34 34 35 struct cucul_dither*dither;35 cucul_dither_t *dither; 36 36 int x, y; 37 37 -
libcaca/trunk/test/spritedit.c
r774 r777 27 27 28 28 int quit = 0; 29 struct cucul_sprite*sprite;29 cucul_sprite_t *sprite; 30 30 int frame = 0; 31 31 unsigned char play = 0; … … 58 58 while(!quit) 59 59 { 60 struct caca_event ev;60 caca_event_t ev; 61 61 int xa, ya, xb, yb; 62 62 char buf[BUFSIZ]; -
libcaca/trunk/test/transform.c
r710 r777 50 50 int main(void) 51 51 { 52 struct caca_event ev;52 caca_event_t ev; 53 53 cucul_t *qq, *normal, *flip, *flop, *rotate; 54 54 caca_t *kk; -
libcaca/trunk/test/unicode.c
r710 r777 27 27 int main(void) 28 28 { 29 struct caca_event ev;29 caca_event_t ev; 30 30 cucul_t *qq; 31 31 caca_t *kk;
Note: See TracChangeset
for help on using the changeset viewer.