Ignore:
Timestamp:
Apr 26, 2006, 12:04:02 PM (15 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Updated C++ bindings, should be coding-style-correction-proof, or at least a bit better than before. Not tested at all.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cpp/cucul++.h

    r838 r892  
    2626#include <cucul.h>
    2727
     28
     29class Cucul;
     30
     31/* Ugly, I know */
     32class Font
     33{
     34 public:
     35    ~Font();
     36    Font(void const *, unsigned int);
     37    char const *const * getList(void);
     38    unsigned int getWidth();
     39    unsigned int getHeight();
     40    void renderCanvas(Cucul *, unsigned char *, unsigned int, unsigned int, unsigned int);
     41
     42 private:
     43    cucul_font *font;
     44
     45};
     46
     47class Dither
     48{
     49 public:
     50    Dither(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
     51    ~Dither();
     52
     53    void setPalette(unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]);
     54    void setBrightness(float);
     55    void setGamma(float);
     56    void setContrast(float);
     57    void setInvert(int);
     58    void setAntialias(char const *);
     59    char const *const * getAntialiasList();
     60    void setColor(char const *);
     61    char const *const * getColorList();
     62    void setCharset(char const *);
     63    char const *const * getCharsetList();
     64    void setMode(char const *);
     65    char const *const * getModeList();
     66    void Bitmap(Cucul *, int, int, int, int, void *);
     67
     68 private:
     69    cucul_dither *dither;
     70
     71};
     72
     73class Buffer
     74{
     75 public:
     76    Buffer(Cucul *cv, char const *);
     77    ~Buffer();
     78    char const *const * getExportList(void);
     79
     80 private:
     81    cucul_buffer *buffer;
     82};
     83
     84
    2885class Cucul
    2986{
    3087    friend class Caca;
     88    friend class Dither;
     89    friend class Font;
     90    friend class Buffer;
    3191  public:
    3292    Cucul();
     
    3494    ~Cucul();
    3595
    36     /* Ugly, I know */
    37     class Font
    38     {
    39         friend class Cucul;
    40       protected:
    41         cucul_font *font;
    42     };
    43 
    44     class Dither
    45     {
    46         friend class Cucul;
    47       protected:
    48         cucul_dither *dither;
    49     };
    50 
    51     class Buffer
    52     {
    53         friend class Cucul;
    54       protected:
    55         cucul_buffer *buffer;
    56     };
    57 
    58     void set_size(unsigned int w, unsigned int h);
    59     unsigned int get_width(void);
    60     unsigned int get_height(void);
    61     void set_color(unsigned int f, unsigned int b);
    62     char const * get_color_name(unsigned int color);
    63     void printf(int x , int y , char const * format,...);
    64     void putchar(int x, int y, char ch);
    65     void putstr(int x, int y, char *str);
    66     void clear(void);
    67     void blit(int, int, Cucul* c1, Cucul* c2);
    68     void invert();
    69     void flip();
    70     void flop();
    71     void rotate();
    72     void draw_line(int, int, int, int, char const *);
    73     void draw_polyline(int const x[], int const y[], int, char const *);
    74     void draw_thin_line(int, int, int, int);
    75     void draw_thin_polyline(int const x[], int const y[], int);
    76     void draw_circle(int, int, int, char const *);
    77     void draw_ellipse(int, int, int, int, char const *);
    78     void draw_thin_ellipse(int, int, int, int);
    79     void fill_ellipse(int, int, int, int, char const *);
    80     void draw_box(int, int, int, int, char const *);
    81     void draw_thin_box(int, int, int, int);
    82     void fill_box(int, int, int, int, char const *);
    83     void draw_triangle(int, int, int, int, int, int, char const *);
    84     void draw_thin_triangle(int, int, int, int, int, int);
    85     void fill_triangle(int, int, int, int, int, int, char const *);
    86     int rand(int, int);
    87     Dither * create_dither(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
    88     void set_dither_palette(Cucul::Dither *, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]);
    89     void set_dither_brightness(Cucul::Dither *, float);
    90     void set_dither_gamma(Cucul::Dither *, float);
    91     void set_dither_contrast(Cucul::Dither *, float);
    92     void set_dither_invert(Cucul::Dither *, int);
    93     void set_dither_antialias(Cucul::Dither *, char const *);
    94     char const *const * get_dither_antialias_list(Cucul::Dither const *);
    95     void set_dither_color(Cucul::Dither *, char const *);
    96     char const *const * get_dither_color_list(Cucul::Dither const *);
    97     void set_dither_charset(Cucul::Dither *, char const *);
    98     char const *const * get_dither_charset_list(Cucul::Dither const *);
    99     void set_dither_mode(Cucul::Dither *, char const *);
    100     char const *const * get_dither_mode_list(Cucul::Dither const *);
    101     void dither_bitmap(int, int, int, int, Cucul::Dither const *, void *);
    102     void free_dither(Cucul::Dither *);
    103     Font * load_font(void const *, unsigned int);
    104     char const *const * get_font_list(void);
    105     unsigned int get_font_width(Font *);
    106     unsigned int get_font_height(Font *);
    107     void render_canvas(Font *, unsigned char *, unsigned int, unsigned int, unsigned int);
    108     void free_font(Font *);
    109     Buffer * export_canvas(char const *);
    110     char const *const * get_export_list(void);
     96    void setSize(unsigned int w, unsigned int h);
     97    unsigned int getWidth(void);
     98    unsigned int getHeight(void);
     99    void setColor(unsigned int f, unsigned int b);
     100    char const * getColorName(unsigned int color);
     101    void Printf(int x , int y , char const * format,...);
     102    void putChar(int x, int y, char ch);
     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, char const *);
     111    void drawPolyline(int const x[], int const y[], int, char const *);
     112    void drawThinLine(int, int, int, int);
     113    void drawThinPolyline(int const x[], int const y[], int);
     114    void drawCircle(int, int, int, char const *);
     115    void drawEllipse(int, int, int, int, char const *);
     116    void drawThinEllipse(int, int, int, int);
     117    void fillEllipse(int, int, int, int, char const *);
     118    void drawBox(int, int, int, int, char const *);
     119    void drawThinBox(int, int, int, int);
     120    void fillBox(int, int, int, int, char const *);
     121    void drawTriangle(int, int, int, int, int, int, char const *);
     122    void drawThinTriangle(int, int, int, int, int, int);
     123    void fillTriangle(int, int, int, int, int, int, char const *);
     124    int Rand(int, int);
    111125
    112126  protected:
Note: See TracChangeset for help on using the changeset viewer.