1 | /* |
---|
2 | * libcucul++ C++ bindings for libcucul |
---|
3 | * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id: cucul++.h 1959 2007-11-15 08:20:37Z sam $ |
---|
7 | * |
---|
8 | * This library is free software. It comes without any warranty, to |
---|
9 | * the extent permitted by applicable law. You can redistribute it |
---|
10 | * and/or modify it under the terms of the Do What The Fuck You Want |
---|
11 | * To Public License, Version 2, as published by Sam Hocevar. See |
---|
12 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
13 | */ |
---|
14 | |
---|
15 | /** \file cucul++.h |
---|
16 | * \version \$Id: cucul++.h 1959 2007-11-15 08:20:37Z sam $ |
---|
17 | * \author Jean-Yves Lamoureux <jylam@lnxscene.org> |
---|
18 | * \brief The \e libcucul++ public header. |
---|
19 | * |
---|
20 | * This header contains the public types and functions that applications |
---|
21 | * using \e libcucul++ may use. |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef _CUCUL_PP_H |
---|
25 | #define _CUCUL_PP_H |
---|
26 | |
---|
27 | #include <cucul.h> |
---|
28 | |
---|
29 | class Cucul; |
---|
30 | |
---|
31 | class Charset |
---|
32 | { |
---|
33 | public: |
---|
34 | unsigned long int utf8ToUtf32(char const *, unsigned int *); |
---|
35 | unsigned int utf32ToUtf8(char *, unsigned long int); |
---|
36 | unsigned char utf32ToCp437(unsigned long int); |
---|
37 | unsigned long int cp437ToUtf32(unsigned char); |
---|
38 | }; |
---|
39 | |
---|
40 | /* Ugly, I know */ |
---|
41 | class Font |
---|
42 | { |
---|
43 | public: |
---|
44 | ~Font(); |
---|
45 | Font(void const *, unsigned int); |
---|
46 | char const *const * getList(void); |
---|
47 | unsigned int getWidth(); |
---|
48 | unsigned int getHeight(); |
---|
49 | void renderCanvas(Cucul *, unsigned char *, unsigned int, |
---|
50 | unsigned int, unsigned int); |
---|
51 | unsigned long int const *getBlocks(); |
---|
52 | |
---|
53 | private: |
---|
54 | cucul_font *font; |
---|
55 | }; |
---|
56 | |
---|
57 | class Dither |
---|
58 | { |
---|
59 | public: |
---|
60 | Dither(unsigned int, unsigned int, unsigned int, unsigned int, |
---|
61 | unsigned int, unsigned int, unsigned int, unsigned int); |
---|
62 | ~Dither(); |
---|
63 | |
---|
64 | void setPalette(unsigned int r[], unsigned int g[], |
---|
65 | unsigned int b[], unsigned int a[]); |
---|
66 | void setBrightness(float); |
---|
67 | void setGamma(float); |
---|
68 | void setContrast(float); |
---|
69 | void setAntialias(char const *); |
---|
70 | char const *const * getAntialiasList(); |
---|
71 | void setColor(char const *); |
---|
72 | char const *const * getColorList(); |
---|
73 | void setCharset(char const *); |
---|
74 | char const *const * getCharsetList(); |
---|
75 | void setMode(char const *); |
---|
76 | char const *const * getModeList(); |
---|
77 | void Bitmap(Cucul *, int, int, int, int, void *); |
---|
78 | |
---|
79 | private: |
---|
80 | cucul_dither *dither; |
---|
81 | }; |
---|
82 | |
---|
83 | class Cucul |
---|
84 | { |
---|
85 | friend class Caca; |
---|
86 | friend class Dither; |
---|
87 | friend class Font; |
---|
88 | public: |
---|
89 | Cucul(); |
---|
90 | Cucul(int width, int height); |
---|
91 | ~Cucul(); |
---|
92 | |
---|
93 | void setSize(unsigned int w, unsigned int h); |
---|
94 | unsigned int getWidth(void); |
---|
95 | unsigned int getHeight(void); |
---|
96 | unsigned long int getAttr(int, int); |
---|
97 | int setAttr(unsigned long int); |
---|
98 | int setColorANSI(unsigned char f, unsigned char b); |
---|
99 | int setColorARGB(unsigned int f, unsigned int b); |
---|
100 | void Printf(int x, int y , char const * format, ...); |
---|
101 | void putChar(int x, int y, unsigned long int ch); |
---|
102 | unsigned long int getChar(int, int); |
---|
103 | void putStr(int x, int y, char *str); |
---|
104 | void Clear(void); |
---|
105 | void Blit(int, int, Cucul* c1, Cucul* c2); |
---|
106 | void Invert(); |
---|
107 | void Flip(); |
---|
108 | void Flop(); |
---|
109 | void Rotate(); |
---|
110 | void drawLine(int, int, int, int, unsigned long int); |
---|
111 | void drawPolyline(int const x[], int const y[], int, unsigned long int); |
---|
112 | void drawThinLine(int, int, int, int); |
---|
113 | void drawThinPolyline(int const x[], int const y[], int); |
---|
114 | void drawCircle(int, int, int, unsigned long int); |
---|
115 | void drawEllipse(int, int, int, int, unsigned long int); |
---|
116 | void drawThinEllipse(int, int, int, int); |
---|
117 | void fillEllipse(int, int, int, int, unsigned long int); |
---|
118 | void drawBox(int, int, int, int, unsigned long int); |
---|
119 | void drawThinBox(int, int, int, int); |
---|
120 | void drawCP437Box(int, int, int, int); |
---|
121 | void fillBox(int, int, int, int, unsigned long int); |
---|
122 | void drawTriangle(int, int, int, int, int, int, unsigned long int); |
---|
123 | void drawThinTriangle(int, int, int, int, int, int); |
---|
124 | void fillTriangle(int, int, int, int, int, int, unsigned long int); |
---|
125 | int Rand(int, int); |
---|
126 | int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int); |
---|
127 | unsigned int getFrameCount(); |
---|
128 | int setFrame(unsigned int); |
---|
129 | int createFrame(unsigned int); |
---|
130 | int freeFrame(unsigned int); |
---|
131 | |
---|
132 | char const * const * getImportList(void); |
---|
133 | long int importMemory(void const *, unsigned long int, char const *); |
---|
134 | long int importFile(char const *, char const *); |
---|
135 | char const * const * getExportList(void); |
---|
136 | void *exportMemory(char const *, unsigned long int *); |
---|
137 | |
---|
138 | protected: |
---|
139 | cucul_canvas_t *get_cucul_canvas_t(); |
---|
140 | |
---|
141 | private: |
---|
142 | cucul_canvas_t *cv; |
---|
143 | }; |
---|
144 | |
---|
145 | #endif /* _CUCUL_PP_H */ |
---|