You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

truecolor.c 1.3 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * truecolor truecolor canvas features
  3. * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  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. #include "config.h"
  14. #include "common.h"
  15. #if !defined(__KERNEL__)
  16. # if defined(HAVE_INTTYPES_H)
  17. # include <inttypes.h>
  18. # endif
  19. # include <stdio.h>
  20. #endif
  21. #include "cucul.h"
  22. #include "caca.h"
  23. int main(int argc, char *argv[])
  24. {
  25. cucul_canvas_t *cv;
  26. caca_display_t *dp;
  27. int x, y;
  28. cv = cucul_create_canvas(32, 16);
  29. dp = caca_create_display(cv);
  30. for(y = 0; y < 16; y++)
  31. for(x = 0; x < 16; x++)
  32. {
  33. uint16_t bgcolor = 0xff00 | (y << 4) | x;
  34. uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);
  35. cucul_set_color_argb(cv, fgcolor, bgcolor);
  36. cucul_putstr(cv, x * 2, y, "CA");
  37. }
  38. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_LIGHTBLUE);
  39. cucul_putstr(cv, 2, 1, " truecolor libcaca ");
  40. caca_refresh_display(dp);
  41. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  42. caca_free_display(dp);
  43. cucul_free_canvas(cv);
  44. return 0;
  45. }