Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (12 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 edited

Legend:

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

    r2300 r2821  
    11/*
    2  *  font          libcucul font test program
     2 *  font          libcaca font test program
    33 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
    44 *                All Rights Reserved
     
    2525#endif
    2626
    27 #include "cucul.h"
    2827#include "caca.h"
    2928
    3029int main(int argc, char *argv[])
    3130{
    32     cucul_canvas_t *cv;
     31    caca_canvas_t *cv;
    3332    caca_display_t *dp;
    34     cucul_font_t *f;
    35     cucul_dither_t *d;
     33    caca_font_t *f;
     34    caca_dither_t *d;
    3635    uint8_t *buf;
    3736    unsigned int w, h;
     
    3938
    4039    /* Create a canvas */
    41     cv = cucul_create_canvas(8, 2);
     40    cv = caca_create_canvas(8, 2);
    4241    if(cv == NULL)
    4342    {
     
    4847
    4948    /* Draw stuff on our canvas */
    50     cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK);
    51     cucul_put_str(cv, 0, 0, "ABcde");
    52     cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_BLACK);
    53     cucul_put_str(cv, 5, 0, "\\o/");
    54     cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
    55     cucul_put_str(cv, 0, 1, "&$âøÿØ?!");
     49    caca_set_color_ansi(cv, CACA_WHITE, CACA_BLACK);
     50    caca_put_str(cv, 0, 0, "ABcde");
     51    caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_BLACK);
     52    caca_put_str(cv, 5, 0, "\\o/");
     53    caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE);
     54    caca_put_str(cv, 0, 1, "&$âøÿØ?!");
    5655
    57     /* Load a libcucul internal font */
    58     fonts = cucul_get_font_list();
     56    /* Load a libcaca internal font */
     57    fonts = caca_get_font_list();
    5958    if(fonts[0] == NULL)
    6059    {
    61         fprintf(stderr, "error: libcucul was compiled without any fonts\n");
     60        fprintf(stderr, "error: libcaca was compiled without any fonts\n");
    6261        return -1;
    6362    }
    64     f = cucul_load_font(fonts[0], 0);
     63    f = caca_load_font(fonts[0], 0);
    6564    if(f == NULL)
    6665    {
     
    7069
    7170    /* Create our bitmap buffer (32-bit ARGB) */
    72     w = cucul_get_canvas_width(cv) * cucul_get_font_width(f);
    73     h = cucul_get_canvas_height(cv) * cucul_get_font_height(f);
     71    w = caca_get_canvas_width(cv) * caca_get_font_width(f);
     72    h = caca_get_canvas_height(cv) * caca_get_font_height(f);
    7473    buf = malloc(4 * w * h);
    7574
    7675    /* Render the canvas onto our image buffer */
    77     cucul_render_canvas(cv, f, buf, w, h, 4 * w);
     76    caca_render_canvas(cv, f, buf, w, h, 4 * w);
    7877
    7978    /* Just for fun, render the image using libcaca */
    80     cucul_set_canvas_size(cv, 80, 32);
     79    caca_set_canvas_size(cv, 80, 32);
    8180    dp = caca_create_display(cv);
    8281
     
    8988        if(*(uint8_t const *)&tmp == 0x12)
    9089#endif
    91             d = cucul_create_dither(32, w, h, 4 * w,
     90            d = caca_create_dither(32, w, h, 4 * w,
    9291                                    0xff0000, 0xff00, 0xff, 0xff000000);
    9392        else
    94             d = cucul_create_dither(32, w, h, 4 * w,
     93            d = caca_create_dither(32, w, h, 4 * w,
    9594                                    0xff00, 0xff0000, 0xff000000, 0xff);
    9695    }
    9796
    98     cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv),
    99                                   cucul_get_canvas_height(cv), d, buf);
     97    caca_dither_bitmap(cv, 0, 0, caca_get_canvas_width(cv),
     98                                  caca_get_canvas_height(cv), d, buf);
    10099    caca_refresh_display(dp);
    101100
     
    105104    caca_free_display(dp);
    106105    free(buf);
    107     cucul_free_dither(d);
    108     cucul_free_font(f);
    109     cucul_free_canvas(cv);
     106    caca_free_dither(d);
     107    caca_free_font(f);
     108    caca_free_canvas(cv);
    110109
    111110    return 0;
Note: See TracChangeset for help on using the changeset viewer.