25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
1.3 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; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "config.h"
  14. #include "common.h"
  15. #if defined(HAVE_INTTYPES_H)
  16. # include <inttypes.h>
  17. #endif
  18. #include <stdio.h>
  19. #include <string.h>
  20. #include "cucul.h"
  21. #define STRING \
  22. "Hello world!\n" \
  23. " _,----._ \n" \
  24. " (/ @ @ \\) \n" \
  25. " | OO | \n" \
  26. " \\ `--' / \n" \
  27. " `----' \n"
  28. int main(void)
  29. {
  30. cucul_canvas_t *cv;
  31. cucul_buffer_t *buffer;
  32. buffer = cucul_load_memory(STRING, strlen(STRING));
  33. cv = cucul_import_canvas(buffer, "text");
  34. cucul_free_buffer(buffer);
  35. buffer = cucul_export_canvas(cv, "ansi");
  36. fwrite(cucul_get_buffer_data(buffer),
  37. cucul_get_buffer_size(buffer), 1, stdout);
  38. cucul_free_buffer(buffer);
  39. cucul_rotate(cv);
  40. buffer = cucul_export_canvas(cv, "ansi");
  41. fwrite(cucul_get_buffer_data(buffer),
  42. cucul_get_buffer_size(buffer), 1, stdout);
  43. cucul_free_buffer(buffer);
  44. cucul_free_canvas(cv);
  45. return 0;
  46. }