source: libcaca/trunk/test/text.c @ 843

Last change on this file since 843 was 843, checked in by Sam Hocevar, 15 years ago
  • Added a test for multiple frames support.
  • Added a test for textfile loading.
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1/*
2 *  text          canvas text import/export
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: text.c 843 2006-04-22 19:13:27Z sam $
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
14#include "config.h"
15
16#if defined(HAVE_INTTYPES_H)
17#   include <inttypes.h>
18#else
19typedef unsigned char uint8_t;
20typedef unsigned short uint16_t;
21typedef unsigned int uint32_t;
22#endif
23
24#include <stdio.h>
25#include <string.h>
26
27#include "cucul.h"
28
29#define STRING \
30  "Hello world!\n" \
31  "  _,----._  \n" \
32  " (/ @  @ \\) \n" \
33  "  |  OO  |  \n" \
34  "  \\ `--' /  \n" \
35  "   `----'   \n"
36
37int main(void)
38{
39    cucul_canvas_t *cv;
40    cucul_buffer_t *buffer;
41
42    cv = cucul_import_canvas(STRING, strlen(STRING), "text");
43
44    buffer = cucul_export_canvas(cv, "ansi");
45    fwrite(cucul_get_buffer_data(buffer),
46           cucul_get_buffer_size(buffer), 1, stdout);
47    cucul_free_buffer(buffer);
48
49    cucul_rotate(cv);
50
51    buffer = cucul_export_canvas(cv, "ansi");
52    fwrite(cucul_get_buffer_data(buffer),
53           cucul_get_buffer_size(buffer), 1, stdout);
54    cucul_free_buffer(buffer);
55
56    cucul_free_canvas(cv);
57
58    return 0;
59}
60
Note: See TracBrowser for help on using the repository browser.