- Timestamp:
- Oct 31, 2006, 2:29:48 PM (16 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/caca0.h
r1257 r1267 131 131 132 132 #define caca_set_color(x, y) \ 133 (__caca0_fg = (x), __caca0_bg = (y), \ 134 cucul_set_attr(__caca0_cv, cucul_ansi_to_attr(x, y))) 133 (__caca0_fg = (x), __caca0_bg = (y), cucul_set_color_ansi(__caca0_cv, x, y)) 135 134 #define caca_get_fg_color() __caca0_fg 136 135 #define caca_get_bg_color() __caca0_bg 137 #define caca_get_color_name cucul_ get_color_name136 #define caca_get_color_name cucul_ansi_to_str 138 137 #define caca_putchar(x, y, c) cucul_putchar(__caca0_cv, x, y, c) 139 138 #define caca_putstr(x, y, s) cucul_putstr(__caca0_cv, x, y, s) -
libcaca/trunk/caca/driver_gl.c
r1257 r1267 513 513 /* Allocate a libcucul canvas and print all the glyphs on it */ 514 514 cv = cucul_create_canvas(1, b); 515 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLACK));515 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); 516 516 517 517 for(b = 0, i = 0; dp->drv.p->blocks[i + 1]; i += 2) -
libcaca/trunk/cucul/colour.c
r1266 r1267 26 26 #include "cucul.h" 27 27 #include "cucul_internals.h" 28 29 /** \brief Set the default character attribute.30 *31 * Set the default character attribute for drawing. Attributes define32 * foreground and background colour, transparency, bold, italics and33 * underline styles, as well as blink. String functions such as34 * caca_printf() and graphical primitive functions such as caca_draw_line()35 * will use this attribute.36 *37 * The attribute value is a 32-bit integer as returned by cucul_get_attr()38 * or created using cucul_ansi_to_attr() and cucul_argb_to_attr(), optionally39 * ORed with style values such as CUCUL_UNDERLINE or CUCUL_BLINK.40 *41 * Only changing the style does not affect the current colour value.42 *43 * If an error occurs, -1 is returned and \b errno is set accordingly:44 * - \c EINVAL The attribute value is out of the 32-bit range.45 *46 * \param cv A handle to the libcucul canvas.47 * \param attr The requested attribute value.48 * \return 0 in case of success, -1 if an error occurred.49 */50 int cucul_set_attr(cucul_canvas_t *cv, unsigned long int attr)51 {52 if(sizeof(unsigned long int) > sizeof(uint32_t) && attr > 0xffffffff)53 {54 #if defined(HAVE_ERRNO_H)55 errno = EINVAL;56 #endif57 return -1;58 }59 60 if(attr < 0x00000010)61 attr = (cv->curattr & 0xfffffff0) | attr;62 63 cv->curattr = attr;64 65 return 0;66 }67 28 68 29 /** \brief Get the text attribute at the given coordinates. … … 99 60 } 100 61 101 /** \brief Set the default colour pair and text style (ANSI version). 102 * 103 * Set the default ANSI colour pair and text style for drawing. String 104 * functions such as caca_printf() and graphical primitive functions such as 105 * caca_draw_line() will use these attributes. 62 /** \brief Set the default character attribute. 63 * 64 * Set the default character attribute for drawing. Attributes define 65 * foreground and background colour, transparency, bold, italics and 66 * underline styles, as well as blink. String functions such as 67 * caca_printf() and graphical primitive functions such as caca_draw_line() 68 * will use this attribute. 69 * 70 * The value of \e attr is either: 71 * - a 32-bit integer as returned by cucul_get_attr(), in which case it 72 * also contains colour information, 73 * - a combination (bitwise OR) of style values (\e CUCUL_UNDERLINE, 74 * \e CUCUL_BLINK, \e CUCUL_BOLD and \e CUCUL_ITALICS), in which case 75 * setting the attribute does not modify the current colour information. 76 * 77 * If an error occurs, -1 is returned and \b errno is set accordingly: 78 * - \c EINVAL The attribute value is out of the 32-bit range. 79 * 80 * \param cv A handle to the libcucul canvas. 81 * \param attr The requested attribute value. 82 * \return 0 in case of success, -1 if an error occurred. 83 */ 84 int cucul_set_attr(cucul_canvas_t *cv, unsigned long int attr) 85 { 86 if(sizeof(unsigned long int) > sizeof(uint32_t) && attr > 0xffffffff) 87 { 88 #if defined(HAVE_ERRNO_H) 89 errno = EINVAL; 90 #endif 91 return -1; 92 } 93 94 if(attr < 0x00000010) 95 attr = (cv->curattr & 0xfffffff0) | attr; 96 97 cv->curattr = attr; 98 99 return 0; 100 } 101 102 /** \brief Set the default colour pair for text (ANSI version). 103 * 104 * Set the default ANSI colour pair for text drawing. String functions such 105 * as caca_printf() and graphical primitive functions such as caca_draw_line() 106 * will use these attributes. 106 107 * 107 108 * Color values are those defined in cucul.h, such as CUCUL_RED 108 109 * or CUCUL_TRANSPARENT. 109 110 * 110 * Style values are those defined in cucul.h, such as CUCUL_UNDERLINE111 * or CUCUL_BLINK. The values can be ORed to set several styles at112 * the same time.113 *114 111 * If an error occurs, 0 is returned and \b errno is set accordingly: 115 * - \c EINVAL The colour values and/or the style mask areinvalid.112 * - \c EINVAL At least one of the colour values is invalid. 116 113 * 117 114 * \param cv A handle to the libcucul canvas. 118 * \param fg The requested foreground colour. 119 * \param bg The requested background colour. 120 * \param style The requested text styles. 115 * \param fg The requested ANSI foreground colour. 116 * \param bg The requested ANSI background colour. 121 117 * \return 0 in case of success, -1 if an error occurred. 122 118 */ 123 unsigned long int cucul_ansi_to_attr(unsigned char fg, unsigned char bg) 124 { 119 int cucul_set_color_ansi(cucul_canvas_t *cv, unsigned char fg, unsigned char bg) 120 { 121 uint32_t attr; 122 125 123 if(fg > 0x20 || bg > 0x20) 126 124 { … … 128 126 errno = EINVAL; 129 127 #endif 130 return 0;128 return -1; 131 129 } 132 130 133 fg |= 0x40;134 bg |= 0x40;135 136 return ((unsigned long int)bg << 18) | ((unsigned long int)fg << 4);131 attr = ((uint32_t)(bg | 0x40) << 18) | ((uint32_t)(fg | 0x40) << 4); 132 cv->curattr = (cv->curattr & 0x0000000f) | attr; 133 134 return 0; 137 135 } 138 136 … … 140 138 int cucul_set_color(cucul_canvas_t *cv, unsigned char fg, unsigned char bg) 141 139 { 142 return cucul_set_ attr(cv, cucul_ansi_to_attr(fg, bg));143 } 144 145 /** \brief Set the default colour pair and text style(truecolor version).146 * 147 * Set the default colour pair and text style for drawing. String148 * functions such as caca_printf() and graphical primitive functions such as149 * caca_draw_line()will use these attributes.140 return cucul_set_color_ansi(cv, fg, bg); 141 } 142 143 /** \brief Set the default colour pair for text (truecolor version). 144 * 145 * Set the default ARGB colour pair for text drawing. String functions such 146 * as caca_printf() and graphical primitive functions such as caca_draw_line() 147 * will use these attributes. 150 148 * 151 149 * Colors are 16-bit ARGB values, each component being coded on 4 bits. For … … 157 155 * 158 156 * \param cv A handle to the libcucul canvas. 159 * \param fg The requested foreground colour. 160 * \param bg The requested background colour. 161 * \param style The requested text styles. 157 * \param fg The requested ARGB foreground colour. 158 * \param bg The requested ARGB background colour. 162 159 * \return 0 in case of success, -1 if an error occurred. 163 160 */ 164 unsigned long int cucul_argb_to_attr(unsigned int fg, unsigned int bg) 165 { 161 int cucul_set_color_argb(cucul_canvas_t *cv, unsigned int fg, unsigned int bg) 162 { 163 uint32_t attr; 164 166 165 if(fg > 0xffff || bg > 0xffff) 167 166 { … … 181 180 bg = ((bg >> 1) & 0x7ff) | ((bg >> 13) << 11); 182 181 183 return ((unsigned long int)bg << 18) | ((unsigned long int)fg << 4); 182 attr = ((uint32_t)bg << 18) | ((uint32_t)fg << 4); 183 cv->curattr = (cv->curattr & 0x0000000f) | attr; 184 185 return 0; 184 186 } 185 187 … … 187 189 int cucul_set_truecolor(cucul_canvas_t *cv, unsigned int fg, unsigned int bg) 188 190 { 189 return cucul_set_ attr(cv, cucul_argb_to_attr(fg, bg));191 return cucul_set_color_argb(cv, fg, bg); 190 192 } 191 193 -
libcaca/trunk/cucul/cucul.c
r1257 r1267 177 177 } 178 178 179 /** \brief Translate a colour index into the colour's name.180 * 181 * Translate a cucul_color enum into a human-readable string describing182 * the corresponding colour.179 /** \brief Translate an ANSI colour index into the colour's name. 180 * 181 * Translate an ANSI colour index such as \e CUCUL_RED or \e CUCUL_WHITE 182 * into a human-readable string describing the corresponding colour. 183 183 * 184 184 * This function never fails. … … 188 188 * the colour is unknown. 189 189 */ 190 char const *cucul_ get_color_name(unsigned intcolor)190 char const *cucul_ansi_to_str(unsigned char color) 191 191 { 192 192 static char const *color_names[] = … … 210 210 }; 211 211 212 if(color < 0 || color> 15)212 if(color > 15) 213 213 return "unknown"; 214 214 215 return color_names[color]; 215 return color_names[(unsigned int)color]; 216 } 217 218 /* Legacy function for old programs */ 219 char const *cucul_get_color_name(unsigned int color) 220 { 221 return cucul_ansi_to_str(color > 15 ? 15 : color); 216 222 } 217 223 -
libcaca/trunk/cucul/cucul.h
r1258 r1267 104 104 * @{ */ 105 105 #define CUCUL_MAGIC_FULLWIDTH 0x000ffffe /**< Used to indicate that the previous character was a fullwidth glyph. */ 106 unsigned long int cucul_get_attr(cucul_canvas_t *, int, int); 106 107 int cucul_set_attr(cucul_canvas_t *, unsigned long int); 107 unsigned long int cucul_get_attr(cucul_canvas_t *, int, int); 108 unsigned long int cucul_ansi_to_attr(unsigned char, unsigned char); 109 unsigned long int cucul_argb_to_attr(unsigned int, unsigned int); 110 char const *cucul_get_color_name(unsigned int); 108 int cucul_set_color_ansi(cucul_canvas_t *, unsigned char, unsigned char); 109 int cucul_set_color_argb(cucul_canvas_t *, unsigned int, unsigned int); 110 char const *cucul_ansi_to_str(unsigned char); 111 111 int cucul_putchar(cucul_canvas_t *, int, int, unsigned long int); 112 112 unsigned long int cucul_getchar(cucul_canvas_t *, int, int); … … 249 249 int cucul_set_truecolor(cucul_canvas_t *, unsigned int, 250 250 unsigned int) CUCUL_DEPRECATED; 251 char const *cucul_get_color_name(unsigned int) CUCUL_DEPRECATED; 251 252 # define CUCUL_COLOR_BLACK CUCUL_BLACK 252 253 # define CUCUL_COLOR_BLUE CUCUL_BLUE -
libcaca/trunk/cucul/dither.c
r1257 r1267 1043 1043 1044 1044 /* Now output the character */ 1045 cucul_set_ attr(cv, cucul_ansi_to_attr(outfg, outbg));1045 cucul_set_color_ansi(cv, outfg, outbg); 1046 1046 cucul_putchar(cv, x, y, outch); 1047 1047 -
libcaca/trunk/cucul/import.c
r1257 r1267 203 203 } 204 204 205 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, CUCUL_TRANSPARENT));205 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 206 206 207 207 for(i = 0; i < size; i++) … … 385 385 case 'K': /* EL - Erase In Line */ 386 386 if(width < 80) 387 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, 388 CUCUL_TRANSPARENT)); 387 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 389 388 cucul_set_canvas_size(cv, width = 80, height); 390 389 for(j = x; j < 80; j++) … … 436 435 if((unsigned int)x + wch > width) 437 436 { 438 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, 439 CUCUL_TRANSPARENT)); 437 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 440 438 cucul_set_canvas_size(cv, width = x + wch, height); 441 439 } … … 443 441 if((unsigned int)y >= height) 444 442 { 445 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, 446 CUCUL_TRANSPARENT)); 443 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 447 444 cucul_set_canvas_size(cv, width, height = y + 1); 448 445 } 449 446 450 447 /* Now paste our character */ 451 cucul_set_ attr(cv, cucul_ansi_to_attr(grcm.efg, grcm.ebg));448 cucul_set_color_ansi(cv, grcm.efg, grcm.ebg); 452 449 cucul_putchar(cv, x, y, ch); 453 450 x += wch; … … 456 453 if((unsigned int)y > height) 457 454 { 458 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, 459 CUCUL_TRANSPARENT)); 455 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 460 456 cucul_set_canvas_size(cv, width, height = y); 461 457 } -
libcaca/trunk/src/aafire.c
r1257 r1267 241 241 cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), 242 242 cucul_get_canvas_height(cv), cucul_dither, bitmap); 243 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));243 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 244 244 if (sloop < 100) 245 245 cucul_putstr(cv, cucul_get_canvas_width(cv) - 30, -
libcaca/trunk/src/cacademo.c
r1257 r1267 162 162 { 163 163 fn[next](RENDER, backcv); 164 cucul_set_attr(mask, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, 165 CUCUL_BLACK)); 164 cucul_set_color_ansi(mask, CUCUL_LIGHTGRAY, CUCUL_BLACK); 166 165 cucul_clear_canvas(mask); 167 cucul_set_ attr(mask, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_WHITE));166 cucul_set_color_ansi(mask, CUCUL_WHITE, CUCUL_WHITE); 168 167 transition(mask, tmode, 169 168 100 * (frame - next_transition) / TRANSITION_FRAMES); … … 171 170 } 172 171 173 cucul_set_ attr(frontcv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));172 cucul_set_color_ansi(frontcv, CUCUL_WHITE, CUCUL_BLUE); 174 173 if(frame < 100) 175 174 cucul_putstr(frontcv, cucul_get_canvas_width(frontcv) - 30, … … 694 693 695 694 if(p & 0x0f) 696 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, p >> 4));695 cucul_set_color_ansi(cv, CUCUL_WHITE, p >> 4); 697 696 else 698 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_BLACK, 699 CUCUL_BLACK)); 697 cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_BLACK); 700 698 cucul_putchar(cv, x, y, gradient[p & 0x0f]); 701 699 } … … 761 759 h = cucul_get_canvas_height(cv); 762 760 763 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_BLACK, CUCUL_BLACK));761 cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_BLACK); 764 762 cucul_clear_canvas(cv); 765 763 … … 783 781 else 784 782 fg = CUCUL_DARKGRAY; 785 cucul_set_ attr(cv, cucul_ansi_to_attr(fg, CUCUL_BLACK));783 cucul_set_color_ansi(cv, fg, CUCUL_BLACK); 786 784 787 785 cucul_putchar(cv, x, y - j, -
libcaca/trunk/src/cacadraw.c
r1257 r1267 152 152 static int refresh_screen(void) 153 153 { 154 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, CUCUL_DEFAULT));154 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_DEFAULT); 155 155 cucul_clear_canvas(cv); 156 156 -
libcaca/trunk/src/cacaview.c
r1257 r1267 305 305 sprintf(buffer, " Loading `%s'... ", list[current]); 306 306 buffer[ww] = '\0'; 307 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));307 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 308 308 cucul_putstr(cv, (ww - strlen(buffer)) / 2, wh / 2, buffer); 309 309 caca_refresh_display(dp); … … 325 325 } 326 326 327 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLACK));327 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); 328 328 cucul_clear_canvas(cv); 329 329 330 330 if(!items) 331 331 { 332 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));332 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 333 333 cucul_printf(cv, ww / 2 - 5, wh / 2, " No image. "); 334 334 } … … 350 350 sprintf(buffer, ERROR_STRING, list[current]); 351 351 buffer[ww] = '\0'; 352 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));352 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 353 353 cucul_putstr(cv, (ww - strlen(buffer)) / 2, wh / 2, buffer); 354 354 free(buffer); … … 380 380 381 381 #if 0 /* FIXME */ 382 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, 383 CUCUL_BLACK)); 382 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 384 383 switch(status) 385 384 { … … 420 419 static void print_status(void) 421 420 { 422 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));421 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 423 422 cucul_draw_line(cv, 0, 0, ww - 1, 0, " "); 424 423 cucul_draw_line(cv, 0, wh - 2, ww - 1, wh - 2, "-"); … … 430 429 cucul_printf(cv, ww - 14, wh - 2, "(zoom: %s%i)", zoom > 0 ? "+" : "", zoom); 431 430 432 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));431 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 433 432 cucul_draw_line(cv, 0, wh - 1, ww - 1, wh - 1, " "); 434 433 } … … 458 457 int i; 459 458 460 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));459 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 461 460 462 461 for(i = 0; help[i]; i++) … … 519 518 { 520 519 if((((xn - x) / 5) ^ ((yn - y) / 3)) & 1) 521 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, 522 CUCUL_DARKGRAY)); 520 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_DARKGRAY); 523 521 else 524 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_DARKGRAY, 525 CUCUL_LIGHTGRAY)); 522 cucul_set_color_ansi(cv, CUCUL_DARKGRAY, CUCUL_LIGHTGRAY); 526 523 cucul_putchar(cv, xn, yn, ' '); 527 524 } -
libcaca/trunk/src/img2irc.c
r1257 r1267 57 57 58 58 cucul_set_canvas_size(cv, cols, lines); 59 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, CUCUL_TRANSPARENT));59 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 60 60 cucul_clear_canvas(cv); 61 61 cucul_dither_bitmap(cv, 0, 0, cols, lines, i->dither, i->pixels); -
libcaca/trunk/test/colors.c
r1266 r1267 36 36 return 1; 37 37 38 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));38 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 39 39 cucul_clear_canvas(cv); 40 40 for(i = 0; i < 16; i++) 41 41 { 42 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));42 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 43 43 cucul_printf(cv, 3, i + (i >= 8 ? 3 : 2), "'%cv': %i (%s)", 44 'a' + i, i, cucul_ get_color_name(i));44 'a' + i, i, cucul_ansi_to_str(i)); 45 45 for(j = 0; j < 16; j++) 46 46 { 47 cucul_set_ attr(cv, cucul_ansi_to_attr(i, j));47 cucul_set_color_ansi(cv, i, j); 48 48 cucul_putstr(cv, (j >= 8 ? 40 : 39) + j * 2, i + (i >= 8 ? 3 : 2), 49 49 "Aa"); … … 51 51 } 52 52 53 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));53 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 54 54 cucul_putstr(cv, 3, 20, "This is bold This is blink This is italics This is underline"); 55 55 cucul_set_attr(cv, CUCUL_BOLD); -
libcaca/trunk/test/demo.c
r1257 r1267 151 151 if(demo) 152 152 { 153 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, 154 CUCUL_BLACK)); 153 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 155 154 cucul_clear_canvas(cv); 156 155 } … … 173 172 if(mouse && !demo) 174 173 { 175 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_RED, CUCUL_BLACK));174 cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BLACK); 176 175 cucul_putstr(cv, xmouse, ymouse, "."); 177 176 cucul_putstr(cv, xmouse, ymouse + 1, "|\\"); … … 185 184 demo(); 186 185 187 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, 188 CUCUL_BLACK)); 186 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 189 187 cucul_draw_thin_box(cv, 1, 1, cucul_get_canvas_width(cv) - 2, 190 188 cucul_get_canvas_height(cv) - 2); … … 211 209 int yo = cucul_get_canvas_height(cv) - 2; 212 210 213 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));211 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 214 212 cucul_clear_canvas(cv); 215 213 cucul_draw_thin_box(cv, 1, 1, xo, yo); … … 253 251 i++; 254 252 255 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));253 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 256 254 cucul_clear_canvas(cv); 257 255 258 256 /* Draw the sun */ 259 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_YELLOW, CUCUL_BLACK));257 cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); 260 258 xo = cucul_get_canvas_width(cv) / 4; 261 259 yo = cucul_get_canvas_height(cv) / 4 + 5 * sin(0.03*i); … … 269 267 270 268 j = 15 + sin(0.03*i) * 8; 271 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLACK));269 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); 272 270 cucul_fill_ellipse(cv, xo, yo, j, j / 2, "#"); 273 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_YELLOW, CUCUL_BLACK));271 cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); 274 272 cucul_draw_ellipse(cv, xo, yo, j, j / 2, "#"); 275 273 … … 287 285 yc = cucul_get_canvas_height(cv) * 3 / 4 + cos(0.02*i) * 5; 288 286 289 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_GREEN, CUCUL_BLACK));287 cucul_set_color_ansi(cv, CUCUL_GREEN, CUCUL_BLACK); 290 288 cucul_fill_triangle(cv, xo, yo, xb, yb, xa, ya, "%"); 291 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_YELLOW, CUCUL_BLACK));289 cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); 292 290 cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xa, ya); 293 291 294 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_RED, CUCUL_BLACK));292 cucul_set_color_ansi(cv, CUCUL_RED, CUCUL_BLACK); 295 293 cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); 296 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_YELLOW, CUCUL_BLACK));294 cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); 297 295 cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); 298 296 299 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_BLUE, CUCUL_BLACK));297 cucul_set_color_ansi(cv, CUCUL_BLUE, CUCUL_BLACK); 300 298 cucul_fill_triangle(cv, xo, yo, xb, yb, xc, yc, "%"); 301 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_YELLOW, CUCUL_BLACK));299 cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_BLACK); 302 300 cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xc, yc); 303 301 … … 312 310 yc = cucul_get_canvas_height(cv) - 3; 313 311 314 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_CYAN, CUCUL_BLACK));312 cucul_set_color_ansi(cv, CUCUL_CYAN, CUCUL_BLACK); 315 313 cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); 316 314 … … 331 329 { 332 330 int delta = cucul_rand(-5, 6); 333 cucul_set_attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), 334 cucul_rand(0, 16))); 331 cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 335 332 cucul_putchar(cv, cucul_get_canvas_width(cv) / 2 336 333 + cos(0.02*j) * (delta + cucul_get_canvas_width(cv) / 4), … … 361 358 { 362 359 /* Putpixel */ 363 cucul_set_attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), 364 cucul_rand(0, 16))); 360 cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 365 361 cucul_putchar(cv, cucul_rand(0, xmax), cucul_rand(0, ymax), 366 362 chars[cucul_rand(0, 9)]); … … 373 369 char buf[BUFSIZ]; 374 370 375 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));371 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 376 372 cucul_clear_canvas(cv); 377 373 for(i = 0; i < 16; i++) 378 374 { 379 sprintf(buf, "'%c': %i (%s)", 'a' + i, i, cucul_ get_color_name(i));380 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));375 sprintf(buf, "'%c': %i (%s)", 'a' + i, i, cucul_ansi_to_str(i)); 376 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 381 377 cucul_putstr(cv, 4, i + (i >= 8 ? 4 : 3), buf); 382 378 for(j = 0; j < 16; j++) 383 379 { 384 cucul_set_ attr(cv, cucul_ansi_to_attr(i, j));380 cucul_set_color_ansi(cv, i, j); 385 381 cucul_putstr(cv, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3), "# "); 386 382 } … … 405 401 } 406 402 407 cucul_set_ attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), CUCUL_BLACK));403 cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); 408 404 if(outline > 1) 409 405 cucul_draw_thin_line(cv, xa, ya, xb, yb); … … 429 425 } 430 426 431 cucul_set_attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), 432 cucul_rand(0, 16))); 427 cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 433 428 cucul_fill_box(cv, xa, ya, xb, yb, "#"); 434 429 435 cucul_set_ attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), CUCUL_BLACK));430 cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); 436 431 if(outline == 2) 437 432 cucul_draw_thin_box(cv, xa, ya, xb, yb); … … 461 456 } 462 457 463 cucul_set_attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), 464 cucul_rand(0, 16))); 458 cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 465 459 cucul_fill_ellipse(cv, x, y, a, b, "#"); 466 460 467 cucul_set_ attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), CUCUL_BLACK));461 cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); 468 462 if(outline == 2) 469 463 cucul_draw_thin_ellipse(cv, x, y, a, b); … … 492 486 } 493 487 494 cucul_set_attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), 495 cucul_rand(0, 16))); 488 cucul_set_color_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16)); 496 489 cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); 497 490 498 cucul_set_ attr(cv, cucul_ansi_to_attr(cucul_rand(0, 16), CUCUL_BLACK));491 cucul_set_color_ansi(cv, cucul_rand(0, 16), CUCUL_BLACK); 499 492 if(outline == 2) 500 493 cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); -
libcaca/trunk/test/dithering.c
r1257 r1267 117 117 else 118 118 ch = density[dista * 2 * 13 / (dista + distb)]; 119 cucul_set_ attr(cv, cucul_ansi_to_attr(points[nearb], points[neara]));119 cucul_set_color_ansi(cv, points[nearb], points[neara]); 120 120 121 121 cucul_putchar(cv, x * cucul_get_canvas_width(cv) / 100, -
libcaca/trunk/test/event.c
r1257 r1267 42 42 h = cucul_get_canvas_height(cv) - 1; 43 43 44 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));44 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 45 45 cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, " "); 46 46 … … 84 84 while(ret); 85 85 86 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));86 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 87 87 cucul_clear_canvas(cv); 88 88 89 89 /* Print current event */ 90 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));90 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 91 91 cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, " "); 92 92 print_event(0, 0, events); … … 96 96 97 97 /* Print previous events */ 98 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLACK));98 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); 99 99 for(i = 1; i < h && events[i].type; i++) 100 100 print_event(0, i, events + i); -
libcaca/trunk/test/export.c
r1266 r1267 116 116 cucul_free_dither(dither); 117 117 118 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLACK));118 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); 119 119 cucul_draw_thin_box(cv, 0, 0, WIDTH - 1, HEIGHT - 1); 120 120 121 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_BLACK, CUCUL_WHITE));121 cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); 122 122 cucul_fill_ellipse(cv, WIDTH / 2, HEIGHT / 2, 123 123 WIDTH / 4, HEIGHT / 4, " "); … … 135 135 cucul_set_attr(cv, CUCUL_UNDERLINE); 136 136 cucul_putstr(cv, WIDTH / 2 + 8, HEIGHT / 2 + 3, "Underline"); 137 cucul_set_attr(cv, 0); 137 138 138 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_LIGHTBLUE));139 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_LIGHTBLUE); 139 140 cucul_putstr(cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); 140 141 141 142 for(x = 0; x < 16; x++) 142 143 { 143 cucul_set_attr(cv, cucul_argb_to_attr(0xff00 | x, 144 0xf00f | (x << 4))); 144 cucul_set_color_argb(cv, 0xff00 | x, 0xf00f | (x << 4)); 145 145 cucul_putstr(cv, WIDTH / 2 - 7 + x, HEIGHT / 2 + 5, "#"); 146 146 } -
libcaca/trunk/test/font.c
r1257 r1267 46 46 47 47 /* Draw stuff on our canvas */ 48 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLACK));48 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK); 49 49 cucul_putstr(cv, 0, 0, "ABcde"); 50 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTRED, CUCUL_BLACK));50 cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_BLACK); 51 51 cucul_putstr(cv, 5, 0, "\\o/"); 52 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));52 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 53 53 cucul_putstr(cv, 0, 1, "&$âøÿØ?!"); 54 54 -
libcaca/trunk/test/font2tga.c
r1257 r1267 59 59 /* Create a canvas */ 60 60 cv = cucul_create_canvas(WIDTH, (glyphs + WIDTH - 1) / WIDTH); 61 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_BLACK, CUCUL_WHITE));61 cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_WHITE); 62 62 63 63 /* Put all glyphs on the canvas */ -
libcaca/trunk/test/frames.c
r1257 r1267 49 49 { 50 50 cucul_set_canvas_frame(cv, frame); 51 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, frame));51 cucul_set_color_ansi(cv, CUCUL_WHITE, frame); 52 52 cucul_fill_box(cv, 0, 0, 40, 15, ":"); 53 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));53 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 54 54 cucul_putstr(cv, frame * 5 / 2, frame, "カカ"); 55 55 } … … 61 61 cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); 62 62 63 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_DEFAULT, CUCUL_TRANSPARENT));63 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 64 64 dp = caca_create_display(cv); 65 65 caca_set_display_time(dp, 50000); -
libcaca/trunk/test/fullwidth.c
r1257 r1267 43 43 for(i = 0; i < 10; i++) 44 44 { 45 cucul_set_ attr(caca, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));45 cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); 46 46 cucul_putstr(caca, 0, i, CACA); 47 cucul_set_ attr(caca, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_RED));47 cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_RED); 48 48 cucul_putchar(caca, i - 2, i, 'x'); 49 49 } … … 54 54 for(i = 0; i < 10; i++) 55 55 { 56 cucul_set_ attr(caca, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));56 cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); 57 57 cucul_putstr(caca, 0, i, CACA); 58 cucul_set_ attr(caca, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_GREEN));58 cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_GREEN); 59 59 cucul_putstr(caca, i - 2, i, "ホ"); 60 60 } … … 63 63 64 64 /* Line of canvas */ 65 cucul_set_ attr(line, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_MAGENTA));65 cucul_set_color_ansi(line, CUCUL_WHITE, CUCUL_MAGENTA); 66 66 cucul_putstr(line, 0, 0, "ほ"); 67 67 for(i = 0; i < 10; i++) 68 68 { 69 cucul_set_ attr(caca, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));69 cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); 70 70 cucul_putstr(caca, 0, i, CACA); 71 71 cucul_blit(caca, i - 2, i, line, NULL); -
libcaca/trunk/test/gamma.c
r1257 r1267 87 87 88 88 /* Draw something on the mask */ 89 cucul_set_ attr(mask, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));89 cucul_set_color_ansi(mask, CUCUL_LIGHTGRAY, CUCUL_BLACK); 90 90 cucul_clear_canvas(mask); 91 cucul_set_ attr(mask, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_WHITE));91 cucul_set_color_ansi(mask, CUCUL_WHITE, CUCUL_WHITE); 92 92 cucul_fill_ellipse(mask, (1.0 + sin(0.05 * (float)x)) 93 93 * 0.5 * cucul_get_canvas_width(mask), … … 100 100 cucul_blit(cv, 0, 0, cw, mask); 101 101 102 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));102 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 103 103 cucul_printf(cv, 2, 1, 104 104 "gamma=%g - use arrows to change, Esc to quit", gam); -
libcaca/trunk/test/input.c
r1257 r1267 44 44 dp = caca_create_display(cv); 45 45 46 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));46 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 47 47 cucul_putstr(cv, 1, 1, "Text entries - press tab to cycle"); 48 48 … … 62 62 unsigned int j, start, size; 63 63 64 cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_BLACK, 65 CUCUL_LIGHTGRAY)); 64 cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_LIGHTGRAY); 66 65 cucul_fill_box(cv, 2, 3 * i + 4, 2 + BUFFER_SIZE, 3 * i + 4, " "); 67 66 … … 77 76 78 77 /* Put the cursor on the active textentry */ 79 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTRED, CUCUL_LIGHTRED));78 cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_LIGHTRED); 80 79 cucul_putchar(cv, 2 + entries[e].cursor, 3 * e + 4, ' '); 81 80 -
libcaca/trunk/test/spritedit.c
r1257 r1267 103 103 104 104 105 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));105 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 106 106 cucul_clear_canvas(cv); 107 107 … … 126 126 xb = xa + 1 + cucul_get_sprite_width(sprite, frame); 127 127 yb = ya + 1 + cucul_get_sprite_height(sprite, frame); 128 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_BLACK, CUCUL_BLACK));128 cucul_set_color_ansi(cv, CUCUL_BLACK, CUCUL_BLACK); 129 129 cucul_fill_box(cv, 57 + xa, 10 + ya, 57 + xb, 10 + yb, " "); 130 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));130 cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); 131 131 cucul_draw_thin_box(cv, 57 + xa, 10 + ya, 57 + xb, 10 + yb); 132 132 cucul_draw_sprite(cv, 57, 10, sprite, frame); -
libcaca/trunk/test/transform.c
r1257 r1267 59 59 rotate = cucul_create_canvas(70, 6); 60 60 61 cucul_set_ attr(normal, cucul_ansi_to_attr(CUCUL_LIGHTMAGENTA, CUCUL_BLACK));61 cucul_set_color_ansi(normal, CUCUL_LIGHTMAGENTA, CUCUL_BLACK); 62 62 for(i = 0; pig[i]; i++) 63 63 cucul_putstr(normal, 55, i, pig[i]); 64 64 65 cucul_set_ attr(normal, cucul_ansi_to_attr(CUCUL_LIGHTGREEN, CUCUL_BLACK));65 cucul_set_color_ansi(normal, CUCUL_LIGHTGREEN, CUCUL_BLACK); 66 66 for(i = 0; duck[i]; i++) 67 67 cucul_putstr(normal, 30, 1 + i, duck[i]); 68 68 69 cucul_set_ attr(normal, cucul_ansi_to_attr(CUCUL_LIGHTCYAN, CUCUL_BLACK));69 cucul_set_color_ansi(normal, CUCUL_LIGHTCYAN, CUCUL_BLACK); 70 70 cucul_putstr(normal, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]"); 71 cucul_set_ attr(normal, cucul_ansi_to_attr(CUCUL_LIGHTRED, CUCUL_BLACK));71 cucul_set_color_ansi(normal, CUCUL_LIGHTRED, CUCUL_BLACK); 72 72 cucul_putchar(normal, 38, 1, '|'); 73 73 74 cucul_set_ attr(normal, cucul_ansi_to_attr(CUCUL_YELLOW, CUCUL_BLACK));74 cucul_set_color_ansi(normal, CUCUL_YELLOW, CUCUL_BLACK); 75 75 cucul_putstr(normal, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/"); 76 76 77 cucul_set_ attr(normal, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_LIGHTRED));77 cucul_set_color_ansi(normal, CUCUL_WHITE, CUCUL_LIGHTRED); 78 78 cucul_putstr(normal, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌"); 79 79 cucul_putstr(normal, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖"); 80 cucul_set_ attr(normal, cucul_ansi_to_attr(CUCUL_BLACK, CUCUL_LIGHTRED));80 cucul_set_color_ansi(normal, CUCUL_BLACK, CUCUL_LIGHTRED); 81 81 cucul_putstr(normal, 4, 3, "▓▒░"); 82 82 cucul_putstr(normal, 4, 4, "▓▒░"); … … 95 95 96 96 /* Blit the transformed canvas onto the main canvas */ 97 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE));97 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 98 98 cucul_putstr(cv, 0, 0, "normal"); 99 99 cucul_blit(cv, 10, 0, normal, NULL); -
libcaca/trunk/test/truecolor.c
r1257 r1267 41 41 uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8); 42 42 43 cucul_set_ attr(cv, cucul_argb_to_attr(fgcolor, bgcolor));43 cucul_set_color_argb(cv, fgcolor, bgcolor); 44 44 cucul_putstr(cv, x * 2, y, "CA"); 45 45 } 46 46 47 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_LIGHTBLUE));47 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_LIGHTBLUE); 48 48 cucul_putstr(cv, 2, 1, " truecolor libcaca "); 49 49 -
libcaca/trunk/test/unicode.c
r1257 r1267 25 25 #include "caca.h" 26 26 27 #define ATTR_WHITE_ON_BLUE cucul_ansi_to_attr(CUCUL_WHITE, CUCUL_BLUE)28 #define ATTR_DEFAULT cucul_ansi_to_attr(CUCUL_DEFAULT, CUCUL_TRANSPARENT)29 30 27 int main(int argc, char *argv[]) 31 28 { … … 36 33 dp = caca_create_display(cv); 37 34 38 cucul_set_ attr(cv, ATTR_WHITE_ON_BLUE);35 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 39 36 cucul_putstr(cv, 1, 1, "Basic Unicode support"); 40 37 41 cucul_set_ attr(cv, ATTR_DEFAULT);38 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 42 39 cucul_putstr(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |"); 43 40 cucul_putstr(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |"); … … 46 43 cucul_putstr(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere."); 47 44 48 cucul_set_ attr(cv, ATTR_WHITE_ON_BLUE);45 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 49 46 cucul_putstr(cv, 1, 7, "Gradient glyphs"); 50 47 51 cucul_set_ attr(cv, ATTR_DEFAULT);48 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 52 49 cucul_putstr(cv, 31, 8, " 0%"); 53 50 cucul_putstr(cv, 31, 9, " 25%"); … … 56 53 cucul_putstr(cv, 31, 12, "100%"); 57 54 58 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTRED, CUCUL_LIGHTGREEN));55 cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_LIGHTGREEN); 59 56 cucul_putstr(cv, 1, 8, " "); 60 57 cucul_putstr(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); … … 63 60 cucul_putstr(cv, 1, 12, "█████████████████████████████"); 64 61 65 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGREEN, CUCUL_LIGHTRED));62 cucul_set_color_ansi(cv, CUCUL_LIGHTGREEN, CUCUL_LIGHTRED); 66 63 cucul_putstr(cv, 36, 8, "█████████████████████████████"); 67 64 cucul_putstr(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); … … 70 67 cucul_putstr(cv, 36, 12, " "); 71 68 72 cucul_set_ attr(cv, ATTR_WHITE_ON_BLUE);69 cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 73 70 cucul_putstr(cv, 1, 14, "Double width characters"); 74 71 75 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTRED, CUCUL_TRANSPARENT));72 cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_TRANSPARENT); 76 73 cucul_putstr(cv, 1, 15, "| ドラゴン ボーレ |"); 77 cucul_set_ attr(cv, ATTR_DEFAULT);74 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 78 75 cucul_putstr(cv, 1, 16, "| ()()()() ()()() |"); 79 cucul_set_ attr(cv, cucul_ansi_to_attr(CUCUL_YELLOW, CUCUL_TRANSPARENT));76 cucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_TRANSPARENT); 80 77 cucul_putstr(cv, 1, 17, "| ドラゴン"); 81 78 cucul_putstr(cv, 12, 17, "ボーレ |"); 82 79 83 cucul_set_ attr(cv, ATTR_DEFAULT);80 cucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT); 84 81 cucul_putstr(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere."); 85 82
Note: See TracChangeset
for help on using the changeset viewer.