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.
 
 
 
 
 
 

61 rivejä
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. #if defined(HAVE_INTTYPES_H)
  15. # include <inttypes.h>
  16. #else
  17. typedef unsigned char uint8_t;
  18. typedef unsigned short uint16_t;
  19. typedef unsigned int uint32_t;
  20. #endif
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include "cucul.h"
  24. #define STRING \
  25. "Hello world!\n" \
  26. " _,----._ \n" \
  27. " (/ @ @ \\) \n" \
  28. " | OO | \n" \
  29. " \\ `--' / \n" \
  30. " `----' \n"
  31. int main(void)
  32. {
  33. cucul_canvas_t *cv;
  34. cucul_buffer_t *buffer;
  35. cv = cucul_import_canvas(STRING, strlen(STRING), "text");
  36. buffer = cucul_export_canvas(cv, "ansi");
  37. fwrite(cucul_get_buffer_data(buffer),
  38. cucul_get_buffer_size(buffer), 1, stdout);
  39. cucul_free_buffer(buffer);
  40. cucul_rotate(cv);
  41. buffer = cucul_export_canvas(cv, "ansi");
  42. fwrite(cucul_get_buffer_data(buffer),
  43. cucul_get_buffer_size(buffer), 1, stdout);
  44. cucul_free_buffer(buffer);
  45. cucul_free_canvas(cv);
  46. return 0;
  47. }