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 804 2006-04-18 08:24:41Z 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 |
---|
21 | typedef unsigned char uint8_t; |
---|
22 | typedef unsigned short uint16_t; |
---|
23 | typedef unsigned long int uint32_t; |
---|
24 | typedef long int intptr_t; |
---|
25 | typedef long unsigned int uintptr_t; |
---|
26 | #endif |
---|
27 | |
---|
28 | struct cucul |
---|
29 | { |
---|
30 | /* Context size */ |
---|
31 | unsigned int width, height; |
---|
32 | |
---|
33 | uint32_t *chars; |
---|
34 | uint32_t *attr; |
---|
35 | char *empty_line, *scratch_line; |
---|
36 | |
---|
37 | uint16_t fgcolor; |
---|
38 | uint16_t bgcolor; |
---|
39 | |
---|
40 | unsigned int refcount; |
---|
41 | }; |
---|
42 | |
---|
43 | struct cucul_buffer |
---|
44 | { |
---|
45 | unsigned long int size; |
---|
46 | char *data; |
---|
47 | }; |
---|
48 | |
---|
49 | /* Bitmap functions */ |
---|
50 | extern int _cucul_init_dither(void); |
---|
51 | extern int _cucul_end_dither(void); |
---|
52 | |
---|
53 | /* Canvas functions */ |
---|
54 | extern void _cucul_set_size(cucul_t *, unsigned int, unsigned int); |
---|
55 | extern void _cucul_putchar32(cucul_t *qq, int x, int y, uint32_t c); |
---|
56 | |
---|
57 | /* Charset functions */ |
---|
58 | extern unsigned int _cucul_strlen_utf8(char const *); |
---|
59 | extern char const *_cucul_skip_utf8(char const *, unsigned int); |
---|
60 | extern uint32_t _cucul_utf8_to_utf32(char const *); |
---|
61 | extern uint8_t _cucul_utf32_to_cp437(uint32_t); |
---|
62 | extern uint32_t _cucul_cp437_to_utf32(uint8_t); |
---|
63 | |
---|
64 | /* Colour functions */ |
---|
65 | uint8_t _cucul_argb32_to_ansi8(uint32_t); |
---|
66 | uint8_t _cucul_argb32_to_ansi4fg(uint32_t); |
---|
67 | uint8_t _cucul_argb32_to_ansi4bg(uint32_t); |
---|
68 | uint16_t _cucul_argb32_to_rgb12fg(uint32_t); |
---|
69 | uint16_t _cucul_argb32_to_rgb12bg(uint32_t); |
---|
70 | uint32_t _cucul_argb32_to_rgb24fg(uint32_t); |
---|
71 | uint32_t _cucul_argb32_to_rgb24bg(uint32_t); |
---|
72 | void _cucul_argb32_to_argb4(uint32_t, uint8_t[8]); |
---|
73 | |
---|
74 | #endif /* __CUCUL_INTERNALS_H__ */ |
---|