Changeset 198 for libcaca/trunk/src/blit.c
- Timestamp:
- Nov 17, 2003, 5:11:34 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/blit.c
r195 r198 86 86 void caca_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h) 87 87 { 88 static int white_colors[] = {CACA_COLOR_DARKGRAY, CACA_COLOR_LIGHTGRAY, CACA_COLOR_WHITE}; 88 89 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}; 89 90 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}; … … 101 102 } 102 103 103 pitch = (3 * w + 3) / 4 * 4; 104 //pitch = (3 * w + 3) / 4 * 4; 105 pitch = 4 * w; 104 106 105 107 for(y = y1 > 0 ? y1 : 0; y <= y2 && y <= (int)caca_get_height(); y++) … … 113 115 int fromx = w * (x - x1) / (x2 - x1 + 1); 114 116 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]; 118 123 int hue, sat, val; 119 124 … … 147 152 else 148 153 { 149 caca_set_color( CACA_COLOR_LIGHTGRAY);154 caca_set_color(white_colors[max * 3 / 256]); 150 155 } 151 156
Note: See TracChangeset
for help on using the changeset viewer.