Changeset 1306


Ignore:
Timestamp:
Nov 8, 2006, 5:43:59 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Renamed cucul_export() to cucul_export_memory(), paves the way for a cucul_export_file() but I'm not sure yet this is a good idea.
  • Use the new import/export API in libcaca.
Location:
libcaca/trunk
Files:
5 edited

Legend:

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

    r1287 r1306  
    214214cucul_canvas_t *__caca0_load_sprite(char const *file)
    215215{
    216     cucul_buffer_t *buf;
    217216    cucul_canvas_t *cv;
    218217
    219     buf = cucul_load_file(file);
    220     if(!buf)
     218    cv = cucul_create_canvas(0, 0);;
     219    if(cucul_import_file(cv, file, "") < 0)
     220    {
     221        cucul_free_canvas(cv);
    221222        return NULL;
    222     cv = cucul_import_canvas(buf, "");
    223     cucul_free_buffer(buf);
    224     if(!cv)
    225         return NULL;
     223    }
    226224
    227225    return cv;
  • libcaca/trunk/caca/driver_raw.c

    r1233 r1306  
    6767static void raw_display(caca_display_t *dp)
    6868{
    69     cucul_buffer_t *buffer;
     69    void *buffer;
     70    unsigned long int len;
    7071
    71     buffer = cucul_export_canvas(dp->cv, "caca");
    72     fwrite(cucul_get_buffer_data(buffer),
    73            cucul_get_buffer_size(buffer), 1, stdout);
    74     fflush(stdout);
    75     cucul_free_buffer(buffer);
     72    buffer = cucul_export_memory(dp->cv, "caca", &len);
     73    if(!buffer)
     74        return;
     75    fwrite(buffer, len, 1, stdout);
     76    free(buffer);
    7677}
    7778
  • libcaca/trunk/cucul/cucul.h

    r1305 r1306  
    221221long int cucul_import_file(cucul_canvas_t *, char const *, char const *);
    222222char const * const * cucul_get_import_list(void);
    223 void *cucul_export(cucul_canvas_t *, char const *, unsigned long int *);
     223void *cucul_export_memory(cucul_canvas_t *, char const *, unsigned long int *);
    224224char const * const * cucul_get_export_list(void);
    225225/*  @} */
  • libcaca/trunk/cucul/export.c

    r1302 r1306  
    8585 *  \return A pointer to the exported memory area, or NULL in case of error.
    8686 */
    87 void *cucul_export(cucul_canvas_t *cv, char const *format,
    88                    unsigned long int *bytes)
     87void *cucul_export_memory(cucul_canvas_t *cv, char const *format,
     88                          unsigned long int *bytes)
    8989{
    9090    if(!strcasecmp("caca", format))
     
    128128 *  Return a list of available export formats. The list is a NULL-terminated
    129129 *  array of strings, interleaving a string containing the internal value for
    130  *  the export format, to be used with cucul_export_canvas(), and a string
     130 *  the export format, to be used with cucul_export_memory(), and a string
    131131 *  containing the natural language description for that export format.
    132132 *
  • libcaca/trunk/cucul/legacy.c

    r1305 r1306  
    8181    }
    8282
    83     ex->data = cucul_export(cv, format, &ex->size);
     83    ex->data = cucul_export_memory(cv, format, &ex->size);
    8484    if(!ex->data)
    8585    {
Note: See TracChangeset for help on using the changeset viewer.