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 1203 2006-10-14 22:11:33Z 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 | /** \file cucul++.h |
---|
15 | * \version \$Id: cucul++.h 1203 2006-10-14 22:11:33Z sam $ |
---|
16 | * \author Jean-Yves Lamoureux <jylam@lnxscene.org> |
---|
17 | * \brief The \e libcucul++ public header. |
---|
18 | * |
---|
19 | * This header contains the public types and functions that applications |
---|
20 | * using \e libcucul++ may use. |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef _CUCUL_PP_H |
---|
24 | #define _CUCUL_PP_H |
---|
25 | |
---|
26 | #include <cucul.h> |
---|
27 | |
---|
28 | |
---|
29 | class Cucul; |
---|
30 | |
---|
31 | |
---|
32 | class Charset |
---|
33 | { |
---|
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 | |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | /* Ugly, I know */ |
---|
45 | class Font |
---|
46 | { |
---|
47 | public: |
---|
48 | ~Font(); |
---|
49 | Font(void const *, unsigned int); |
---|
50 | char const *const * getList(void); |
---|
51 | unsigned int getWidth(); |
---|
52 | unsigned int getHeight(); |
---|
53 | void renderCanvas(Cucul *, unsigned char *, unsigned int, unsigned int, unsigned int); |
---|
54 | unsigned long int const *getBlocks(); |
---|
55 | |
---|
56 | private: |
---|
57 | cucul_font *font; |
---|
58 | |
---|
59 | }; |
---|
60 | |
---|
61 | class Dither |
---|
62 | { |
---|
63 | public: |
---|
64 | Dither(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); |
---|
65 | ~Dither(); |
---|
66 | |
---|
67 | void setPalette(unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]); |
---|
68 | void setBrightness(float); |
---|
69 | void setGamma(float); |
---|
70 | void setContrast(float); |
---|
71 | void setInvert(int); |
---|
72 | void setAntialias(char const *); |
---|
73 | char const *const * getAntialiasList(); |
---|
74 | void setColor(char const *); |
---|
75 | char const *const * getColorList(); |
---|
76 | void setCharset(char const *); |
---|
77 | char const *const * getCharsetList(); |
---|
78 | void setMode(char const *); |
---|
79 | char const *const * getModeList(); |
---|
80 | void Bitmap(Cucul *, int, int, int, int, void *); |
---|
81 | |
---|
82 | private: |
---|
83 | cucul_dither *dither; |
---|
84 | |
---|
85 | }; |
---|
86 | |
---|
87 | class Buffer |
---|
88 | { |
---|
89 | friend class Cucul; |
---|
90 | public: |
---|
91 | Buffer(); |
---|
92 | ~Buffer(); |
---|
93 | char const *const * getExportList(void); |
---|
94 | void *getData(void); |
---|
95 | void loadMemory(void *buf, unsigned long int size); |
---|
96 | void loadFile(char const *filename); |
---|
97 | unsigned long int getSize(); |
---|
98 | |
---|
99 | protected: |
---|
100 | cucul_buffer *get_buffer(); |
---|
101 | |
---|
102 | private: |
---|
103 | cucul_buffer *buffer_; |
---|
104 | cucul_buffer *getBuffer(); |
---|
105 | }; |
---|
106 | |
---|
107 | |
---|
108 | class Cucul |
---|
109 | { |
---|
110 | friend class Caca; |
---|
111 | friend class Dither; |
---|
112 | friend class Font; |
---|
113 | friend class Buffer; |
---|
114 | public: |
---|
115 | Cucul(); |
---|
116 | Cucul(int width, int height); |
---|
117 | Cucul(Buffer *, char const *); |
---|
118 | ~Cucul(); |
---|
119 | |
---|
120 | void setSize(unsigned int w, unsigned int h); |
---|
121 | unsigned int getWidth(void); |
---|
122 | unsigned int getHeight(void); |
---|
123 | void setColor(unsigned int f, unsigned int b); |
---|
124 | int setTruecolor(unsigned int f, unsigned int b); |
---|
125 | unsigned long int getColor(int, int); |
---|
126 | char const * getColorName(unsigned int color); |
---|
127 | void Printf(int x , int y , char const * format,...); |
---|
128 | void putChar(int x, int y, char ch); |
---|
129 | unsigned long int getChar(cucul_canvas_t *, int, int); |
---|
130 | void putStr(int x, int y, char *str); |
---|
131 | void Clear(void); |
---|
132 | void Blit(int, int, Cucul* c1, Cucul* c2); |
---|
133 | void Invert(); |
---|
134 | void Flip(); |
---|
135 | void Flop(); |
---|
136 | void Rotate(); |
---|
137 | void drawLine(int, int, int, int, char const *); |
---|
138 | void drawPolyline(int const x[], int const y[], int, char const *); |
---|
139 | void drawThinLine(int, int, int, int); |
---|
140 | void drawThinPolyline(int const x[], int const y[], int); |
---|
141 | void drawCircle(int, int, int, char const *); |
---|
142 | void drawEllipse(int, int, int, int, char const *); |
---|
143 | void drawThinEllipse(int, int, int, int); |
---|
144 | void fillEllipse(int, int, int, int, char const *); |
---|
145 | void drawBox(int, int, int, int, char const *); |
---|
146 | void drawThinBox(int, int, int, int); |
---|
147 | void fillBox(int, int, int, int, char const *); |
---|
148 | void drawTriangle(int, int, int, int, int, int, char const *); |
---|
149 | void drawThinTriangle(int, int, int, int, int, int); |
---|
150 | void fillTriangle(int, int, int, int, int, int, char const *); |
---|
151 | int Rand(int, int); |
---|
152 | int setBoundaries(cucul_canvas_t *, int, int, |
---|
153 | unsigned int, unsigned int); |
---|
154 | unsigned int getFrameCount(); |
---|
155 | int setFrame(unsigned int); |
---|
156 | int createFrame(unsigned int); |
---|
157 | int freeFrame(unsigned int); |
---|
158 | |
---|
159 | protected: |
---|
160 | cucul_canvas_t *get_cucul_canvas_t(); |
---|
161 | |
---|
162 | private: |
---|
163 | cucul_canvas_t *cv; |
---|
164 | }; |
---|
165 | |
---|
166 | |
---|
167 | #endif /* _CUCUL_PP_H */ |
---|