Ignore:
Timestamp:
Sep 30, 2006, 12:48:32 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Make the --metal filter only change the colour, not the characters.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/src/filters.c

    r1109 r1142  
    6161void filter_metal(cucul_canvas_t *cv)
    6262{
    63     static struct
     63    static unsigned char const palette[] =
    6464    {
    65         char ch[6];
    66         unsigned char fg, bg;
    67     }
    68     const palette[] =
    69     {
    70         { " ", CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_LIGHTBLUE },
    71         { "░", CUCUL_COLOR_BLUE, CUCUL_COLOR_LIGHTBLUE },
    72         { "▒", CUCUL_COLOR_BLUE, CUCUL_COLOR_LIGHTBLUE },
    73         { "░", CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLUE },
    74         { " ", CUCUL_COLOR_BLUE, CUCUL_COLOR_BLUE },
    75         { " ", CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_LIGHTGRAY },
    76         { "░", CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_LIGHTGRAY },
    77         { "▒", CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_LIGHTGRAY },
    78         { "░", CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_DARKGRAY },
    79         { " ", CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_DARKGRAY },
     65        CUCUL_COLOR_LIGHTBLUE,
     66        CUCUL_COLOR_BLUE,
     67        CUCUL_COLOR_LIGHTGRAY,
     68        CUCUL_COLOR_DARKGRAY,
    8069    };
    8170
     
    8877        for(x = 0; x < w; x++)
    8978    {
     79        unsigned long int ch = cucul_getchar(cv, x, y);
    9080        int i;
    9181
    92         if(cucul_getchar(cv, x, y) == (unsigned char)' ')
     82        if(ch == (unsigned char)' ')
    9383            continue;
    9484
    95         i = y * 10 / h;
    96         cucul_set_color(cv, palette[i].fg, palette[i].bg);
    97         cucul_putstr(cv, x, y, palette[i].ch);
     85        i = y * 4 / h;
     86        cucul_set_color(cv, palette[i], CUCUL_COLOR_TRANSPARENT);
     87        cucul_putchar(cv, x, y, ch);
    9888    }
    9989}
Note: See TracChangeset for help on using the changeset viewer.