Ignore:
Timestamp:
Nov 17, 2003, 5:11:34 PM (19 years ago)
Author:
Sam Hocevar
Message:
  • src/io.c src/caca.h: + Interpret escape sequences for F1, F2, left, right, etc.
  • src/Makefile.am examples/Makefile.am: + Install caca.h in /usr/include. + Do not install example programs.
  • src/blit.c: + Minor improvements to grayscale colors.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/src/blit.c

    r195 r198  
    8686void caca_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h)
    8787{
     88    static int white_colors[] = {CACA_COLOR_DARKGRAY, CACA_COLOR_LIGHTGRAY, CACA_COLOR_WHITE};
    8889    static int light_colors[] = {CACA_COLOR_LIGHTMAGENTA, CACA_COLOR_LIGHTRED, CACA_COLOR_YELLOW, CACA_COLOR_LIGHTGREEN, CACA_COLOR_LIGHTCYAN, CACA_COLOR_LIGHTBLUE, CACA_COLOR_LIGHTMAGENTA};
    8990    static int dark_colors[] = {CACA_COLOR_MAGENTA, CACA_COLOR_RED, CACA_COLOR_BROWN, CACA_COLOR_GREEN, CACA_COLOR_CYAN, CACA_COLOR_BLUE, CACA_COLOR_MAGENTA};
     
    101102    }
    102103
    103     pitch = (3 * w + 3) / 4 * 4;
     104    //pitch = (3 * w + 3) / 4 * 4;
     105    pitch = 4 * w;
    104106
    105107    for(y = y1 > 0 ? y1 : 0; y <= y2 && y <= (int)caca_get_height(); y++)
     
    113115            int fromx = w * (x - x1) / (x2 - x1 + 1);
    114116            int fromy = h * (y - y1) / (y2 - y1 + 1);
    115             int r = ((unsigned char *)pixels)[3 * fromx + pitch * fromy];
    116             int g = ((unsigned char *)pixels)[3 * fromx + 1 + pitch * fromy];
    117             int b = ((unsigned char *)pixels)[3 * fromx + 2 + pitch * fromy];
     117            //int r = ((unsigned char *)pixels)[3 * fromx + pitch * fromy];
     118            //int g = ((unsigned char *)pixels)[3 * fromx + 1 + pitch * fromy];
     119            //int b = ((unsigned char *)pixels)[3 * fromx + 2 + pitch * fromy];
     120            int b = ((unsigned char *)pixels)[4 * fromx + pitch * fromy];
     121            int g = ((unsigned char *)pixels)[4 * fromx + 1 + pitch * fromy];
     122            int r = ((unsigned char *)pixels)[4 * fromx + 2 + pitch * fromy];
    118123            int hue, sat, val;
    119124
     
    147152            else
    148153            {
    149                 caca_set_color(CACA_COLOR_LIGHTGRAY);
     154                caca_set_color(white_colors[max * 3 / 256]);
    150155            }
    151156
Note: See TracChangeset for help on using the changeset viewer.