Ignore:
Timestamp:
Nov 12, 2006, 9:37:58 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • Now that libcaca 0.99.beta10 is out, we can switch to the new API.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/tools/caca2tlf.c

    r1368 r1376  
    169169static void add_char(unsigned long int ch)
    170170{
    171     cucul_buffer_t *buf;
     171    void *buf;
     172    unsigned long int len;
    172173    unsigned int x, y, myw, mygw;
    173174    int full = cucul_utf32_is_fullwidth(ch);
    174175
    175176    cucul_set_canvas_size(onechar, full ? 2 : 1, 1);
    176     cucul_putchar(onechar, 0, 0, ch);
     177    cucul_put_char(onechar, 0, 0, ch);
    177178    cucul_render_canvas(onechar, f, image, iw, ih, 4 * iw);
    178179
     
    191192
    192193            if(c >= 0xa0)
    193                 cucul_putstr(out, x, y, "█");
     194                cucul_put_str(out, x, y, "█");
    194195            else if(c >= 0x80)
    195                 cucul_putstr(out, x, y, "▓");
     196                cucul_put_str(out, x, y, "▓");
    196197            else if(c >= 0x40)
    197                 cucul_putstr(out, x, y, "▒");
     198                cucul_put_str(out, x, y, "▒");
    198199            else if(c >= 0x20)
    199                 cucul_putstr(out, x, y, "░");
     200                cucul_put_str(out, x, y, "░");
    200201            else
    201                 cucul_putchar(out, x, y, ' ');
     202                cucul_put_char(out, x, y, ' ');
    202203        }
    203204        break;
     
    211212            uint8_t p2 = image[4 * (x + (y * 2 + 1) * iw) + 2];
    212213
    213             cucul_putstr(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80)]);
     214            cucul_put_str(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80)]);
    214215        }
    215216        break;
     
    229230            uint8_t p4 = image[4 * (x * 2 + 1 + (y * 2 + 1) * iw) + 2];
    230231
    231             cucul_putstr(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80) +
    232                                         4 * (p3 > 0x80) + 8 * (p4 > 0x80)]);
     232            cucul_put_str(out, x, y, str[(p1 > 0x80) + 2 * (p2 > 0x80) +
     233                                         4 * (p3 > 0x80) + 8 * (p4 > 0x80)]);
    233234        }
    234235        break;
     
    236237
    237238    cucul_draw_line(out, mygw, 0, mygw, gh - 1, '@');
    238     cucul_putchar(out, mygw + 1, gh - 1, '@');
    239 
    240     buf = cucul_export_canvas(out, "utf8");
    241     fwrite(cucul_get_buffer_data(buf), cucul_get_buffer_size(buf), 1, stdout);
    242     cucul_free_buffer(buf);
     239    cucul_put_char(out, mygw + 1, gh - 1, '@');
     240
     241    buf = cucul_export_memory(out, "utf8", &len);
     242    fwrite(buf, len, 1, stdout);
     243    free(buf);
    243244}
    244245
Note: See TracChangeset for help on using the changeset viewer.