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

Last change on this file since 1462 was 1462, checked in by Sam Hocevar, 13 years ago
  • Bwarf, typo in the no warranty clause.
  • Property svn:keywords set to Id
File size: 4.4 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 1462 2006-12-12 01:53:54Z 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 1462 2006-12-12 01:53:54Z 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
29class Cucul;
30
31class Charset
32{
33    unsigned long int utf8ToUtf32(char const *, unsigned int *);
34    unsigned int utf32ToUtf8(char *, unsigned long int);
35    unsigned char utf32ToCp437(unsigned long int);
36    unsigned long int cp437ToUtf32(unsigned char);
37};
38
39/* Ugly, I know */
40class Font
41{
42 public:
43    ~Font();
44    Font(void const *, unsigned int);
45    char const *const * getList(void);
46    unsigned int getWidth();
47    unsigned int getHeight();
48    void renderCanvas(Cucul *, unsigned char *, unsigned int,
49                               unsigned int, unsigned int);
50    unsigned long int const *getBlocks();
51
52 private:
53    cucul_font *font;
54};
55
56class Dither
57{
58 public:
59    Dither(unsigned int, unsigned int, unsigned int, unsigned int,
60           unsigned int, unsigned int, unsigned int, unsigned int);
61    ~Dither();
62
63    void setPalette(unsigned int r[], unsigned int g[],
64                    unsigned int b[], unsigned int a[]);
65    void setBrightness(float);
66    void setGamma(float);
67    void setContrast(float);
68    void setInvert(int);
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
83class 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 */
Note: See TracBrowser for help on using the repository browser.