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

Last change on this file since 2304 was 2304, checked in by Sam Hocevar, 15 years ago
  • Get rid of the last long types in the API.
  • Use size_t and ssize_t where appropriate.
  • 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 2304 2008-04-19 19:25:47Z 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 2304 2008-04-19 19:25:47Z 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    uint32_t utf8ToUtf32(char const *, size_t *);
42    size_t utf32ToUtf8(char *, uint32_t);
43    uint8_t utf32ToCp437(uint32_t);
44    uint32_t cp437ToUtf32(uint8_t);
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 *, uint8_t *, unsigned int,
57                               unsigned int, unsigned int);
58    uint32_t 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    uint32_t getAttr(int, int);
104    int setAttr(uint32_t);
105    int setColorANSI(uint8_t f, uint8_t 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, uint32_t ch);
109    uint32_t 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, uint32_t);
118    void drawPolyline(int const x[], int const y[], int, uint32_t);
119    void drawThinLine(int, int, int, int);
120    void drawThinPolyline(int const x[], int const y[], int);
121    void drawCircle(int, int, int, uint32_t);
122    void drawEllipse(int, int, int, int, uint32_t);
123    void drawThinEllipse(int, int, int, int);
124    void fillEllipse(int, int, int, int, uint32_t);
125    void drawBox(int, int, int, int, uint32_t);
126    void drawThinBox(int, int, int, int);
127    void drawCP437Box(int, int, int, int);
128    void fillBox(int, int, int, int, uint32_t);
129    void drawTriangle(int, int, int, int, int, int, uint32_t);
130    void drawThinTriangle(int, int, int, int, int, int);
131    void fillTriangle(int, int, int, int, int, int, uint32_t);
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.