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/dithering.c

    r2299 r2821  
    1919#endif
    2020
    21 #include "cucul.h"
    2221#include "caca.h"
    2322
     
    2827unsigned int points[] =
    2928{
    30     CUCUL_BLACK, CUCUL_DARKGRAY, CUCUL_LIGHTGRAY,
    31     CUCUL_WHITE, CUCUL_RED, CUCUL_LIGHTRED
     29    CACA_BLACK, CACA_DARKGRAY, CACA_LIGHTGRAY,
     30    CACA_WHITE, CACA_RED, CACA_LIGHTRED
    3231};
    3332
     
    3635int main(int argc, char *argv[])
    3736{
    38     cucul_canvas_t *cv;
     37    caca_canvas_t *cv;
    3938    caca_display_t *dp;
    4039    int neara, dista, nearb, distb, dist;
    4140    int x, y;
    4241
    43     cv = cucul_create_canvas(80, 24);
     42    cv = caca_create_canvas(80, 24);
    4443    if(cv == NULL)
    4544    {
     
    6867        /* distance to 40% */
    6968        dist = XRATIO * (x - 40) * (x - 40) + YRATIO * y * y;
    70         if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
     69        if(caca_rand(-FUZZY, FUZZY+1) + dist < dista)
    7170        {
    7271            nearb = neara; distb = dista; neara = 1; dista = dist;
     
    7978        /* check dist to 70% */
    8079        dist = XRATIO * (x - 70) * (x - 70) + YRATIO * y * y;
    81         if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
     80        if(caca_rand(-FUZZY, FUZZY+1) + dist < dista)
    8281        {
    8382            nearb = neara; distb = dista; neara = 2; dista = dist;
    8483        }
    85         else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
     84        else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb)
    8685        {
    8786            nearb = 2; distb = dist;
     
    9089        /* check dist to white */
    9190        dist = XRATIO * (x - 100) * (x - 100) + YRATIO * y * y;
    92         if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
     91        if(caca_rand(-FUZZY, FUZZY+1) + dist < dista)
    9392        {
    9493            nearb = neara; distb = dista; neara = 3; dista = dist;
    9594        }
    96         else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
     95        else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb)
    9796        {
    9897            nearb = 3; distb = dist;
     
    103102        dist = XRATIO * (x - 40) * (x - 40) + YRATIO * (y - 100) * (y - 100);
    104103        dist = dist * 12 / 16;
    105         if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
     104        if(caca_rand(-FUZZY, FUZZY+1) + dist < dista)
    106105        {
    107106            nearb = neara; distb = dista; neara = 4; dista = dist;
    108107        }
    109         else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
     108        else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb)
    110109        {
    111110            nearb = 4; distb = dist;
     
    115114        dist = XRATIO * (x - 100) * (x - 100) + YRATIO * (y - 100) * (y - 100);
    116115        dist = dist * 8 / 16;
    117         if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista)
     116        if(caca_rand(-FUZZY, FUZZY+1) + dist < dista)
    118117        {
    119118            nearb = neara; distb = dista; neara = 5; dista = dist;
    120119        }
    121         else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb)
     120        else if(caca_rand(-FUZZY, FUZZY+1) + dist < distb)
    122121        {
    123122            nearb = 5; distb = dist;
     
    130129        else
    131130            ch = density[dista * 2 * 13 / (dista + distb)];
    132         cucul_set_color_ansi(cv, points[nearb], points[neara]);
     131        caca_set_color_ansi(cv, points[nearb], points[neara]);
    133132
    134         cucul_put_char(cv, x * cucul_get_canvas_width(cv) / 100,
    135                           (100 - y) * cucul_get_canvas_height(cv) / 100, ch);
     133        caca_put_char(cv, x * caca_get_canvas_width(cv) / 100,
     134                          (100 - y) * caca_get_canvas_height(cv) / 100, ch);
    136135    }
    137136
     
    141140
    142141    caca_free_display(dp);
    143     cucul_free_canvas(cv);
     142    caca_free_canvas(cv);
    144143
    145144    return 0;
Note: See TracChangeset for help on using the changeset viewer.