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 copied

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/frame.c

    r2819 r2821  
    11/*
    2  *  libcucul      Canvas for ultrafast compositing of Unicode letters
     2 *  libcaca       Colour ASCII-Art library
    33 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
    44 *                All Rights Reserved
     
    2525#endif
    2626
    27 #include "cucul.h"
    28 #include "cucul_internals.h"
     27#include "caca.h"
     28#include "caca_internals.h"
    2929
    3030/** \brief Get the number of frames in a canvas.
     
    3434 *  This function never fails.
    3535 *
    36  *  \param cv A libcucul canvas
     36 *  \param cv A libcaca canvas
    3737 *  \return The frame count
    3838 */
    39 int cucul_get_frame_count(cucul_canvas_t const *cv)
     39int caca_get_frame_count(caca_canvas_t const *cv)
    4040{
    4141    return cv->framecount;
     
    4646 *  Set the active canvas frame. All subsequent drawing operations will
    4747 *  be performed on that frame. The current painting context set by
    48  *  cucul_set_attr() is inherited.
     48 *  caca_set_attr() is inherited.
    4949 *
    5050 *  If the frame index is outside the canvas' frame range, nothing happens.
     
    5353 *  - \c EINVAL Requested frame is out of range.
    5454 *
    55  *  \param cv A libcucul canvas
     55 *  \param cv A libcaca canvas
    5656 *  \param id The canvas frame to activate
    5757 *  \return 0 in case of success, -1 if an error occurred.
    5858 */
    59 int cucul_set_frame(cucul_canvas_t *cv, int id)
     59int caca_set_frame(caca_canvas_t *cv, int id)
    6060{
    6161    if(id < 0 || id >= cv->framecount)
     
    6565    }
    6666
    67     _cucul_save_frame_info(cv);
     67    _caca_save_frame_info(cv);
    6868    cv->frame = id;
    69     _cucul_load_frame_info(cv);
     69    _caca_load_frame_info(cv);
    7070
    7171    return 0;
     
    7575 *
    7676 *  Return the current frame's name. The returned string is valid until
    77  *  the frame is deleted or cucul_set_frame_name() is called to change
     77 *  the frame is deleted or caca_set_frame_name() is called to change
    7878 *  the frame name again.
    7979 *
    8080 *  This function never fails.
    8181 *
    82  *  \param cv A libcucul canvas.
     82 *  \param cv A libcaca canvas.
    8383 *  \return The current frame's name.
    8484 */
    85 char const *cucul_get_frame_name(cucul_canvas_t const *cv)
     85char const *caca_get_frame_name(caca_canvas_t const *cv)
    8686{
    8787    return cv->frames[cv->frame].name;
     
    9797 *  - \c ENOMEM Not enough memory to allocate new frame.
    9898 *
    99  *  \param cv A libcucul canvas.
     99 *  \param cv A libcaca canvas.
    100100 *  \param name The name to give to the current frame.
    101101 *  \return 0 in case of success, -1 if an error occurred.
    102102 */
    103 int cucul_set_frame_name(cucul_canvas_t *cv, char const *name)
     103int caca_set_frame_name(caca_canvas_t *cv, char const *name)
    104104{
    105105    char *newname = strdup(name);
     
    134134 *  - \c ENOMEM Not enough memory to allocate new frame.
    135135 *
    136  *  \param cv A libcucul canvas
     136 *  \param cv A libcaca canvas
    137137 *  \param id The index where to insert the new frame
    138138 *  \return 0 in case of success, -1 if an error occurred.
    139139 */
    140 int cucul_create_frame(cucul_canvas_t *cv, int id)
     140int caca_create_frame(caca_canvas_t *cv, int id)
    141141{
    142142    int size = cv->width * cv->height;
     
    150150    cv->framecount++;
    151151    cv->frames = realloc(cv->frames,
    152                          sizeof(struct cucul_frame) * cv->framecount);
     152                         sizeof(struct caca_frame) * cv->framecount);
    153153
    154154    for(f = cv->framecount - 1; f > id; f--)
     
    194194 *    last frame of the canvas.
    195195 *
    196  *  \param cv A libcucul canvas
     196 *  \param cv A libcaca canvas
    197197 *  \param id The index of the frame to delete
    198198 *  \return 0 in case of success, -1 if an error occurred.
    199199 */
    200 int cucul_free_frame(cucul_canvas_t *cv, int id)
     200int caca_free_frame(caca_canvas_t *cv, int id)
    201201{
    202202    int f;
     
    223223    cv->framecount--;
    224224    cv->frames = realloc(cv->frames,
    225                          sizeof(struct cucul_frame) * cv->framecount);
     225                         sizeof(struct caca_frame) * cv->framecount);
    226226
    227227    if(cv->frame > id)
     
    230230    {
    231231        cv->frame = 0;
    232         _cucul_load_frame_info(cv);
     232        _caca_load_frame_info(cv);
    233233    }
    234234
     
    240240 */
    241241
    242 void _cucul_save_frame_info(cucul_canvas_t *cv)
     242void _caca_save_frame_info(caca_canvas_t *cv)
    243243{
    244244    cv->frames[cv->frame].width = cv->width;
     
    248248}
    249249
    250 void _cucul_load_frame_info(cucul_canvas_t *cv)
     250void _caca_load_frame_info(caca_canvas_t *cv)
    251251{
    252252    cv->width = cv->frames[cv->frame].width;
Note: See TracChangeset for help on using the changeset viewer.