source: libcaca/trunk/test/colors.c @ 1462

Last change on this file since 1462 was 1462, checked in by Sam Hocevar, 13 years ago
  • Bwarf, typo in the no warranty clause.
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
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 1462 2006-12-12 01:53:54Z sam $
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15#include "config.h"
16#include "common.h"
17
18#if !defined(__KERNEL__)
19#   include <stdio.h>
20#endif
21
22#include "cucul.h"
23#include "caca.h"
24
25int main(int argc, char **argv)
26{
27    cucul_canvas_t *cv;
28    caca_display_t *dp;
29    int i, j;
30
31    cv = cucul_create_canvas(0, 0);
32    if(!cv)
33        return 1;
34
35    dp = caca_create_display(cv);
36    if(!dp)
37        return 1;
38
39    cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK);
40    cucul_clear_canvas(cv);
41    for(i = 0; i < 16; i++)
42    {
43        cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK);
44        cucul_printf(cv, 3, i + (i >= 8 ? 3 : 2), "ANSI %i", i);
45        for(j = 0; j < 16; j++)
46        {
47            cucul_set_color_ansi(cv, i, j);
48            cucul_put_str(cv, (j >= 8 ? 13 : 12) + j * 4, i + (i >= 8 ? 3 : 2),
49                          "Aaホ");
50        }
51    }
52
53    cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK);
54    cucul_put_str(cv, 3, 20, "This is bold    This is blink    This is italics    This is underline");
55    cucul_set_attr(cv, CUCUL_BOLD);
56    cucul_put_str(cv, 3 + 8, 20, "bold");
57    cucul_set_attr(cv, CUCUL_BLINK);
58    cucul_put_str(cv, 3 + 24, 20, "blink");
59    cucul_set_attr(cv, CUCUL_ITALICS);
60    cucul_put_str(cv, 3 + 41, 20, "italics");
61    cucul_set_attr(cv, CUCUL_UNDERLINE);
62    cucul_put_str(cv, 3 + 60, 20, "underline");
63
64    caca_refresh_display(dp);
65    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
66
67    caca_free_display(dp);
68    cucul_free_canvas(cv);
69
70    return 0;
71}
72
Note: See TracBrowser for help on using the repository browser.