1 | /* |
---|
2 | * colors display all possible libcaca colour pairs |
---|
3 | * Copyright (c) 2003-2004 Sam Hocevar <sam@zoy.org> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id: colors.c 1347 2006-11-11 16:29:39Z sam $ |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the Do What The Fuck You Want To |
---|
10 | * Public License, Version 2, as published by Sam Hocevar. See |
---|
11 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
12 | */ |
---|
13 | |
---|
14 | #include "config.h" |
---|
15 | #include "common.h" |
---|
16 | |
---|
17 | #if !defined(__KERNEL__) |
---|
18 | # include <stdio.h> |
---|
19 | #endif |
---|
20 | |
---|
21 | #include "cucul.h" |
---|
22 | #include "caca.h" |
---|
23 | |
---|
24 | int main(int argc, char **argv) |
---|
25 | { |
---|
26 | cucul_canvas_t *cv; |
---|
27 | caca_display_t *dp; |
---|
28 | int i, j; |
---|
29 | |
---|
30 | cv = cucul_create_canvas(0, 0); |
---|
31 | if(!cv) |
---|
32 | return 1; |
---|
33 | |
---|
34 | dp = caca_create_display(cv); |
---|
35 | if(!dp) |
---|
36 | return 1; |
---|
37 | |
---|
38 | cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); |
---|
39 | cucul_clear_canvas(cv); |
---|
40 | for(i = 0; i < 16; i++) |
---|
41 | { |
---|
42 | cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); |
---|
43 | cucul_printf(cv, 3, i + (i >= 8 ? 3 : 2), "ANSI %i", i); |
---|
44 | for(j = 0; j < 16; j++) |
---|
45 | { |
---|
46 | cucul_set_color_ansi(cv, i, j); |
---|
47 | cucul_put_str(cv, (j >= 8 ? 13 : 12) + j * 4, i + (i >= 8 ? 3 : 2), |
---|
48 | "Aaホ"); |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK); |
---|
53 | cucul_put_str(cv, 3, 20, "This is bold This is blink This is italics This is underline"); |
---|
54 | cucul_set_attr(cv, CUCUL_BOLD); |
---|
55 | cucul_put_str(cv, 3 + 8, 20, "bold"); |
---|
56 | cucul_set_attr(cv, CUCUL_BLINK); |
---|
57 | cucul_put_str(cv, 3 + 24, 20, "blink"); |
---|
58 | cucul_set_attr(cv, CUCUL_ITALICS); |
---|
59 | cucul_put_str(cv, 3 + 41, 20, "italics"); |
---|
60 | cucul_set_attr(cv, CUCUL_UNDERLINE); |
---|
61 | cucul_put_str(cv, 3 + 60, 20, "underline"); |
---|
62 | |
---|
63 | caca_refresh_display(dp); |
---|
64 | caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); |
---|
65 | |
---|
66 | caca_free_display(dp); |
---|
67 | cucul_free_canvas(cv); |
---|
68 | |
---|
69 | return 0; |
---|
70 | } |
---|
71 | |
---|