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

Last change on this file since 777 was 777, checked in by Sam Hocevar, 15 years ago
  • Replaced "struct cucul_*" and "struct caca_*" types with opaque typedefs such as cucul_dither_t instead of struct cucul_dither.
  • Made cucul_buffer_t an opaque structure and implemented the two getters cucul_get_buffer_data() and cucul_get_buffer_size().
  • Documented all missing functions and function parameters.
  • Property svn:keywords set to Id
File size: 1.3 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 777 2006-04-16 18:28:47Z 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
16#if !defined(__KERNEL__)
17#   include <stdio.h>
18#endif
19
20#include "cucul.h"
21#include "caca.h"
22
23int main(int argc, char **argv)
24{
25    cucul_t *qq;
26    caca_t *kk;
27    caca_event_t ev;
28    int i, j;
29
30    qq = cucul_create(0, 0);
31    if(!qq)
32        return 1;
33
34    kk = caca_attach(qq);
35    if(!kk)
36        return 1;
37
38    cucul_clear(qq);
39    for(i = 0; i < 16; i++)
40    {
41        cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
42        cucul_printf(qq, 4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
43                     'a' + i, i, cucul_get_color_name(i));
44        for(j = 0; j < 16; j++)
45        {
46            cucul_set_color(qq, i, j);
47            cucul_putstr(qq, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3),
48                         "# ");
49        }
50    }
51
52    caca_display(kk);
53    caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, -1);
54
55    caca_detach(kk);
56    cucul_free(qq);
57
58    return 0;
59}
60
Note: See TracBrowser for help on using the repository browser.