source: libcaca/trunk/cpp/cucul++.h @ 831

Last change on this file since 831 was 827, checked in by Sam Hocevar, 14 years ago
  • Fixed ugly coding style of the C++ bindings. Vieux porc immonde.
  • Property svn:keywords set to Id
File size: 4.5 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 827 2006-04-21 19:06:38Z 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 827 2006-04-21 19:06:38Z 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
28class Cucul
29{
30    friend class Caca;
31  public:
32    Cucul();
33    Cucul(int width, int height);
34    ~Cucul();
35
36    /* Ugly, I know */
37    class Font
38    {
39        friend class Cucul;
40      protected:
41        cucul_font *font;
42    };
43
44    class Sprite
45    {
46        friend class Cucul;
47      protected:
48        cucul_sprite *sprite;
49    };
50
51    class Dither
52    {
53        friend class Cucul;
54      protected:
55        cucul_dither *dither;
56    };
57
58    class Buffer
59    {
60        friend class Cucul;
61      protected:
62        cucul_buffer *buffer;
63    };
64
65    void set_size(unsigned int w, unsigned int h);
66    unsigned int get_width(void);
67    unsigned int get_height(void);
68    void set_color(unsigned int f, unsigned int b);
69    char const * get_color_name(unsigned int color);
70    void printf(int x , int y , char const * format,...);
71    void putchar(int x, int y, char ch);
72    void putstr(int x, int y, char *str);
73    void clear(unsigned char bg);
74    void blit(int, int, Cucul* c1, Cucul* c2);
75    void invert();
76    void flip();
77    void flop();
78    void rotate();
79    void draw_line(int, int, int, int, char const *);
80    void draw_polyline(int const x[], int const y[], int, char const *);
81    void draw_thin_line(int, int, int, int);
82    void draw_thin_polyline(int const x[], int const y[], int);
83    void draw_circle(int, int, int, char const *);
84    void draw_ellipse(int, int, int, int, char const *);
85    void draw_thin_ellipse(int, int, int, int);
86    void fill_ellipse(int, int, int, int, char const *);
87    void draw_box(int, int, int, int, char const *);
88    void draw_thin_box(int, int, int, int);
89    void fill_box(int, int, int, int, char const *);
90    void draw_triangle(int, int, int, int, int, int, char const *);
91    void draw_thin_triangle(int, int, int, int, int, int);
92    void fill_triangle(int, int, int, int, int, int, char const *);
93    int rand(int, int);
94    Sprite * load_sprite(char const *);
95    int get_sprite_frames(Cucul::Sprite const *);
96    int get_sprite_width(Cucul::Sprite const *, int);
97    int get_sprite_height(Cucul::Sprite const *, int);
98    int get_sprite_dx(Cucul::Sprite const *, int);
99    int get_sprite_dy(Cucul::Sprite const *, int);
100    void draw_sprite(int, int, Cucul::Sprite const *, int);
101    void free_sprite(Cucul::Sprite*);
102    Dither * create_dither(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
103    void set_dither_palette(Cucul::Dither *, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]);
104    void set_dither_brightness(Cucul::Dither *, float);
105    void set_dither_gamma(Cucul::Dither *, float);
106    void set_dither_contrast(Cucul::Dither *, float);
107    void set_dither_invert(Cucul::Dither *, int);
108    void set_dither_antialias(Cucul::Dither *, char const *);
109    char const *const * get_dither_antialias_list(Cucul::Dither const *);
110    void set_dither_color(Cucul::Dither *, char const *);
111    char const *const * get_dither_color_list(Cucul::Dither const *);
112    void set_dither_charset(Cucul::Dither *, char const *);
113    char const *const * get_dither_charset_list(Cucul::Dither const *);
114    void set_dither_mode(Cucul::Dither *, char const *);
115    char const *const * get_dither_mode_list(Cucul::Dither const *);
116    void dither_bitmap(int, int, int, int, Cucul::Dither const *, void *);
117    void free_dither(Cucul::Dither *);
118    Font * load_font(void const *, unsigned int);
119    char const *const * get_font_list(void);
120    unsigned int get_font_width(Font *);
121    unsigned int get_font_height(Font *);
122    void render_canvas(Font *, unsigned char *, unsigned int, unsigned int, unsigned int);
123    void free_font(Font *);
124    Buffer * export_canvas(char const *);
125    char const *const * get_export_list(void);
126
127  protected:
128    cucul_canvas_t *get_cucul_canvas_t();
129
130  private:
131    cucul_canvas_t *cv;
132};
133
134
135#endif /* _CUCUL_PP_H */
Note: See TracBrowser for help on using the repository browser.