source: libcaca/trunk/test/hsv.c @ 1048

Last change on this file since 1048 was 1048, checked in by Jean-Yves Lamoureux, 14 years ago
  • Updated kernel 'driver', still not working, but most of the work is done
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1/*
2 *  hsv           libcaca HSV rendering test program
3 *  Copyright (c) 2003 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: hsv.c 1048 2006-09-17 12:44:18Z jylam $
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#   if defined(HAVE_INTTYPES_H)
19#      include <inttypes.h>
20#   endif
21#   include <stdio.h>
22#endif
23
24#include "cucul.h"
25#include "caca.h"
26
27uint32_t buffer[256*256];
28
29int main(int argc, char *argv[])
30{
31    cucul_canvas_t *cv;
32    caca_display_t *dp;
33
34    cucul_dither_t *dither;
35    int x, y;
36
37    cv = cucul_create_canvas(0, 0);
38    dp = caca_create_display(cv);
39
40    for(y = 0; y < 256; y++)
41        for(x = 0; x < 256; x++)
42    {
43        buffer[y * 256 + x] = ((y * x / 256) << 16) | ((y * x / 256) << 8) | (x<< 0);
44    }
45
46    dither = cucul_create_dither(32, 256, 256, 4 * 256,
47                                 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0);
48    cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv),
49                        cucul_get_canvas_height(cv), dither, buffer);
50    cucul_free_dither(dither);
51
52    caca_refresh_display(dp);
53
54    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
55
56    caca_free_display(dp);
57    cucul_free_canvas(cv);
58
59    return 0;
60}
61
Note: See TracBrowser for help on using the repository browser.