選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

text.c 1.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. cv = cucul_import_canvas(STRING, strlen(STRING), "text");
  33. buffer = cucul_export_canvas(cv, "ansi");
  34. fwrite(cucul_get_buffer_data(buffer),
  35. cucul_get_buffer_size(buffer), 1, stdout);
  36. cucul_free_buffer(buffer);
  37. cucul_rotate(cv);
  38. buffer = cucul_export_canvas(cv, "ansi");
  39. fwrite(cucul_get_buffer_data(buffer),
  40. cucul_get_buffer_size(buffer), 1, stdout);
  41. cucul_free_buffer(buffer);
  42. cucul_free_canvas(cv);
  43. return 0;
  44. }