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.
 
 
 
 
 
 

79 lines
2.1 KiB

  1. /*
  2. * colors display all possible libcaca colour pairs
  3. * Copyright (c) 2003-2004 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. #include "config.h"
  15. #include "common.h"
  16. #if !defined(__KERNEL__)
  17. # include <stdio.h>
  18. #endif
  19. #include "cucul.h"
  20. #include "caca.h"
  21. int main(int argc, char **argv)
  22. {
  23. cucul_canvas_t *cv;
  24. caca_display_t *dp;
  25. int i, j;
  26. cv = cucul_create_canvas(32, 16);
  27. if(cv == NULL)
  28. {
  29. printf("Failed to create canvas\n");
  30. return 1;
  31. }
  32. dp = caca_create_display(cv);
  33. if(dp == NULL)
  34. {
  35. printf("Failed to create display\n");
  36. return 1;
  37. }
  38. cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK);
  39. cucul_clear_canvas(cv);
  40. for(i = 0; i < 16; i++)
  41. {
  42. cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK);
  43. cucul_printf(cv, 3, i + (i >= 8 ? 3 : 2), "ANSI %i", i);
  44. for(j = 0; j < 16; j++)
  45. {
  46. cucul_set_color_ansi(cv, i, j);
  47. cucul_put_str(cv, (j >= 8 ? 13 : 12) + j * 4, i + (i >= 8 ? 3 : 2),
  48. "Aaホ");
  49. }
  50. }
  51. cucul_set_color_ansi(cv, CUCUL_LIGHTGRAY, CUCUL_BLACK);
  52. cucul_put_str(cv, 3, 20, "This is bold This is blink This is italics This is underline");
  53. cucul_set_attr(cv, CUCUL_BOLD);
  54. cucul_put_str(cv, 3 + 8, 20, "bold");
  55. cucul_set_attr(cv, CUCUL_BLINK);
  56. cucul_put_str(cv, 3 + 24, 20, "blink");
  57. cucul_set_attr(cv, CUCUL_ITALICS);
  58. cucul_put_str(cv, 3 + 41, 20, "italics");
  59. cucul_set_attr(cv, CUCUL_UNDERLINE);
  60. cucul_put_str(cv, 3 + 60, 20, "underline");
  61. caca_refresh_display(dp);
  62. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  63. caca_free_display(dp);
  64. cucul_free_canvas(cv);
  65. return 0;
  66. }