source: libcaca/trunk/cucul/cucul_internals.h @ 842

Last change on this file since 842 was 842, checked in by Sam Hocevar, 15 years ago
  • Support for multiple frames in canvases.
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1/*
2 *  libcucul      Canvas for ultrafast compositing of Unicode letters
3 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: cucul_internals.h 842 2006-04-22 19:11:25Z sam $
7 *
8 *  This library 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#ifndef __CUCUL_INTERNALS_H__
15#define __CUCUL_INTERNALS_H__
16
17#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__)
18#   include <inttypes.h>
19#elif !defined(CUSTOM_INTTYPES) && !defined(_DOXYGEN_SKIP_ME)
20#   define CUSTOM_INTTYPES
21typedef unsigned char uint8_t;
22typedef unsigned short uint16_t;
23typedef unsigned long int uint32_t;
24typedef long int intptr_t;
25typedef long unsigned int uintptr_t;
26#endif
27
28struct cucul_canvas
29{
30    /* Canvas size */
31    unsigned int width, height;
32
33    /* Shortcut to the active frame */
34    uint32_t *chars;
35    uint32_t *attr;
36
37    /* Frame information */
38    unsigned int frame, framecount;
39    uint32_t **allchars;
40    uint32_t **allattr;
41
42    /* Painting context */
43    uint16_t fgcolor;
44    uint16_t bgcolor;
45
46    unsigned int refcount;
47};
48
49struct cucul_buffer
50{
51    unsigned long int size;
52    char *data;
53};
54
55/* Bitmap functions */
56extern int _cucul_init_dither(void);
57extern int _cucul_end_dither(void);
58
59/* Canvas functions */
60extern void _cucul_set_canvas_size(cucul_canvas_t *, unsigned int, unsigned int);
61extern void _cucul_putchar32(cucul_canvas_t *, int, int, uint32_t);
62
63/* Charset functions */
64extern unsigned int _cucul_strlen_utf8(char const *);
65extern char const *_cucul_skip_utf8(char const *, unsigned int);
66extern uint32_t _cucul_utf8_to_utf32(char const *);
67extern uint8_t _cucul_utf32_to_cp437(uint32_t);
68extern uint32_t _cucul_cp437_to_utf32(uint8_t);
69
70/* Colour functions */
71uint8_t _cucul_argb32_to_ansi8(uint32_t);
72uint8_t _cucul_argb32_to_ansi4fg(uint32_t);
73uint8_t _cucul_argb32_to_ansi4bg(uint32_t);
74uint16_t _cucul_argb32_to_rgb12fg(uint32_t);
75uint16_t _cucul_argb32_to_rgb12bg(uint32_t);
76uint32_t _cucul_argb32_to_rgb24fg(uint32_t);
77uint32_t _cucul_argb32_to_rgb24bg(uint32_t);
78void _cucul_argb32_to_argb4(uint32_t, uint8_t[8]);
79
80#endif /* __CUCUL_INTERNALS_H__ */
Note: See TracBrowser for help on using the repository browser.