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

Last change on this file since 1048 was 1048, checked in by Jean-Yves Lamoureux, 16 years ago
  • Updated kernel 'driver', still not working, but most of the work is done
  • Property svn:keywords set to Id
File size: 1.4 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 1048 2006-09-17 12:44:18Z jylam $
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#if !defined(__KERNEL__)
17#   if defined(HAVE_INTTYPES_H)
18#      include <inttypes.h>
19#   endif
20#   include <stdio.h>
21#   include <string.h>
22#endif
23#include "cucul.h"
24
25#define STRING \
26  "Hello world!\n" \
27  "  _,----._  \n" \
28  " (/ @  @ \\) \n" \
29  "  |  OO  |  \n" \
30  "  \\ `--' /  \n" \
31  "   `----'   \n"
32
33int main(int argc, char *argv[])
34{
35    cucul_canvas_t *cv;
36    cucul_buffer_t *buffer;
37
38    buffer = cucul_load_memory(STRING, strlen(STRING));
39    cv = cucul_import_canvas(buffer, "text");
40    cucul_free_buffer(buffer);
41
42    buffer = cucul_export_canvas(cv, "utf8");
43    fwrite(cucul_get_buffer_data(buffer),
44           cucul_get_buffer_size(buffer), 1, stdout);
45    cucul_free_buffer(buffer);
46
47    cucul_rotate(cv);
48
49    buffer = cucul_export_canvas(cv, "utf8");
50    fwrite(cucul_get_buffer_data(buffer),
51           cucul_get_buffer_size(buffer), 1, stdout);
52    cucul_free_buffer(buffer);
53
54    cucul_free_canvas(cv);
55
56    return 0;
57}
58
Note: See TracBrowser for help on using the repository browser.