Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

61 lignes
1.5 KiB

  1. /*
  2. * hsv libcaca HSV rendering test program
  3. * Copyright (c) 2003-2012 Sam Hocevar <sam@hocevar.net>
  4. * All Rights Reserved
  5. *
  6. * This program is free software. It comes without any warranty, to
  7. * the extent permitted by applicable law. You can redistribute it
  8. * and/or modify it under the terms of the Do What the Fuck You Want
  9. * to Public License, Version 2, as published by Sam Hocevar. See
  10. * http://www.wtfpl.net/ for more details.
  11. */
  12. #include "config.h"
  13. #if !defined(__KERNEL__)
  14. # include <stdio.h>
  15. #endif
  16. #include "caca.h"
  17. uint32_t buffer[256*256];
  18. int main(int argc, char *argv[])
  19. {
  20. caca_display_t *dp;
  21. caca_canvas_t *cv;
  22. caca_dither_t *dither;
  23. int x, y;
  24. dp = caca_create_display(NULL);
  25. if(dp == NULL)
  26. {
  27. printf("Can't create display\n");
  28. return -1;
  29. }
  30. cv = caca_get_canvas(dp);
  31. for(y = 0; y < 256; y++)
  32. for(x = 0; x < 256; x++)
  33. {
  34. buffer[y * 256 + x] = ((y * x / 256) << 16) | ((y * x / 256) << 8) | (x<< 0);
  35. }
  36. dither = caca_create_dither(32, 256, 256, 4 * 256,
  37. 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0);
  38. caca_dither_bitmap(caca_get_canvas(dp), 0, 0, caca_get_canvas_width(cv),
  39. caca_get_canvas_height(cv), dither, buffer);
  40. caca_free_dither(dither);
  41. caca_refresh_display(dp);
  42. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  43. caca_free_display(dp);
  44. return 0;
  45. }