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.
 
 
 
 
 
 

56 lines
1.2 KiB

  1. /*
  2. * hsv libcaca HSV rendering test program
  3. * Copyright (c) 2003 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. #if defined(HAVE_INTTYPES_H)
  15. # include <inttypes.h>
  16. #else
  17. typedef unsigned char uint8_t;
  18. typedef unsigned short uint16_t;
  19. typedef unsigned int uint32_t;
  20. #endif
  21. #include "caca.h"
  22. uint32_t buffer[256*256];
  23. int main(void)
  24. {
  25. struct caca_bitmap *bitmap;
  26. int x, y;
  27. caca_init();
  28. for(y = 0; y < 256; y++)
  29. for(x = 0; x < 256; x++)
  30. {
  31. buffer[y * 256 + x] = ((y * x / 256) << 16) | ((y * x / 256) << 8) | (x<< 0);
  32. }
  33. bitmap = caca_create_bitmap(32, 256, 256, 4 * 256,
  34. 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0);
  35. caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1,
  36. bitmap, buffer);
  37. caca_free_bitmap(bitmap);
  38. caca_refresh();
  39. while(!caca_get_event(CACA_EVENT_KEY_PRESS));
  40. caca_end();
  41. return 0;
  42. }