Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

58 righe
1.2 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. 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. }