No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

66 líneas
1.7 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 GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  21. * 02111-1307 USA
  22. */
  23. #include "config.h"
  24. #if defined(HAVE_INTTYPES_H)
  25. # include <inttypes.h>
  26. #else
  27. typedef unsigned char uint8_t;
  28. typedef unsigned short uint16_t;
  29. typedef unsigned int uint32_t;
  30. #endif
  31. #include "caca.h"
  32. uint32_t buffer[256*256];
  33. int main(void)
  34. {
  35. struct caca_bitmap *bitmap;
  36. int x, y;
  37. caca_init();
  38. for(y = 0; y < 256; y++)
  39. for(x = 0; x < 256; x++)
  40. {
  41. buffer[y * 256 + x] = ((y * x / 256) << 16) | ((y * x / 256) << 8) | (x<< 0);
  42. }
  43. bitmap = caca_create_bitmap(32, 256, 256, 4 * 256,
  44. 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0);
  45. caca_draw_bitmap(0, 0, caca_get_width() - 1, caca_get_height() - 1,
  46. bitmap, buffer);
  47. caca_free_bitmap(bitmap);
  48. caca_refresh();
  49. while(!caca_get_event(CACA_EVENT_KEY_PRESS));
  50. caca_end();
  51. return 0;
  52. }