1 /***************************************************************************
2                           graphic.h  -  description
3                              -------------------
4     begin                : Sat Oct 14 2000
5     copyright            : (C) 2000 by Waldemar Baraldi
6     email                : baraldi@lacasilla.com.ar
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef GRAPHIC_H
19 #define GRAPHIC_H
20 
21 #include "surface.h"
22 #include "SDL.h"
23 #include <string.h> // Only for Red Hat
24 
25 
26 #define OPAQUE		255
27 #define TRANSPARENT	0
28 
29 
30 enum Axis {HAxis, VAxis};
31 
32 class Graphic: public Surface{
33 
34   public:
35 
36     Graphic();
37 
38     Graphic(Graphic * g);
39 
40     Graphic(int width, int height);
41 
42     virtual ~Graphic();
43 
44     void setAlpha(char value=OPAQUE);
45 
46     /** Enable or disable clipping.*/
47     void enableClipping(bool flag=true);
48 
49     /** Establish the cliping zone.*/
50     void setClipping(int top, int left, int bottom, int right);
51 
52     virtual void flip(Axis a=HAxis);
53 
54     virtual void fill(int r, int g, int b);
55 
56     virtual void fillRect(int x, int y, int w, int h, int r, int g, int b, int a);
57 
58   protected:
59 
60     int clip_x, clip_y, clip_width, clip_height;
61     bool clip_active;
62     void * pixels;
63 };
64 
65 
66 #endif
67 
68