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

Last change on this file since 1875 was 1875, checked in by Sam Hocevar, 13 years ago
  • Removed calls to now deprecated cucul_set_dither_invert().
  • 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 1875 2007-11-04 09:56: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 1875 2007-11-04 09:56: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
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 setAntialias(char const *);
69    char const *const * getAntialiasList();
70    void setColor(char const *);
71    char const *const * getColorList();
72    void setCharset(char const *);
73    char const *const * getCharsetList();
74    void setMode(char const *);
75    char const *const * getModeList();
76    void Bitmap(Cucul *, int, int, int, int, void *);
77
78 private:
79    cucul_dither *dither;
80};
81
82class Cucul
83{
84    friend class Caca;
85    friend class Dither;
86    friend class Font;
87 public:
88    Cucul();
89    Cucul(int width, int height);
90    ~Cucul();
91
92    void setSize(unsigned int w, unsigned int h);
93    unsigned int getWidth(void);
94    unsigned int getHeight(void);
95    unsigned long int getAttr(int, int);
96    int setAttr(unsigned long int);
97    int setColorANSI(unsigned char f, unsigned char b);
98    int setColorARGB(unsigned int f, unsigned int b);
99    void Printf(int x, int y , char const * format, ...);
100    void putChar(int x, int y, unsigned long int ch);
101    unsigned long int getChar(int, int);
102    void putStr(int x, int y, char *str);
103    void Clear(void);
104    void Blit(int, int, Cucul* c1, Cucul* c2);
105    void Invert();
106    void Flip();
107    void Flop();
108    void Rotate();
109    void drawLine(int, int, int, int, unsigned long int);
110    void drawPolyline(int const x[], int const y[], int, unsigned long int);
111    void drawThinLine(int, int, int, int);
112    void drawThinPolyline(int const x[], int const y[], int);
113    void drawCircle(int, int, int, unsigned long int);
114    void drawEllipse(int, int, int, int, unsigned long int);
115    void drawThinEllipse(int, int, int, int);
116    void fillEllipse(int, int, int, int, unsigned long int);
117    void drawBox(int, int, int, int, unsigned long int);
118    void drawThinBox(int, int, int, int);
119    void drawCP437Box(int, int, int, int);
120    void fillBox(int, int, int, int, unsigned long int);
121    void drawTriangle(int, int, int, int, int, int, unsigned long int);
122    void drawThinTriangle(int, int, int, int, int, int);
123    void fillTriangle(int, int, int, int, int, int, unsigned long int);
124    int Rand(int, int);
125    int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int);
126    unsigned int getFrameCount();
127    int setFrame(unsigned int);
128    int createFrame(unsigned int);
129    int freeFrame(unsigned int);
130
131    char const * const * getImportList(void);
132    long int importMemory(void const *, unsigned long int, char const *);
133    long int importFile(char const *, char const *);
134    char const * const * getExportList(void);
135    void *exportMemory(char const *, unsigned long int *);
136
137 protected:
138    cucul_canvas_t *get_cucul_canvas_t();
139
140 private:
141    cucul_canvas_t *cv;
142};
143
144#endif /* _CUCUL_PP_H */
Note: See TracBrowser for help on using the repository browser.