summaryrefslogtreecommitdiff
path: root/Source/++DFB/include/idirectfbsurface.h
blob: 6404dbc820418bcd9a99589744be6c4c3b504a9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*
   (c) Copyright 2000-2002  convergence integrated media GmbH.
   All rights reserved.

   Written by Denis Oliver Kropp <dok@convergence.de>,
              Andreas Hundt <andi@convergence.de> and
              Sven Neumann <sven@convergence.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/

#ifndef IDIRECTFBSURFACE_H
#define IDIRECTFBSURFACE_H

#ifndef DFBPP_H
#error Please include ++dfb.h only.
#endif

class IDirectFBSurface : public IPPAny<IDirectFBSurface, IDirectFBSurface_C> {
friend
     class IDirectFB;
friend
     class IDirectFBDisplayLayer;
friend
     class IDirectFBImageProvider;
friend
     class IDirectFBVideoProvider;
friend
     class IDirectFBWindow;

public:
     IDirectFBSurface(IDirectFBSurface_C* myptr=NULL):IPPAny<IDirectFBSurface, IDirectFBSurface_C>(myptr){}

     DFBSurfaceCapabilities GetCapabilities     ();
     void                   GetPosition         (int                      *x,
                                                 int                      *y);
     void                   GetSize             (int                      *width,
                                                 int                      *height);
     void                   GetVisibleRectangle (DFBRectangle             *rect);
     DFBSurfacePixelFormat  GetPixelFormat      ();
     DFBAccelerationMask    GetAccelerationMask (IDirectFBSurface         *source = NULL);

     IDirectFBPalette       GetPalette          ();
     void                   SetPalette          (IDirectFBPalette         *palette);
     void                   SetAlphaRamp        (u8                      a0,
                                                 u8                      a1,
                                                 u8                      a2,
                                                 u8                      a3);

     void                   Lock                (DFBSurfaceLockFlags       flags,
                                                 void                    **ptr,
                                                 int                      *pitch);
     void                   Unlock              ();
     void                   Flip                (DFBRegion                *region = NULL,
                                                 DFBSurfaceFlipFlags       flags = static_cast<DFBSurfaceFlipFlags>(0));
     void                   SetField            (int                       field);
     void                   Clear               (u8                      r = 0x00,
                                                 u8                      g = 0x00,
                                                 u8                      b = 0x00,
                                                 u8                      a = 0x00);
     void                   Clear               (DFBColor               &color);

     void                   SetClip             (const DFBRegion          *clip = 0);
     void                   SetClip             (const DFBRectangle       *clip);
     void                   SetColor            (u8                      r,
                                                 u8                      g,
                                                 u8                      b,
                                                 u8                      a = 0xFF);
     void                   SetColor            (DFBColor               &color);
     void                   SetColorIndex       (unsigned int              index);
     void                   SetSrcBlendFunction (DFBSurfaceBlendFunction   function);
     void                   SetDstBlendFunction (DFBSurfaceBlendFunction   function);
     void                   SetPorterDuff       (DFBSurfacePorterDuffRule  rule);
     void                   SetSrcColorKey      (u8                      r,
                                                 u8                      g,
                                                 u8                      b);
     void                   SetSrcColorKeyIndex (unsigned int              index);
     void                   SetDstColorKey      (u8                      r,
                                                 u8                      g,
                                                 u8                      b);
     void                   SetDstColorKeyIndex (unsigned int              index);

     void                   SetBlittingFlags    (DFBSurfaceBlittingFlags   flags);
     void                   Blit                (IDirectFBSurface         *source,
                                                 const DFBRectangle       *source_rect = NULL,
                                                 int                       x = 0,
                                                 int                       y = 0);
     void                   TileBlit            (IDirectFBSurface         *source,
                                                 const DFBRectangle       *source_rect = NULL,
                                                 int                       x = 0,
                                                 int                       y = 0);
     void                   BatchBlit           (IDirectFBSurface         *source,
                                                 const DFBRectangle       *source_rects,
                                                 const DFBPoint           *dest_points,
                                                 int                       num);
     void                   StretchBlit         (IDirectFBSurface         *source,
                                                 const DFBRectangle       *source_rect = NULL,
                                                 const DFBRectangle       *destination_rect = NULL);

     void                   TextureTriangles    (IDirectFBSurface         *source,
                                                 const DFBVertex          *vertices,
                                                 const int                *indices,
                                                 int                       num,
                                                 DFBTriangleFormation      formation);

     void                   SetDrawingFlags     (DFBSurfaceDrawingFlags    flags);
     void                   FillRectangle       (int                       x,
                                                 int                       y,
                                                 int                       width,
                                                 int                       height);
     void                   FillRectangle       (DFBRectangle             &rect);
     void                   FillRectangle       (DFBRegion                &rect);
     void                   FillRectangles      (const DFBRectangle       *rects,
                                                 unsigned int              num_rects);
     void                   DrawRectangle       (int                       x,
                                                 int                       y,
                                                 int                       width,
                                                 int                       height);
     void                   DrawLine            (int                       x1,
                                                 int                       y1,
                                                 int                       x2,
                                                 int                       y2); 
     void                   DrawLines           (const DFBRegion          *lines,
                                                 unsigned int              num_lines);
     void                   FillTriangle        (int                       x1,
                                                 int                       y1,
                                                 int                       x2,
                                                 int                       y2,
                                                 int                       x3,
                                                 int                       y3);
     void                   FillSpans           (int                       y,
                                                 const DFBSpan            *spans,
                                                 unsigned int              num);

     void                   SetFont             (const IDirectFBFont &font) const;
     IDirectFBFont          GetFont             () const;
     void                   DrawString          (const char               *text,
                                                 int                       bytes,
                                                 int                       x,
                                                 int                       y,
                                                 DFBSurfaceTextFlags       flags);
     void                   DrawGlyph           (unsigned int              index,
                                                 int                       x,
                                                 int                       y,
                                                 DFBSurfaceTextFlags       flags);
     void                   SetEncoding         (DFBTextEncodingID         encoding);

     IDirectFBSurface       GetSubSurface       (DFBRectangle             *rect);

     void                   Dump                (const char               *directory,
                                                 const char               *prefix);

     void                   DisableAcceleration (DFBAccelerationMask       mask);

     IDirectFBGL           *GetGL               ();

     /* Additional methods added for enhanced usability */

     int                    GetWidth            ();
     int                    GetHeight           ();

     void                   SetColor            (const DFBColor           &color);
     void                   SetColor            (const DFBColor           *color);

     void                   FillRectangle       (const DFBRectangle       &rect);
     void                   DrawRectangle       (const DFBRectangle       &rect);
     void                   DrawLine            (const DFBRegion          &line);

     IDirectFBSurface       GetSubSurface       (int                       x,
                                                 int                       y,
                                                 int                       width,
                                                 int                       height);

     void                   GetClip             (DFBRegion                *clip);

     int                    GetFramebufferOffset();

     void                   ReleaseSource       ();
     void                   SetIndexTranslation (const int                *indices,
                                                 int                       num_indices);

     void                   Read                (void                     *ptr,
                                                 int                       pitch,
                                                 const DFBRectangle       *rect = NULL);

     void                   Write               (const void               *ptr,
                                                 int                       pitch,
                                                 const DFBRectangle       *rect = NULL);

     inline IDirectFBSurface& operator = (const IDirectFBSurface& other){
          return IPPAny<IDirectFBSurface, IDirectFBSurface_C>::operator =(other);
     }
     inline IDirectFBSurface& operator = (IDirectFBSurface_C* other){
          return IPPAny<IDirectFBSurface, IDirectFBSurface_C>::operator =(other);
     }
};

#endif