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

Last change on this file since 858 was 858, checked in by Sam Hocevar, 15 years ago
  • Added "common.h", a placeholder for simple features and functions missing from some systems.
  • Property svn:keywords set to Id
File size: 1.2 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 858 2006-04-24 19:57:23Z 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#include "common.h"
16
17#if defined(HAVE_INTTYPES_H)
18#   include <inttypes.h>
19#endif
20
21#include <stdio.h>
22#include <string.h>
23
24#include "cucul.h"
25
26#define STRING \
27  "Hello world!\n" \
28  "  _,----._  \n" \
29  " (/ @  @ \\) \n" \
30  "  |  OO  |  \n" \
31  "  \\ `--' /  \n" \
32  "   `----'   \n"
33
34int main(void)
35{
36    cucul_canvas_t *cv;
37    cucul_buffer_t *buffer;
38
39    cv = cucul_import_canvas(STRING, strlen(STRING), "text");
40
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
46    cucul_rotate(cv);
47
48    buffer = cucul_export_canvas(cv, "ansi");
49    fwrite(cucul_get_buffer_data(buffer),
50           cucul_get_buffer_size(buffer), 1, stdout);
51    cucul_free_buffer(buffer);
52
53    cucul_free_canvas(cv);
54
55    return 0;
56}
57
Note: See TracBrowser for help on using the repository browser.