Changeset 2821 for libcaca/trunk/examples/transform.c
- Timestamp:
- Sep 27, 2008, 3:12:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/examples/transform.c
r2299 r2821 20 20 #endif 21 21 22 #include "cucul.h"23 22 #include "caca.h" 24 23 … … 40 39 int main(int argc, char *argv[]) 41 40 { 42 c ucul_canvas_t *cv, *image, *tmp, *sprite;41 caca_canvas_t *cv, *image, *tmp, *sprite; 43 42 caca_display_t *dp; 44 43 45 cv = c ucul_create_canvas(0, 0);44 cv = caca_create_canvas(0, 0); 46 45 if(cv == NULL) 47 46 { … … 56 55 } 57 56 58 image = c ucul_create_canvas(70, 6);59 tmp = c ucul_create_canvas(70, 6);60 sprite = c ucul_create_canvas(0, 0);57 image = caca_create_canvas(70, 6); 58 tmp = caca_create_canvas(70, 6); 59 sprite = caca_create_canvas(0, 0); 61 60 62 c ucul_set_color_ansi(sprite, CUCUL_LIGHTMAGENTA, CUCUL_BLACK);63 c ucul_import_memory(sprite, pig, strlen(pig), "text");64 c ucul_blit(image, 55, 0, sprite, NULL);61 caca_set_color_ansi(sprite, CACA_LIGHTMAGENTA, CACA_BLACK); 62 caca_import_memory(sprite, pig, strlen(pig), "text"); 63 caca_blit(image, 55, 0, sprite, NULL); 65 64 66 c ucul_set_color_ansi(sprite, CUCUL_LIGHTGREEN, CUCUL_BLACK);67 c ucul_import_memory(sprite, duck, strlen(duck), "text");68 c ucul_blit(image, 30, 1, sprite, NULL);65 caca_set_color_ansi(sprite, CACA_LIGHTGREEN, CACA_BLACK); 66 caca_import_memory(sprite, duck, strlen(duck), "text"); 67 caca_blit(image, 30, 1, sprite, NULL); 69 68 70 c ucul_set_color_ansi(image, CUCUL_LIGHTCYAN, CUCUL_BLACK);71 c ucul_put_str(image, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]");72 c ucul_set_color_ansi(image, CUCUL_LIGHTRED, CUCUL_BLACK);73 c ucul_put_char(image, 38, 1, '|');69 caca_set_color_ansi(image, CACA_LIGHTCYAN, CACA_BLACK); 70 caca_put_str(image, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]"); 71 caca_set_color_ansi(image, CACA_LIGHTRED, CACA_BLACK); 72 caca_put_char(image, 38, 1, '|'); 74 73 75 c ucul_set_color_ansi(image, CUCUL_YELLOW, CUCUL_BLACK);76 c ucul_put_str(image, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/");74 caca_set_color_ansi(image, CACA_YELLOW, CACA_BLACK); 75 caca_put_str(image, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/"); 77 76 78 c ucul_set_color_ansi(image, CUCUL_WHITE, CUCUL_LIGHTRED);79 c ucul_put_str(image, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌");80 c ucul_put_str(image, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖");81 c ucul_set_color_ansi(image, CUCUL_BLACK, CUCUL_LIGHTRED);82 c ucul_put_str(image, 4, 3, "▓▒░");83 c ucul_put_str(image, 4, 4, "▓▒░");84 c ucul_put_str(image, 24, 3, "░▒▓");85 c ucul_put_str(image, 24, 4, "░▒▓");77 caca_set_color_ansi(image, CACA_WHITE, CACA_LIGHTRED); 78 caca_put_str(image, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌"); 79 caca_put_str(image, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖"); 80 caca_set_color_ansi(image, CACA_BLACK, CACA_LIGHTRED); 81 caca_put_str(image, 4, 3, "▓▒░"); 82 caca_put_str(image, 4, 4, "▓▒░"); 83 caca_put_str(image, 24, 3, "░▒▓"); 84 caca_put_str(image, 24, 4, "░▒▓"); 86 85 87 86 /* Blit the transformed canvas onto the main canvas */ 88 c ucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);89 c ucul_put_str(cv, 0, 0, "normal");90 c ucul_blit(cv, 10, 0, image, NULL);87 caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); 88 caca_put_str(cv, 0, 0, "normal"); 89 caca_blit(cv, 10, 0, image, NULL); 91 90 92 c ucul_put_str(cv, 0, 6, "flip");93 c ucul_blit(tmp, 0, 0, image, NULL);94 c ucul_flip(tmp);95 c ucul_blit(cv, 10, 6, tmp, NULL);91 caca_put_str(cv, 0, 6, "flip"); 92 caca_blit(tmp, 0, 0, image, NULL); 93 caca_flip(tmp); 94 caca_blit(cv, 10, 6, tmp, NULL); 96 95 97 c ucul_put_str(cv, 0, 12, "flop");98 c ucul_blit(tmp, 0, 0, image, NULL);99 c ucul_flop(tmp);100 c ucul_blit(cv, 10, 12, tmp, NULL);96 caca_put_str(cv, 0, 12, "flop"); 97 caca_blit(tmp, 0, 0, image, NULL); 98 caca_flop(tmp); 99 caca_blit(cv, 10, 12, tmp, NULL); 101 100 102 c ucul_put_str(cv, 0, 18, "rotate");103 c ucul_blit(tmp, 0, 0, image, NULL);104 c ucul_rotate_180(tmp);105 c ucul_blit(cv, 10, 18, tmp, NULL);101 caca_put_str(cv, 0, 18, "rotate"); 102 caca_blit(tmp, 0, 0, image, NULL); 103 caca_rotate_180(tmp); 104 caca_blit(cv, 10, 18, tmp, NULL); 106 105 107 106 caca_refresh_display(dp); … … 110 109 111 110 caca_free_display(dp); 112 c ucul_free_canvas(tmp);113 c ucul_free_canvas(sprite);114 c ucul_free_canvas(image);115 c ucul_free_canvas(cv);111 caca_free_canvas(tmp); 112 caca_free_canvas(sprite); 113 caca_free_canvas(image); 114 caca_free_canvas(cv); 116 115 117 116 return 0;
Note: See TracChangeset
for help on using the changeset viewer.