Changeset 1080 for libcaca/trunk/test/toilet.c
- Timestamp:
- Sep 22, 2006, 2:27:13 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/test/toilet.c
r1077 r1080 35 35 36 36 /* Canvas special effects */ 37 static void make_gay(cucul_canvas_t *); 37 static void filter_autocrop(cucul_canvas_t *); 38 static void filter_gay(cucul_canvas_t *); 38 39 39 40 int main(int argc, char *argv[]) … … 149 150 /* Do gay stuff with our string (léopard) */ 150 151 cv = cuculize_big(string, length); 152 filter_autocrop(cv); 151 153 if(flag_gay) 152 make_gay(cv);154 filter_gay(cv); 153 155 154 156 /* Output char */ … … 230 232 } 231 233 232 static void make_gay(cucul_canvas_t *cv) 234 static void filter_autocrop(cucul_canvas_t *cv) 235 { 236 unsigned int x, y, w, h; 237 unsigned int xmin, xmax, ymin, ymax; 238 239 xmin = w = cucul_get_canvas_width(cv); 240 xmax = 0; 241 ymin = h = cucul_get_canvas_height(cv); 242 ymax = 0; 243 244 for(y = 0; y < h; y++) 245 for(x = 0; x < w; x++) 246 { 247 unsigned long int ch = cucul_getchar(cv, x, y); 248 if(ch != (unsigned char)' ') 249 { 250 if(x < xmin) 251 xmin = x; 252 if(x > xmax) 253 xmax = x; 254 if(y < ymin) 255 ymin = y; 256 if(y > ymax) 257 ymax = y; 258 } 259 } 260 261 cucul_set_canvas_boundaries(cv, xmin, ymin, 262 xmax - xmin + 1, ymax - ymin + 1); 263 } 264 265 static void filter_gay(cucul_canvas_t *cv) 233 266 { 234 267 static unsigned char const rainbow[] =
Note: See TracChangeset
for help on using the changeset viewer.