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.
 
 
 
 
 
 

68 lines
1.7 KiB

  1. /*
  2. * text canvas text import/export
  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. # include <stdlib.h>
  23. #endif
  24. #include "cucul.h"
  25. #define STRING \
  26. " _,----._ \n" \
  27. " (/ @ @ \\) \n" \
  28. " | OO | \n" \
  29. " \\ `--' / \n" \
  30. " `----' \n" \
  31. "Hello world!\n"
  32. int main(int argc, char *argv[])
  33. {
  34. cucul_canvas_t *cv, *pig;
  35. void *buffer;
  36. unsigned long int len;
  37. pig = cucul_create_canvas(0, 0);
  38. cucul_import_memory(pig, STRING, strlen(STRING), "text");
  39. cv = cucul_create_canvas(cucul_get_canvas_width(pig) * 2,
  40. cucul_get_canvas_height(pig) * 2);
  41. cucul_blit(cv, 0, 0, pig, NULL);
  42. cucul_flip(pig);
  43. cucul_blit(cv, cucul_get_canvas_width(pig), 0, pig, NULL);
  44. cucul_flip(pig);
  45. cucul_flop(pig);
  46. cucul_blit(cv, 0, cucul_get_canvas_height(pig), pig, NULL);
  47. cucul_flop(pig);
  48. cucul_rotate(pig);
  49. cucul_blit(cv, cucul_get_canvas_width(pig),
  50. cucul_get_canvas_height(pig), pig, NULL);
  51. buffer = cucul_export_memory(cv, "utf8", &len);
  52. fwrite(buffer, len, 1, stdout);
  53. free(buffer);
  54. cucul_free_canvas(pig);
  55. cucul_free_canvas(cv);
  56. return 0;
  57. }