Changeset 2821 for libcaca/trunk/caca/frame.c
- Timestamp:
- Sep 27, 2008, 3:12:46 PM (12 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/frame.c
r2819 r2821 1 1 /* 2 * libc ucul Canvas for ultrafast compositing of Unicode letters2 * libcaca Colour ASCII-Art library 3 3 * Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> 4 4 * All Rights Reserved … … 25 25 #endif 26 26 27 #include "c ucul.h"28 #include "c ucul_internals.h"27 #include "caca.h" 28 #include "caca_internals.h" 29 29 30 30 /** \brief Get the number of frames in a canvas. … … 34 34 * This function never fails. 35 35 * 36 * \param cv A libc uculcanvas36 * \param cv A libcaca canvas 37 37 * \return The frame count 38 38 */ 39 int c ucul_get_frame_count(cucul_canvas_t const *cv)39 int caca_get_frame_count(caca_canvas_t const *cv) 40 40 { 41 41 return cv->framecount; … … 46 46 * Set the active canvas frame. All subsequent drawing operations will 47 47 * be performed on that frame. The current painting context set by 48 * c ucul_set_attr() is inherited.48 * caca_set_attr() is inherited. 49 49 * 50 50 * If the frame index is outside the canvas' frame range, nothing happens. … … 53 53 * - \c EINVAL Requested frame is out of range. 54 54 * 55 * \param cv A libc uculcanvas55 * \param cv A libcaca canvas 56 56 * \param id The canvas frame to activate 57 57 * \return 0 in case of success, -1 if an error occurred. 58 58 */ 59 int c ucul_set_frame(cucul_canvas_t *cv, int id)59 int caca_set_frame(caca_canvas_t *cv, int id) 60 60 { 61 61 if(id < 0 || id >= cv->framecount) … … 65 65 } 66 66 67 _c ucul_save_frame_info(cv);67 _caca_save_frame_info(cv); 68 68 cv->frame = id; 69 _c ucul_load_frame_info(cv);69 _caca_load_frame_info(cv); 70 70 71 71 return 0; … … 75 75 * 76 76 * Return the current frame's name. The returned string is valid until 77 * the frame is deleted or c ucul_set_frame_name() is called to change77 * the frame is deleted or caca_set_frame_name() is called to change 78 78 * the frame name again. 79 79 * 80 80 * This function never fails. 81 81 * 82 * \param cv A libc uculcanvas.82 * \param cv A libcaca canvas. 83 83 * \return The current frame's name. 84 84 */ 85 char const *c ucul_get_frame_name(cucul_canvas_t const *cv)85 char const *caca_get_frame_name(caca_canvas_t const *cv) 86 86 { 87 87 return cv->frames[cv->frame].name; … … 97 97 * - \c ENOMEM Not enough memory to allocate new frame. 98 98 * 99 * \param cv A libc uculcanvas.99 * \param cv A libcaca canvas. 100 100 * \param name The name to give to the current frame. 101 101 * \return 0 in case of success, -1 if an error occurred. 102 102 */ 103 int c ucul_set_frame_name(cucul_canvas_t *cv, char const *name)103 int caca_set_frame_name(caca_canvas_t *cv, char const *name) 104 104 { 105 105 char *newname = strdup(name); … … 134 134 * - \c ENOMEM Not enough memory to allocate new frame. 135 135 * 136 * \param cv A libc uculcanvas136 * \param cv A libcaca canvas 137 137 * \param id The index where to insert the new frame 138 138 * \return 0 in case of success, -1 if an error occurred. 139 139 */ 140 int c ucul_create_frame(cucul_canvas_t *cv, int id)140 int caca_create_frame(caca_canvas_t *cv, int id) 141 141 { 142 142 int size = cv->width * cv->height; … … 150 150 cv->framecount++; 151 151 cv->frames = realloc(cv->frames, 152 sizeof(struct c ucul_frame) * cv->framecount);152 sizeof(struct caca_frame) * cv->framecount); 153 153 154 154 for(f = cv->framecount - 1; f > id; f--) … … 194 194 * last frame of the canvas. 195 195 * 196 * \param cv A libc uculcanvas196 * \param cv A libcaca canvas 197 197 * \param id The index of the frame to delete 198 198 * \return 0 in case of success, -1 if an error occurred. 199 199 */ 200 int c ucul_free_frame(cucul_canvas_t *cv, int id)200 int caca_free_frame(caca_canvas_t *cv, int id) 201 201 { 202 202 int f; … … 223 223 cv->framecount--; 224 224 cv->frames = realloc(cv->frames, 225 sizeof(struct c ucul_frame) * cv->framecount);225 sizeof(struct caca_frame) * cv->framecount); 226 226 227 227 if(cv->frame > id) … … 230 230 { 231 231 cv->frame = 0; 232 _c ucul_load_frame_info(cv);232 _caca_load_frame_info(cv); 233 233 } 234 234 … … 240 240 */ 241 241 242 void _c ucul_save_frame_info(cucul_canvas_t *cv)242 void _caca_save_frame_info(caca_canvas_t *cv) 243 243 { 244 244 cv->frames[cv->frame].width = cv->width; … … 248 248 } 249 249 250 void _c ucul_load_frame_info(cucul_canvas_t *cv)250 void _caca_load_frame_info(caca_canvas_t *cv) 251 251 { 252 252 cv->width = cv->frames[cv->frame].width;
Note: See TracChangeset
for help on using the changeset viewer.