with cucul_set_attr_ansi(). Old application will still compile (but issue a warning) and run, though.tags/v0.99.beta14
@@ -512,7 +512,7 @@ static void gl_compute_font(caca_display_t *dp) | |||
/* Allocate a libcucul canvas and print all the glyphs on it */ | |||
cv = cucul_create_canvas(1, b); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK, 0); | |||
for(b = 0, i = 0; dp->drv.p->blocks[i + 1]; i += 2) | |||
{ | |||
@@ -26,6 +26,10 @@ | |||
#include "cucul.h" | |||
#include "cucul_internals.h" | |||
/* Legacy stuff from old versions */ | |||
int cucul_set_color(cucul_canvas_t *, unsigned char, unsigned char); | |||
int cucul_set_truecolor(cucul_canvas_t *, unsigned int, unsigned int); | |||
/* RGB colours for the ANSI palette. There is no real standard, so we | |||
* use the same values as gnome-terminal. The 7th colour (brown) is a bit | |||
* special: 0xfa50 instead of 0xfaa0. */ | |||
@@ -120,9 +120,6 @@ int cucul_blit(cucul_canvas_t *, int, int, cucul_canvas_t const *, | |||
cucul_canvas_t const *); | |||
int cucul_set_canvas_boundaries(cucul_canvas_t *, int, int, | |||
unsigned int, unsigned int); | |||
/* Legacy stuff */ | |||
int cucul_set_color(cucul_canvas_t *, unsigned char, unsigned char); | |||
int cucul_set_truecolor(cucul_canvas_t *, unsigned int, unsigned int); | |||
/* @} */ | |||
/** \defgroup transform libcucul canvas transformation | |||
@@ -1042,7 +1042,7 @@ int cucul_dither_bitmap(cucul_canvas_t *cv, int x, int y, int w, int h, | |||
} | |||
/* Now output the character */ | |||
cucul_set_color(cv, outfg, outbg); | |||
cucul_set_attr_ansi(cv, outfg, outbg, 0); | |||
cucul_putchar(cv, x, y, outch); | |||
d->increment_dither(); | |||
@@ -202,7 +202,7 @@ static cucul_canvas_t *import_text(void const *data, unsigned int size) | |||
return NULL; | |||
} | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT, 0); | |||
for(i = 0; i < size; i++) | |||
{ | |||
@@ -384,8 +384,8 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size, | |||
break; | |||
case 'K': /* EL - Erase In Line */ | |||
if(width < 80) | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, | |||
CUCUL_COLOR_TRANSPARENT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, | |||
CUCUL_COLOR_TRANSPARENT, 0); | |||
cucul_set_canvas_size(cv, width = 80, height); | |||
for(j = x; j < 80; j++) | |||
cucul_putchar(cv, j, y, ' '); | |||
@@ -435,25 +435,28 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size, | |||
/* Make sure the canvas is big enough. */ | |||
if((unsigned int)x + wch > width) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, | |||
CUCUL_COLOR_TRANSPARENT, 0); | |||
cucul_set_canvas_size(cv, width = x + wch, height); | |||
} | |||
if((unsigned int)y >= height) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, | |||
CUCUL_COLOR_TRANSPARENT, 0); | |||
cucul_set_canvas_size(cv, width, height = y + 1); | |||
} | |||
/* Now paste our character */ | |||
cucul_set_color(cv, grcm.efg, grcm.ebg); | |||
cucul_set_attr_ansi(cv, grcm.efg, grcm.ebg, 0); | |||
cucul_putchar(cv, x, y, ch); | |||
x += wch; | |||
} | |||
if((unsigned int)y > height) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, | |||
CUCUL_COLOR_TRANSPARENT, 0); | |||
cucul_set_canvas_size(cv, width, height = y); | |||
} | |||
@@ -48,7 +48,7 @@ unsigned int cucul_get_canvas_frame_count(cucul_canvas_t *cv) | |||
* | |||
* Set the active canvas frame. All subsequent drawing operations will | |||
* be performed on that frame. The current painting context set by | |||
* cucul_set_color() or cucul_set_truecolor() is inherited. | |||
* cucul_set_attr_ansi() or cucul_set_attr_argb() is inherited. | |||
* | |||
* If the frame index is outside the canvas' frame range, nothing happens. | |||
* | |||
@@ -240,7 +240,7 @@ drawfire (void) | |||
paused: | |||
cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), | |||
cucul_get_canvas_height(cv), cucul_dither, bitmap); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
if (sloop < 100) | |||
cucul_putstr(cv, cucul_get_canvas_width(cv) - 30, | |||
cucul_get_canvas_height(cv) - 2, | |||
@@ -161,15 +161,17 @@ paused: | |||
if(next != -1) | |||
{ | |||
fn[next](RENDER, backcv); | |||
cucul_set_color(mask, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(mask, CUCUL_COLOR_LIGHTGRAY, | |||
CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(mask); | |||
cucul_set_color(mask, CUCUL_COLOR_WHITE, CUCUL_COLOR_WHITE); | |||
cucul_set_attr_ansi(mask, CUCUL_COLOR_WHITE, | |||
CUCUL_COLOR_WHITE, 0); | |||
transition(mask, tmode, | |||
100 * (frame - next_transition) / TRANSITION_FRAMES); | |||
cucul_blit(frontcv, 0, 0, backcv, mask); | |||
} | |||
cucul_set_color(frontcv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(frontcv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
if(frame < 100) | |||
cucul_putstr(frontcv, cucul_get_canvas_width(frontcv) - 30, | |||
cucul_get_canvas_height(frontcv) - 2, | |||
@@ -692,9 +694,10 @@ void langton(enum action action, cucul_canvas_t *cv) | |||
uint8_t p = screen[x + width * y]; | |||
if(p & 0x0f) | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, p >> 4); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, p >> 4, 0); | |||
else | |||
cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_BLACK, | |||
CUCUL_COLOR_BLACK, 0); | |||
cucul_putchar(cv, x, y, gradient[p & 0x0f]); | |||
} | |||
} | |||
@@ -758,7 +761,7 @@ void matrix(enum action action, cucul_canvas_t *cv) | |||
w = cucul_get_canvas_width(cv); | |||
h = cucul_get_canvas_height(cv); | |||
cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
for(i = 0; i < MAXDROPS && i < (w * h / 32); i++) | |||
@@ -780,7 +783,7 @@ void matrix(enum action action, cucul_canvas_t *cv) | |||
fg = CUCUL_COLOR_GREEN; | |||
else | |||
fg = CUCUL_COLOR_DARKGRAY; | |||
cucul_set_color(cv, fg, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, fg, CUCUL_COLOR_BLACK, 0); | |||
cucul_putchar(cv, x, y - j, | |||
drop[i].str[(y - j) % drop[i].len]); | |||
@@ -151,7 +151,7 @@ quit: | |||
static int refresh_screen(void) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_DEFAULT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_DEFAULT, 0); | |||
cucul_clear_canvas(cv); | |||
cucul_blit(cv, - x, - y, image, NULL); | |||
@@ -304,7 +304,7 @@ int main(int argc, char **argv) | |||
sprintf(buffer, " Loading `%s'... ", list[current]); | |||
buffer[ww] = '\0'; | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, (ww - strlen(buffer)) / 2, wh / 2, buffer); | |||
caca_refresh_display(dp); | |||
ww = cucul_get_canvas_width(cv); | |||
@@ -324,12 +324,12 @@ int main(int argc, char **argv) | |||
free(buffer); | |||
} | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
if(!items) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_printf(cv, ww / 2 - 5, wh / 2, " No image. "); | |||
} | |||
else if(!im) | |||
@@ -349,7 +349,7 @@ int main(int argc, char **argv) | |||
sprintf(buffer, ERROR_STRING, list[current]); | |||
buffer[ww] = '\0'; | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, (ww - strlen(buffer)) / 2, wh / 2, buffer); | |||
free(buffer); | |||
} | |||
@@ -379,7 +379,8 @@ int main(int argc, char **argv) | |||
print_status(); | |||
#if 0 /* FIXME */ | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, | |||
CUCUL_COLOR_BLACK, 0); | |||
switch(status) | |||
{ | |||
case STATUS_ANTIALIASING: | |||
@@ -418,7 +419,7 @@ int main(int argc, char **argv) | |||
static void print_status(void) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_draw_line(cv, 0, 0, ww - 1, 0, " "); | |||
cucul_draw_line(cv, 0, wh - 2, ww - 1, wh - 2, "-"); | |||
cucul_putstr(cv, 0, 0, "q:Quit np:Next/Prev +-x:Zoom gG:Gamma " | |||
@@ -428,7 +429,7 @@ static void print_status(void) | |||
cucul_printf(cv, ww - 30, wh - 2, "(gamma: %#.3g)", GAMMA(g)); | |||
cucul_printf(cv, ww - 14, wh - 2, "(zoom: %s%i)", zoom > 0 ? "+" : "", zoom); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_line(cv, 0, wh - 1, ww - 1, wh - 1, " "); | |||
} | |||
@@ -456,7 +457,7 @@ static void print_help(int x, int y) | |||
int i; | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
for(i = 0; help[i]; i++) | |||
cucul_putstr(cv, x, y + i, help[i]); | |||
@@ -517,9 +518,11 @@ static void draw_checkers(int x, int y, int w, int h) | |||
for(xn = x > 0 ? x : 0; xn < x + w; xn++) | |||
{ | |||
if((((xn - x) / 5) ^ ((yn - y) / 3)) & 1) | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_DARKGRAY); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, | |||
CUCUL_COLOR_DARKGRAY, 0); | |||
else | |||
cucul_set_color(cv, CUCUL_COLOR_DARKGRAY, CUCUL_COLOR_LIGHTGRAY); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DARKGRAY, | |||
CUCUL_COLOR_LIGHTGRAY, 0); | |||
cucul_putchar(cv, xn, yn, ' '); | |||
} | |||
} | |||
@@ -56,7 +56,7 @@ int main(int argc, char **argv) | |||
lines = cols * i->h * 6 / i->w / 10; | |||
cucul_set_canvas_size(cv, cols, lines); | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT, 0); | |||
cucul_clear_canvas(cv); | |||
cucul_dither_bitmap(cv, 0, 0, cols, lines, i->dither, i->pixels); | |||
@@ -35,16 +35,16 @@ int main(int argc, char **argv) | |||
if(!dp) | |||
return 1; | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
for(i = 0; i < 16; i++) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_printf(cv, 4, i + (i >= 8 ? 4 : 3), "'%cv': %i (%s)", | |||
'a' + i, i, cucul_get_color_name(i)); | |||
for(j = 0; j < 16; j++) | |||
{ | |||
cucul_set_color(cv, i, j); | |||
cucul_set_attr_ansi(cv, i, j, 0); | |||
cucul_putstr(cv, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3), | |||
"Aa"); | |||
} | |||
@@ -150,7 +150,8 @@ int main(int argc, char **argv) | |||
if(demo) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, | |||
CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
} | |||
} | |||
@@ -171,7 +172,7 @@ int main(int argc, char **argv) | |||
display_menu(); | |||
if(mouse && !demo) | |||
{ | |||
cucul_set_color(cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, xmouse, ymouse, "."); | |||
cucul_putstr(cv, xmouse, ymouse + 1, "|\\"); | |||
} | |||
@@ -183,7 +184,8 @@ int main(int argc, char **argv) | |||
{ | |||
demo(); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, | |||
CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_thin_box(cv, 1, 1, cucul_get_canvas_width(cv) - 2, | |||
cucul_get_canvas_height(cv) - 2); | |||
cucul_printf(cv, 4, 1, "[%i.%i fps]----", | |||
@@ -208,7 +210,7 @@ static void display_menu(void) | |||
int xo = cucul_get_canvas_width(cv) - 2; | |||
int yo = cucul_get_canvas_height(cv) - 2; | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
cucul_draw_thin_box(cv, 1, 1, xo, yo); | |||
@@ -250,11 +252,11 @@ static void demo_all(void) | |||
i++; | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
/* Draw the sun */ | |||
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK, 0); | |||
xo = cucul_get_canvas_width(cv) / 4; | |||
yo = cucul_get_canvas_height(cv) / 4 + 5 * sin(0.03*i); | |||
@@ -266,9 +268,9 @@ static void demo_all(void) | |||
} | |||
j = 15 + sin(0.03*i) * 8; | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK, 0); | |||
cucul_fill_ellipse(cv, xo, yo, j, j / 2, "#"); | |||
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_ellipse(cv, xo, yo, j, j / 2, "#"); | |||
/* Draw the pyramid */ | |||
@@ -284,19 +286,19 @@ static void demo_all(void) | |||
xc = cucul_get_canvas_width(cv) / 4 - sin(0.02*i) * 5; | |||
yc = cucul_get_canvas_height(cv) * 3 / 4 + cos(0.02*i) * 5; | |||
cucul_set_color(cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_GREEN, CUCUL_COLOR_BLACK, 0); | |||
cucul_fill_triangle(cv, xo, yo, xb, yb, xa, ya, "%"); | |||
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xa, ya); | |||
cucul_set_color(cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_RED, CUCUL_COLOR_BLACK, 0); | |||
cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); | |||
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
cucul_set_color(cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_BLUE, CUCUL_COLOR_BLACK, 0); | |||
cucul_fill_triangle(cv, xo, yo, xb, yb, xc, yc, "%"); | |||
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_thin_triangle(cv, xo, yo, xb, yb, xc, yc); | |||
/* Draw a background triangle */ | |||
@@ -309,7 +311,7 @@ static void demo_all(void) | |||
xc = cucul_get_canvas_width(cv) / 3; | |||
yc = cucul_get_canvas_height(cv) - 3; | |||
cucul_set_color(cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_CYAN, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
xo = cucul_get_canvas_width(cv) / 2 + cos(0.027*i) * cucul_get_canvas_width(cv) / 3; | |||
@@ -328,7 +330,7 @@ static void demo_all(void) | |||
for(j = i - 60; j < i; j++) | |||
{ | |||
int delta = cucul_rand(-5, 6); | |||
cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16), 0); | |||
cucul_putchar(cv, cucul_get_canvas_width(cv) / 2 | |||
+ cos(0.02*j) * (delta + cucul_get_canvas_width(cv) / 4), | |||
cucul_get_canvas_height(cv) / 2 | |||
@@ -357,7 +359,7 @@ static void demo_dots(void) | |||
for(i = 1000; i--;) | |||
{ | |||
/* Putpixel */ | |||
cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16), 0); | |||
cucul_putchar(cv, cucul_rand(0, xmax), cucul_rand(0, ymax), | |||
chars[cucul_rand(0, 9)]); | |||
} | |||
@@ -368,16 +370,16 @@ static void demo_color(void) | |||
int i, j; | |||
char buf[BUFSIZ]; | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
for(i = 0; i < 16; i++) | |||
{ | |||
sprintf(buf, "'%c': %i (%s)", 'a' + i, i, cucul_get_color_name(i)); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 4, i + (i >= 8 ? 4 : 3), buf); | |||
for(j = 0; j < 16; j++) | |||
{ | |||
cucul_set_color(cv, i, j); | |||
cucul_set_attr_ansi(cv, i, j, 0); | |||
cucul_putstr(cv, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3), "# "); | |||
} | |||
} | |||
@@ -400,7 +402,7 @@ static void demo_lines(void) | |||
xb = cucul_rand(0, w); yb = cucul_rand(0, h); | |||
} | |||
cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK, 0); | |||
if(outline > 1) | |||
cucul_draw_thin_line(cv, xa, ya, xb, yb); | |||
else | |||
@@ -424,10 +426,10 @@ static void demo_boxes(void) | |||
xb = cucul_rand(0, w); yb = cucul_rand(0, h); | |||
} | |||
cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16), 0); | |||
cucul_fill_box(cv, xa, ya, xb, yb, "#"); | |||
cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK, 0); | |||
if(outline == 2) | |||
cucul_draw_thin_box(cv, xa, ya, xb, yb); | |||
else if(outline == 1) | |||
@@ -455,10 +457,10 @@ static void demo_ellipses(void) | |||
} while(x - a < 0 || x + a >= w || y - b < 0 || y + b >= h); | |||
} | |||
cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16), 0); | |||
cucul_fill_ellipse(cv, x, y, a, b, "#"); | |||
cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK, 0); | |||
if(outline == 2) | |||
cucul_draw_thin_ellipse(cv, x, y, a, b); | |||
else if(outline == 1) | |||
@@ -485,10 +487,10 @@ static void demo_triangles(void) | |||
xc = cucul_rand(0, w); yc = cucul_rand(0, h); | |||
} | |||
cucul_set_color(cv, cucul_rand(0, 16), cucul_rand(0, 16)); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), cucul_rand(0, 16), 0); | |||
cucul_fill_triangle(cv, xa, ya, xb, yb, xc, yc, "#"); | |||
cucul_set_color(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, cucul_rand(0, 16), CUCUL_COLOR_BLACK, 0); | |||
if(outline == 2) | |||
cucul_draw_thin_triangle(cv, xa, ya, xb, yb, xc, yc); | |||
else if(outline == 1) | |||
@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) | |||
ch = density[distb * 2 * 13 / (dista + distb)]; | |||
else | |||
ch = density[dista * 2 * 13 / (dista + distb)]; | |||
cucul_set_color(cv, points[nearb], points[neara]); | |||
cucul_set_attr_ansi(cv, points[nearb], points[neara], 0); | |||
cucul_putchar(cv, x * cucul_get_canvas_width(cv) / 100, | |||
(100 - y) * cucul_get_canvas_height(cv) / 100, ch); | |||
@@ -41,7 +41,7 @@ int main(int argc, char **argv) | |||
h = cucul_get_canvas_height(cv) - 1; | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, " "); | |||
cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, " "); | |||
@@ -83,11 +83,11 @@ int main(int argc, char **argv) | |||
} | |||
while(ret); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
/* Print current event */ | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_draw_line(cv, 0, 0, cucul_get_canvas_width(cv) - 1, 0, " "); | |||
print_event(0, 0, events); | |||
@@ -95,7 +95,7 @@ int main(int argc, char **argv) | |||
cucul_printf(cv, 0, h, "type \"quit\" to exit: %s", quit_string[quit]); | |||
/* Print previous events */ | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK, 0); | |||
for(i = 1; i < h && events[i].type; i++) | |||
print_event(0, i, events + i); | |||
@@ -115,10 +115,10 @@ int main(int argc, char *argv[]) | |||
cucul_get_canvas_height(cv), dither, pixels); | |||
cucul_free_dither(dither); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_thin_box(cv, 0, 0, WIDTH - 1, HEIGHT - 1); | |||
cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_WHITE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_WHITE, 0); | |||
cucul_fill_ellipse(cv, WIDTH / 2, HEIGHT / 2, | |||
WIDTH / 4, HEIGHT / 4, " "); | |||
cucul_putstr(cv, WIDTH / 2 - 5, HEIGHT / 2 - 5, "(\") \\o/ <&>"); | |||
@@ -126,12 +126,12 @@ int main(int argc, char *argv[]) | |||
cucul_putstr(cv, WIDTH / 2 - 8, HEIGHT / 2 - 2, "[ドラゴン ボーレ]"); | |||
cucul_putstr(cv, WIDTH / 2 - 7, HEIGHT / 2 + 2, "äβç ░▒▓█▓▒░ ΔЗҒ"); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE, 0); | |||
cucul_putstr(cv, WIDTH / 2 - 7, HEIGHT / 2, " LIBCACA "); | |||
for(x = 0; x < 16; x++) | |||
{ | |||
cucul_set_truecolor(cv, 0xff00 | x, 0xf00f | (x << 4)); | |||
cucul_set_attr_argb(cv, 0xff00 | x, 0xf00f | (x << 4), 0); | |||
cucul_putstr(cv, WIDTH / 2 - 7 + x, HEIGHT / 2 + 5, "#"); | |||
} | |||
} | |||
@@ -45,11 +45,11 @@ int main(int argc, char *argv[]) | |||
cv = cucul_create_canvas(8, 2); | |||
/* Draw stuff on our canvas */ | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 0, 0, "ABcde"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 5, 0, "\\o/"); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, 0, 1, "&$âøÿØ?!"); | |||
/* Load a libcucul internal font */ | |||
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) | |||
/* Create a canvas */ | |||
cv = cucul_create_canvas(WIDTH, (glyphs + WIDTH - 1) / WIDTH); | |||
cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_WHITE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_WHITE, 0); | |||
/* Put all glyphs on the canvas */ | |||
x = y = 0; | |||
@@ -48,9 +48,9 @@ int main(int argc, char *argv[]) | |||
for(frame = 0; frame < 16; frame++) | |||
{ | |||
cucul_set_canvas_frame(cv, frame); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, frame); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, frame, 0); | |||
cucul_fill_box(cv, 0, 0, 40, 15, ":"); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, frame * 5 / 2, frame, "カカ"); | |||
} | |||
@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) | |||
fprintf(stderr, "canvas shrinked, size is %ix%i\n", | |||
cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); | |||
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT, 0); | |||
dp = caca_create_display(cv); | |||
caca_set_display_time(dp, 50000); | |||
@@ -42,9 +42,9 @@ int main(int argc, char *argv[]) | |||
/* Line of x's */ | |||
for(i = 0; i < 10; i++) | |||
{ | |||
cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(caca, 0, i, CACA); | |||
cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_RED); | |||
cucul_set_attr_ansi(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_RED, 0); | |||
cucul_putchar(caca, i - 2, i, 'x'); | |||
} | |||
@@ -53,20 +53,20 @@ int main(int argc, char *argv[]) | |||
/* Line of ホ's */ | |||
for(i = 0; i < 10; i++) | |||
{ | |||
cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(caca, 0, i, CACA); | |||
cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_GREEN); | |||
cucul_set_attr_ansi(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_GREEN, 0); | |||
cucul_putstr(caca, i - 2, i, "ホ"); | |||
} | |||
cucul_blit(cv, 15, 1, caca, NULL); | |||
/* Line of canvas */ | |||
cucul_set_color(line, CUCUL_COLOR_WHITE, CUCUL_COLOR_MAGENTA); | |||
cucul_set_attr_ansi(line, CUCUL_COLOR_WHITE, CUCUL_COLOR_MAGENTA, 0); | |||
cucul_putstr(line, 0, 0, "ほ"); | |||
for(i = 0; i < 10; i++) | |||
{ | |||
cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(caca, 0, i, CACA); | |||
cucul_blit(caca, i - 2, i, line, NULL); | |||
} | |||
@@ -86,9 +86,9 @@ int main(int argc, char *argv[]) | |||
cucul_get_canvas_height(cw), right, buffer); | |||
/* Draw something on the mask */ | |||
cucul_set_color(mask, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(mask, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(mask); | |||
cucul_set_color(mask, CUCUL_COLOR_WHITE, CUCUL_COLOR_WHITE); | |||
cucul_set_attr_ansi(mask, CUCUL_COLOR_WHITE, CUCUL_COLOR_WHITE, 0); | |||
cucul_fill_ellipse(mask, (1.0 + sin(0.05 * (float)x)) | |||
* 0.5 * cucul_get_canvas_width(mask), | |||
(1.0 + cos(0.05 * (float)x)) | |||
@@ -99,7 +99,7 @@ int main(int argc, char *argv[]) | |||
/* Blit the spare canvas onto the first one */ | |||
cucul_blit(cv, 0, 0, cw, mask); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_printf(cv, 2, 1, | |||
"gamma=%g - use arrows to change, Esc to quit", gam); | |||
@@ -43,7 +43,7 @@ int main(int argc, char *argv[]) | |||
cv = cucul_create_canvas(0, 0); | |||
dp = caca_create_display(cv); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, 1, 1, "Text entries - press tab to cycle"); | |||
for(i = 0; i < TEXT_ENTRIES; i++) | |||
@@ -61,7 +61,8 @@ int main(int argc, char *argv[]) | |||
{ | |||
unsigned int j, start, size; | |||
cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_LIGHTGRAY); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_BLACK, | |||
CUCUL_COLOR_LIGHTGRAY, 0); | |||
cucul_fill_box(cv, 2, 3 * i + 4, 2 + BUFFER_SIZE, 3 * i + 4, " "); | |||
start = 0; | |||
@@ -75,7 +76,7 @@ int main(int argc, char *argv[]) | |||
} | |||
/* Put the cursor on the active textentry */ | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_LIGHTRED); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_LIGHTRED, 0); | |||
cucul_putchar(cv, 2 + entries[e].cursor, 3 * e + 4, ' '); | |||
caca_refresh_display(dp); | |||
@@ -102,7 +102,7 @@ int main(int argc, char **argv) | |||
} | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_clear_canvas(cv); | |||
cucul_draw_thin_box(cv, 0, 0, cucul_get_canvas_width(cv) - 1, | |||
@@ -125,9 +125,9 @@ int main(int argc, char **argv) | |||
ya = -1 - cucul_get_sprite_dy(sprite, frame); | |||
xb = xa + 1 + cucul_get_sprite_width(sprite, frame); | |||
yb = ya + 1 + cucul_get_sprite_height(sprite, frame); | |||
cucul_set_color(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_BLACK, CUCUL_COLOR_BLACK, 0); | |||
cucul_fill_box(cv, 57 + xa, 10 + ya, 57 + xb, 10 + yb, " "); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_draw_thin_box(cv, 57 + xa, 10 + ya, 57 + xb, 10 + yb); | |||
cucul_draw_sprite(cv, 57, 10, sprite, frame); | |||
@@ -58,26 +58,26 @@ int main(int argc, char *argv[]) | |||
flop = cucul_create_canvas(70, 6); | |||
rotate = cucul_create_canvas(70, 6); | |||
cucul_set_color(normal, CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(normal, CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK, 0); | |||
for(i = 0; pig[i]; i++) | |||
cucul_putstr(normal, 55, i, pig[i]); | |||
cucul_set_color(normal, CUCUL_COLOR_LIGHTGREEN, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(normal, CUCUL_COLOR_LIGHTGREEN, CUCUL_COLOR_BLACK, 0); | |||
for(i = 0; duck[i]; i++) | |||
cucul_putstr(normal, 30, 1 + i, duck[i]); | |||
cucul_set_color(normal, CUCUL_COLOR_LIGHTCYAN, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(normal, CUCUL_COLOR_LIGHTCYAN, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(normal, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]"); | |||
cucul_set_color(normal, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(normal, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK, 0); | |||
cucul_putchar(normal, 38, 1, '|'); | |||
cucul_set_color(normal, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(normal, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(normal, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/"); | |||
cucul_set_color(normal, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTRED); | |||
cucul_set_attr_ansi(normal, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTRED, 0); | |||
cucul_putstr(normal, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌"); | |||
cucul_putstr(normal, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖"); | |||
cucul_set_color(normal, CUCUL_COLOR_BLACK, CUCUL_COLOR_LIGHTRED); | |||
cucul_set_attr_ansi(normal, CUCUL_COLOR_BLACK, CUCUL_COLOR_LIGHTRED, 0); | |||
cucul_putstr(normal, 4, 3, "▓▒░"); | |||
cucul_putstr(normal, 4, 4, "▓▒░"); | |||
cucul_putstr(normal, 24, 3, "░▒▓"); | |||
@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) | |||
cucul_rotate(rotate); | |||
/* Blit the transformed canvas onto the main canvas */ | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, 0, 0, "normal"); | |||
cucul_blit(cv, 10, 0, normal, NULL); | |||
cucul_putstr(cv, 0, 6, "flip"); | |||
@@ -40,11 +40,11 @@ int main(int argc, char *argv[]) | |||
uint16_t bgcolor = 0xff00 | (y << 4) | x; | |||
uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8); | |||
cucul_set_truecolor(cv, fgcolor, bgcolor); | |||
cucul_set_attr_argb(cv, fgcolor, bgcolor, 0); | |||
cucul_putstr(cv, x * 2, y, "CA"); | |||
} | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE, 0); | |||
cucul_putstr(cv, 2, 1, " truecolor libcaca "); | |||
caca_refresh_display(dp); | |||
@@ -32,52 +32,52 @@ int main(int argc, char *argv[]) | |||
cv = cucul_create_canvas(0, 0); | |||
dp = caca_create_display(cv); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, 1, 1, "Basic Unicode support"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |"); | |||
cucul_putstr(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |"); | |||
cucul_putstr(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |"); | |||
cucul_putstr(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere."); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, 1, 7, "Gradient glyphs"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 31, 8, " 0%"); | |||
cucul_putstr(cv, 31, 9, " 25%"); | |||
cucul_putstr(cv, 31, 10, " 50%"); | |||
cucul_putstr(cv, 31, 11, " 75%"); | |||
cucul_putstr(cv, 31, 12, "100%"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_LIGHTGREEN); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_LIGHTGREEN, 0); | |||
cucul_putstr(cv, 1, 8, " "); | |||
cucul_putstr(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); | |||
cucul_putstr(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); | |||
cucul_putstr(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); | |||
cucul_putstr(cv, 1, 12, "█████████████████████████████"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGREEN, CUCUL_COLOR_LIGHTRED); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGREEN, CUCUL_COLOR_LIGHTRED, 0); | |||
cucul_putstr(cv, 36, 8, "█████████████████████████████"); | |||
cucul_putstr(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); | |||
cucul_putstr(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); | |||
cucul_putstr(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); | |||
cucul_putstr(cv, 36, 12, " "); | |||
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE, 0); | |||
cucul_putstr(cv, 1, 14, "Double width characters"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 1, 15, "| ドラゴン ボーレ |"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 1, 16, "| ()()()() ()()() |"); | |||
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 1, 17, "| ドラゴン"); | |||
cucul_putstr(cv, 12, 17, "ボーレ |"); | |||
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); | |||
cucul_set_attr_ansi(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK, 0); | |||
cucul_putstr(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere."); | |||
cucul_putstr(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼"); | |||