Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * unicode libcaca Unicode rendering test program
  3. * Copyright (c) 2006 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. # if defined(HAVE_INTTYPES_H)
  18. # include <inttypes.h>
  19. # endif
  20. # include <stdio.h>
  21. # include <string.h>
  22. #endif
  23. #include "cucul.h"
  24. #include "caca.h"
  25. static char const pig[] =
  26. ",--. ,--.\n"
  27. "\\ /-~-\\ /\n"
  28. " )' o O `(\n"
  29. "( ,---. )\n"
  30. " `(_o_o_)'\n"
  31. " )`-'(\n";
  32. static char const duck[] =
  33. " ,~~.\n"
  34. " __ , ( O )>\n"
  35. "___( o)> )`~~' (\n"
  36. "\\ <_. ) ( .__) )\n"
  37. " `---' `-.____,'\n";
  38. int main(int argc, char *argv[])
  39. {
  40. cucul_canvas_t *cv, *image, *tmp, *sprite;
  41. caca_display_t *dp;
  42. cv = cucul_create_canvas(0, 0);
  43. if(cv == NULL)
  44. {
  45. printf("Can't created canvas\n");
  46. return -1;
  47. }
  48. dp = caca_create_display(cv);
  49. if(dp == NULL)
  50. {
  51. printf("Can't create display\n");
  52. return -1;
  53. }
  54. image = cucul_create_canvas(70, 6);
  55. tmp = cucul_create_canvas(70, 6);
  56. sprite = cucul_create_canvas(0, 0);
  57. cucul_set_color_ansi(sprite, CUCUL_LIGHTMAGENTA, CUCUL_BLACK);
  58. cucul_import_memory(sprite, pig, strlen(pig), "text");
  59. cucul_blit(image, 55, 0, sprite, NULL);
  60. cucul_set_color_ansi(sprite, CUCUL_LIGHTGREEN, CUCUL_BLACK);
  61. cucul_import_memory(sprite, duck, strlen(duck), "text");
  62. cucul_blit(image, 30, 1, sprite, NULL);
  63. cucul_set_color_ansi(image, CUCUL_LIGHTCYAN, CUCUL_BLACK);
  64. cucul_put_str(image, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]");
  65. cucul_set_color_ansi(image, CUCUL_LIGHTRED, CUCUL_BLACK);
  66. cucul_put_char(image, 38, 1, '|');
  67. cucul_set_color_ansi(image, CUCUL_YELLOW, CUCUL_BLACK);
  68. cucul_put_str(image, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/");
  69. cucul_set_color_ansi(image, CUCUL_WHITE, CUCUL_LIGHTRED);
  70. cucul_put_str(image, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌");
  71. cucul_put_str(image, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖");
  72. cucul_set_color_ansi(image, CUCUL_BLACK, CUCUL_LIGHTRED);
  73. cucul_put_str(image, 4, 3, "▓▒░");
  74. cucul_put_str(image, 4, 4, "▓▒░");
  75. cucul_put_str(image, 24, 3, "░▒▓");
  76. cucul_put_str(image, 24, 4, "░▒▓");
  77. /* Blit the transformed canvas onto the main canvas */
  78. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
  79. cucul_put_str(cv, 0, 0, "normal");
  80. cucul_blit(cv, 10, 0, image, NULL);
  81. cucul_put_str(cv, 0, 6, "flip");
  82. cucul_blit(tmp, 0, 0, image, NULL);
  83. cucul_flip(tmp);
  84. cucul_blit(cv, 10, 6, tmp, NULL);
  85. cucul_put_str(cv, 0, 12, "flop");
  86. cucul_blit(tmp, 0, 0, image, NULL);
  87. cucul_flop(tmp);
  88. cucul_blit(cv, 10, 12, tmp, NULL);
  89. cucul_put_str(cv, 0, 18, "rotate");
  90. cucul_blit(tmp, 0, 0, image, NULL);
  91. cucul_rotate_180(tmp);
  92. cucul_blit(cv, 10, 18, tmp, NULL);
  93. caca_refresh_display(dp);
  94. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  95. caca_free_display(dp);
  96. cucul_free_canvas(tmp);
  97. cucul_free_canvas(sprite);
  98. cucul_free_canvas(image);
  99. cucul_free_canvas(cv);
  100. return 0;
  101. }