source: libcaca/trunk/cxx/cucul++.h @ 2075

Last change on this file since 2075 was 2074, checked in by Sam Hocevar, 12 years ago
  • Add cucul_get_version() and caca_get_version() and updated C++ bindings accordingly.
  • The C++ test example no longer needs "config.h".
  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
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 2074 2007-11-26 01:04:32Z 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 2074 2007-11-26 01:04:32Z 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#undef __class
30#if defined(_WIN32) && defined(__LIBCUCUL_PP__)
31#   define __class class __declspec(dllexport)
32#else
33#   define __class class
34#endif
35
36class Cucul;
37
38__class Charset
39{
40 public:
41    unsigned long int utf8ToUtf32(char const *, unsigned int *);
42    unsigned int utf32ToUtf8(char *, unsigned long int);
43    unsigned char utf32ToCp437(unsigned long int);
44    unsigned long int cp437ToUtf32(unsigned char);
45};
46
47/* Ugly, I know */
48__class Font
49{
50 public:
51    ~Font();
52    Font(void const *, unsigned int);
53    char const *const * getList(void);
54    unsigned int getWidth();
55    unsigned int getHeight();
56    void renderCanvas(Cucul *, unsigned char *, unsigned int,
57                               unsigned int, unsigned int);
58    unsigned long int const *getBlocks();
59
60 private:
61    cucul_font *font;
62};
63
64__class Dither
65{
66 public:
67    Dither(unsigned int, unsigned int, unsigned int, unsigned int,
68           unsigned int, unsigned int, unsigned int, unsigned int);
69    ~Dither();
70
71    void setPalette(unsigned int r[], unsigned int g[],
72                    unsigned int b[], unsigned int a[]);
73    void setBrightness(float);
74    void setGamma(float);
75    void setContrast(float);
76    void setAntialias(char const *);
77    char const *const * getAntialiasList();
78    void setColor(char const *);
79    char const *const * getColorList();
80    void setCharset(char const *);
81    char const *const * getCharsetList();
82    void setMode(char const *);
83    char const *const * getModeList();
84    void Bitmap(Cucul *, int, int, int, int, void *);
85
86 private:
87    cucul_dither *dither;
88};
89
90__class Cucul
91{
92    friend class Caca;
93    friend class Dither;
94    friend class Font;
95 public:
96    Cucul();
97    Cucul(int width, int height);
98    ~Cucul();
99
100    void setSize(unsigned int w, unsigned int h);
101    unsigned int getWidth(void);
102    unsigned int getHeight(void);
103    unsigned long int getAttr(int, int);
104    int setAttr(unsigned long int);
105    int setColorANSI(unsigned char f, unsigned char b);
106    int setColorARGB(unsigned int f, unsigned int b);
107    void Printf(int x, int y , char const * format, ...);
108    void putChar(int x, int y, unsigned long int ch);
109    unsigned long int getChar(int, int);
110    void putStr(int x, int y, char *str);
111    void Clear(void);
112    void Blit(int, int, Cucul* c1, Cucul* c2);
113    void Invert();
114    void Flip();
115    void Flop();
116    void Rotate();
117    void drawLine(int, int, int, int, unsigned long int);
118    void drawPolyline(int const x[], int const y[], int, unsigned long int);
119    void drawThinLine(int, int, int, int);
120    void drawThinPolyline(int const x[], int const y[], int);
121    void drawCircle(int, int, int, unsigned long int);
122    void drawEllipse(int, int, int, int, unsigned long int);
123    void drawThinEllipse(int, int, int, int);
124    void fillEllipse(int, int, int, int, unsigned long int);
125    void drawBox(int, int, int, int, unsigned long int);
126    void drawThinBox(int, int, int, int);
127    void drawCP437Box(int, int, int, int);
128    void fillBox(int, int, int, int, unsigned long int);
129    void drawTriangle(int, int, int, int, int, int, unsigned long int);
130    void drawThinTriangle(int, int, int, int, int, int);
131    void fillTriangle(int, int, int, int, int, int, unsigned long int);
132    int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int);
133    unsigned int getFrameCount();
134    int setFrame(unsigned int);
135    int createFrame(unsigned int);
136    int freeFrame(unsigned int);
137
138    char const * const * getImportList(void);
139    long int importMemory(void const *, unsigned long int, char const *);
140    long int importFile(char const *, char const *);
141    char const * const * getExportList(void);
142    void *exportMemory(char const *, unsigned long int *);
143
144    static int Rand(int, int);
145    static char const * getVersion();
146 protected:
147    cucul_canvas_t *get_cucul_canvas_t();
148
149 private:
150    cucul_canvas_t *cv;
151};
152
153#endif /* _CUCUL_PP_H */
Note: See TracBrowser for help on using the repository browser.