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.
 
 
 
 
 
 

120 rindas
3.4 KiB

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