Ignore:
Timestamp:
May 21, 2009, 10:55:21 PM (11 years ago)
Author:
Sam Hocevar
Message:

Add caca_export_area_to_memory() to export only a selected part of the
current canvas. This is useful to export dirty rectangles. Accordingly,
add caca_import_area_from_memory() and caca_import_area_from_file().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/spritedit.c

    r2821 r3495  
    11/*
    22 *  spritedit     sprite editor for libcaca
    3  *  Copyright (c) 2003 Sam Hocevar <sam@zoy.org>
     3 *  Copyright (c) 2003-2009 Sam Hocevar <sam@hocevar.net>
    44 *                All Rights Reserved
    55 *
     
    6262    {
    6363        caca_set_frame(sprite, i);
    64         caca_import_memory(sprite, guy[i], strlen(guy[i]), "utf8");
     64        caca_import_canvas_from_memory(sprite, guy[i], strlen(guy[i]), "utf8");
    6565    }
    6666
    6767    /* Export our sprite in a memory buffer. We could save this to
    6868     * disk afterwards. */
    69     buffer = caca_export_memory(sprite, "caca", &len);
     69    buffer = caca_export_canvas_to_memory(sprite, "caca", &len);
    7070
    7171    /* Free our sprite and reload it from the memory buffer. We could
     
    7373    caca_free_canvas(sprite);
    7474    sprite = caca_create_canvas(0, 0);
    75     caca_import_memory(sprite, buffer, len, "caca");
     75    caca_import_canvas_from_memory(sprite, buffer, len, "caca");
    7676    free(buffer);
    7777
     
    8181        caca_set_frame(sprite, i);
    8282        printf("Frame #%i\n", i);
    83         buffer = caca_export_memory(sprite, "utf8", &len);
     83        buffer = caca_export_canvas_to_memory(sprite, "utf8", &len);
    8484        fwrite(buffer, len, 1, stdout);
    8585        free(buffer);
Note: See TracChangeset for help on using the changeset viewer.