Changeset 815 for libcaca/trunk/test
- Timestamp:
- Apr 18, 2006, 6:17:14 PM (15 years ago)
- Location:
- libcaca/trunk/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/test/demo.c
r814 r815 311 311 for(j = i - 60; j < i; j++) 312 312 { 313 int delta = cucul_rand(-5, 5);314 cucul_set_color(cv, cucul_rand(0, 1 5), cucul_rand(0, 15));313 int delta = cucul_rand(-5, 6); 314 cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 315 315 cucul_putchar(cv, cucul_get_canvas_width(cv) / 2 316 316 + cos(0.02*j) * (delta + cucul_get_canvas_width(cv) / 4), … … 328 328 static void demo_dots(void) 329 329 { 330 int xmax = cucul_get_canvas_width(cv) - 1;331 int ymax = cucul_get_canvas_height(cv) - 1;330 int xmax = cucul_get_canvas_width(cv); 331 int ymax = cucul_get_canvas_height(cv); 332 332 int i; 333 333 static char chars[10] = … … 339 339 { 340 340 /* Putpixel */ 341 cucul_set_color(cv, cucul_rand(0, 1 5), cucul_rand(0, 15));341 cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 342 342 cucul_putchar(cv, cucul_rand(0, xmax), cucul_rand(0, ymax), 343 343 chars[cucul_rand(0, 9)]); … … 377 377 else 378 378 { 379 xa = cucul_rand(0, w - 1); ya = cucul_rand(0, h - 1);380 xb = cucul_rand(0, w - 1); yb = cucul_rand(0, h - 1);381 } 382 383 cucul_set_color(cv, cucul_rand(0, 1 5), CUCUL_COLOR_BLACK);379 xa = cucul_rand(0, w); ya = cucul_rand(0, h); 380 xb = cucul_rand(0, w); yb = cucul_rand(0, h); 381 } 382 383 cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); 384 384 if(outline > 1) 385 385 cucul_draw_thin_line(cv, xa, ya, xb, yb); … … 401 401 else 402 402 { 403 xa = cucul_rand(0, w - 1); ya = cucul_rand(0, h - 1);404 xb = cucul_rand(0, w - 1); yb = cucul_rand(0, h - 1);405 } 406 407 cucul_set_color(cv, cucul_rand(0, 1 5), cucul_rand(0, 15));403 xa = cucul_rand(0, w); ya = cucul_rand(0, h); 404 xb = cucul_rand(0, w); yb = cucul_rand(0, h); 405 } 406 407 cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 408 408 cucul_fill_box(cv, xa, ya, xb, yb, "#"); 409 409 410 cucul_set_color(cv, cucul_rand(0, 1 5), CUCUL_COLOR_BLACK);410 cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); 411 411 if(outline == 2) 412 412 cucul_draw_thin_box(cv, xa, ya, xb, yb); … … 436 436 } 437 437 438 cucul_set_color(cv, cucul_rand(0, 1 5), cucul_rand(0, 15));438 cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 439 439 cucul_fill_ellipse(cv, x, y, a, b, "#"); 440 440 441 cucul_set_color(cv, cucul_rand(0, 1 5), CUCUL_COLOR_BLACK);441 cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); 442 442 if(outline == 2) 443 443 cucul_draw_thin_ellipse(cv, x, y, a, b); … … 461 461 { 462 462 463 xa = cucul_rand(0, w - 1); ya = cucul_rand(0, h - 1);464 xb = cucul_rand(0, w - 1); yb = cucul_rand(0, h - 1);465 xc = cucul_rand(0, w - 1); yc = cucul_rand(0, h - 1);466 } 467 468 cucul_set_color(cv, cucul_rand(0, 1 5), cucul_rand(0, 15));463 xa = cucul_rand(0, w); ya = cucul_rand(0, h); 464 xb = cucul_rand(0, w); yb = cucul_rand(0, h); 465 xc = cucul_rand(0, w); yc = cucul_rand(0, h); 466 } 467 468 cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 469 469 cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); 470 470 471 cucul_set_color(cv, cucul_rand(0, 1 5), CUCUL_COLOR_BLACK);471 cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); 472 472 if(outline == 2) 473 473 cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); … … 478 478 static void demo_sprites(void) 479 479 { 480 cucul_draw_sprite(cv, cucul_rand(0, cucul_get_canvas_width(cv) - 1),481 cucul_rand(0, cucul_get_canvas_height(cv) - 1), sprite, 0);480 cucul_draw_sprite(cv, cucul_rand(0, cucul_get_canvas_width(cv)), 481 cucul_rand(0, cucul_get_canvas_height(cv)), sprite, 0); 482 482 } 483 483 -
libcaca/trunk/test/dithering.c
r813 r815 55 55 /* distance to 40% */ 56 56 dist = XRATIO * (x - 40) * (x - 40) + YRATIO * y * y; 57 if(cucul_rand(-FUZZY, FUZZY ) + dist < dista)57 if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) 58 58 { 59 59 nearb = neara; distb = dista; neara = 1; dista = dist; … … 66 66 /* check dist to 70% */ 67 67 dist = XRATIO * (x - 70) * (x - 70) + YRATIO * y * y; 68 if(cucul_rand(-FUZZY, FUZZY ) + dist < dista)68 if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) 69 69 { 70 70 nearb = neara; distb = dista; neara = 2; dista = dist; 71 71 } 72 else if(cucul_rand(-FUZZY, FUZZY ) + dist < distb)72 else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) 73 73 { 74 74 nearb = 2; distb = dist; … … 77 77 /* check dist to white */ 78 78 dist = XRATIO * (x - 100) * (x - 100) + YRATIO * y * y; 79 if(cucul_rand(-FUZZY, FUZZY ) + dist < dista)79 if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) 80 80 { 81 81 nearb = neara; distb = dista; neara = 3; dista = dist; 82 82 } 83 else if(cucul_rand(-FUZZY, FUZZY ) + dist < distb)83 else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) 84 84 { 85 85 nearb = 3; distb = dist; … … 90 90 dist = XRATIO * (x - 40) * (x - 40) + YRATIO * (y - 100) * (y - 100); 91 91 dist = dist * 12 / 16; 92 if(cucul_rand(-FUZZY, FUZZY ) + dist < dista)92 if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) 93 93 { 94 94 nearb = neara; distb = dista; neara = 4; dista = dist; 95 95 } 96 else if(cucul_rand(-FUZZY, FUZZY ) + dist < distb)96 else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) 97 97 { 98 98 nearb = 4; distb = dist; … … 102 102 dist = XRATIO * (x - 100) * (x - 100) + YRATIO * (y - 100) * (y - 100); 103 103 dist = dist * 8 / 16; 104 if(cucul_rand(-FUZZY, FUZZY ) + dist < dista)104 if(cucul_rand(-FUZZY, FUZZY+1) + dist < dista) 105 105 { 106 106 nearb = neara; distb = dista; neara = 5; dista = dist; 107 107 } 108 else if(cucul_rand(-FUZZY, FUZZY ) + dist < distb)108 else if(cucul_rand(-FUZZY, FUZZY+1) + dist < distb) 109 109 { 110 110 nearb = 5; distb = dist;
Note: See TracChangeset
for help on using the changeset viewer.