Changeset 2988 for toilet/trunk/src/filter.c
- Timestamp:
- 10/18/08 23:36:17 (5 years ago)
- File:
-
- 1 edited
-
toilet/trunk/src/filter.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
toilet/trunk/src/filter.c
r1831 r2988 25 25 #include <stdio.h> 26 26 #include <stdlib.h> 27 #include <c ucul.h>27 #include <caca.h> 28 28 29 29 #include "toilet.h" … … 130 130 unsigned int xmin, xmax, ymin, ymax; 131 131 132 xmin = w = c ucul_get_canvas_width(cx->torender);132 xmin = w = caca_get_canvas_width(cx->torender); 133 133 xmax = 0; 134 ymin = h = c ucul_get_canvas_height(cx->torender);134 ymin = h = caca_get_canvas_height(cx->torender); 135 135 ymax = 0; 136 136 … … 138 138 for(x = 0; x < w; x++) 139 139 { 140 unsigned long int ch = c ucul_get_char(cx->torender, x, y);140 unsigned long int ch = caca_get_char(cx->torender, x, y); 141 141 if(ch != (unsigned char)' ') 142 142 { … … 155 155 return; 156 156 157 c ucul_set_canvas_boundaries(cx->torender, xmin, ymin,157 caca_set_canvas_boundaries(cx->torender, xmin, ymin, 158 158 xmax - xmin + 1, ymax - ymin + 1); 159 159 } … … 163 163 static unsigned char const palette[] = 164 164 { 165 C UCUL_LIGHTBLUE, CUCUL_BLUE, CUCUL_LIGHTGRAY, CUCUL_DARKGRAY,165 CACA_LIGHTBLUE, CACA_BLUE, CACA_LIGHTGRAY, CACA_DARKGRAY, 166 166 }; 167 167 168 168 unsigned int x, y, w, h; 169 169 170 w = c ucul_get_canvas_width(cx->torender);171 h = c ucul_get_canvas_height(cx->torender);170 w = caca_get_canvas_width(cx->torender); 171 h = caca_get_canvas_height(cx->torender); 172 172 173 173 for(y = 0; y < h; y++) 174 174 for(x = 0; x < w; x++) 175 175 { 176 unsigned long int ch = c ucul_get_char(cx->torender, x, y);176 unsigned long int ch = caca_get_char(cx->torender, x, y); 177 177 int i; 178 178 … … 181 181 182 182 i = ((cx->lines + y + x / 8) / 2) % 4; 183 c ucul_set_color_ansi(cx->torender, palette[i], CUCUL_TRANSPARENT);184 c ucul_put_char(cx->torender, x, y, ch);183 caca_set_color_ansi(cx->torender, palette[i], CACA_TRANSPARENT); 184 caca_put_char(cx->torender, x, y, ch); 185 185 } 186 186 } … … 190 190 static unsigned char const rainbow[] = 191 191 { 192 C UCUL_LIGHTMAGENTA, CUCUL_LIGHTRED, CUCUL_YELLOW,193 C UCUL_LIGHTGREEN, CUCUL_LIGHTCYAN, CUCUL_LIGHTBLUE,192 CACA_LIGHTMAGENTA, CACA_LIGHTRED, CACA_YELLOW, 193 CACA_LIGHTGREEN, CACA_LIGHTCYAN, CACA_LIGHTBLUE, 194 194 }; 195 195 unsigned int x, y, w, h; 196 196 197 w = c ucul_get_canvas_width(cx->torender);198 h = c ucul_get_canvas_height(cx->torender);197 w = caca_get_canvas_width(cx->torender); 198 h = caca_get_canvas_height(cx->torender); 199 199 200 200 for(y = 0; y < h; y++) 201 201 for(x = 0; x < w; x++) 202 202 { 203 unsigned long int ch = c ucul_get_char(cx->torender, x, y);203 unsigned long int ch = caca_get_char(cx->torender, x, y); 204 204 if(ch != (unsigned char)' ') 205 205 { 206 c ucul_set_color_ansi(cx->torender,206 caca_set_color_ansi(cx->torender, 207 207 rainbow[(x / 2 + y + cx->lines) % 6], 208 C UCUL_TRANSPARENT);209 c ucul_put_char(cx->torender, x, y, ch);208 CACA_TRANSPARENT); 209 caca_put_char(cx->torender, x, y, ch); 210 210 } 211 211 } … … 214 214 static void filter_flip(context_t *cx) 215 215 { 216 c ucul_flip(cx->torender);216 caca_flip(cx->torender); 217 217 } 218 218 219 219 static void filter_flop(context_t *cx) 220 220 { 221 c ucul_flop(cx->torender);221 caca_flop(cx->torender); 222 222 } 223 223 224 224 static void filter_180(context_t *cx) 225 225 { 226 c ucul_rotate_180(cx->torender);226 caca_rotate_180(cx->torender); 227 227 } 228 228 229 229 static void filter_left(context_t *cx) 230 230 { 231 c ucul_rotate_left(cx->torender);231 caca_rotate_left(cx->torender); 232 232 } 233 233 234 234 static void filter_right(context_t *cx) 235 235 { 236 c ucul_rotate_right(cx->torender);237 } 238 236 caca_rotate_right(cx->torender); 237 } 238
Note: See TracChangeset
for help on using the changeset viewer.
