Changeset 1394 for libcaca


Ignore:
Timestamp:
Nov 14, 2006, 8:59:52 AM (16 years ago)
Author:
Sam Hocevar
Message:
  • Documented flip/flop/rotate as being involutive.
  • Updated text test.
Location:
libcaca/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/transform.c

    r1254 r1394  
    5656 *
    5757 *  Flip a canvas horizontally, choosing characters that look like the
    58  *  mirrored version wherever possible.
     58 *  mirrored version wherever possible. Some characters will stay
     59 *  unchanged by the process, but the operation is guaranteed to be
     60 *  involutive: performing it again gives back the original canvas.
    5961 *
    6062 *  This function never fails.
     
    113115 *
    114116 *  Flip a canvas vertically, choosing characters that look like the
    115  *  mirrored version wherever possible.
     117 *  mirrored version wherever possible. Some characters will stay
     118 *  unchanged by the process, but the operation is guaranteed to be
     119 *  involutive: performing it again gives back the original canvas.
    116120 *
    117121 *  This function never fails.
     
    156160 *
    157161 *  Apply a 180-degree transformation to a canvas, choosing characters
    158  *  that look like the upside-down version wherever possible.
     162 *  that look like the upside-down version wherever possible. Some
     163 *  characters will stay unchanged by the process, but the operation is
     164 *  guaranteed to be involutive: performing it again gives back the
     165 *  original canvas.
    159166 *
    160167 *  This function never fails.
  • libcaca/trunk/test/text.c

    r1308 r1394  
    2525
    2626#define STRING \
    27   "Hello world!\n" \
    2827  "  _,----._  \n" \
    2928  " (/ @  @ \\) \n" \
    3029  "  |  OO  |  \n" \
    3130  "  \\ `--' /  \n" \
    32   "   `----'   \n"
     31  "   `----'   \n" \
     32  "Hello world!\n"
    3333
    3434int main(int argc, char *argv[])
    3535{
    36     cucul_canvas_t *cv;
     36    cucul_canvas_t *cv, *pig;
    3737    void *buffer;
    3838    unsigned long int len;
    3939
    40     cv = cucul_create_canvas(0, 0);
     40    pig = cucul_create_canvas(0, 0);
     41    cucul_import_memory(pig, STRING, strlen(STRING), "text");
    4142
    42     cucul_import_memory(cv, STRING, strlen(STRING), "text");
     43    cv = cucul_create_canvas(cucul_get_canvas_width(pig) * 2,
     44                             cucul_get_canvas_height(pig) * 2);
     45
     46    cucul_blit(cv, 0, 0, pig, NULL);
     47    cucul_flip(pig);
     48    cucul_blit(cv, cucul_get_canvas_width(pig), 0, pig, NULL);
     49    cucul_flip(pig);
     50    cucul_flop(pig);
     51    cucul_blit(cv, 0, cucul_get_canvas_height(pig), pig, NULL);
     52    cucul_flop(pig);
     53    cucul_rotate(pig);
     54    cucul_blit(cv, cucul_get_canvas_width(pig),
     55                   cucul_get_canvas_height(pig), pig, NULL);
    4356
    4457    buffer = cucul_export_memory(cv, "utf8", &len);
     
    4659    free(buffer);
    4760
    48     cucul_rotate(cv);
    49 
    50     buffer = cucul_export_memory(cv, "utf8", &len);
    51     fwrite(buffer, len, 1, stdout);
    52     free(buffer);
    53 
     61    cucul_free_canvas(pig);
    5462    cucul_free_canvas(cv);
    5563
Note: See TracChangeset for help on using the changeset viewer.