1 /*
2    (c) Copyright 2001-2009  The world wide DirectFB Open Source Community (directfb.org)
3    (c) Copyright 2000-2004  Convergence (integrated media) GmbH
4 
5    All rights reserved.
6 
7    Written by Denis Oliver Kropp <dok@directfb.org>,
8               Andreas Hundt <andi@fischlustig.de>,
9               Sven Neumann <neo@directfb.org>,
10               Ville Syrjälä <syrjala@sci.fi> and
11               Claudio Ciccani <klan@users.sf.net>.
12 
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2 of the License, or (at your option) any later version.
17 
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    Lesser General Public License for more details.
22 
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; if not, write to the
25    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26    Boston, MA 02111-1307, USA.
27 */
28 
29 #ifndef __DIRECTFB_H__
30 #define __DIRECTFB_H__
31 
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 #include <dfb_types.h>
39 #include <sys/time.h> /* struct timeval */
40 
41 #include <directfb_build.h>
42 #include <directfb_keyboard.h>
43 
44 #include <direct/interface.h>
45 
46 /*
47  * Version handling.
48  */
49 extern const unsigned int directfb_major_version;
50 extern const unsigned int directfb_minor_version;
51 extern const unsigned int directfb_micro_version;
52 extern const unsigned int directfb_binary_age;
53 extern const unsigned int directfb_interface_age;
54 
55 /*
56  * Check for a certain DirectFB version.
57  * In case of an error a message is returned describing the mismatch.
58  */
59 const char * DirectFBCheckVersion( unsigned int required_major,
60                                    unsigned int required_minor,
61                                    unsigned int required_micro );
62 
63 
64 /*
65  * Main interface of DirectFB, created by DirectFBCreate().
66  */
67 DECLARE_INTERFACE( IDirectFB )
68 
69 /*
70  * Interface to a surface object, being a graphics context for rendering and state control,
71  * buffer operations, palette access and sub area translate'n'clip logic.
72  */
73 DECLARE_INTERFACE( IDirectFBSurface )
74 
75 /*
76  * Interface for read/write access to the colors of a palette object and for cloning it.
77  */
78 DECLARE_INTERFACE( IDirectFBPalette )
79 
80 /*
81  * Input device interface for keymap access, event buffers and state queries.
82  */
83 DECLARE_INTERFACE( IDirectFBInputDevice )
84 
85 /*
86  * Layer interface for configuration, window stack usage or direct surface access, with shared/exclusive context.
87  */
88 DECLARE_INTERFACE( IDirectFBDisplayLayer )
89 
90 /*
91  * Interface to a window object, controlling appearance and focus, positioning and stacking,
92  * event buffers and surface access.
93  */
94 DECLARE_INTERFACE( IDirectFBWindow )
95 
96 /*
97  * Interface to a local event buffer to send/receive events, wait for events, abort waiting or reset buffer.
98  */
99 DECLARE_INTERFACE( IDirectFBEventBuffer )
100 
101 /*
102  * Font interface for getting metrics, measuring strings or single characters, query/choose encodings.
103  */
104 DECLARE_INTERFACE( IDirectFBFont )
105 
106 /*
107  * Interface to an image provider, retrieving information about the image and rendering it to a surface.
108  */
109 DECLARE_INTERFACE( IDirectFBImageProvider )
110 
111 /*
112  * Interface to a video provider for playback with advanced control and basic stream information.
113  */
114 DECLARE_INTERFACE( IDirectFBVideoProvider )
115 
116 /*
117  * Data buffer interface, providing unified access to different kinds of data storage and live feed.
118  */
119 DECLARE_INTERFACE( IDirectFBDataBuffer )
120 
121 /*
122  * Interface to different display outputs, encoders, connector settings, power management and synchronization.
123  */
124 DECLARE_INTERFACE( IDirectFBScreen )
125 
126 /*
127  * OpenGL context of a surface.
128  */
129 DECLARE_INTERFACE( IDirectFBGL )
130 
131 
132 /*
133  * Return code of all interface methods and most functions
134  *
135  * Whenever a method has to return any information, it is done via output parameters. These are pointers to
136  * primitive types such as <i>int *ret_num</i>, enumerated types like <i>DFBBoolean *ret_enabled</i>, structures
137  * as in <i>DFBDisplayLayerConfig *ret_config</i>, just <i>void **ret_data</i> or other types...
138  */
139 typedef enum {
140      /*
141       * Aliases for backward compatibility and uniform look in DirectFB code
142       */
143      DFB_OK              = DR_OK,                 /* No error occured. */
144      DFB_FAILURE         = DR_FAILURE,            /* A general or unknown error occured. */
145      DFB_INIT            = DR_INIT,               /* A general initialization error occured. */
146      DFB_BUG             = DR_BUG,                /* Internal bug or inconsistency has been detected. */
147      DFB_DEAD            = DR_DEAD,               /* Interface has a zero reference counter (available in debug mode). */
148      DFB_UNSUPPORTED     = DR_UNSUPPORTED,        /* The requested operation or an argument is (currently) not supported. */
149      DFB_UNIMPLEMENTED   = DR_UNIMPLEMENTED,      /* The requested operation is not implemented, yet. */
150      DFB_ACCESSDENIED    = DR_ACCESSDENIED,       /* Access to the resource is denied. */
151      DFB_INVAREA         = DR_INVAREA,            /* An invalid area has been specified or detected. */
152      DFB_INVARG          = DR_INVARG,             /* An invalid argument has been specified. */
153      DFB_NOSYSTEMMEMORY  = DR_NOLOCALMEMORY,      /* There's not enough system memory. */
154      DFB_NOSHAREDMEMORY  = DR_NOSHAREDMEMORY,     /* There's not enough shared memory. */
155      DFB_LOCKED          = DR_LOCKED,             /* The resource is (already) locked. */
156      DFB_BUFFEREMPTY     = DR_BUFFEREMPTY,        /* The buffer is empty. */
157      DFB_FILENOTFOUND    = DR_FILENOTFOUND,       /* The specified file has not been found. */
158      DFB_IO              = DR_IO,                 /* A general I/O error occured. */
159      DFB_BUSY            = DR_BUSY,               /* The resource or device is busy. */
160      DFB_NOIMPL          = DR_NOIMPL,             /* No implementation for this interface or content type has been found. */
161      DFB_TIMEOUT         = DR_TIMEOUT,            /* The operation timed out. */
162      DFB_THIZNULL        = DR_THIZNULL,           /* 'thiz' pointer is NULL. */
163      DFB_IDNOTFOUND      = DR_IDNOTFOUND,         /* No resource has been found by the specified id. */
164      DFB_DESTROYED       = DR_DESTROYED,          /* The underlying object (e.g. a window or surface) has been destroyed. */
165      DFB_FUSION          = DR_FUSION,             /* Internal fusion error detected, most likely related to IPC resources. */
166      DFB_BUFFERTOOLARGE  = DR_BUFFERTOOLARGE,     /* Buffer is too large. */
167      DFB_INTERRUPTED     = DR_INTERRUPTED,        /* The operation has been interrupted. */
168      DFB_NOCONTEXT       = DR_NOCONTEXT,          /* No context available. */
169      DFB_TEMPUNAVAIL     = DR_TEMPUNAVAIL,        /* Temporarily unavailable. */
170      DFB_LIMITEXCEEDED   = DR_LIMITEXCEEDED,      /* Attempted to exceed limit, i.e. any kind of maximum size, count etc. */
171      DFB_NOSUCHMETHOD    = DR_NOSUCHMETHOD,       /* Requested method is not known, e.g. to remote site. */
172      DFB_NOSUCHINSTANCE  = DR_NOSUCHINSTANCE,     /* Requested instance is not known, e.g. to remote site. */
173      DFB_ITEMNOTFOUND    = DR_ITEMNOTFOUND,       /* No such item found. */
174      DFB_VERSIONMISMATCH = DR_VERSIONMISMATCH,    /* Some versions didn't match. */
175      DFB_EOF             = DR_EOF,                /* Reached end of file. */
176      DFB_SUSPENDED       = DR_SUSPENDED,          /* The requested object is suspended. */
177      DFB_INCOMPLETE      = DR_INCOMPLETE,         /* The operation has been executed, but not completely. */
178      DFB_NOCORE          = DR_NOCORE,             /* Core part not available. */
179 
180      /*
181       * DirectFB specific result codes starting at (after) this offset
182       */
183      DFB__RESULT_OFFSET  = D_RESULT_TYPE_BASE( 'D','F','B' ),
184 
185      DFB_NOVIDEOMEMORY,  /* There's not enough video memory. */
186      DFB_MISSINGFONT,    /* No font has been set. */
187      DFB_MISSINGIMAGE,   /* No image has been set. */
188      DFB_NOALLOCATION,   /* No allocation. */
189 } DFBResult;
190 
191 /*
192  * A boolean.
193  */
194 typedef enum {
195      DFB_FALSE = 0,
196      DFB_TRUE  = !DFB_FALSE
197 } DFBBoolean;
198 
199 /*
200  * A point specified by x/y coordinates.
201  */
202 typedef struct {
203      int            x;   /* X coordinate of it */
204      int            y;   /* Y coordinate of it */
205 } DFBPoint;
206 
207 /*
208  * A horizontal line specified by x and width.
209  */
210 typedef struct {
211      int            x;   /* X coordinate */
212      int            w;   /* width of span */
213 } DFBSpan;
214 
215 /*
216  * A dimension specified by width and height.
217  */
218 typedef struct {
219      int            w;   /* width of it */
220      int            h;   /* height of it */
221 } DFBDimension;
222 
223 /*
224  * A rectangle specified by a point and a dimension.
225  */
226 typedef struct {
227      int            x;   /* X coordinate of its top-left point */
228      int            y;   /* Y coordinate of its top-left point */
229      int            w;   /* width of it */
230      int            h;   /* height of it */
231 } DFBRectangle;
232 
233 /*
234  * A rectangle specified by normalized coordinates.
235  *
236  * E.g. using 0.0, 0.0, 1.0, 1.0 would specify the whole screen.
237  */
238 typedef struct {
239      float          x;   /* normalized X coordinate */
240      float          y;   /* normalized Y coordinate */
241      float          w;   /* normalized width */
242      float          h;   /* normalized height */
243 } DFBLocation;
244 
245 /*
246  * A region specified by two points.
247  *
248  * The defined region includes both endpoints.
249  */
250 typedef struct {
251      int            x1;  /* X coordinate of top-left point */
252      int            y1;  /* Y coordinate of top-left point */
253      int            x2;  /* X coordinate of lower-right point */
254      int            y2;  /* Y coordinate of lower-right point */
255 } DFBRegion;
256 
257 /*
258  * Insets specify a distance from each edge of a rectangle.
259  *
260  * Positive values always mean 'outside'.
261  */
262 typedef struct {
263      int            l;   /* distance from left edge */
264      int            t;   /* distance from top edge */
265      int            r;   /* distance from right edge */
266      int            b;   /* distance from bottom edge */
267 } DFBInsets;
268 
269 /*
270  * A triangle specified by three points.
271  */
272 typedef struct {
273      int            x1;  /* X coordinate of first edge */
274      int            y1;  /* Y coordinate of first edge */
275      int            x2;  /* X coordinate of second edge */
276      int            y2;  /* Y coordinate of second edge */
277      int            x3;  /* X coordinate of third edge */
278      int            y3;  /* Y coordinate of third edge */
279 } DFBTriangle;
280 
281 /*
282  * A trapezoid specified by two points with a width each.
283  */
284 typedef struct {
285      int            x1;  /* X coordinate of first span */
286      int            y1;  /* Y coordinate of first span  */
287      int            w1;  /* width of first span */
288      int            x2;  /* X coordinate of second span */
289      int            y2;  /* Y coordinate of second span */
290      int            w2;  /* width of second span */
291 } DFBTrapezoid;
292 
293 /*
294  * A color defined by channels with 8bit each.
295  */
296 typedef struct {
297      u8             a;   /* alpha channel */
298      u8             r;   /* red channel */
299      u8             g;   /* green channel */
300      u8             b;   /* blue channel */
301 } DFBColor;
302 
303 /*
304  * A color key defined by R,G,B and eventually a color index.
305  */
306 typedef struct {
307      u8             index;    /* color index */
308      u8             r;        /* red channel */
309      u8             g;        /* green channel */
310      u8             b;        /* blue channel */
311 } DFBColorKey;
312 
313 /*
314  * A color defined by channels with 8bit each.
315  */
316 typedef struct {
317      u8             a;   /* alpha channel */
318      u8             y;   /* luma channel */
319      u8             u;   /* chroma channel */
320      u8             v;   /* chroma channel */
321 } DFBColorYUV;
322 
323 /*
324  * Macro to compare two points.
325  */
326 #define DFB_POINT_EQUAL(a,b)  ((a).x == (b).x &&  \
327                                (a).y == (b).y)
328 
329 /*
330  * Macro to compare two rectangles.
331  */
332 #define DFB_RECTANGLE_EQUAL(a,b)  ((a).x == (b).x &&  \
333                                    (a).y == (b).y &&  \
334                                    (a).w == (b).w &&  \
335                                    (a).h == (b).h)
336 
337 /*
338  * Macro to compare two locations.
339  */
340 #define DFB_LOCATION_EQUAL(a,b)  ((a).x == (b).x &&  \
341                                   (a).y == (b).y &&  \
342                                   (a).w == (b).w &&  \
343                                   (a).h == (b).h)
344 
345 /*
346  * Macro to compare two regions.
347  */
348 #define DFB_REGION_EQUAL(a,b)  ((a).x1 == (b).x1 &&  \
349                                 (a).y1 == (b).y1 &&  \
350                                 (a).x2 == (b).x2 &&  \
351                                 (a).y2 == (b).y2)
352 
353 /*
354  * Macro to compare two colors.
355  */
356 #define DFB_COLOR_EQUAL(x,y)  ((x).a == (y).a &&  \
357                                (x).r == (y).r &&  \
358                                (x).g == (y).g &&  \
359                                (x).b == (y).b)
360 
361 /*
362  * Macro to compare two color keys.
363  */
364 #define DFB_COLORKEY_EQUAL(x,y) ((x).index == (y).index &&  \
365                                  (x).r == (y).r &&  \
366                                  (x).g == (y).g &&  \
367                                  (x).b == (y).b)
368 
369 /*
370  * Print a description of the result code along with an
371  * optional message that is put in front with a colon.
372  */
373 DFBResult DirectFBError(
374                              const char  *msg,    /* optional message */
375                              DFBResult    result  /* result code to interpret */
376                        );
377 
378 /*
379  * Behaves like DirectFBError, but shuts down the calling application.
380  */
381 DFBResult DirectFBErrorFatal(
382                              const char  *msg,    /* optional message */
383                              DFBResult    result  /* result code to interpret */
384                             );
385 
386 /*
387  * Returns a string describing 'result'.
388  */
389 const char *DirectFBErrorString(
390                          DFBResult    result
391                       );
392 
393 /*
394  * Retrieves information about supported command-line flags in the
395  * form of a user-readable string formatted suitable to be printed
396  * as usage information.
397  */
398 const char *DirectFBUsageString( void );
399 
400 /*
401  * Parses the command-line and initializes some variables. You
402  * absolutely need to call this before doing anything else.
403  * Removes all options used by DirectFB from argv.
404  */
405 DFBResult DirectFBInit(
406                          int         *argc,    /* pointer to main()'s argc */
407                          char      *(*argv[])  /* pointer to main()'s argv */
408                       );
409 
410 /*
411  * Sets configuration parameters supported on command line and in
412  * config file. Can only be called before DirectFBCreate but after
413  * DirectFBInit.
414  */
415 DFBResult DirectFBSetOption(
416                          const char  *name,
417                          const char  *value
418                       );
419 
420 /*
421  * Creates the super interface.
422  */
423 DFBResult DirectFBCreate(
424                           IDirectFB **interface  /* pointer to the
425                                                     created interface */
426                         );
427 
428 
429 typedef unsigned int DFBScreenID;
430 typedef unsigned int DFBDisplayLayerID;
431 typedef unsigned int DFBDisplayLayerSourceID;
432 typedef unsigned int DFBSurfaceID;
433 typedef unsigned int DFBWindowID;
434 typedef unsigned int DFBInputDeviceID;
435 typedef unsigned int DFBTextEncodingID;
436 
437 typedef u32 DFBDisplayLayerIDs;
438 
439 
440 typedef unsigned int DFBColorID;
441 
442 /*
443  * Predefined color IDs.
444  */
445 #define DCID_PRIMARY 0
446 #define DCID_OUTLINE 1
447 
448 /*
449  * Maximum number of color ids.
450  */
451 #define DFB_COLOR_IDS_MAX                    8
452 
453 
454 /*
455  * Maximum number of layer ids.
456  */
457 #define DFB_DISPLAYLAYER_IDS_MAX             32
458 
459 /*
460  * Adds the id to the bitmask of layer ids.
461  */
462 #define DFB_DISPLAYLAYER_IDS_ADD(ids,id)     (ids) |=  (1 << (id))
463 
464 /*
465  * Removes the id from the bitmask of layer ids.
466  */
467 #define DFB_DISPLAYLAYER_IDS_REMOVE(ids,id)  (ids) &= ~(1 << (id))
468 
469 /*
470  * Checks if the bitmask of layer ids contains the id.
471  */
472 #define DFB_DISPLAYLAYER_IDS_HAVE(ids,id)    ((ids) & (1 << (id)))
473 
474 /*
475  * Empties (clears) the bitmask of layer ids.
476  */
477 #define DFB_DISPLAYLAYER_IDS_EMPTY(ids)      (ids) = 0
478 
479 /*
480  * Predefined text encoding IDs.
481  */
482 #define DTEID_UTF8  0
483 #define DTEID_OTHER 1
484 
485 /*
486  * The cooperative level controls the super interface's behaviour
487  * in functions like SetVideoMode or CreateSurface for the primary.
488  */
489 typedef enum {
490      DFSCL_NORMAL        = 0x00000000,  /* Normal shared access, primary
491                                            surface will be the buffer of an
492                                            implicitly created window at the
493                                            resolution given by SetVideoMode().
494                                            */
495      DFSCL_FULLSCREEN,                  /* Application grabs the primary layer,
496                                            SetVideoMode automates layer
497                                            control. Primary surface is the
498                                            primary layer surface. */
499      DFSCL_EXCLUSIVE                    /* All but the primary layer will be
500                                            disabled, the application has full
501                                            control over layers if desired,
502                                            other applications have no
503                                            input/output/control. Primary
504                                            surface is the primary layer
505                                            surface. */
506 } DFBCooperativeLevel;
507 
508 /*
509  * Capabilities of a display layer.
510  */
511 typedef enum {
512      DLCAPS_NONE              = 0x00000000,
513 
514      DLCAPS_SURFACE           = 0x00000001,  /* The layer has a surface that can be drawn to. This
515                                                 may not be provided by layers that display realtime
516                                                 data, e.g. from an MPEG decoder chip. Playback
517                                                 control may be provided by an external API. */
518      DLCAPS_OPACITY           = 0x00000002,  /* The layer supports blending with layer(s) below
519                                                 based on a global alpha factor. */
520      DLCAPS_ALPHACHANNEL      = 0x00000004,  /* The layer supports blending with layer(s) below
521                                                 based on each pixel's alpha value. */
522      DLCAPS_SCREEN_LOCATION   = 0x00000008,  /* The layer location on the screen can be changed,
523                                                 this includes position and size as normalized
524                                                 values. The default is 0.0f, 0.0f, 1.0f, 1.0f.
525                                                 Supports IDirectFBDisplayLayer::SetScreenLocation()
526                                                 and IDirectFBDisplayLayer::SetScreenRectangle().
527                                                 This implies DLCAPS_SCREEN_POSITION and _SIZE. */
528      DLCAPS_FLICKER_FILTERING = 0x00000010,  /* Flicker filtering can be enabled for smooth output
529                                                 on interlaced display devices. */
530      DLCAPS_DEINTERLACING     = 0x00000020,  /* The layer provides optional deinterlacing for
531                                                 displaying interlaced video data on progressive
532                                                 display devices. */
533      DLCAPS_SRC_COLORKEY      = 0x00000040,  /* A specific color can be declared as transparent. */
534      DLCAPS_DST_COLORKEY      = 0x00000080,  /* A specific color of layers below can be specified
535                                                 as the color of the only locations where the layer
536                                                 is visible. */
537      DLCAPS_BRIGHTNESS        = 0x00000100,  /* Adjustment of brightness is supported. */
538      DLCAPS_CONTRAST          = 0x00000200,  /* Adjustment of contrast is supported. */
539      DLCAPS_HUE               = 0x00000400,  /* Adjustment of hue is supported. */
540      DLCAPS_SATURATION        = 0x00000800,  /* Adjustment of saturation is supported. */
541      DLCAPS_LEVELS            = 0x00001000,  /* Adjustment of the layer's level
542                                                 (z position) is supported. */
543      DLCAPS_FIELD_PARITY      = 0x00002000,  /* Field parity can be selected */
544      DLCAPS_WINDOWS           = 0x00004000,  /* Hardware window support. */
545      DLCAPS_SOURCES           = 0x00008000,  /* Sources can be selected. */
546      DLCAPS_ALPHA_RAMP        = 0x00010000,  /* Alpha values for formats with one or two alpha bits
547                                                 can be chosen, i.e. using ARGB1555 or ARGB2554 the
548                                                 user can define the meaning of the two or four
549                                                 possibilities. In short, this feature provides a
550                                                 lookup table for the alpha bits of these formats.
551                                                 See also IDirectFBSurface::SetAlphaRamp(). */
552      DLCAPS_PREMULTIPLIED     = 0x00020000,  /* Surfaces with premultiplied alpha are supported. */
553 
554      DLCAPS_SCREEN_POSITION   = 0x00100000,  /* The layer position on the screen can be changed.
555                                                 Supports IDirectFBDisplayLayer::SetScreenPosition(). */
556      DLCAPS_SCREEN_SIZE       = 0x00200000,  /* The layer size (defined by its source rectangle)
557                                                 can be scaled to a different size on the screen
558                                                 (defined by its screen/destination rectangle or
559                                                 its normalized size) and does not have to be 1:1
560                                                 with it. */
561 
562      DLCAPS_CLIP_REGIONS      = 0x00400000,  /* Supports IDirectFBDisplayLayer::SetClipRegions(). */
563 
564      DLCAPS_ALL               = 0x0073FFFF
565 } DFBDisplayLayerCapabilities;
566 
567 /*
568  * Capabilities of a screen.
569  */
570 typedef enum {
571      DSCCAPS_NONE             = 0x00000000,
572 
573      DSCCAPS_VSYNC            = 0x00000001,  /* Synchronization with the
574                                                 vertical retrace supported. */
575      DSCCAPS_POWER_MANAGEMENT = 0x00000002,  /* Power management supported. */
576 
577      DSCCAPS_MIXERS           = 0x00000010,  /* Has mixers. */
578      DSCCAPS_ENCODERS         = 0x00000020,  /* Has encoders. */
579      DSCCAPS_OUTPUTS          = 0x00000040,  /* Has outputs. */
580 
581      DSCCAPS_ALL              = 0x00000073
582 } DFBScreenCapabilities;
583 
584 /*
585  * Used to enable some capabilities like flicker filtering or colorkeying.
586  */
587 typedef enum {
588      DLOP_NONE                = 0x00000000,  /* None of these. */
589      DLOP_ALPHACHANNEL        = 0x00000001,  /* Make usage of alpha channel
590                                                 for blending on a pixel per
591                                                 pixel basis. */
592      DLOP_FLICKER_FILTERING   = 0x00000002,  /* Enable flicker filtering. */
593      DLOP_DEINTERLACING       = 0x00000004,  /* Enable deinterlacing of an
594                                                 interlaced (video) source. */
595      DLOP_SRC_COLORKEY        = 0x00000008,  /* Enable source color key. */
596      DLOP_DST_COLORKEY        = 0x00000010,  /* Enable dest. color key. */
597      DLOP_OPACITY             = 0x00000020,  /* Make usage of the global alpha
598                                                 factor set by SetOpacity. */
599      DLOP_FIELD_PARITY        = 0x00000040   /* Set field parity */
600 } DFBDisplayLayerOptions;
601 
602 /*
603  * Layer Buffer Mode.
604  */
605 typedef enum {
606      DLBM_UNKNOWN    = 0x00000000,
607 
608      DLBM_FRONTONLY  = 0x00000001,      /* no backbuffer */
609      DLBM_BACKVIDEO  = 0x00000002,      /* backbuffer in video memory */
610      DLBM_BACKSYSTEM = 0x00000004,      /* backbuffer in system memory */
611      DLBM_TRIPLE     = 0x00000008,      /* triple buffering */
612      DLBM_WINDOWS    = 0x00000010       /* no layer buffers at all,
613                                            using buffer of each window */
614 } DFBDisplayLayerBufferMode;
615 
616 /*
617  * Flags defining which fields of a DFBSurfaceDescription are valid.
618  */
619 typedef enum {
620      DSDESC_NONE         = 0x00000000,  /* none of these */
621 
622      DSDESC_CAPS         = 0x00000001,  /* caps field is valid */
623      DSDESC_WIDTH        = 0x00000002,  /* width field is valid */
624      DSDESC_HEIGHT       = 0x00000004,  /* height field is valid */
625      DSDESC_PIXELFORMAT  = 0x00000008,  /* pixelformat field is valid */
626      DSDESC_PREALLOCATED = 0x00000010,  /* Surface uses data that has been
627                                            preallocated by the application.
628                                            The field array 'preallocated'
629                                            has to be set using the first
630                                            element for the front buffer
631                                            and eventually the second one
632                                            for the back buffer. */
633      DSDESC_PALETTE      = 0x00000020,  /* Initialize the surfaces palette
634                                            with the entries specified in the
635                                            description. */
636 
637      DSDESC_RESOURCE_ID  = 0x00000100,  /* user defined resource id for general purpose
638                                            surfaces is specified, or resource id of window,
639                                            layer, user is returned */
640 
641      DSDESC_HINTS        = 0x00000200,  /* Flags for optimized allocation and pixel format selection are set.
642                                            See also DFBSurfaceHintFlags. */
643 
644      DSDESC_ALL          = 0x0000033F   /* all of these */
645 } DFBSurfaceDescriptionFlags;
646 
647 /*
648  * Flags defining which fields of a DFBPaletteDescription are valid.
649  */
650 typedef enum {
651      DPDESC_CAPS         = 0x00000001,  /* Specify palette capabilities. */
652      DPDESC_SIZE         = 0x00000002,  /* Specify number of entries. */
653      DPDESC_ENTRIES      = 0x00000004   /* Initialize the palette with the
654                                            entries specified in the
655                                            description. */
656 } DFBPaletteDescriptionFlags;
657 
658 /*
659  * The surface capabilities.
660  */
661 typedef enum {
662      DSCAPS_NONE          = 0x00000000,  /* None of these. */
663 
664      DSCAPS_PRIMARY       = 0x00000001,  /* It's the primary surface. */
665      DSCAPS_SYSTEMONLY    = 0x00000002,  /* Surface data is permanently stored in system memory.<br>
666                                             There's no video memory allocation/storage. */
667      DSCAPS_VIDEOONLY     = 0x00000004,  /* Surface data is permanently stored in video memory.<br>
668                                             There's no system memory allocation/storage. */
669      DSCAPS_DOUBLE        = 0x00000010,  /* Surface is double buffered */
670      DSCAPS_SUBSURFACE    = 0x00000020,  /* Surface is just a sub area of another
671                                             one sharing the surface data. */
672      DSCAPS_INTERLACED    = 0x00000040,  /* Each buffer contains interlaced video (or graphics)
673                                             data consisting of two fields.<br>
674                                             Their lines are stored interleaved. One field's height
675                                             is a half of the surface's height. */
676      DSCAPS_SEPARATED     = 0x00000080,  /* For usage with DSCAPS_INTERLACED.<br>
677                                             DSCAPS_SEPARATED specifies that the fields are NOT
678                                             interleaved line by line in the buffer.<br>
679                                             The first field is followed by the second one. */
680      DSCAPS_STATIC_ALLOC  = 0x00000100,  /* The amount of video or system memory allocated for the
681                                             surface is never less than its initial value. This way
682                                             a surface can be resized (smaller and bigger up to the
683                                             initial size) without reallocation of the buffers. It's
684                                             useful for surfaces that need a guaranteed space in
685                                             video memory after resizing. */
686      DSCAPS_TRIPLE        = 0x00000200,  /* Surface is triple buffered. */
687 
688      DSCAPS_PREMULTIPLIED = 0x00001000,  /* Surface stores data with premultiplied alpha. */
689 
690      DSCAPS_DEPTH         = 0x00010000,  /* A depth buffer is allocated. */
691 
692      DSCAPS_SHARED        = 0x00100000,  /* The surface will be accessible among processes. */
693 
694      DSCAPS_ROTATED       = 0x01000000,  /* The back buffers are allocated with swapped width/height (unimplemented!). */
695 
696      DSCAPS_ALL           = 0x011113F7,  /* All of these. */
697 
698 
699      DSCAPS_FLIPPING      = DSCAPS_DOUBLE | DSCAPS_TRIPLE /* Surface needs Flip() calls to make
700                                                              updates/changes visible/usable. */
701 } DFBSurfaceCapabilities;
702 
703 /*
704  * The palette capabilities.
705  */
706 typedef enum {
707      DPCAPS_NONE         = 0x00000000   /* None of these. */
708 } DFBPaletteCapabilities;
709 
710 /*
711  * Flags controlling drawing commands.
712  */
713 typedef enum {
714      DSDRAW_NOFX               = 0x00000000, /* uses none of the effects */
715      DSDRAW_BLEND              = 0x00000001, /* uses alpha from color */
716      DSDRAW_DST_COLORKEY       = 0x00000002, /* write to destination only if the destination pixel
717                                                 matches the destination color key */
718      DSDRAW_SRC_PREMULTIPLY    = 0x00000004, /* multiplies the color's rgb channels by the alpha
719                                                 channel before drawing */
720      DSDRAW_DST_PREMULTIPLY    = 0x00000008, /* modulates the dest. color with the dest. alpha */
721      DSDRAW_DEMULTIPLY         = 0x00000010, /* divides the color by the alpha before writing the
722                                                 data to the destination */
723      DSDRAW_XOR                = 0x00000020  /* bitwise xor the destination pixels with the
724                                                 specified color after premultiplication */
725 } DFBSurfaceDrawingFlags;
726 
727 /*
728  * Flags controlling blitting commands.
729  */
730 typedef enum {
731      DSBLIT_NOFX               = 0x00000000, /* uses none of the effects */
732      DSBLIT_BLEND_ALPHACHANNEL = 0x00000001, /* enables blending and uses
733                                                 alphachannel from source */
734      DSBLIT_BLEND_COLORALPHA   = 0x00000002, /* enables blending and uses
735                                                 alpha value from color */
736      DSBLIT_COLORIZE           = 0x00000004, /* modulates source color with
737                                                 the color's r/g/b values */
738      DSBLIT_SRC_COLORKEY       = 0x00000008, /* don't blit pixels matching the source color key */
739      DSBLIT_DST_COLORKEY       = 0x00000010, /* write to destination only if the destination pixel
740                                                 matches the destination color key */
741      DSBLIT_SRC_PREMULTIPLY    = 0x00000020, /* modulates the source color with the (modulated)
742                                                 source alpha */
743      DSBLIT_DST_PREMULTIPLY    = 0x00000040, /* modulates the dest. color with the dest. alpha */
744      DSBLIT_DEMULTIPLY         = 0x00000080, /* divides the color by the alpha before writing the
745                                                 data to the destination */
746      DSBLIT_DEINTERLACE        = 0x00000100, /* deinterlaces the source during blitting by reading
747                                                 only one field (every second line of full
748                                                 image) scaling it vertically by factor two */
749      DSBLIT_SRC_PREMULTCOLOR   = 0x00000200, /* modulates the source color with the color alpha */
750      DSBLIT_XOR                = 0x00000400, /* bitwise xor the destination pixels with the
751                                                 source pixels after premultiplication */
752      DSBLIT_INDEX_TRANSLATION  = 0x00000800, /* do fast indexed to indexed translation,
753                                                 this flag is mutual exclusive with all others */
754      DSBLIT_ROTATE90           = 0x00002000, /* rotate the image by 90 degree */
755      DSBLIT_ROTATE180          = 0x00001000, /* rotate the image by 180 degree */
756      DSBLIT_ROTATE270          = 0x00004000, /* rotate the image by 270 degree */
757      DSBLIT_COLORKEY_PROTECT   = 0x00010000, /* make sure written pixels don't match color key (internal only ATM) */
758      DSBLIT_SRC_MASK_ALPHA     = 0x00100000, /* modulate source alpha channel with alpha channel from source mask,
759                                                 see also IDirectFBSurface::SetSourceMask() */
760      DSBLIT_SRC_MASK_COLOR     = 0x00200000, /* modulate source color channels with color channels from source mask,
761                                                 see also IDirectFBSurface::SetSourceMask() */
762      DSBLIT_SOURCE2            = 0x00400000, /* use secondary source instead of destination for reading */
763      DSBLIT_FLIP_HORIZONTAL    = 0x01000000, /* flip the image horizontally */
764      DSBLIT_FLIP_VERTICAL      = 0x02000000, /* flip the image vertically */
765 } DFBSurfaceBlittingFlags;
766 
767 /*
768  * Options for drawing and blitting operations. Not mandatory for acceleration.
769  */
770 typedef enum {
771      DSRO_NONE                 = 0x00000000, /* None of these. */
772 
773      DSRO_SMOOTH_UPSCALE       = 0x00000001, /* Use interpolation for upscale StretchBlit(). */
774      DSRO_SMOOTH_DOWNSCALE     = 0x00000002, /* Use interpolation for downscale StretchBlit(). */
775      DSRO_MATRIX               = 0x00000004, /* Use the transformation matrix set via IDirectFBSurface::SetMatrix(). */
776      DSRO_ANTIALIAS            = 0x00000008, /* Enable anti-aliasing for edges (alphablend must be enabled). */
777 
778      DSRO_ALL                  = 0x0000000F  /* All of these. */
779 } DFBSurfaceRenderOptions;
780 
781 /*
782  * Mask of accelerated functions.
783  */
784 typedef enum {
785      DFXL_NONE           = 0x00000000,  /* None of these. */
786 
787      DFXL_FILLRECTANGLE  = 0x00000001,  /* FillRectangle() is accelerated. */
788      DFXL_DRAWRECTANGLE  = 0x00000002,  /* DrawRectangle() is accelerated. */
789      DFXL_DRAWLINE       = 0x00000004,  /* DrawLine() is accelerated. */
790      DFXL_FILLTRIANGLE   = 0x00000008,  /* FillTriangle() is accelerated. */
791      DFXL_FILLTRAPEZOID  = 0x00000010,  /* FillTrapezoid() is accelerated. */
792 
793      DFXL_BLIT           = 0x00010000,  /* Blit() and TileBlit() are accelerated. */
794      DFXL_STRETCHBLIT    = 0x00020000,  /* StretchBlit() is accelerated. */
795      DFXL_TEXTRIANGLES   = 0x00040000,  /* TextureTriangles() is accelerated. */
796      DFXL_BLIT2          = 0x00080000,  /* BatchBlit2() is accelerated. */
797 
798      DFXL_DRAWSTRING     = 0x01000000,  /* DrawString() and DrawGlyph() are accelerated. */
799 
800 
801      DFXL_ALL            = 0x010F001F,  /* All drawing/blitting functions. */
802      DFXL_ALL_DRAW       = 0x0000001F,  /* All drawing functions. */
803      DFXL_ALL_BLIT       = 0x010F0000,  /* All blitting functions. */
804 } DFBAccelerationMask;
805 
806 
807 /*
808  * @internal
809  */
810 #define DFB_DRAWING_FUNCTION(a)    ((a) & 0x0000FFFF)
811 
812 /*
813  * @internal
814  */
815 #define DFB_BLITTING_FUNCTION(a)   ((a) & 0xFFFF0000)
816 
817 /*
818  * Type of display layer for basic classification.
819  * Values may be or'ed together.
820  */
821 typedef enum {
822      DLTF_NONE           = 0x00000000,  /* Unclassified, no specific type. */
823 
824      DLTF_GRAPHICS       = 0x00000001,  /* Can be used for graphics output. */
825      DLTF_VIDEO          = 0x00000002,  /* Can be used for live video output.*/
826      DLTF_STILL_PICTURE  = 0x00000004,  /* Can be used for single frames. */
827      DLTF_BACKGROUND     = 0x00000008,  /* Can be used as a background layer.*/
828 
829      DLTF_ALL            = 0x0000000F   /* All type flags set. */
830 } DFBDisplayLayerTypeFlags;
831 
832 /*
833  * Type of input device for basic classification.
834  * Values may be or'ed together.
835  */
836 typedef enum {
837      DIDTF_NONE          = 0x00000000,  /* Unclassified, no specific type. */
838 
839      DIDTF_KEYBOARD      = 0x00000001,  /* Can act as a keyboard. */
840      DIDTF_MOUSE         = 0x00000002,  /* Can be used as a mouse. */
841      DIDTF_JOYSTICK      = 0x00000004,  /* Can be used as a joystick. */
842      DIDTF_REMOTE        = 0x00000008,  /* Is a remote control. */
843      DIDTF_VIRTUAL       = 0x00000010,  /* Is a virtual input device. */
844 
845      DIDTF_ALL           = 0x0000001F   /* All type flags set. */
846 } DFBInputDeviceTypeFlags;
847 
848 /*
849  * Basic input device features.
850  */
851 typedef enum {
852      DICAPS_KEYS         = 0x00000001,  /* device supports key events */
853      DICAPS_AXES         = 0x00000002,  /* device supports axis events */
854      DICAPS_BUTTONS      = 0x00000004,  /* device supports button events */
855 
856      DICAPS_ALL          = 0x00000007   /* all capabilities */
857 } DFBInputDeviceCapabilities;
858 
859 /*
860  * Identifier (index) for e.g. mouse or joystick buttons.
861  */
862 typedef enum {
863      DIBI_LEFT           = 0x00000000,  /* left mouse button */
864      DIBI_RIGHT          = 0x00000001,  /* right mouse button */
865      DIBI_MIDDLE         = 0x00000002,  /* middle mouse button */
866 
867      DIBI_FIRST          = DIBI_LEFT,   /* other buttons:
868                                            DIBI_FIRST + zero based index */
869      DIBI_LAST           = 0x0000001F   /* 32 buttons maximum */
870 } DFBInputDeviceButtonIdentifier;
871 
872 /*
873  * Axis identifier (index) for e.g. mouse or joystick.
874  *
875  * The X, Y and Z axis are predefined. To access other axes,
876  * use DIAI_FIRST plus a zero based index, e.g. the 4th axis
877  * would be (DIAI_FIRST + 3).
878  */
879 typedef enum {
880      DIAI_X              = 0x00000000,  /* X axis */
881      DIAI_Y              = 0x00000001,  /* Y axis */
882      DIAI_Z              = 0x00000002,  /* Z axis */
883 
884      DIAI_FIRST          = DIAI_X,      /* other axis:
885                                            DIAI_FIRST + zero based index */
886      DIAI_LAST           = 0x0000001F   /* 32 axes maximum */
887 } DFBInputDeviceAxisIdentifier;
888 
889 /*
890  * Flags defining which fields of a DFBWindowDescription are valid.
891  */
892 typedef enum {
893      DWDESC_CAPS         = 0x00000001,  /* caps field is valid */
894      DWDESC_WIDTH        = 0x00000002,  /* width field is valid */
895      DWDESC_HEIGHT       = 0x00000004,  /* height field is valid */
896      DWDESC_PIXELFORMAT  = 0x00000008,  /* pixelformat field is valid */
897      DWDESC_POSX         = 0x00000010,  /* posx field is valid */
898      DWDESC_POSY         = 0x00000020,  /* posy field is valid */
899      DWDESC_SURFACE_CAPS = 0x00000040,  /* Create the window surface with
900                                            special capabilities. */
901      DWDESC_PARENT       = 0x00000080,  /* This window has a parent according to parent_id field. */
902      DWDESC_OPTIONS      = 0x00000100,  /* Initial window options have been set. */
903      DWDESC_STACKING     = 0x00000200,  /* Initial stacking class has been set. */
904 
905      DWDESC_TOPLEVEL_ID  = 0x00000400,  /* The top level window is set in toplevel_id field. */
906 
907      DWDESC_RESOURCE_ID  = 0x00001000,  /* Resource id for window surface creation has been set. */
908 } DFBWindowDescriptionFlags;
909 
910 /*
911  * Flags defining which fields of a DFBDataBufferDescription are valid.
912  */
913 typedef enum {
914      DBDESC_FILE         = 0x00000001,  /* Create a static buffer for the
915                                            specified filename. */
916      DBDESC_MEMORY       = 0x00000002   /* Create a static buffer for the
917                                            specified memory area. */
918 } DFBDataBufferDescriptionFlags;
919 
920 /*
921  * Capabilities a window can have.
922  */
923 typedef enum {
924      DWCAPS_NONE         = 0x00000000,  /* None of these. */
925 
926      DWCAPS_ALPHACHANNEL = 0x00000001,  /* The window has an alphachannel
927                                            for pixel-per-pixel blending. */
928      DWCAPS_DOUBLEBUFFER = 0x00000002,  /* The window's surface is double
929                                            buffered. This is very useful
930                                            to avoid visibility of content
931                                            that is still in preparation.
932                                            Normally a window's content can
933                                            get visible before an update if
934                                            there is another reason causing
935                                            a window stack repaint. */
936      DWCAPS_INPUTONLY    = 0x00000004,  /* The window has no surface.
937                                            You can not draw to it but it
938                                            receives events */
939      DWCAPS_NODECORATION = 0x00000008,  /* The window won't be decorated. */
940 
941      DWCAPS_SUBWINDOW    = 0x00000010,  /* Not a top level window. */
942 
943      DWCAPS_COLOR        = 0x00000020,  /* The window has no buffer;
944                                            it consumes no backing store.
945                                            It is filled with a constant color
946                                            and it receives events. The color is
947                                            never specified premultiplied. */
948 
949      DWCAPS_NOFOCUS      = 0x00000100,  /* Window will never get focus or receive key events, unless it grabs them. */
950 
951 
952      DWCAPS_ALL          = 0x0000013F   /* All of these. */
953 } DFBWindowCapabilities;
954 
955 /*
956  * Flags controlling the appearance and behaviour of the window.
957  */
958 typedef enum {
959      DWOP_NONE           = 0x00000000,  /* none of these */
960      DWOP_COLORKEYING    = 0x00000001,  /* enable color key */
961      DWOP_ALPHACHANNEL   = 0x00000002,  /* enable alpha blending using the
962                                            window's alpha channel */
963      DWOP_OPAQUE_REGION  = 0x00000004,  /* overrides DWOP_ALPHACHANNEL for the
964                                            region set by SetOpaqueRegion() */
965      DWOP_SHAPED         = 0x00000008,  /* window doesn't receive mouse events for
966                                            invisible regions, must be used with
967                                            DWOP_ALPHACHANNEL or DWOP_COLORKEYING */
968      DWOP_KEEP_POSITION  = 0x00000010,  /* window can't be moved
969                                            with the mouse */
970      DWOP_KEEP_SIZE      = 0x00000020,  /* window can't be resized
971                                            with the mouse */
972      DWOP_KEEP_STACKING  = 0x00000040,  /* window can't be raised
973                                            or lowered with the mouse */
974      DWOP_GHOST          = 0x00001000,  /* never get focus or input,
975                                            clicks will go through,
976                                            implies DWOP_KEEP... */
977      DWOP_INDESTRUCTIBLE = 0x00002000,  /* window can't be destroyed
978                                            by internal shortcut */
979      DWOP_INPUTONLY      = 0x00004000,  /* The window will be input only.
980                                            It will receive events but is not shown.
981                                            Note that toggling this bit will not
982                                            free/assign the window surface. */
983      DWOP_SCALE          = 0x00010000,  /* Surface won't be changed if window size on screen changes. The surface
984                                            can be resized separately using IDirectFBWindow::ResizeSurface(). */
985 
986      DWOP_KEEP_ABOVE     = 0x00100000,  /* Keep window above parent window. */
987      DWOP_KEEP_UNDER     = 0x00200000,  /* Keep window under parent window. */
988      DWOP_FOLLOW_BOUNDS  = 0x00400000,  /* Follow window bounds from parent. */
989 
990      DWOP_ALL            = 0x0071707F   /* all possible options */
991 } DFBWindowOptions;
992 
993 /*
994  * The stacking class restricts the stacking order of windows.
995  */
996 typedef enum {
997      DWSC_MIDDLE         = 0x00000000,  /* This is the default stacking
998                                            class of new windows. */
999      DWSC_UPPER          = 0x00000001,  /* Window is always above windows
1000                                            in the middle stacking class.
1001                                            Only windows that are also in
1002                                            the upper stacking class can
1003                                            get above them. */
1004      DWSC_LOWER          = 0x00000002   /* Window is always below windows
1005                                            in the middle stacking class.
1006                                            Only windows that are also in
1007                                            the lower stacking class can
1008                                            get below them. */
1009 } DFBWindowStackingClass;
1010 
1011 
1012 /*
1013  * Flags describing how to load a font.
1014  *
1015  * These flags describe how a font is loaded and affect how the
1016  * glyphs are drawn. There is no way to change this after the font
1017  * has been loaded. If you need to render a font with different
1018  * attributes, you have to create multiple FontProviders of the
1019  * same font file.
1020  */
1021 typedef enum {
1022      DFFA_NONE           = 0x00000000,  /* none of these flags */
1023      DFFA_NOKERNING      = 0x00000001,  /* don't use kerning */
1024      DFFA_NOHINTING      = 0x00000002,  /* don't use hinting */
1025      DFFA_MONOCHROME     = 0x00000004,  /* don't use anti-aliasing */
1026      DFFA_NOCHARMAP      = 0x00000008,  /* no char map, glyph indices are
1027                                            specified directly */
1028      DFFA_FIXEDCLIP      = 0x00000010,  /* width fixed advance, clip to it */
1029      DFFA_NOBITMAP       = 0x00000020,  /* ignore bitmap strikes; for
1030                                            bitmap-only fonts this flag is
1031                                            ignored */
1032      DFFA_OUTLINED       = 0x00000040,
1033      DFFA_AUTOHINTING    = 0x00000080,  /* prefer auto-hinter over the font's
1034                                            native hinter */
1035      DFFA_SOFTHINTING    = 0x00000100   /* use a lighter hinting algorithm
1036                                            that produces glyphs that are more
1037                                            fuzzy but better resemble the
1038                                            original shape */
1039 } DFBFontAttributes;
1040 
1041 /*
1042  * Flags defining which fields of a DFBFontDescription are valid.
1043  */
1044 typedef enum {
1045      DFDESC_ATTRIBUTES        = 0x00000001,  /* attributes field is valid */
1046      DFDESC_HEIGHT            = 0x00000002,  /* height is specified */
1047      DFDESC_WIDTH             = 0x00000004,  /* width is specified */
1048      DFDESC_INDEX             = 0x00000008,  /* index is specified */
1049      DFDESC_FIXEDADVANCE      = 0x00000010,  /* specify a fixed advance overriding
1050                                                 any character advance of fixed or
1051                                                 proportional fonts */
1052      DFDESC_FRACT_HEIGHT      = 0x00000020,  /* fractional height is set */
1053      DFDESC_FRACT_WIDTH       = 0x00000040,  /* fractional width is set */
1054      DFDESC_OUTLINE_WIDTH     = 0x00000080,  /* outline width is set */
1055      DFDESC_OUTLINE_OPACITY   = 0x00000100,  /* outline opacity is set */
1056      DFDESC_ROTATION          = 0x00000200,  /* rotation is set */
1057 } DFBFontDescriptionFlags;
1058 
1059 /*
1060  * Description of how to load glyphs from a font file.
1061  *
1062  * The attributes control how the glyphs are rendered. Width and height can be used to specify the
1063  * desired face size in pixels. If you are loading a non-scalable font, you shouldn't specify a
1064  * font size.
1065  *
1066  * Please note that the height value in the DFBFontDescription doesn't correspond to the height
1067  * returned by IDirectFBFont::GetHeight().
1068  *
1069  * The index field controls which face is loaded from a font file that provides a collection of
1070  * faces. This is rarely needed.
1071  *
1072  * Fractional sizes (fract_height and fract_width) are 26.6 fixed point integers and override
1073  * the pixel sizes if both are specified.
1074  *
1075  * Outline parameters are ignored if DFFA_OUTLINED is not used (see DFBFontAttributes). To change the
1076  * default values of 1.0 each use DFDESC_OUTLINE_WIDTH and/or DFDESC_OUTLINE_OPACITY.
1077  *
1078  * The rotation value is a 0.24 fixed point number of rotations.  Use the macros DFB_DEGREES
1079  * and DFB_RADIANS to convert from those units.
1080  */
1081 typedef struct {
1082      DFBFontDescriptionFlags            flags;
1083 
1084      DFBFontAttributes                  attributes;
1085      int                                height;
1086      int                                width;
1087      unsigned int                       index;
1088      int                                fixed_advance;
1089 
1090      int                                fract_height;
1091      int                                fract_width;
1092 
1093      int                                outline_width;      /* Outline width as 16.16 fixed point integer */
1094      int                                outline_opacity;    /* Outline opacity as 16.16 fixed point integer */
1095 
1096      int                                rotation;
1097 } DFBFontDescription;
1098 
1099 #define DFB_DEGREES(deg) ((int)((deg)/360.0*(1<<24)))
1100 #define DFB_RADIANS(rad) ((int)((rad)/(2.0*M_PI)*(1<<24)))
1101 
1102 /*
1103  * @internal
1104  *
1105  * Encodes format constants in the following way (bit 31 - 0):
1106  *
1107  * lkjj:hhgg | gfff:eeed | cccc:bbbb | baaa:aaaa
1108  *
1109  * a) pixelformat index<br>
1110  * b) effective color (or index) bits per pixel of format<br>
1111  * c) effective alpha bits per pixel of format<br>
1112  * d) alpha channel present<br>
1113  * e) bytes per "pixel in a row" (1/8 fragment, i.e. bits)<br>
1114  * f) bytes per "pixel in a row" (decimal part, i.e. bytes)<br>
1115  * g) smallest number of pixels aligned to byte boundary (minus one)<br>
1116  * h) multiplier for planes minus one (1/4 fragment)<br>
1117  * j) multiplier for planes minus one (decimal part)<br>
1118  * k) color and/or alpha lookup table present<br>
1119  * l) alpha channel is inverted
1120  */
1121 #define DFB_SURFACE_PIXELFORMAT( index, color_bits, alpha_bits, has_alpha,     \
1122                                  row_bits, row_bytes, align, mul_f, mul_d,     \
1123                                  has_lut, inv_alpha )                          \
1124      ( (((index     ) & 0x7F)      ) |                                         \
1125        (((color_bits) & 0x1F) <<  7) |                                         \
1126        (((alpha_bits) & 0x0F) << 12) |                                         \
1127        (((has_alpha ) ? 1 :0) << 16) |                                         \
1128        (((row_bits  ) & 0x07) << 17) |                                         \
1129        (((row_bytes ) & 0x07) << 20) |                                         \
1130        (((align     ) & 0x07) << 23) |                                         \
1131        (((mul_f     ) & 0x03) << 26) |                                         \
1132        (((mul_d     ) & 0x03) << 28) |                                         \
1133        (((has_lut   ) ? 1 :0) << 30) |                                         \
1134        (((inv_alpha ) ? 1 :0) << 31) )
1135 
1136 /*
1137  * Pixel format of a surface.
1138  */
1139 typedef enum {
1140      DSPF_UNKNOWN   = 0x00000000,  /* unknown or unspecified format */
1141 
1142      /* 16 bit  ARGB (2 byte, alpha 1@15, red 5@10, green 5@5, blue 5@0) */
1143      DSPF_ARGB1555  = DFB_SURFACE_PIXELFORMAT(  0, 15, 1, 1, 0, 2, 0, 0, 0, 0, 0 ),
1144 
1145      /* 16 bit   RGB (2 byte, red 5@11, green 6@5, blue 5@0) */
1146      DSPF_RGB16     = DFB_SURFACE_PIXELFORMAT(  1, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
1147 
1148      /* 24 bit   RGB (3 byte, red 8@16, green 8@8, blue 8@0) */
1149      DSPF_RGB24     = DFB_SURFACE_PIXELFORMAT(  2, 24, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
1150 
1151      /* 24 bit   RGB (4 byte, nothing@24, red 8@16, green 8@8, blue 8@0) */
1152      DSPF_RGB32     = DFB_SURFACE_PIXELFORMAT(  3, 24, 0, 0, 0, 4, 0, 0, 0, 0, 0 ),
1153 
1154      /* 32 bit  ARGB (4 byte, alpha 8@24, red 8@16, green 8@8, blue 8@0) */
1155      DSPF_ARGB      = DFB_SURFACE_PIXELFORMAT(  4, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
1156 
1157      /*  8 bit alpha (1 byte, alpha 8@0), e.g. anti-aliased glyphs */
1158      DSPF_A8        = DFB_SURFACE_PIXELFORMAT(  5,  0, 8, 1, 0, 1, 0, 0, 0, 0, 0 ),
1159 
1160      /* 16 bit   YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */
1161      DSPF_YUY2      = DFB_SURFACE_PIXELFORMAT(  6, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
1162 
1163      /*  8 bit   RGB (1 byte, red 3@5, green 3@2, blue 2@0) */
1164      DSPF_RGB332    = DFB_SURFACE_PIXELFORMAT(  7,  8, 0, 0, 0, 1, 0, 0, 0, 0, 0 ),
1165 
1166      /* 16 bit   YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */
1167      DSPF_UYVY      = DFB_SURFACE_PIXELFORMAT(  8, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
1168 
1169      /* 12 bit   YUV (8 bit Y plane followed by 8 bit quarter size U/V planes) */
1170      DSPF_I420      = DFB_SURFACE_PIXELFORMAT(  9, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
1171 
1172      /* 12 bit   YUV (8 bit Y plane followed by 8 bit quarter size V/U planes) */
1173      DSPF_YV12      = DFB_SURFACE_PIXELFORMAT( 10, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
1174 
1175      /*  8 bit   LUT (8 bit color and alpha lookup from palette) */
1176      DSPF_LUT8      = DFB_SURFACE_PIXELFORMAT( 11,  8, 0, 1, 0, 1, 0, 0, 0, 1, 0 ),
1177 
1178      /*  8 bit  ALUT (1 byte, alpha 4@4, color lookup 4@0) */
1179      DSPF_ALUT44    = DFB_SURFACE_PIXELFORMAT( 12,  4, 4, 1, 0, 1, 0, 0, 0, 1, 0 ),
1180 
1181      /* 32 bit  ARGB (4 byte, inv. alpha 8@24, red 8@16, green 8@8, blue 8@0) */
1182      DSPF_AiRGB     = DFB_SURFACE_PIXELFORMAT( 13, 24, 8, 1, 0, 4, 0, 0, 0, 0, 1 ),
1183 
1184      /*  1 bit alpha (1 byte/ 8 pixel, most significant bit used first) */
1185      DSPF_A1        = DFB_SURFACE_PIXELFORMAT( 14,  0, 1, 1, 1, 0, 7, 0, 0, 0, 0 ),
1186 
1187      /* 12 bit   YUV (8 bit Y plane followed by one 16 bit quarter size Cb|Cr [7:0|7:0] plane) */
1188      DSPF_NV12      = DFB_SURFACE_PIXELFORMAT( 15, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
1189 
1190      /* 16 bit   YUV (8 bit Y plane followed by one 16 bit half width Cb|Cr [7:0|7:0] plane) */
1191      DSPF_NV16      = DFB_SURFACE_PIXELFORMAT( 16, 24, 0, 0, 0, 1, 0, 0, 1, 0, 0 ),
1192 
1193      /* 16 bit  ARGB (2 byte, alpha 2@14, red 5@9, green 5@4, blue 4@0) */
1194      DSPF_ARGB2554  = DFB_SURFACE_PIXELFORMAT( 17, 14, 2, 1, 0, 2, 0, 0, 0, 0, 0 ),
1195 
1196      /* 16 bit  ARGB (2 byte, alpha 4@12, red 4@8, green 4@4, blue 4@0) */
1197      DSPF_ARGB4444  = DFB_SURFACE_PIXELFORMAT( 18, 12, 4, 1, 0, 2, 0, 0, 0, 0, 0 ),
1198 
1199      /* 16 bit  RGBA (2 byte, red 4@12, green 4@8, blue 4@4, alpha 4@0) */
1200      DSPF_RGBA4444  = DFB_SURFACE_PIXELFORMAT( 19, 12, 4, 1, 0, 2, 0, 0, 0, 0, 0 ),
1201 
1202      /* 12 bit   YUV (8 bit Y plane followed by one 16 bit quarter size Cr|Cb [7:0|7:0] plane) */
1203      DSPF_NV21      = DFB_SURFACE_PIXELFORMAT( 20, 12, 0, 0, 0, 1, 0, 2, 0, 0, 0 ),
1204 
1205      /* 32 bit  AYUV (4 byte, alpha 8@24, Y 8@16, Cb 8@8, Cr 8@0) */
1206      DSPF_AYUV      = DFB_SURFACE_PIXELFORMAT( 21, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
1207 
1208      /*  4 bit alpha (1 byte/ 2 pixel, more significant nibble used first) */
1209      DSPF_A4        = DFB_SURFACE_PIXELFORMAT( 22,  0, 4, 1, 4, 0, 1, 0, 0, 0, 0 ),
1210 
1211      /*  1 bit alpha (3 byte/  alpha 1@18, red 6@12, green 6@6, blue 6@0) */
1212      DSPF_ARGB1666  = DFB_SURFACE_PIXELFORMAT( 23, 18, 1, 1, 0, 3, 0, 0, 0, 0, 0 ),
1213 
1214      /*  6 bit alpha (3 byte/  alpha 6@18, red 6@12, green 6@6, blue 6@0) */
1215      DSPF_ARGB6666  = DFB_SURFACE_PIXELFORMAT( 24, 18, 6, 1, 0, 3, 0, 0, 0, 0, 0 ),
1216 
1217      /*  6 bit   RGB (3 byte/   red 6@12, green 6@6, blue 6@0) */
1218      DSPF_RGB18     = DFB_SURFACE_PIXELFORMAT( 25, 18, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
1219 
1220      /*  2 bit   LUT (1 byte/ 4 pixel, 2 bit color and alpha lookup from palette) */
1221      DSPF_LUT2      = DFB_SURFACE_PIXELFORMAT( 26,  2, 0, 1, 2, 0, 3, 0, 0, 1, 0 ),
1222 
1223      /* 16 bit   RGB (2 byte, nothing @12, red 4@8, green 4@4, blue 4@0) */
1224      DSPF_RGB444    = DFB_SURFACE_PIXELFORMAT( 27, 12, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
1225 
1226      /* 16 bit   RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */
1227      DSPF_RGB555    = DFB_SURFACE_PIXELFORMAT( 28, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
1228 
1229      /* 16 bit   BGR (2 byte, nothing @15, blue 5@10, green 5@5, red 5@0) */
1230      DSPF_BGR555    = DFB_SURFACE_PIXELFORMAT( 29, 15, 0, 0, 0, 2, 0, 0, 0, 0, 0 ),
1231 
1232      /* 16 bit  RGBA (2 byte, red 5@11, green 5@6, blue 5@1, alpha 1@0) */
1233      DSPF_RGBA5551  = DFB_SURFACE_PIXELFORMAT( 30, 15, 1, 1, 0, 2, 0, 0, 0, 0, 0 ),
1234 
1235      /* 24 bit full YUV planar (8 bit Y plane followed by an 8 bit Cb and an
1236         8 bit Cr plane) */
1237      DSPF_YUV444P   = DFB_SURFACE_PIXELFORMAT( 31, 24, 0, 0, 0, 1, 0, 0, 2, 0, 0 ),
1238 
1239      /* 24 bit  ARGB (3 byte, alpha 8@16, red 5@11, green 6@5, blue 5@0) */
1240      DSPF_ARGB8565  = DFB_SURFACE_PIXELFORMAT( 32, 16, 8, 1, 0, 3, 0, 0, 0, 0, 0 ),
1241 
1242      /* 32 bit  AVYU 4:4:4 (4 byte, alpha 8@24, Cr 8@16, Y 8@8, Cb 8@0) */
1243      DSPF_AVYU      = DFB_SURFACE_PIXELFORMAT( 33, 24, 8, 1, 0, 4, 0, 0, 0, 0, 0 ),
1244 
1245      /* 24 bit   VYU 4:4:4 (3 byte, Cr 8@16, Y 8@8, Cb 8@0) */
1246      DSPF_VYU       = DFB_SURFACE_PIXELFORMAT( 34, 24, 0, 0, 0, 3, 0, 0, 0, 0, 0 ),
1247 
1248      /*  1 bit alpha (1 byte/ 8 pixel, LEAST significant bit used first) */
1249      DSPF_A1_LSB    = DFB_SURFACE_PIXELFORMAT( 35,  0, 1, 1, 1, 0, 7, 0, 0, 0, 0 ),
1250 
1251      /* 16 bit   YUV (8 bit Y plane followed by 8 bit 2x1 subsampled V/U planes) */
1252      DSPF_YV16      = DFB_SURFACE_PIXELFORMAT( 36, 16, 0, 0, 0, 1, 0, 0, 1, 0, 0 ),
1253 
1254 } DFBSurfacePixelFormat;
1255 
1256 /* Number of pixelformats defined */
1257 #define DFB_NUM_PIXELFORMATS            37
1258 
1259 /* These macros extract information about the pixel format. */
1260 #define DFB_PIXELFORMAT_INDEX(fmt)      (((fmt) & 0x0000007F)      )
1261 
1262 #define DFB_COLOR_BITS_PER_PIXEL(fmt)   (((fmt) & 0x00000F80) >>  7)
1263 
1264 #define DFB_ALPHA_BITS_PER_PIXEL(fmt)   (((fmt) & 0x0000F000) >> 12)
1265 
1266 #define DFB_PIXELFORMAT_HAS_ALPHA(fmt)  (((fmt) & 0x00010000) !=  0)
1267 
1268 #define DFB_BITS_PER_PIXEL(fmt)         (((fmt) & 0x007E0000) >> 17)
1269 
1270 #define DFB_BYTES_PER_PIXEL(fmt)        (((fmt) & 0x00700000) >> 20)
1271 
1272 #define DFB_BYTES_PER_LINE(fmt,width)   (((((fmt) & 0x007E0000) >> 17) * (width) + 7) >> 3)
1273 
1274 #define DFB_PIXELFORMAT_ALIGNMENT(fmt)  (((fmt) & 0x03800000) >> 23)
1275 
1276 #define DFB_PLANE_MULTIPLY(fmt,height)  ((((((fmt) & 0x3C000000) >> 26) + 4) * (height)) >> 2)
1277 
1278 #define DFB_PIXELFORMAT_IS_INDEXED(fmt) (((fmt) & 0x40000000) !=  0)
1279 
1280 #define DFB_PLANAR_PIXELFORMAT(fmt)     (((fmt) & 0x3C000000) !=  0)
1281 
1282 #define DFB_PIXELFORMAT_INV_ALPHA(fmt)  (((fmt) & 0x80000000) !=  0)
1283 
1284 /*
1285  * Hint flags for optimized allocation, format selection etc.
1286  */
1287 typedef enum {
1288      DSHF_NONE                = 0x00000000,
1289 
1290      DSHF_LAYER               = 0x00000001,       /* Surface optimized for display layer usage */
1291      DSHF_WINDOW              = 0x00000002,       /* Surface optimized for being a window buffer */
1292      DSHF_CURSOR              = 0x00000004,       /* Surface optimized for usage as a cursor shape */
1293      DSHF_FONT                = 0x00000008,       /* Surface optimized for text rendering */
1294 
1295      DSHF_ALL                 = 0x0000000F
1296 } DFBSurfaceHintFlags;
1297 
1298 /*
1299  * Description of the surface that is to be created.
1300  */
1301 typedef struct {
1302      DFBSurfaceDescriptionFlags         flags;       /* field validation */
1303 
1304      DFBSurfaceCapabilities             caps;        /* capabilities */
1305      int                                width;       /* pixel width */
1306      int                                height;      /* pixel height */
1307      DFBSurfacePixelFormat              pixelformat; /* pixel format */
1308 
1309      struct {
1310           void                         *data;        /* data pointer of existing buffer */
1311           int                           pitch;       /* pitch of buffer */
1312      } preallocated[2];
1313 
1314      struct {
1315           const DFBColor               *entries;
1316           unsigned int                  size;
1317      } palette;                                      /* initial palette */
1318 
1319      unsigned long                      resource_id;   /* universal resource id, either user specified for general
1320                                                           purpose surfaces or id of layer or window */
1321 
1322      DFBSurfaceHintFlags                hints;       /* usage hints for optimized allocation, format selection etc. */
1323 } DFBSurfaceDescription;
1324 
1325 /*
1326  * Description of the palette that is to be created.
1327  */
1328 typedef struct {
1329      DFBPaletteDescriptionFlags         flags;       /* Validation of fields. */
1330 
1331      DFBPaletteCapabilities             caps;        /* Palette capabilities. */
1332      unsigned int                       size;        /* Number of entries. */
1333      const DFBColor                    *entries;     /* Preset palette
1334                                                         entries. */
1335 } DFBPaletteDescription;
1336 
1337 
1338 #define DFB_DISPLAY_LAYER_DESC_NAME_LENGTH   32
1339 
1340 /*
1341  * Description of the display layer capabilities.
1342  */
1343 typedef struct {
1344      DFBDisplayLayerTypeFlags           type;          /* Classification of the display layer. */
1345      DFBDisplayLayerCapabilities        caps;          /* Capability flags of the display layer. */
1346 
1347      char name[DFB_DISPLAY_LAYER_DESC_NAME_LENGTH];    /* Display layer name. */
1348 
1349      int                                level;         /* Default level. */
1350      int                                regions;       /* Number of concurrent regions supported.<br>
1351                                                            -1 = unlimited,
1352                                                             0 = unknown/one,
1353                                                            >0 = actual number */
1354      int                                sources;       /* Number of selectable sources. */
1355      int                                clip_regions;  /* Number of clipping regions. */
1356 
1357      DFBSurfaceCapabilities             surface_caps;
1358      unsigned int                       surface_accessor;
1359 } DFBDisplayLayerDescription;
1360 
1361 /*
1362  * Capabilities of a display layer source.
1363  */
1364 typedef enum {
1365      DDLSCAPS_NONE       = 0x00000000,  /* none of these */
1366 
1367      DDLSCAPS_SURFACE    = 0x00000001,  /* source has an accessable surface */
1368 
1369      DDLSCAPS_ALL        = 0x00000001   /* all of these */
1370 } DFBDisplayLayerSourceCaps;
1371 
1372 #define DFB_DISPLAY_LAYER_SOURCE_DESC_NAME_LENGTH    24
1373 
1374 /*
1375  * Description of a display layer source.
1376  */
1377 typedef struct {
1378      DFBDisplayLayerSourceID            source_id;          /* ID of the source. */
1379 
1380      char name[DFB_DISPLAY_LAYER_SOURCE_DESC_NAME_LENGTH];  /* Name of the source. */
1381 
1382      DFBDisplayLayerSourceCaps          caps;               /* Capabilites of the source. */
1383 } DFBDisplayLayerSourceDescription;
1384 
1385 
1386 #define DFB_SCREEN_DESC_NAME_LENGTH          32
1387 
1388 /*
1389  * Description of the display encoder capabilities.
1390  */
1391 typedef struct {
1392      DFBScreenCapabilities              caps;        /* Capability flags of
1393                                                         the screen. */
1394 
1395      char name[DFB_SCREEN_DESC_NAME_LENGTH];         /* Rough description. */
1396 
1397      int                                mixers;      /* Number of mixers
1398                                                         available. */
1399      int                                encoders;    /* Number of display
1400                                                         encoders available. */
1401      int                                outputs;     /* Number of output
1402                                                         connectors available. */
1403 } DFBScreenDescription;
1404 
1405 
1406 #define DFB_INPUT_DEVICE_DESC_NAME_LENGTH    32
1407 #define DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH  40
1408 
1409 /*
1410  * Description of the input device capabilities.
1411  */
1412 typedef struct {
1413      DFBInputDeviceTypeFlags            type;        /* classification of
1414                                                         input device */
1415      DFBInputDeviceCapabilities         caps;        /* capabilities,
1416                                                         validates the
1417                                                         following fields */
1418 
1419      int                                min_keycode; /* minimum hardware
1420                                                         keycode or -1 if
1421                                                         no differentiation
1422                                                         between hardware
1423                                                         keys is made */
1424      int                                max_keycode; /* maximum hardware
1425                                                         keycode or -1 if
1426                                                         no differentiation
1427                                                         between hardware
1428                                                         keys is made */
1429      DFBInputDeviceAxisIdentifier       max_axis;    /* highest axis
1430                                                         identifier */
1431      DFBInputDeviceButtonIdentifier     max_button;  /* highest button
1432                                                         identifier */
1433 
1434      char name[DFB_INPUT_DEVICE_DESC_NAME_LENGTH];   /* Device name */
1435 
1436      char vendor[DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH]; /* Device vendor */
1437 
1438      int  vendor_id;                                 /* Vendor ID */
1439      int  product_id;                                /* Product ID */
1440 } DFBInputDeviceDescription;
1441 
1442 typedef enum {
1443      DIAIF_NONE                    = 0x00000000,
1444 
1445      DIAIF_ABS_MIN                 = 0x00000001,
1446      DIAIF_ABS_MAX                 = 0x00000002,
1447 
1448      DIAIF_ALL                     = 0x00000003
1449 } DFBInputDeviceAxisInfoFlags;
1450 
1451 typedef struct {
1452      DFBInputDeviceAxisInfoFlags   flags;
1453      int                           abs_min;
1454      int                           abs_max;
1455 } DFBInputDeviceAxisInfo;
1456 
1457 #define DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH    40
1458 #define DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH  60
1459 
1460 typedef struct {
1461      int  major;                                          /* Major version */
1462      int  minor;                                          /* Minor version */
1463 
1464      char name[DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH];     /* Driver name */
1465      char vendor[DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH]; /* Driver vendor */
1466 } DFBGraphicsDriverInfo;
1467 
1468 #define DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH    48
1469 #define DFB_GRAPHICS_DEVICE_DESC_VENDOR_LENGTH  64
1470 
1471 /*
1472  * Description of the graphics device capabilities.
1473  */
1474 typedef struct {
1475      DFBAccelerationMask      acceleration_mask;          /* Accelerated functions */
1476 
1477      DFBSurfaceBlittingFlags  blitting_flags;             /* Supported blitting flags */
1478      DFBSurfaceDrawingFlags   drawing_flags;              /* Supported drawing flags */
1479 
1480      unsigned int             video_memory;               /* Amount of video memory in bytes */
1481 
1482      char name[DFB_GRAPHICS_DEVICE_DESC_NAME_LENGTH];     /* Device/Chipset name */
1483      char vendor[DFB_GRAPHICS_DEVICE_DESC_VENDOR_LENGTH]; /* Device vendor */
1484 
1485      DFBGraphicsDriverInfo    driver;
1486 } DFBGraphicsDeviceDescription;
1487 
1488 /*
1489  * Description of the window that is to be created.
1490  */
1491 typedef struct {
1492      DFBWindowDescriptionFlags          flags;        /* field validation */
1493 
1494      DFBWindowCapabilities              caps;         /* capabilities */
1495      int                                width;        /* pixel width */
1496      int                                height;       /* pixel height */
1497      DFBSurfacePixelFormat              pixelformat;  /* pixel format */
1498      int                                posx;         /* distance from left layer border */
1499      int                                posy;         /* distance from upper layer border */
1500      DFBSurfaceCapabilities             surface_caps; /* surface capabilities */
1501      DFBWindowID                        parent_id;    /* window id of parent window */
1502      DFBWindowOptions                   options;      /* initial window options */
1503      DFBWindowStackingClass             stacking;     /* initial stacking class */
1504 
1505      unsigned long                      resource_id;  /* resource id used to create the window surface */
1506 
1507      DFBWindowID                        toplevel_id;  /* top level window, if != 0 window will be a sub window */
1508 } DFBWindowDescription;
1509 
1510 /*
1511  * Description of a data buffer that is to be created.
1512  */
1513 typedef struct {
1514      DFBDataBufferDescriptionFlags      flags;       /* field validation */
1515 
1516      const char                        *file;        /* for file based data buffers */
1517 
1518      struct {
1519           const void                   *data;        /* static data pointer */
1520           unsigned int                  length;      /* length of buffer */
1521      } memory;                                       /* memory based buffers */
1522 } DFBDataBufferDescription;
1523 
1524 /*
1525  * Return value of callback function of enumerations.
1526  */
1527 typedef enum {
1528      DFENUM_OK           = 0x00000000,  /* Proceed with enumeration */
1529      DFENUM_CANCEL       = 0x00000001   /* Cancel enumeration */
1530 } DFBEnumerationResult;
1531 
1532 /*
1533  * Called for each supported video mode.
1534  */
1535 typedef DFBEnumerationResult (*DFBVideoModeCallback) (
1536      int                       width,
1537      int                       height,
1538      int                       bpp,
1539      void                     *callbackdata
1540 );
1541 
1542 /*
1543  * Called for each existing screen.
1544  * "screen_id" can be used to get an interface to the screen.
1545  */
1546 typedef DFBEnumerationResult (*DFBScreenCallback) (
1547      DFBScreenID                        screen_id,
1548      DFBScreenDescription               desc,
1549      void                              *callbackdata
1550 );
1551 
1552 /*
1553  * Called for each existing display layer.
1554  * "layer_id" can be used to get an interface to the layer.
1555  */
1556 typedef DFBEnumerationResult (*DFBDisplayLayerCallback) (
1557      DFBDisplayLayerID                  layer_id,
1558      DFBDisplayLayerDescription         desc,
1559      void                              *callbackdata
1560 );
1561 
1562 /*
1563  * Called for each existing input device.
1564  * "device_id" can be used to get an interface to the device.
1565  */
1566 typedef DFBEnumerationResult (*DFBInputDeviceCallback) (
1567      DFBInputDeviceID                   device_id,
1568      DFBInputDeviceDescription          desc,
1569      void                              *callbackdata
1570 );
1571 
1572 /*
1573  * Called for each block of continous data requested, e.g. by a
1574  * Video Provider. Write as many data as you can but not more
1575  * than specified by length. Return the number of bytes written
1576  * or 'EOF' if no data is available anymore.
1577  */
1578 typedef int (*DFBGetDataCallback) (
1579      void                              *buffer,
1580      unsigned int                       length,
1581      void                              *callbackdata
1582 );
1583 
1584 /*
1585  * Information about an IDirectFBVideoProvider.
1586  */
1587 typedef enum {
1588      DVCAPS_BASIC       = 0x00000000,  /* basic ops (PlayTo, Stop)         */
1589      DVCAPS_SEEK        = 0x00000001,  /* supports SeekTo                  */
1590      DVCAPS_SCALE       = 0x00000002,  /* can scale the video              */
1591      DVCAPS_INTERLACED  = 0x00000004,  /* supports interlaced surfaces     */
1592      DVCAPS_SPEED       = 0x00000008,  /* supports changing playback speed */
1593      DVCAPS_BRIGHTNESS  = 0x00000010,  /* supports Brightness adjustment   */
1594      DVCAPS_CONTRAST    = 0x00000020,  /* supports Contrast adjustment     */
1595      DVCAPS_HUE         = 0x00000040,  /* supports Hue adjustment          */
1596      DVCAPS_SATURATION  = 0x00000080,  /* supports Saturation adjustment   */
1597      DVCAPS_INTERACTIVE = 0x00000100,  /* supports SendEvent               */
1598      DVCAPS_VOLUME      = 0x00000200,  /* supports Volume adjustment       */
1599      DVCAPS_EVENT       = 0x00000400,  /* supports the sending of events as video/audio data changes.*/
1600      DVCAPS_ATTRIBUTES  = 0x00000800,  /* supports dynamic changing of atrributes.*/
1601      DVCAPS_AUDIO_SEL   = 0x00001000,  /* Supportes chosing audio outputs.*/
1602 } DFBVideoProviderCapabilities;
1603 
1604 /*
1605  * Information about the status of an IDirectFBVideoProvider.
1606  */
1607 typedef enum {
1608      DVSTATE_UNKNOWN    = 0x00000000, /* unknown status               */
1609      DVSTATE_PLAY       = 0x00000001, /* video provider is playing    */
1610      DVSTATE_STOP       = 0x00000002, /* playback was stopped         */
1611      DVSTATE_FINISHED   = 0x00000003, /* playback is finished         */
1612      DVSTATE_BUFFERING  = 0x00000004  /* video provider is buffering,
1613                                          playback is running          */
1614 } DFBVideoProviderStatus;
1615 
1616 /*
1617  * Flags controlling playback mode of a IDirectFBVideoProvider.
1618  */
1619 typedef enum {
1620      DVPLAY_NOFX        = 0x00000000, /* normal playback           */
1621      DVPLAY_REWIND      = 0x00000001, /* reverse playback          */
1622      DVPLAY_LOOPING     = 0x00000002  /* automatically restart
1623                                          playback when end-of-stream
1624                                          is reached (gapless).     */
1625 } DFBVideoProviderPlaybackFlags;
1626 
1627 /*
1628  * Flags to allow Audio Unit selection.
1629  */
1630 typedef enum {
1631      DVAUDIOUNIT_NONE   = 0x00000000, /* No Audio Unit            */
1632      DVAUDIOUNIT_ONE    = 0x00000001, /* Audio Unit One           */
1633      DVAUDIOUNIT_TWO    = 0x00000002, /* Audio Unit Two           */
1634      DVAUDIOUNIT_THREE  = 0x00000004, /* Audio Unit Three         */
1635      DVAUDIOUNIT_FOUR   = 0x00000008, /* Audio Unit Four          */
1636      DVAUDIOUNIT_ALL    = 0x0000000F, /* Audio Unit One           */
1637 } DFBVideoProviderAudioUnits;
1638 
1639 
1640 /*
1641  * Flags defining which fields of a DFBColorAdjustment are valid.
1642  */
1643 typedef enum {
1644      DCAF_NONE         = 0x00000000,  /* none of these              */
1645      DCAF_BRIGHTNESS   = 0x00000001,  /* brightness field is valid  */
1646      DCAF_CONTRAST     = 0x00000002,  /* contrast field is valid    */
1647      DCAF_HUE          = 0x00000004,  /* hue field is valid         */
1648      DCAF_SATURATION   = 0x00000008,  /* saturation field is valid  */
1649      DCAF_ALL          = 0x0000000F   /* all of these               */
1650 } DFBColorAdjustmentFlags;
1651 
1652 /*
1653  * Color Adjustment used to adjust video colors.
1654  *
1655  * All fields are in the range 0x0 to 0xFFFF with
1656  * 0x8000 as the default value (no adjustment).
1657  */
1658 typedef struct {
1659      DFBColorAdjustmentFlags  flags;
1660 
1661      u16                      brightness;
1662      u16                      contrast;
1663      u16                      hue;
1664      u16                      saturation;
1665 } DFBColorAdjustment;
1666 
1667 
1668 /*
1669  * <i><b>IDirectFB</b></i> is the main interface. It can be
1670  * retrieved by a call to <i>DirectFBCreate</i>. It's the only
1671  * interface with a global creation facility. Other interfaces
1672  * are created by this interface or interfaces created by it.
1673  *
1674  * <b>Hardware capabilities</b> such as the amount of video
1675  * memory or a list of supported drawing/blitting functions and
1676  * flags can be retrieved.  It also provides enumeration of all
1677  * supported video modes.
1678  *
1679  * <b>Input devices</b> and <b>display layers</b> that are
1680  * present can be enumerated via a callback mechanism. The
1681  * callback is given the capabilities and the device or layer
1682  * ID. An interface to specific input devices or display layers
1683  * can be retrieved by passing the device or layer ID to the
1684  * corresponding method.
1685  *
1686  * <b>Surfaces</b> for general purpose use can be created via
1687  * <i>CreateSurface</i>. These surfaces are so called "offscreen
1688  * surfaces" and could be used for sprites or icons.
1689  *
1690  * The <b>primary surface</b> is an abstraction and API shortcut
1691  * for getting a surface for visual output. Fullscreen games for
1692  * example have the whole screen as their primary
1693  * surface. Alternatively fullscreen applications can be forced
1694  * to run in a window. The primary surface is also created via
1695  * <i>CreateSurface</i> but with the special capability
1696  * DSCAPS_PRIMARY.
1697  *
1698  * The <b>cooperative level</b> selects the type of the primary
1699  * surface.  With a call to <i>SetCooperativeLevel</i> the
1700  * application can choose between the surface of an implicitly
1701  * created window and the surface of the primary layer
1702  * (deactivating the window stack). The application doesn't need
1703  * to have any extra functionality to run in a window. If the
1704  * application is forced to run in a window the call to
1705  * <i>SetCooperativeLevel</i> fails with DFB_ACCESSDENIED.
1706  * Applications that want to be "window aware" shouldn't exit on
1707  * this error.
1708  *
1709  * The <b>video mode</b> can be changed via <i>SetVideoMode</i>
1710  * and is the size and depth of the primary surface, i.e. the
1711  * screen when in exclusive cooperative level. Without exclusive
1712  * access <i>SetVideoMode</i> sets the size of the implicitly
1713  * created window.
1714  *
1715  * <b>Event buffers</b> can be created with an option to
1716  * automatically attach input devices matching the specified
1717  * capabilities. If DICAPS_NONE is passed an event buffer with
1718  * nothing attached to is created. An event buffer can be
1719  * attached to input devices and windows.
1720  *
1721  * <b>Fonts, images and videos</b> are created by this
1722  * interface. There are different implementations for different
1723  * content types. On creation a suitable implementation is
1724  * automatically chosen.
1725  */
1726 DEFINE_INTERFACE(   IDirectFB,
1727 
1728    /** Cooperative level, video mode **/
1729 
1730      /*
1731       * Puts the interface into the specified cooperative level.
1732       *
1733       * Function fails with DFB_LOCKED if another instance already
1734       * is in a cooperative level other than DFSCL_NORMAL.
1735       */
1736      DFBResult (*SetCooperativeLevel) (
1737           IDirectFB                *thiz,
1738           DFBCooperativeLevel       level
1739      );
1740 
1741      /*
1742       * Switch the current video mode (primary layer).
1743       *
1744       * If in shared cooperative level this function sets the
1745       * resolution of the window that is created implicitly for
1746       * the primary surface.
1747       *
1748       * The following values are valid for bpp: 2, 8, 12, 14, 15, 18, 24, 32.
1749       * These will result in the following formats, respectively: DSPF_LUT2,
1750       *  DSPF_LUT8, DSPF_ARGB4444, DSPF_ARGB2554, DSPF_ARGB1555, DSPF_RGB16,
1751       *  DSPF_RGB18, DSPF_RGB24, DSPF_RGB32.
1752       */
1753      DFBResult (*SetVideoMode) (
1754           IDirectFB                *thiz,
1755           int                       width,
1756           int                       height,
1757           int                       bpp
1758      );
1759 
1760 
1761    /** Hardware capabilities **/
1762 
1763      /*
1764       * Get a description of the graphics device.
1765       *
1766       * For more detailed information use
1767       * IDirectFBSurface::GetAccelerationMask().
1768       */
1769      DFBResult (*GetDeviceDescription) (
1770           IDirectFB                    *thiz,
1771           DFBGraphicsDeviceDescription *ret_desc
1772      );
1773 
1774      /*
1775       * Enumerate supported video modes.
1776       *
1777       * Calls the given callback for all available video modes.
1778       * Useful to select a certain mode to be used with
1779       * IDirectFB::SetVideoMode().
1780       */
1781      DFBResult (*EnumVideoModes) (
1782           IDirectFB                *thiz,
1783           DFBVideoModeCallback      callback,
1784           void                     *callbackdata
1785      );
1786 
1787 
1788    /** Surfaces & Palettes **/
1789 
1790      /*
1791       * Create a surface matching the specified description.
1792       */
1793      DFBResult (*CreateSurface) (
1794           IDirectFB                     *thiz,
1795           const DFBSurfaceDescription   *desc,
1796           IDirectFBSurface             **ret_interface
1797      );
1798 
1799      /*
1800       * Create a palette matching the specified description.
1801       *
1802       * Passing a NULL description creates a default palette with
1803       * 256 entries filled with colors matching the RGB332 format.
1804       */
1805      DFBResult (*CreatePalette) (
1806           IDirectFB                    *thiz,
1807           const DFBPaletteDescription  *desc,
1808           IDirectFBPalette            **ret_interface
1809      );
1810 
1811 
1812    /** Screens **/
1813 
1814      /*
1815       * Enumerate all existing screen.
1816       *
1817       * Calls the given callback for each available screen.
1818       * The callback is passed the screen id that can be
1819       * used to retrieve an interface to a specific screen using
1820       * IDirectFB::GetScreen().
1821       */
1822      DFBResult (*EnumScreens) (
1823           IDirectFB                *thiz,
1824           DFBScreenCallback         callback,
1825           void                     *callbackdata
1826      );
1827 
1828      /*
1829       * Retrieve an interface to a specific screen.
1830       */
1831      DFBResult (*GetScreen) (
1832           IDirectFB                *thiz,
1833           DFBScreenID               screen_id,
1834           IDirectFBScreen         **ret_interface
1835      );
1836 
1837 
1838    /** Display Layers **/
1839 
1840      /*
1841       * Enumerate all existing display layers.
1842       *
1843       * Calls the given callback for each available display
1844       * layer. The callback is passed the layer id that can be
1845       * used to retrieve an interface to a specific layer using
1846       * IDirectFB::GetDisplayLayer().
1847       */
1848      DFBResult (*EnumDisplayLayers) (
1849           IDirectFB                *thiz,
1850           DFBDisplayLayerCallback   callback,
1851           void                     *callbackdata
1852      );
1853 
1854      /*
1855       * Retrieve an interface to a specific display layer.
1856       *
1857       * The default <i>layer_id</i> is DLID_PRIMARY.
1858       * Others can be obtained using IDirectFB::EnumDisplayLayers().
1859       */
1860      DFBResult (*GetDisplayLayer) (
1861           IDirectFB                *thiz,
1862           DFBDisplayLayerID         layer_id,
1863           IDirectFBDisplayLayer   **ret_interface
1864      );
1865 
1866 
1867    /** Input Devices **/
1868 
1869      /*
1870       * Enumerate all existing input devices.
1871       *
1872       * Calls the given callback for all available input devices.
1873       * The callback is passed the device id that can be used to
1874       * retrieve an interface on a specific device using
1875       * IDirectFB::GetInputDevice().
1876       */
1877      DFBResult (*EnumInputDevices) (
1878           IDirectFB                *thiz,
1879           DFBInputDeviceCallback    callback,
1880           void                     *callbackdata
1881      );
1882 
1883      /*
1884       * Retrieve an interface to a specific input device.
1885       */
1886      DFBResult (*GetInputDevice) (
1887           IDirectFB                *thiz,
1888           DFBInputDeviceID          device_id,
1889           IDirectFBInputDevice    **ret_interface
1890      );
1891 
1892      /*
1893       * Create a buffer for events.
1894       *
1895       * Creates an empty event buffer without event sources connected to it.
1896       */
1897      DFBResult (*CreateEventBuffer) (
1898           IDirectFB                   *thiz,
1899           IDirectFBEventBuffer       **ret_buffer
1900      );
1901 
1902      /*
1903       * Create a buffer for events with input devices connected.
1904       *
1905       * Creates an event buffer and attaches all input devices
1906       * with matching capabilities. If no input devices match,
1907       * e.g. by specifying DICAPS_NONE, a buffer will be returned
1908       * that has no event sources connected to it.
1909       *
1910       * If global is DFB_FALSE events will only be delivered if this
1911       * instance of IDirectFB has a focused primary (either running fullscreen
1912       * or running in windowed mode with the window being focused).
1913       *
1914       * If global is DFB_TRUE no event will be discarded.
1915       */
1916      DFBResult (*CreateInputEventBuffer) (
1917           IDirectFB                   *thiz,
1918           DFBInputDeviceCapabilities   caps,
1919           DFBBoolean                   global,
1920           IDirectFBEventBuffer       **ret_buffer
1921      );
1922 
1923 
1924 
1925    /** Media **/
1926 
1927      /*
1928       * Create an image provider for the specified file.
1929       */
1930      DFBResult (*CreateImageProvider) (
1931           IDirectFB                *thiz,
1932           const char               *filename,
1933           IDirectFBImageProvider  **ret_interface
1934      );
1935 
1936      /*
1937       * Create a video provider.
1938       */
1939      DFBResult (*CreateVideoProvider) (
1940           IDirectFB                *thiz,
1941           const char               *filename,
1942           IDirectFBVideoProvider  **ret_interface
1943      );
1944 
1945      /*
1946       * Load a font from the specified file given a description
1947       * of how to load the glyphs.
1948       */
1949      DFBResult (*CreateFont) (
1950           IDirectFB                     *thiz,
1951           const char                    *filename,
1952           const DFBFontDescription      *desc,
1953           IDirectFBFont                **ret_interface
1954      );
1955 
1956      /*
1957       * Create a data buffer.
1958       *
1959       * If no description is specified (NULL) a streamed data buffer
1960       * is created.
1961       */
1962      DFBResult (*CreateDataBuffer) (
1963           IDirectFB                       *thiz,
1964           const DFBDataBufferDescription  *desc,
1965           IDirectFBDataBuffer            **ret_interface
1966      );
1967 
1968 
1969    /** Clipboard **/
1970 
1971      /*
1972       * Set clipboard content.
1973       *
1974       * This is an experimental and intermediate API call that is
1975       * supposed to change soon.
1976       *
1977       * If timestamp is non null DirectFB returns the time stamp
1978       * that it associated with the new data.
1979       */
1980      DFBResult (*SetClipboardData) (
1981           IDirectFB                *thiz,
1982           const char               *mime_type,
1983           const void               *data,
1984           unsigned int              size,
1985           struct timeval           *ret_timestamp
1986      );
1987 
1988      /*
1989       * Get clipboard content.
1990       *
1991       * Memory returned in *ret_mimetype and *ret_data has to be freed.
1992       *
1993       * This is an experimental and intermediate API call that is
1994       * supposed to change soon.
1995       */
1996      DFBResult (*GetClipboardData) (
1997           IDirectFB                *thiz,
1998           char                    **ret_mimetype,
1999           void                    **ret_data,
2000           unsigned int             *ret_size
2001      );
2002 
2003      /*
2004       * Get time stamp of last SetClipboardData call.
2005       *
2006       * This is an experimental and intermediate API call that is
2007       * supposed to change soon.
2008       */
2009      DFBResult (*GetClipboardTimeStamp) (
2010           IDirectFB                *thiz,
2011           struct timeval           *ret_timestamp
2012      );
2013 
2014 
2015    /** Misc **/
2016 
2017      /*
2018       * Suspend DirectFB, no other calls to DirectFB are allowed
2019       * until Resume has been called.
2020       */
2021      DFBResult (*Suspend) (
2022           IDirectFB                *thiz
2023      );
2024 
2025      /*
2026       * Resume DirectFB, only to be called after Suspend.
2027       */
2028      DFBResult (*Resume) (
2029           IDirectFB                *thiz
2030      );
2031 
2032      /*
2033       * Wait until graphics card is idle,
2034       * i.e. finish all drawing/blitting functions.
2035       */
2036      DFBResult (*WaitIdle) (
2037           IDirectFB                *thiz
2038      );
2039 
2040      /*
2041       * Wait for next vertical retrace.
2042       */
2043      DFBResult (*WaitForSync) (
2044           IDirectFB                *thiz
2045      );
2046 
2047 
2048    /** Extensions **/
2049 
2050      /*
2051       * Load an implementation of a specific interface type.
2052       *
2053       * This methods loads an interface implementation of the specified
2054       * <b>type</b> of interface, e.g. "IFusionSound".
2055       *
2056       * A specific implementation can be forced with the optional
2057       * <b>implementation</b> argument.
2058       *
2059       * Implementations are passed <b>arg</b> during probing and construction.
2060       *
2061       * If an implementation has been successfully probed and the interface
2062       * has been constructed, the resulting interface pointer is stored in
2063       * <b>interface</b>.
2064       */
2065      DFBResult (*GetInterface) (
2066           IDirectFB                *thiz,
2067           const char               *type,
2068           const char               *implementation,
2069           void                     *arg,
2070           void                    **ret_interface
2071      );
2072 )
2073 
2074 /* predefined layer ids */
2075 #define DLID_PRIMARY          0x0000
2076 
2077 /* predefined layer source ids */
2078 #define DLSID_SURFACE         0x0000
2079 
2080 /* predefined screen ids */
2081 #define DSCID_PRIMARY         0x0000
2082 
2083 /* predefined input device ids */
2084 #define DIDID_KEYBOARD        0x0000    /* primary keyboard       */
2085 #define DIDID_MOUSE           0x0001    /* primary mouse          */
2086 #define DIDID_JOYSTICK        0x0002    /* primary joystick       */
2087 #define DIDID_REMOTE          0x0003    /* primary remote control */
2088 #define DIDID_ANY             0x0010    /* no primary device      */
2089 
2090 
2091 /*
2092  * Cooperative level handling the access permissions.
2093  */
2094 typedef enum {
2095      DLSCL_SHARED             = 0, /* shared access */
2096      DLSCL_EXCLUSIVE,              /* exclusive access,
2097                                       fullscreen/mode switching */
2098      DLSCL_ADMINISTRATIVE          /* administrative access,
2099                                       enumerate windows, control them */
2100 } DFBDisplayLayerCooperativeLevel;
2101 
2102 /*
2103  * Background mode defining how to erase/initialize the area
2104  * for a windowstack repaint
2105  */
2106 typedef enum {
2107      DLBM_DONTCARE            = 0, /* do not clear the layer before
2108                                       repainting the windowstack */
2109      DLBM_COLOR,                   /* fill with solid color
2110                                       (SetBackgroundColor) */
2111      DLBM_IMAGE,                   /* use an image (SetBackgroundImage) */
2112      DLBM_TILE                     /* use a tiled image (SetBackgroundImage) */
2113 } DFBDisplayLayerBackgroundMode;
2114 
2115 /*
2116  * Layer configuration flags
2117  */
2118 typedef enum {
2119      DLCONF_NONE              = 0x00000000,
2120 
2121      DLCONF_WIDTH             = 0x00000001,
2122      DLCONF_HEIGHT            = 0x00000002,
2123      DLCONF_PIXELFORMAT       = 0x00000004,
2124      DLCONF_BUFFERMODE        = 0x00000008,
2125      DLCONF_OPTIONS           = 0x00000010,
2126      DLCONF_SOURCE            = 0x00000020,
2127      DLCONF_SURFACE_CAPS      = 0x00000040,
2128 
2129      DLCONF_ALL               = 0x0000007F
2130 } DFBDisplayLayerConfigFlags;
2131 
2132 /*
2133  * Layer configuration
2134  */
2135 typedef struct {
2136      DFBDisplayLayerConfigFlags    flags;         /* Which fields of the configuration are set */
2137 
2138      int                           width;         /* Pixel width */
2139      int                           height;        /* Pixel height */
2140      DFBSurfacePixelFormat         pixelformat;   /* Pixel format */
2141      DFBDisplayLayerBufferMode     buffermode;    /* Buffer mode */
2142      DFBDisplayLayerOptions        options;       /* Enable capabilities */
2143      DFBDisplayLayerSourceID       source;        /* Selected layer source */
2144 
2145      DFBSurfaceCapabilities        surface_caps;  /* Choose surface capabilities, available:
2146                                                      INTERLACED, SEPARATED, PREMULTIPLIED. */
2147 } DFBDisplayLayerConfig;
2148 
2149 /*
2150  * Screen Power Mode.
2151  */
2152 typedef enum {
2153      DSPM_ON        = 0,
2154      DSPM_STANDBY,
2155      DSPM_SUSPEND,
2156      DSPM_OFF
2157 } DFBScreenPowerMode;
2158 
2159 
2160 /*
2161  * Capabilities of a mixer.
2162  */
2163 typedef enum {
2164      DSMCAPS_NONE         = 0x00000000, /* None of these. */
2165 
2166      DSMCAPS_FULL         = 0x00000001, /* Can mix full tree as specified in the description. */
2167      DSMCAPS_SUB_LEVEL    = 0x00000002, /* Can set a maximum layer level, e.g. to exclude an OSD from VCR output. */
2168      DSMCAPS_SUB_LAYERS   = 0x00000004, /* Can select a number of layers individually as specified in the description. */
2169      DSMCAPS_BACKGROUND   = 0x00000008  /* Background color is configurable. */
2170 } DFBScreenMixerCapabilities;
2171 
2172 
2173 #define DFB_SCREEN_MIXER_DESC_NAME_LENGTH    24
2174 
2175 /*
2176  * Description of a mixer.
2177  */
2178 typedef struct {
2179      DFBScreenMixerCapabilities  caps;
2180 
2181      DFBDisplayLayerIDs          layers;             /* Visible layers if the
2182                                                         full tree is selected. */
2183 
2184      int                         sub_num;            /* Number of layers that can
2185                                                         be selected in sub mode. */
2186      DFBDisplayLayerIDs          sub_layers;         /* Layers available for sub mode
2187                                                         with layer selection. */
2188 
2189      char name[DFB_SCREEN_MIXER_DESC_NAME_LENGTH];   /* Mixer name */
2190 } DFBScreenMixerDescription;
2191 
2192 /*
2193  * Flags for mixer configuration.
2194  */
2195 typedef enum {
2196      DSMCONF_NONE         = 0x00000000, /* None of these. */
2197 
2198      DSMCONF_TREE         = 0x00000001, /* (Sub) tree is selected. */
2199      DSMCONF_LEVEL        = 0x00000002, /* Level is specified. */
2200      DSMCONF_LAYERS       = 0x00000004, /* Layer selection is set. */
2201 
2202      DSMCONF_BACKGROUND   = 0x00000010, /* Background color is set. */
2203 
2204      DSMCONF_ALL          = 0x00000017
2205 } DFBScreenMixerConfigFlags;
2206 
2207 /*
2208  * (Sub) tree selection.
2209  */
2210 typedef enum {
2211      DSMT_UNKNOWN         = 0x00000000, /* Unknown mode */
2212 
2213      DSMT_FULL            = 0x00000001, /* Full tree. */
2214      DSMT_SUB_LEVEL       = 0x00000002, /* Sub tree via maximum level. */
2215      DSMT_SUB_LAYERS      = 0x00000003  /* Sub tree via layer selection. */
2216 } DFBScreenMixerTree;
2217 
2218 /*
2219  * Configuration of a mixer.
2220  */
2221 typedef struct {
2222      DFBScreenMixerConfigFlags   flags;      /* Validates struct members. */
2223 
2224      DFBScreenMixerTree          tree;       /* Selected (sub) tree. */
2225 
2226      int                         level;      /* Max. level of sub level mode. */
2227      DFBDisplayLayerIDs          layers;     /* Layers for sub layers mode. */
2228 
2229      DFBColor                    background; /* Background color. */
2230 } DFBScreenMixerConfig;
2231 
2232 
2233 /*
2234  * Capabilities of an output.
2235  */
2236 typedef enum {
2237      DSOCAPS_NONE          = 0x00000000, /* None of these. */
2238 
2239      DSOCAPS_CONNECTORS    = 0x00000001, /* Output connectors are available. */
2240 
2241      DSOCAPS_ENCODER_SEL   = 0x00000010, /* Encoder can be selected. */
2242      DSOCAPS_SIGNAL_SEL    = 0x00000020, /* Signal(s) can be selected. */
2243      DSOCAPS_CONNECTOR_SEL = 0x00000040, /* Connector(s) can be selected. */
2244      DSOCAPS_SLOW_BLANKING = 0x00000080, /* Slow Blanking on outputs is supported. */
2245      DSOCAPS_RESOLUTION    = 0x00000100, /* Output Resolution can be changed. (global screen size)*/
2246      DSOCAPS_ALL           = 0x000001F1
2247 } DFBScreenOutputCapabilities;
2248 
2249 /*
2250  * Type of output connector.
2251  */
2252 typedef enum {
2253      DSOC_UNKNOWN        = 0x00000000, /* Unknown type */
2254 
2255      DSOC_VGA            = 0x00000001, /* VGA connector */
2256      DSOC_SCART          = 0x00000002, /* SCART connector */
2257      DSOC_YC             = 0x00000004, /* Y/C connector */
2258      DSOC_CVBS           = 0x00000008, /* CVBS connector */
2259      DSOC_SCART2         = 0x00000010, /* 2nd SCART connector */
2260      DSOC_COMPONENT      = 0x00000020, /* Component video connector */
2261      DSOC_HDMI           = 0x00000040, /* HDMI connector */
2262      DSOC_656            = 0x00000080, /* DVO connector */
2263 } DFBScreenOutputConnectors;
2264 
2265 /*
2266  * Type of output signal.
2267  */
2268 typedef enum {
2269      DSOS_NONE           = 0x00000000, /* No signal */
2270 
2271      DSOS_VGA            = 0x00000001, /* VGA signal */
2272      DSOS_YC             = 0x00000002, /* Y/C signal */
2273      DSOS_CVBS           = 0x00000004, /* CVBS signal */
2274      DSOS_RGB            = 0x00000008, /* R/G/B signal */
2275      DSOS_YCBCR          = 0x00000010, /* Y/Cb/Cr signal */
2276      DSOS_HDMI           = 0x00000020, /* HDMI signal */
2277      DSOS_656            = 0x00000040  /* 656 Digital output signal */
2278 } DFBScreenOutputSignals;
2279 
2280 
2281 /*
2282  * Type of slow blanking signalling.
2283  */
2284 typedef enum {
2285      DSOSB_OFF           = 0x00000000, /* No signal */
2286      DSOSB_16x9          = 0x00000001, /* 16*9 Widescreen signalling */
2287      DSOSB_4x3           = 0x00000002, /* 4*3 widescreen signalling */
2288      DSOSB_FOLLOW        = 0x00000004, /* Follow signalling */
2289      DSOSB_MONITOR       = 0x00000008  /* Monitor */
2290 } DFBScreenOutputSlowBlankingSignals;
2291 
2292 /**
2293  * Resolutions.  TV Standards implies too many things:
2294  *               resolution / encoding / frequency.
2295  */
2296 typedef enum {
2297     DSOR_UNKNOWN   = 0x00000000, /* Unknown Resolution */
2298     DSOR_640_480   = 0x00000001, /* 640x480 Resolution */
2299     DSOR_720_480   = 0x00000002, /* 720x480 Resolution */
2300     DSOR_720_576   = 0x00000004, /* 720x576 Resolution */
2301     DSOR_800_600   = 0x00000008, /* 800x600 Resolution */
2302     DSOR_1024_768  = 0x00000010, /* 1024x768 Resolution */
2303     DSOR_1152_864  = 0x00000020, /* 1152x864 Resolution */
2304     DSOR_1280_720  = 0x00000040, /* 1280x720 Resolution */
2305     DSOR_1280_768  = 0x00000080, /* 1280x768 Resolution */
2306     DSOR_1280_960  = 0x00000100, /* 1280x960 Resolution */
2307     DSOR_1280_1024 = 0x00000200, /* 1280x1024 Resolution */
2308     DSOR_1400_1050 = 0x00000400, /* 1400x1050 Resolution */
2309     DSOR_1600_1200 = 0x00000800, /* 1600x1200 Resolution */
2310     DSOR_1920_1080 = 0x00001000, /* 1920x1080 Resolution */
2311     DSOR_ALL       = 0x00001FFF  /* All Resolution */
2312 } DFBScreenOutputResolution;
2313 
2314 
2315 #define DFB_SCREEN_OUTPUT_DESC_NAME_LENGTH    24
2316 
2317 /*
2318  * Description of a screen output.
2319  */
2320 typedef struct {
2321      DFBScreenOutputCapabilities   caps;             /* Screen capabilities. */
2322 
2323      DFBScreenOutputConnectors     all_connectors;   /* Output connectors. */
2324      DFBScreenOutputSignals        all_signals;      /* Output signals. */
2325      DFBScreenOutputResolution     all_resolutions;  /* Output Resolutions */
2326 
2327      char name[DFB_SCREEN_OUTPUT_DESC_NAME_LENGTH];  /* Output name */
2328 } DFBScreenOutputDescription;
2329 
2330 /*
2331  * Flags for screen output configuration.
2332  */
2333 typedef enum {
2334      DSOCONF_NONE         = 0x00000000, /* None of these. */
2335 
2336      DSOCONF_ENCODER      = 0x00000001, /* Set encoder the signal(s) comes from. */
2337      DSOCONF_SIGNALS      = 0x00000002, /* Select signal(s) from encoder. */
2338      DSOCONF_CONNECTORS   = 0x00000004, /* Select output connector(s). */
2339      DSOCONF_SLOW_BLANKING= 0x00000008, /* Can select slow blanking support. */
2340      DSOCONF_RESOLUTION   = 0x00000010, /* Can change output resolution */
2341 
2342      DSOCONF_ALL          = 0x0000001F
2343 } DFBScreenOutputConfigFlags;
2344 
2345 /*
2346  * Configuration of an output.
2347  */
2348 typedef struct {
2349      DFBScreenOutputConfigFlags  flags;          /* Validates struct members. */
2350 
2351      int                         encoder;        /* Chosen encoder. */
2352      DFBScreenOutputSignals      out_signals;    /* Selected encoder signal(s). */
2353      DFBScreenOutputConnectors   out_connectors; /* Selected output connector(s). */
2354      DFBScreenOutputSlowBlankingSignals     slow_blanking;/* Slow Blanking signals. */
2355      DFBScreenOutputResolution   resolution;     /* Output Resolution */
2356 } DFBScreenOutputConfig;
2357 
2358 
2359 /*
2360  * Capabilities of a display encoder.
2361  */
2362 typedef enum {
2363      DSECAPS_NONE         = 0x00000000, /* None of these. */
2364 
2365      DSECAPS_TV_STANDARDS = 0x00000001, /* TV standards can be selected. */
2366      DSECAPS_TEST_PICTURE = 0x00000002, /* Test picture generation supported. */
2367      DSECAPS_MIXER_SEL    = 0x00000004, /* Mixer can be selected. */
2368      DSECAPS_OUT_SIGNALS  = 0x00000008, /* Different output signals are supported. */
2369      DSECAPS_SCANMODE     = 0x00000010, /* Can switch between interlaced and progressive output. */
2370      DSECAPS_FREQUENCY    = 0x00000020, /* Can switch between different frequencies. */
2371 
2372      DSECAPS_BRIGHTNESS   = 0x00000100, /* Adjustment of brightness is supported. */
2373      DSECAPS_CONTRAST     = 0x00000200, /* Adjustment of contrast is supported. */
2374      DSECAPS_HUE          = 0x00000400, /* Adjustment of hue is supported. */
2375      DSECAPS_SATURATION   = 0x00000800, /* Adjustment of saturation is supported. */
2376 
2377      DSECAPS_CONNECTORS   = 0x00001000, /* Select output connector(s). */
2378      DSECAPS_SLOW_BLANKING = 0x00002000, /* Slow Blanking on outputs is supported. */
2379      DSECAPS_RESOLUTION   = 0x00004000, /* Different encoder resolutions supported */
2380 
2381      DSECAPS_ALL          = 0x00007f3f
2382 } DFBScreenEncoderCapabilities;
2383 
2384 /*
2385  * Type of display encoder.
2386  */
2387 typedef enum {
2388      DSET_UNKNOWN         = 0x00000000, /* Unknown type */
2389 
2390      DSET_CRTC            = 0x00000001, /* Encoder is a CRTC. */
2391      DSET_TV              = 0x00000002, /* TV output encoder. */
2392      DSET_DIGITAL         = 0x00000004  /* Support signals other than SD TV standards. */
2393 } DFBScreenEncoderType;
2394 
2395 /*
2396  * TV standards.
2397  */
2398 typedef enum {
2399      DSETV_UNKNOWN        = 0x00000000, /* Unknown standard */
2400 
2401      DSETV_PAL            = 0x00000001, /* PAL */
2402      DSETV_NTSC           = 0x00000002, /* NTSC */
2403      DSETV_SECAM          = 0x00000004, /* SECAM */
2404      DSETV_PAL_60         = 0x00000008, /* PAL-60 */
2405      DSETV_PAL_BG         = 0x00000010, /* PAL BG support (specific) */
2406      DSETV_PAL_I          = 0x00000020, /* PAL I support (specific) */
2407      DSETV_PAL_M          = 0x00000040, /* PAL M support (specific) */
2408      DSETV_PAL_N          = 0x00000080, /* PAL N support (specific) */
2409      DSETV_PAL_NC         = 0x00000100, /* PAL NC support (specific) */
2410      DSETV_NTSC_M_JPN     = 0x00000200, /* NTSC_JPN support */
2411      DSETV_DIGITAL        = 0x00000400, /* TV standards from the digital domain.  specify resolution, scantype, frequency.*/
2412      DSETV_NTSC_443       = 0x00000800, /* NTSC with 4.43MHz colour carrier */
2413      DSETV_ALL            = 0x00000FFF  /* All TV Standards*/
2414 } DFBScreenEncoderTVStandards;
2415 
2416 /*
2417  * Scan modes.
2418  */
2419 typedef enum {
2420      DSESM_UNKNOWN        = 0x00000000, /* Unknown mode */
2421 
2422      DSESM_INTERLACED     = 0x00000001, /* Interlaced scan mode */
2423      DSESM_PROGRESSIVE    = 0x00000002  /* Progressive scan mode */
2424 } DFBScreenEncoderScanMode;
2425 
2426 /*
2427  * Frequency of output signal.
2428  */
2429 typedef enum {
2430      DSEF_UNKNOWN        = 0x00000000, /* Unknown Frequency */
2431 
2432      DSEF_25HZ           = 0x00000001, /* 25 Hz Output. */
2433      DSEF_29_97HZ        = 0x00000002, /* 29.97 Hz Output. */
2434      DSEF_50HZ           = 0x00000004, /* 50 Hz Output. */
2435      DSEF_59_94HZ        = 0x00000008, /* 59.94 Hz Output. */
2436      DSEF_60HZ           = 0x00000010, /* 60 Hz Output. */
2437      DSEF_75HZ           = 0x00000020, /* 75 Hz Output. */
2438      DSEF_30HZ           = 0x00000040, /* 30 Hz Output. */
2439      DSEF_24HZ           = 0x00000080, /* 24 Hz Output. */
2440      DSEF_23_976HZ       = 0x00000100, /* 23.976 Hz Output. */
2441 } DFBScreenEncoderFrequency;
2442 
2443 #define DFB_SCREEN_ENCODER_DESC_NAME_LENGTH    24
2444 
2445 /*
2446  * Description of a display encoder.
2447  */
2448 typedef struct {
2449      DFBScreenEncoderCapabilities  caps;               /* Encoder capabilities. */
2450      DFBScreenEncoderType          type;               /* Type of encoder. */
2451 
2452      DFBScreenEncoderTVStandards   tv_standards;       /* Supported TV standards. */
2453      DFBScreenOutputSignals        out_signals;        /* Supported output signals. */
2454      DFBScreenOutputConnectors     all_connectors;     /* Supported output connectors */
2455      DFBScreenOutputResolution     all_resolutions;    /* Supported Resolutions*/
2456 
2457      char name[DFB_SCREEN_ENCODER_DESC_NAME_LENGTH];   /* Encoder name */
2458 } DFBScreenEncoderDescription;
2459 
2460 /*
2461  * Flags for display encoder configuration.
2462  */
2463 typedef enum {
2464      DSECONF_NONE         = 0x00000000, /* None of these. */
2465 
2466      DSECONF_TV_STANDARD  = 0x00000001, /* Set TV standard. */
2467      DSECONF_TEST_PICTURE = 0x00000002, /* Set test picture mode. */
2468      DSECONF_MIXER        = 0x00000004, /* Select mixer. */
2469      DSECONF_OUT_SIGNALS  = 0x00000008, /* Select generated output signal(s). */
2470      DSECONF_SCANMODE     = 0x00000010, /* Select interlaced or progressive output. */
2471      DSECONF_TEST_COLOR   = 0x00000020, /* Set color for DSETP_SINGLE. */
2472      DSECONF_ADJUSTMENT   = 0x00000040, /* Set color adjustment. */
2473      DSECONF_FREQUENCY    = 0x00000080, /* Set Output Frequency*/
2474 
2475      DSECONF_CONNECTORS   = 0x00000100, /* Select output connector(s). */
2476      DSECONF_SLOW_BLANKING = 0x00000200, /* Can select slow blanking support. */
2477      DSECONF_RESOLUTION    = 0x00000400, /* Can change resolution of the encoder.*/
2478 
2479      DSECONF_ALL          = 0x000007FF
2480 } DFBScreenEncoderConfigFlags;
2481 
2482 /*
2483  * Test picture mode.
2484  */
2485 typedef enum {
2486      DSETP_OFF      = 0x00000000,  /* Disable test picture. */
2487 
2488      DSETP_MULTI    = 0x00000001,  /* Show color bars. */
2489      DSETP_SINGLE   = 0x00000002,  /* Whole screen as defined in configuration. */
2490 
2491      DSETP_WHITE    = 0x00000010,  /* Whole screen (ff, ff, ff). */
2492      DSETP_YELLOW   = 0x00000020,  /* Whole screen (ff, ff, 00). */
2493      DSETP_CYAN     = 0x00000030,  /* Whole screen (00, ff, ff). */
2494      DSETP_GREEN    = 0x00000040,  /* Whole screen (00, ff, 00). */
2495      DSETP_MAGENTA  = 0x00000050,  /* Whole screen (ff, 00, ff). */
2496      DSETP_RED      = 0x00000060,  /* Whole screen (ff, 00, 00). */
2497      DSETP_BLUE     = 0x00000070,  /* Whole screen (00, 00, ff). */
2498      DSETP_BLACK    = 0x00000080   /* Whole screen (00, 00, 00). */
2499 } DFBScreenEncoderTestPicture;
2500 
2501 /*
2502  * Configuration of a display encoder.
2503  */
2504 typedef struct {
2505      DFBScreenEncoderConfigFlags   flags;         /* Validates struct members. */
2506 
2507      DFBScreenEncoderTVStandards   tv_standard;   /* TV standard. */
2508      DFBScreenEncoderTestPicture   test_picture;  /* Test picture mode. */
2509      int                           mixer;         /* Selected mixer. */
2510      DFBScreenOutputSignals        out_signals;   /* Generated output signals. */
2511      DFBScreenOutputConnectors     out_connectors; /* Selected output connector(s). */
2512      DFBScreenOutputSlowBlankingSignals     slow_blanking;/* Slow Blanking signals. */
2513 
2514      DFBScreenEncoderScanMode      scanmode;      /* Interlaced or progressive output. */
2515 
2516      DFBColor                      test_color;    /* Color for DSETP_SINGLE. */
2517 
2518      DFBColorAdjustment            adjustment;    /* Color adjustment. */
2519 
2520      DFBScreenEncoderFrequency     frequency;     /* Selected Output Frequency*/
2521      DFBScreenOutputResolution     resolution;    /* Selected Output resolution*/
2522 } DFBScreenEncoderConfig;
2523 
2524 
2525 /*******************
2526  * IDirectFBScreen *
2527  *******************/
2528 
2529 /*
2530  * <i>No summary yet...</i>
2531  */
2532 DEFINE_INTERFACE(   IDirectFBScreen,
2533 
2534    /** Retrieving information **/
2535 
2536      /*
2537       * Get the unique screen ID.
2538       */
2539      DFBResult (*GetID) (
2540           IDirectFBScreen                    *thiz,
2541           DFBScreenID                        *ret_screen_id
2542      );
2543 
2544      /*
2545       * Get a description of this screen, i.e. the capabilities.
2546       */
2547      DFBResult (*GetDescription) (
2548           IDirectFBScreen                    *thiz,
2549           DFBScreenDescription               *ret_desc
2550      );
2551 
2552      /*
2553       * Get the screen's width and height in pixels.
2554       */
2555      DFBResult (*GetSize) (
2556           IDirectFBScreen                    *thiz,
2557           int                                *ret_width,
2558           int                                *ret_height
2559      );
2560 
2561 
2562    /** Display Layers **/
2563 
2564      /*
2565       * Enumerate all existing display layers for this screen.
2566       *
2567       * Calls the given callback for each available display
2568       * layer. The callback is passed the layer id that can be
2569       * used to retrieve an interface to a specific layer using
2570       * IDirectFB::GetDisplayLayer().
2571       */
2572      DFBResult (*EnumDisplayLayers) (
2573           IDirectFBScreen                    *thiz,
2574           DFBDisplayLayerCallback             callback,
2575           void                               *callbackdata
2576      );
2577 
2578 
2579    /** Power management **/
2580 
2581      /*
2582       * Set screen power mode.
2583       */
2584      DFBResult (*SetPowerMode) (
2585           IDirectFBScreen                    *thiz,
2586           DFBScreenPowerMode                  mode
2587      );
2588 
2589 
2590    /** Synchronization **/
2591 
2592      /*
2593       * Wait for next vertical retrace.
2594       */
2595      DFBResult (*WaitForSync) (
2596           IDirectFBScreen                    *thiz
2597      );
2598 
2599 
2600    /** Mixers **/
2601 
2602      /*
2603       * Get a description of available mixers.
2604       *
2605       * All descriptions are written to the array pointed to by
2606       * <b>ret_descriptions</b>. The number of mixers is returned by
2607       * IDirectFBScreen::GetDescription().
2608       */
2609      DFBResult (*GetMixerDescriptions) (
2610           IDirectFBScreen                    *thiz,
2611           DFBScreenMixerDescription          *ret_descriptions
2612      );
2613 
2614      /*
2615       * Get current mixer configuration.
2616       */
2617      DFBResult (*GetMixerConfiguration) (
2618           IDirectFBScreen                    *thiz,
2619           int                                 mixer,
2620           DFBScreenMixerConfig               *ret_config
2621      );
2622 
2623      /*
2624       * Test mixer configuration.
2625       *
2626       * If configuration fails and 'ret_failed' is not NULL it will
2627       * indicate which fields of the configuration caused the error.
2628       */
2629      DFBResult (*TestMixerConfiguration) (
2630           IDirectFBScreen                    *thiz,
2631           int                                 mixer,
2632           const DFBScreenMixerConfig         *config,
2633           DFBScreenMixerConfigFlags          *ret_failed
2634      );
2635 
2636      /*
2637       * Set mixer configuration.
2638       */
2639      DFBResult (*SetMixerConfiguration) (
2640           IDirectFBScreen                    *thiz,
2641           int                                 mixer,
2642           const DFBScreenMixerConfig         *config
2643      );
2644 
2645 
2646    /** Encoders **/
2647 
2648      /*
2649       * Get a description of available display encoders.
2650       *
2651       * All descriptions are written to the array pointed to by
2652       * <b>ret_descriptions</b>. The number of encoders is returned by
2653       * IDirectFBScreen::GetDescription().
2654       */
2655      DFBResult (*GetEncoderDescriptions) (
2656           IDirectFBScreen                    *thiz,
2657           DFBScreenEncoderDescription        *ret_descriptions
2658      );
2659 
2660      /*
2661       * Get current encoder configuration.
2662       */
2663      DFBResult (*GetEncoderConfiguration) (
2664           IDirectFBScreen                    *thiz,
2665           int                                 encoder,
2666           DFBScreenEncoderConfig             *ret_config
2667      );
2668 
2669      /*
2670       * Test encoder configuration.
2671       *
2672       * If configuration fails and 'ret_failed' is not NULL it will
2673       * indicate which fields of the configuration caused the
2674       * error.
2675       */
2676      DFBResult (*TestEncoderConfiguration) (
2677           IDirectFBScreen                    *thiz,
2678           int                                 encoder,
2679           const DFBScreenEncoderConfig       *config,
2680           DFBScreenEncoderConfigFlags        *ret_failed
2681      );
2682 
2683      /*
2684       * Set encoder configuration.
2685       */
2686      DFBResult (*SetEncoderConfiguration) (
2687           IDirectFBScreen                    *thiz,
2688           int                                 encoder,
2689           const DFBScreenEncoderConfig       *config
2690      );
2691 
2692 
2693    /** Outputs **/
2694 
2695      /*
2696       * Get a description of available outputs.
2697       *
2698       * All descriptions are written to the array pointed to by
2699       * <b>ret_descriptions</b>. The number of outputs is returned by
2700       * IDirectFBScreen::GetDescription().
2701       */
2702      DFBResult (*GetOutputDescriptions) (
2703           IDirectFBScreen                    *thiz,
2704           DFBScreenOutputDescription         *ret_descriptions
2705      );
2706 
2707      /*
2708       * Get current output configuration.
2709       */
2710      DFBResult (*GetOutputConfiguration) (
2711           IDirectFBScreen                    *thiz,
2712           int                                 output,
2713           DFBScreenOutputConfig              *ret_config
2714      );
2715 
2716      /*
2717       * Test output configuration.
2718       *
2719       * If configuration fails and 'ret_failed' is not NULL it will
2720       * indicate which fields of the configuration caused the error.
2721       */
2722      DFBResult (*TestOutputConfiguration) (
2723           IDirectFBScreen                    *thiz,
2724           int                                 output,
2725           const DFBScreenOutputConfig        *config,
2726           DFBScreenOutputConfigFlags         *ret_failed
2727      );
2728 
2729      /*
2730       * Set output configuration.
2731       */
2732      DFBResult (*SetOutputConfiguration) (
2733           IDirectFBScreen                    *thiz,
2734           int                                 output,
2735           const DFBScreenOutputConfig        *config
2736      );
2737 
2738 
2739    /** Synchronization **/
2740 
2741      /*
2742       * Return current VSync count.
2743       */
2744      DFBResult (*GetVSyncCount) (
2745           IDirectFBScreen                    *thiz,
2746           unsigned long                      *ret_count
2747      );
2748 )
2749 
2750 
2751 /*************************
2752  * IDirectFBDisplayLayer *
2753  *************************/
2754 
2755 /*
2756  * <i>No summary yet...</i>
2757  */
2758 DEFINE_INTERFACE(   IDirectFBDisplayLayer,
2759 
2760    /** Information **/
2761 
2762      /*
2763       * Get the unique layer ID.
2764       */
2765      DFBResult (*GetID) (
2766           IDirectFBDisplayLayer              *thiz,
2767           DFBDisplayLayerID                  *ret_layer_id
2768      );
2769 
2770      /*
2771       * Get a description of this display layer, i.e. the capabilities.
2772       */
2773      DFBResult (*GetDescription) (
2774           IDirectFBDisplayLayer              *thiz,
2775           DFBDisplayLayerDescription         *ret_desc
2776      );
2777 
2778      /*
2779       * Get a description of available sources.
2780       *
2781       * All descriptions are written to the array pointed to by
2782       * <b>ret_descriptions</b>. The number of sources is returned by
2783       * IDirectFBDisplayLayer::GetDescription().
2784       */
2785      DFBResult (*GetSourceDescriptions) (
2786           IDirectFBDisplayLayer              *thiz,
2787           DFBDisplayLayerSourceDescription   *ret_descriptions
2788      );
2789 
2790      /*
2791       * For an interlaced display, this returns the currently inactive
2792       * field: 0 for the top field, and 1 for the bottom field.
2793       *
2794       * The inactive field is the one you should draw to next to avoid
2795       * tearing, the active field is the one currently being displayed.
2796       *
2797       * For a progressive output, this should always return 0.  We should
2798       * also have some other call to indicate whether the display layer
2799       * is interlaced or progressive, but this is a start.
2800       */
2801      DFBResult (*GetCurrentOutputField) (
2802           IDirectFBDisplayLayer              *thiz,
2803           int                                *ret_field
2804      );
2805 
2806 
2807    /** Interfaces **/
2808 
2809      /*
2810       * Get an interface to layer's surface.
2811       *
2812       * Only available in exclusive mode.
2813       */
2814      DFBResult (*GetSurface) (
2815           IDirectFBDisplayLayer              *thiz,
2816           IDirectFBSurface                  **ret_interface
2817      );
2818 
2819      /*
2820       * Get an interface to the screen to which the layer belongs.
2821       */
2822      DFBResult (*GetScreen) (
2823           IDirectFBDisplayLayer              *thiz,
2824           IDirectFBScreen                   **ret_interface
2825      );
2826 
2827 
2828    /** Configuration **/
2829 
2830      /*
2831       * Set cooperative level to get control over the layer
2832       * or the windows within this layer.
2833       */
2834      DFBResult (*SetCooperativeLevel) (
2835           IDirectFBDisplayLayer              *thiz,
2836           DFBDisplayLayerCooperativeLevel     level
2837      );
2838 
2839      /*
2840       * Get current layer configuration.
2841       */
2842      DFBResult (*GetConfiguration) (
2843           IDirectFBDisplayLayer              *thiz,
2844           DFBDisplayLayerConfig              *ret_config
2845      );
2846 
2847      /*
2848       * Test layer configuration.
2849       *
2850       * If configuration fails and 'failed' is not NULL it will
2851       * indicate which fields of the configuration caused the
2852       * error.
2853       */
2854      DFBResult (*TestConfiguration) (
2855           IDirectFBDisplayLayer              *thiz,
2856           const DFBDisplayLayerConfig        *config,
2857           DFBDisplayLayerConfigFlags         *ret_failed
2858      );
2859 
2860      /*
2861       * Set layer configuration.
2862       *
2863       * Only available in exclusive or administrative mode.
2864       */
2865      DFBResult (*SetConfiguration) (
2866           IDirectFBDisplayLayer              *thiz,
2867           const DFBDisplayLayerConfig        *config
2868      );
2869 
2870 
2871    /** Layout **/
2872 
2873      /*
2874       * Set location on screen as normalized values.
2875       *
2876       * So the whole screen is 0.0, 0.0, 1.0, 1.0.
2877       */
2878      DFBResult (*SetScreenLocation) (
2879           IDirectFBDisplayLayer              *thiz,
2880           float                               x,
2881           float                               y,
2882           float                               width,
2883           float                               height
2884      );
2885 
2886      /*
2887       * Set location on screen in pixels.
2888       */
2889      DFBResult (*SetScreenPosition) (
2890           IDirectFBDisplayLayer              *thiz,
2891           int                                 x,
2892           int                                 y
2893      );
2894 
2895      /*
2896       * Set location on screen in pixels.
2897       */
2898      DFBResult (*SetScreenRectangle) (
2899           IDirectFBDisplayLayer              *thiz,
2900           int                                 x,
2901           int                                 y,
2902           int                                 width,
2903           int                                 height
2904      );
2905 
2906 
2907    /** Misc Settings **/
2908 
2909      /*
2910       * Set global alpha factor for blending with layer(s) below.
2911       */
2912      DFBResult (*SetOpacity) (
2913           IDirectFBDisplayLayer              *thiz,
2914           u8                                  opacity
2915      );
2916 
2917      /*
2918       * Set the source rectangle.
2919       *
2920       * Only this part of the layer will be displayed.
2921       */
2922      DFBResult (*SetSourceRectangle) (
2923           IDirectFBDisplayLayer              *thiz,
2924           int                                 x,
2925           int                                 y,
2926           int                                 width,
2927           int                                 height
2928      );
2929 
2930      /*
2931       * For an interlaced display, this sets the field parity.
2932       *
2933       * field: 0 for top field first, and 1 for bottom field first.
2934       */
2935      DFBResult (*SetFieldParity) (
2936           IDirectFBDisplayLayer              *thiz,
2937           int                                 field
2938      );
2939 
2940      /*
2941       * Set the clipping region(s).
2942       *
2943       * If supported, this method sets the clipping <b>regions</b> that are used to
2944       * to enable or disable visibility of parts of the layer. The <b>num_regions</b>
2945       * must not exceed the limit as stated in the display layer description.
2946       *
2947       * If <b>positive</b> is DFB_TRUE the layer will be shown only in these regions,
2948       * otherwise it's shown as usual except in these regions.
2949       *
2950       * Also see IDirectFBDisplayLayer::GetDescription().
2951       */
2952      DFBResult (*SetClipRegions) (
2953           IDirectFBDisplayLayer              *thiz,
2954           const DFBRegion                    *regions,
2955           int                                 num_regions,
2956           DFBBoolean                          positive
2957      );
2958 
2959 
2960    /** Color keys **/
2961 
2962      /*
2963       * Set the source color key.
2964       *
2965       * If a pixel of the layer matches this color the underlying
2966       * pixel is visible at this point.
2967       */
2968      DFBResult (*SetSrcColorKey) (
2969           IDirectFBDisplayLayer              *thiz,
2970           u8                                  r,
2971           u8                                  g,
2972           u8                                  b
2973      );
2974 
2975      /*
2976       * Set the destination color key.
2977       *
2978       * The layer is only visible at points where the underlying
2979       * pixel matches this color.
2980       */
2981      DFBResult (*SetDstColorKey) (
2982           IDirectFBDisplayLayer              *thiz,
2983           u8                                  r,
2984           u8                                  g,
2985           u8                                  b
2986      );
2987 
2988 
2989    /** Z Order **/
2990 
2991      /*
2992       * Get the current display layer level.
2993       *
2994       * The level describes the z axis position of a layer. The
2995       * primary layer is always on level zero unless a special
2996       * driver adds support for level adjustment on the primary
2997       * layer.  Layers above have a positive level, e.g. video
2998       * overlays.  Layers below have a negative level, e.g. video
2999       * underlays or background layers.
3000       */
3001      DFBResult (*GetLevel) (
3002           IDirectFBDisplayLayer              *thiz,
3003           int                                *ret_level
3004      );
3005 
3006      /*
3007       * Set the display layer level.
3008       *
3009       * Moves the layer to the specified level. The order of all
3010       * other layers won't be changed. Note that only a few
3011       * layers support level adjustment which is reflected by
3012       * their capabilities.
3013       */
3014      DFBResult (*SetLevel) (
3015           IDirectFBDisplayLayer              *thiz,
3016           int                                 level
3017      );
3018 
3019 
3020    /** Background handling **/
3021 
3022      /*
3023       * Set the erase behaviour for windowstack repaints.
3024       *
3025       * Only available in exclusive or administrative mode.
3026       */
3027      DFBResult (*SetBackgroundMode) (
3028           IDirectFBDisplayLayer              *thiz,
3029           DFBDisplayLayerBackgroundMode       mode
3030      );
3031 
3032      /*
3033       * Set the background image for the imaged background mode.
3034       *
3035       * Only available in exclusive or administrative mode.
3036       */
3037      DFBResult (*SetBackgroundImage) (
3038           IDirectFBDisplayLayer              *thiz,
3039           IDirectFBSurface                   *surface
3040      );
3041 
3042      /*
3043       * Set the color for a solid colored background.
3044       *
3045       * Only available in exclusive or administrative mode.
3046       */
3047      DFBResult (*SetBackgroundColor) (
3048           IDirectFBDisplayLayer              *thiz,
3049           u8                                  r,
3050           u8                                  g,
3051           u8                                  b,
3052           u8                                  a
3053      );
3054 
3055    /** Color adjustment **/
3056 
3057      /*
3058       * Get the layers color adjustment.
3059       */
3060      DFBResult (*GetColorAdjustment) (
3061           IDirectFBDisplayLayer              *thiz,
3062           DFBColorAdjustment                 *ret_adj
3063      );
3064 
3065      /*
3066       * Set the layers color adjustment.
3067       *
3068       * Only available in exclusive or administrative mode.
3069       *
3070       * This function only has an effect if the underlying
3071       * hardware supports this operation. Check the layers
3072       * capabilities to find out if this is the case.
3073       */
3074      DFBResult (*SetColorAdjustment) (
3075           IDirectFBDisplayLayer              *thiz,
3076           const DFBColorAdjustment           *adj
3077      );
3078 
3079 
3080    /** Windows **/
3081 
3082      /*
3083       * Create a window within this layer given a
3084       * description of the window that is to be created.
3085       */
3086      DFBResult (*CreateWindow) (
3087           IDirectFBDisplayLayer              *thiz,
3088           const DFBWindowDescription         *desc,
3089           IDirectFBWindow                   **ret_interface
3090      );
3091 
3092      /*
3093       * Retrieve an interface to an existing window.
3094       *
3095       * The window is identified by its window id.
3096       */
3097      DFBResult (*GetWindow) (
3098           IDirectFBDisplayLayer              *thiz,
3099           DFBWindowID                         window_id,
3100           IDirectFBWindow                   **ret_interface
3101      );
3102 
3103 
3104    /** Cursor handling **/
3105 
3106      /*
3107       * Enable/disable the mouse cursor for this layer.
3108       *
3109       * Windows on a layer will only receive motion events if
3110       * the cursor is enabled. This function is only available
3111       * in exclusive/administrative mode.
3112       */
3113      DFBResult (*EnableCursor) (
3114           IDirectFBDisplayLayer              *thiz,
3115           int                                 enable
3116      );
3117 
3118      /*
3119       * Returns the x/y coordinates of the layer's mouse cursor.
3120       */
3121      DFBResult (*GetCursorPosition) (
3122           IDirectFBDisplayLayer              *thiz,
3123           int                                *ret_x,
3124           int                                *ret_y
3125      );
3126 
3127      /*
3128       * Move cursor to specified position.
3129       *
3130       * Handles movement like a real one, i.e. generates events.
3131       */
3132      DFBResult (*WarpCursor) (
3133           IDirectFBDisplayLayer              *thiz,
3134           int                                 x,
3135           int                                 y
3136      );
3137 
3138      /*
3139       * Set cursor acceleration.
3140       *
3141       * Sets the acceleration of cursor movements. The amount
3142       * beyond the 'threshold' will be multiplied with the
3143       * acceleration factor. The acceleration factor is
3144       * 'numerator/denominator'.
3145       */
3146      DFBResult (*SetCursorAcceleration) (
3147           IDirectFBDisplayLayer              *thiz,
3148           int                                 numerator,
3149           int                                 denominator,
3150           int                                 threshold
3151      );
3152 
3153      /*
3154       * Set the cursor shape and the hotspot.
3155       */
3156      DFBResult (*SetCursorShape) (
3157           IDirectFBDisplayLayer              *thiz,
3158           IDirectFBSurface                   *shape,
3159           int                                 hot_x,
3160           int                                 hot_y
3161      );
3162 
3163      /*
3164       * Set the cursor opacity.
3165       *
3166       * This function is especially useful if you want
3167       * to hide the cursor but still want windows on this
3168       * display layer to receive motion events. In this
3169       * case, simply set the cursor opacity to zero.
3170       */
3171      DFBResult (*SetCursorOpacity) (
3172           IDirectFBDisplayLayer              *thiz,
3173           u8                                  opacity
3174      );
3175 
3176 
3177    /** Synchronization **/
3178 
3179      /*
3180       * Wait for next vertical retrace.
3181       */
3182      DFBResult (*WaitForSync) (
3183           IDirectFBDisplayLayer              *thiz
3184      );
3185 
3186 
3187    /** Contexts **/
3188 
3189      /*
3190       * Switch the layer context.
3191       *
3192       * Switches to the shared context unless <b>exclusive</b> is DFB_TRUE
3193       * and the cooperative level of this interface is DLSCL_EXCLUSIVE.
3194       */
3195      DFBResult (*SwitchContext) (
3196           IDirectFBDisplayLayer              *thiz,
3197           DFBBoolean                          exclusive
3198      );
3199 
3200 
3201    /** Rotation **/
3202 
3203      /*
3204       * Set the rotation of data within the layer.
3205       *
3206       * Only available in exclusive or administrative mode.
3207       *
3208       * Any <b>rotation</b> other than 0, 90, 180 or 270 is not supported.
3209       *
3210       * No layer hardware feature usage, only rotated blitting is used.
3211       */
3212      DFBResult (*SetRotation) (
3213           IDirectFBDisplayLayer              *thiz,
3214           int                                 rotation
3215      );
3216 
3217      /*
3218       * Get the rotation of data within the layer.
3219       */
3220      DFBResult (*GetRotation) (
3221           IDirectFBDisplayLayer              *thiz,
3222           int                                *ret_rotation
3223      );
3224 
3225 
3226    /** Windows **/
3227 
3228      /*
3229       * Retrieve an interface to an existing window.
3230       *
3231       * The window is identified by its surface' resource id.
3232       */
3233      DFBResult (*GetWindowByResourceID) (
3234           IDirectFBDisplayLayer              *thiz,
3235           unsigned long                       resource_id,
3236           IDirectFBWindow                   **ret_interface
3237      );
3238 )
3239 
3240 
3241 /*
3242  * Flipping flags controlling the behaviour of IDirectFBSurface::Flip().
3243  */
3244 typedef enum {
3245      DSFLIP_NONE         = 0x00000000,  /* None of these. */
3246 
3247      DSFLIP_WAIT         = 0x00000001,  /* Flip() returns upon vertical sync. Flipping is still done
3248                                            immediately unless DSFLIP_ONSYNC is specified, too.  */
3249      DSFLIP_BLIT         = 0x00000002,  /* Copy from back buffer to front buffer rather than
3250                                            just swapping these buffers. This behaviour is enforced
3251                                            if the region passed to Flip() is not NULL or if the
3252                                            surface being flipped is a sub surface. */
3253      DSFLIP_ONSYNC       = 0x00000004,  /* Do the actual flipping upon the next vertical sync.
3254                                            The Flip() method will still return immediately unless
3255                                            DSFLIP_WAIT is specified, too. */
3256 
3257      DSFLIP_PIPELINE     = 0x00000008,
3258 
3259      DSFLIP_ONCE         = 0x00000010,
3260 
3261      DSFLIP_QUEUE        = 0x00000100,
3262      DSFLIP_FLUSH        = 0x00000200,
3263 
3264      DSFLIP_WAITFORSYNC  = DSFLIP_WAIT | DSFLIP_ONSYNC
3265 } DFBSurfaceFlipFlags;
3266 
3267 /*
3268  * Flags controlling the text layout.
3269  */
3270 typedef enum {
3271      DSTF_LEFT           = 0x00000000,  /* left aligned */
3272      DSTF_CENTER         = 0x00000001,  /* horizontally centered */
3273      DSTF_RIGHT          = 0x00000002,  /* right aligned */
3274 
3275      DSTF_TOP            = 0x00000004,  /* y specifies the top
3276                                            instead of the baseline */
3277      DSTF_BOTTOM         = 0x00000008,  /* y specifies the bottom
3278                                            instead of the baseline */
3279 
3280      DSTF_OUTLINE        = 0x00000010,  /* enables outline rendering if loaded font supports it */
3281 
3282      DSTF_TOPLEFT        = DSTF_TOP | DSTF_LEFT,
3283      DSTF_TOPCENTER      = DSTF_TOP | DSTF_CENTER,
3284      DSTF_TOPRIGHT       = DSTF_TOP | DSTF_RIGHT,
3285 
3286      DSTF_BOTTOMLEFT     = DSTF_BOTTOM | DSTF_LEFT,
3287      DSTF_BOTTOMCENTER   = DSTF_BOTTOM | DSTF_CENTER,
3288      DSTF_BOTTOMRIGHT    = DSTF_BOTTOM | DSTF_RIGHT
3289 } DFBSurfaceTextFlags;
3290 
3291 /*
3292  * Flags defining the type of data access.
3293  * These are important for surface swapping management.
3294  */
3295 typedef enum {
3296      DSLF_READ           = 0x00000001,  /* Request read access while
3297                                            surface is locked. */
3298      DSLF_WRITE          = 0x00000002   /* Request write access. If
3299                                            specified and surface has
3300                                            a back buffer, it will be
3301                                            used. Otherwise, the front
3302                                            buffer is used. */
3303 } DFBSurfaceLockFlags;
3304 
3305 /*
3306  * Available Porter/Duff rules.
3307  *
3308  * pixel = (source * fs + destination * fd),
3309  * sa = source alpha,
3310  * da = destination alpha
3311  */
3312 typedef enum {
3313      DSPD_NONE           =  0, /* fs: sa      fd: 1.0-sa (defaults) */
3314      DSPD_CLEAR          =  1, /* fs: 0.0     fd: 0.0    */
3315      DSPD_SRC            =  2, /* fs: 1.0     fd: 0.0    */
3316      DSPD_SRC_OVER       =  3, /* fs: 1.0     fd: 1.0-sa */
3317      DSPD_DST_OVER       =  4, /* fs: 1.0-da  fd: 1.0    */
3318      DSPD_SRC_IN         =  5, /* fs: da      fd: 0.0    */
3319      DSPD_DST_IN         =  6, /* fs: 0.0     fd: sa     */
3320      DSPD_SRC_OUT        =  7, /* fs: 1.0-da  fd: 0.0    */
3321      DSPD_DST_OUT        =  8, /* fs: 0.0     fd: 1.0-sa */
3322      DSPD_SRC_ATOP       =  9, /* fs: da      fd: 1.0-sa */
3323      DSPD_DST_ATOP       = 10, /* fs: 1.0-da  fd: sa     */
3324      DSPD_ADD            = 11, /* fs: 1.0     fd: 1.0    */
3325      DSPD_XOR            = 12, /* fs: 1.0-da  fd: 1.0-sa */
3326      DSPD_DST            = 13, /* fs: 0.0     fd: 1.0    */
3327 } DFBSurfacePorterDuffRule;
3328 
3329 /*
3330  * Blend functions to use for source and destination blending
3331  */
3332 typedef enum {
3333      /*
3334       * pixel color = sc * cf[sf] + dc * cf[df]
3335       * pixel alpha = sa * af[sf] + da * af[df]
3336       * sc = source color
3337       * sa = source alpha
3338       * dc = destination color
3339       * da = destination alpha
3340       * sf = source blend function
3341       * df = destination blend function
3342       * cf[x] = color factor for blend function x
3343       * af[x] = alpha factor for blend function x
3344       */
3345      DSBF_UNKNOWN            = 0,  /*                             */
3346      DSBF_ZERO               = 1,  /* cf:    0           af:    0 */
3347      DSBF_ONE                = 2,  /* cf:    1           af:    1 */
3348      DSBF_SRCCOLOR           = 3,  /* cf:   sc           af:   sa */
3349      DSBF_INVSRCCOLOR        = 4,  /* cf: 1-sc           af: 1-sa */
3350      DSBF_SRCALPHA           = 5,  /* cf:   sa           af:   sa */
3351      DSBF_INVSRCALPHA        = 6,  /* cf: 1-sa           af: 1-sa */
3352      DSBF_DESTALPHA          = 7,  /* cf:   da           af:   da */
3353      DSBF_INVDESTALPHA       = 8,  /* cf: 1-da           af: 1-da */
3354      DSBF_DESTCOLOR          = 9,  /* cf:   dc           af:   da */
3355      DSBF_INVDESTCOLOR       = 10, /* cf: 1-dc           af: 1-da */
3356      DSBF_SRCALPHASAT        = 11, /* cf: min(sa, 1-da)  af:    1 */
3357 } DFBSurfaceBlendFunction;
3358 
3359 /*
3360  * Transformed vertex of a textured triangle.
3361  */
3362 typedef struct {
3363      float x;   /* Destination X coordinate (in pixels) */
3364      float y;   /* Destination Y coordinate (in pixels) */
3365      float z;   /* Z coordinate */
3366      float w;   /* W coordinate */
3367 
3368      float s;   /* Texture S coordinate */
3369      float t;   /* Texture T coordinate */
3370 } DFBVertex;
3371 
3372 /*
3373  * Way of building triangles from the list of vertices.
3374  */
3375 typedef enum {
3376      DTTF_LIST,  /* 0/1/2  3/4/5  6/7/8 ... */
3377      DTTF_STRIP, /* 0/1/2  1/2/3  2/3/4 ... */
3378      DTTF_FAN    /* 0/1/2  0/2/3  0/3/4 ... */
3379 } DFBTriangleFormation;
3380 
3381 /*
3382  * Flags controlling surface masks set via IDirectFBSurface::SetSourceMask().
3383  */
3384 typedef enum {
3385      DSMF_NONE      = 0x00000000,  /* None of these. */
3386 
3387      DSMF_STENCIL   = 0x00000001,  /* Take <b>x</b> and <b>y</b> as fixed start coordinates in the mask. */
3388 
3389      DSMF_ALL       = 0x00000001,  /* All of these. */
3390 } DFBSurfaceMaskFlags;
3391 
3392 /********************
3393  * IDirectFBSurface *
3394  ********************/
3395 
3396 /*
3397  * <i>No summary yet...</i>
3398  */
3399 DEFINE_INTERFACE(   IDirectFBSurface,
3400 
3401    /** Retrieving information **/
3402 
3403      /*
3404       * Return the capabilities of this surface.
3405       */
3406      DFBResult (*GetCapabilities) (
3407           IDirectFBSurface         *thiz,
3408           DFBSurfaceCapabilities   *ret_caps
3409      );
3410 
3411      /*
3412       * Get the surface's position in pixels.
3413       */
3414      DFBResult (*GetPosition) (
3415           IDirectFBSurface         *thiz,
3416           int                      *ret_x,
3417           int                      *ret_y
3418      );
3419 
3420      /*
3421       * Get the surface's width and height in pixels.
3422       */
3423      DFBResult (*GetSize) (
3424           IDirectFBSurface         *thiz,
3425           int                      *ret_width,
3426           int                      *ret_height
3427      );
3428 
3429      /*
3430       * Created sub surfaces might be clipped by their parents,
3431       * this function returns the resulting rectangle relative
3432       * to this surface.
3433       *
3434       * For non sub surfaces this function returns
3435       * { 0, 0, width, height }.
3436       */
3437      DFBResult (*GetVisibleRectangle) (
3438           IDirectFBSurface         *thiz,
3439           DFBRectangle             *ret_rect
3440      );
3441 
3442      /*
3443       * Get the current pixel format.
3444       */
3445      DFBResult (*GetPixelFormat) (
3446           IDirectFBSurface         *thiz,
3447           DFBSurfacePixelFormat    *ret_format
3448      );
3449 
3450      /*
3451       * Get a mask of drawing functions that are hardware
3452       * accelerated with the current settings.
3453       *
3454       * If a source surface is specified the mask will also
3455       * contain accelerated blitting functions.  Note that there
3456       * is no guarantee that these will actually be accelerated
3457       * since the surface storage (video/system) is examined only
3458       * when something actually gets drawn or blitted.
3459       */
3460      DFBResult (*GetAccelerationMask) (
3461           IDirectFBSurface         *thiz,
3462           IDirectFBSurface         *source,
3463           DFBAccelerationMask      *ret_mask
3464      );
3465 
3466 
3467    /** Palette & Alpha Ramp **/
3468 
3469      /*
3470       * Get access to the surface's palette.
3471       *
3472       * Returns an interface that can be used to gain
3473       * read and/or write access to the surface's palette.
3474       */
3475      DFBResult (*GetPalette) (
3476           IDirectFBSurface         *thiz,
3477           IDirectFBPalette        **ret_interface
3478      );
3479 
3480      /*
3481       * Change the surface's palette.
3482       */
3483      DFBResult (*SetPalette) (
3484           IDirectFBSurface         *thiz,
3485           IDirectFBPalette         *palette
3486      );
3487 
3488      /*
3489       * Set the alpha ramp for formats with one or two alpha bits.
3490       *
3491       * Either all four values or the first and the
3492       * last one are used, depending on the format.
3493       * Default values are: 0x00, 0x55, 0xaa, 0xff.
3494       */
3495      DFBResult (*SetAlphaRamp) (
3496           IDirectFBSurface         *thiz,
3497           u8                        a0,
3498           u8                        a1,
3499           u8                        a2,
3500           u8                        a3
3501      );
3502 
3503 
3504    /** Buffer operations **/
3505 
3506      /*
3507       * Lock the surface for the access type specified.
3508       *
3509       * Returns a data pointer and the line pitch of it.<br>
3510       * <br>
3511       * <b>Note:</b> If the surface is double/triple buffered and
3512       * the DSLF_WRITE flag is specified, the pointer is to the back
3513       * buffer.  In all other cases, the pointer is to the front
3514       * buffer.
3515       */
3516      DFBResult (*Lock) (
3517           IDirectFBSurface         *thiz,
3518           DFBSurfaceLockFlags       flags,
3519           void                    **ret_ptr,
3520           int                      *ret_pitch
3521      );
3522 
3523      /*
3524       * Obsolete. Returns DFB_FAILURE always.
3525       *
3526       * Previously returned the framebuffer offset of a locked surface.
3527       * However, it is not a safe API to use at all, since it is not
3528       * guaranteed that the offset actually belongs to fbmem (e.g. could be AGP memory).
3529       */
3530      DFBResult (*GetFramebufferOffset) (
3531           IDirectFBSurface *thiz,
3532           int              *offset
3533      );
3534 
3535      /*
3536       * Unlock the surface after direct access.
3537       */
3538      DFBResult (*Unlock) (
3539           IDirectFBSurface         *thiz
3540      );
3541 
3542      /*
3543       * Flip/Update surface buffers.
3544       *
3545       * If no region is specified the whole surface is flipped,
3546       * otherwise blitting is used to update the region.
3547       * If surface capabilities don't include DSCAPS_FLIPPING,
3548       * this method has the effect to make visible changes
3549       * made to the surface contents.
3550       */
3551      DFBResult (*Flip) (
3552           IDirectFBSurface         *thiz,
3553           const DFBRegion          *region,
3554           DFBSurfaceFlipFlags       flags
3555      );
3556 
3557      /*
3558       * Set the active field.
3559       *
3560       * Interlaced surfaces consist of two fields. Software driven
3561       * deinterlacing uses this method to manually switch the field
3562       * that is displayed, e.g. scaled up vertically by two.
3563       */
3564      DFBResult (*SetField) (
3565           IDirectFBSurface         *thiz,
3566           int                       field
3567      );
3568 
3569      /*
3570       * Clear the surface and its depth buffer if existent.
3571       *
3572       * Fills the whole (sub) surface with the specified color while ignoring
3573       * drawing flags and color of the current state, but limited to the current clip.
3574       *
3575       * As with all drawing and blitting functions the backbuffer is written to.
3576       * If you are initializing a double buffered surface you may want to clear both
3577       * buffers by doing a Clear-Flip-Clear sequence.
3578       */
3579      DFBResult (*Clear) (
3580           IDirectFBSurface         *thiz,
3581           u8                        r,
3582           u8                        g,
3583           u8                        b,
3584           u8                        a
3585      );
3586 
3587 
3588    /** Drawing/blitting control **/
3589 
3590      /*
3591       * Set the clipping region used to limit the area for
3592       * drawing, blitting and text functions.
3593       *
3594       * If no region is specified (NULL passed) the clip is set
3595       * to the surface extents (initial clip).
3596       */
3597      DFBResult (*SetClip) (
3598           IDirectFBSurface         *thiz,
3599           const DFBRegion          *clip
3600      );
3601 
3602      /*
3603       * Get the clipping region used to limit the area for
3604       * drawing, blitting and text functions.
3605       */
3606      DFBResult (*GetClip) (
3607           IDirectFBSurface         *thiz,
3608           DFBRegion                *ret_clip
3609      );
3610 
3611      /*
3612       * Set the color used for drawing/text functions or
3613       * alpha/color modulation (blitting functions).
3614       *
3615       * If you are not using the alpha value it should be set to
3616       * 0xff to ensure visibility when the code is ported to or
3617       * used for surfaces with an alpha channel.
3618       *
3619       * This method should be avoided for surfaces with an indexed
3620       * pixelformat, e.g. DSPF_LUT8, otherwise an expensive search
3621       * in the color/alpha lookup table occurs.
3622       */
3623      DFBResult (*SetColor) (
3624           IDirectFBSurface         *thiz,
3625           u8                        r,
3626           u8                        g,
3627           u8                        b,
3628           u8                        a
3629      );
3630 
3631      /*
3632       * Set the color like with SetColor() but using
3633       * an index to the color/alpha lookup table.
3634       *
3635       * This method is only supported by surfaces with an
3636       * indexed pixelformat, e.g. DSPF_LUT8. For these formats
3637       * this method should be used instead of SetColor().
3638       */
3639      DFBResult (*SetColorIndex) (
3640           IDirectFBSurface         *thiz,
3641           unsigned int              index
3642      );
3643 
3644      /*
3645       * Set the blend function that applies to the source.
3646       */
3647      DFBResult (*SetSrcBlendFunction) (
3648           IDirectFBSurface         *thiz,
3649           DFBSurfaceBlendFunction   function
3650      );
3651 
3652      /*
3653       * Set the blend function that applies to the destination.
3654       */
3655      DFBResult (*SetDstBlendFunction) (
3656           IDirectFBSurface         *thiz,
3657           DFBSurfaceBlendFunction   function
3658      );
3659 
3660      /*
3661       * Set the source and destination blend function by
3662       * specifying a Porter/Duff rule.
3663       */
3664      DFBResult (*SetPorterDuff) (
3665           IDirectFBSurface         *thiz,
3666           DFBSurfacePorterDuffRule  rule
3667      );
3668 
3669      /*
3670       * Set the source color key, i.e. the color that is excluded
3671       * when blitting FROM this surface TO another that has
3672       * source color keying enabled.
3673       */
3674      DFBResult (*SetSrcColorKey) (
3675           IDirectFBSurface         *thiz,
3676           u8                        r,
3677           u8                        g,
3678           u8                        b
3679      );
3680 
3681      /*
3682       * Set the source color key like with SetSrcColorKey() but using
3683       * an index to the color/alpha lookup table.
3684       *
3685       * This method is only supported by surfaces with an
3686       * indexed pixelformat, e.g. DSPF_LUT8. For these formats
3687       * this method should be used instead of SetSrcColorKey().
3688       */
3689      DFBResult (*SetSrcColorKeyIndex) (
3690           IDirectFBSurface         *thiz,
3691           unsigned int              index
3692      );
3693 
3694      /*
3695       * Set the destination color key, i.e. the only color that
3696       * gets overwritten by drawing and blitting to this surface
3697       * when destination color keying is enabled.
3698       */
3699      DFBResult (*SetDstColorKey) (
3700           IDirectFBSurface         *thiz,
3701           u8                        r,
3702           u8                        g,
3703           u8                        b
3704      );
3705 
3706      /*
3707       * Set the destination color key like with SetDstColorKey() but using
3708       * an index to the color/alpha lookup table.
3709       *
3710       * This method is only supported by surfaces with an
3711       * indexed pixelformat, e.g. DSPF_LUT8. For these formats
3712       * this method should be used instead of SetDstColorKey().
3713       */
3714      DFBResult (*SetDstColorKeyIndex) (
3715           IDirectFBSurface         *thiz,
3716           unsigned int              index
3717      );
3718 
3719 
3720 
3721    /** Blitting functions **/
3722 
3723      /*
3724       * Set the flags for all subsequent blitting commands.
3725       */
3726      DFBResult (*SetBlittingFlags) (
3727           IDirectFBSurface         *thiz,
3728           DFBSurfaceBlittingFlags   flags
3729      );
3730 
3731      /*
3732       * Blit an area from the source to this surface.
3733       *
3734       * Pass a NULL rectangle to use the whole source surface.
3735       * Source may be the same surface.
3736       */
3737      DFBResult (*Blit) (
3738           IDirectFBSurface         *thiz,
3739           IDirectFBSurface         *source,
3740           const DFBRectangle       *source_rect,
3741           int                       x,
3742           int                       y
3743      );
3744 
3745      /*
3746       * Blit an area from the source tiled to this surface.
3747       *
3748       * Pass a NULL rectangle to use the whole source surface.
3749       * Source may be the same surface.
3750       */
3751      DFBResult (*TileBlit) (
3752           IDirectFBSurface         *thiz,
3753           IDirectFBSurface         *source,
3754           const DFBRectangle       *source_rect,
3755           int                       x,
3756           int                       y
3757      );
3758 
3759      /*
3760       * Blit a bunch of areas at once.
3761       *
3762       * Source may be the same surface.
3763       */
3764      DFBResult (*BatchBlit) (
3765           IDirectFBSurface         *thiz,
3766           IDirectFBSurface         *source,
3767           const DFBRectangle       *source_rects,
3768           const DFBPoint           *dest_points,
3769           int                       num
3770      );
3771 
3772      /*
3773       * Blit an area scaled from the source to the destination
3774       * rectangle.
3775       *
3776       * Pass a NULL rectangle to use the whole source surface.
3777       */
3778      DFBResult (*StretchBlit) (
3779           IDirectFBSurface         *thiz,
3780           IDirectFBSurface         *source,
3781           const DFBRectangle       *source_rect,
3782           const DFBRectangle       *destination_rect
3783      );
3784 
3785      /*
3786       * Preliminary texture mapping support.
3787       *
3788       * Maps a <b>texture</b> onto triangles being built
3789       * from <b>vertices</b> according to the chosen <b>formation</b>.
3790       *
3791       * Optional <b>indices</b> can be used to avoid rearrangement of vertex lists,
3792       * otherwise the vertex list is processed consecutively, i.e. as if <b>indices</b>
3793       * are ascending numbers starting at zero.
3794       *
3795       * Either the number of <b>indices</b> (if non NULL) or the number of <b>vertices</b> is
3796       * specified by <b>num</b> and has to be three at least. If the chosen <b>formation</b>
3797       * is DTTF_LIST it also has to be a multiple of three.
3798       */
3799      DFBResult (*TextureTriangles) (
3800           IDirectFBSurface         *thiz,
3801           IDirectFBSurface         *texture,
3802           const DFBVertex          *vertices,
3803           const int                *indices,
3804           int                       num,
3805           DFBTriangleFormation      formation
3806      );
3807 
3808 
3809    /** Drawing functions **/
3810 
3811      /*
3812       * Set the flags for all subsequent drawing commands.
3813       */
3814      DFBResult (*SetDrawingFlags) (
3815           IDirectFBSurface         *thiz,
3816           DFBSurfaceDrawingFlags    flags
3817      );
3818 
3819      /*
3820       * Fill the specified rectangle with the given color
3821       * following the specified flags.
3822       */
3823      DFBResult (*FillRectangle) (
3824           IDirectFBSurface         *thiz,
3825           int                       x,
3826           int                       y,
3827           int                       w,
3828           int                       h
3829      );
3830 
3831      /*
3832       * Draw an outline of the specified rectangle with the given
3833       * color following the specified flags.
3834       */
3835      DFBResult (*DrawRectangle) (
3836           IDirectFBSurface         *thiz,
3837           int                       x,
3838           int                       y,
3839           int                       w,
3840           int                       h
3841      );
3842 
3843      /*
3844       * Draw a line from one point to the other with the given color
3845       * following the drawing flags.
3846       */
3847      DFBResult (*DrawLine) (
3848           IDirectFBSurface         *thiz,
3849           int                       x1,
3850           int                       y1,
3851           int                       x2,
3852           int                       y2
3853      );
3854 
3855      /*
3856       * Draw 'num_lines' lines with the given color following the
3857       * drawing flags. Each line specified by a DFBRegion.
3858       */
3859      DFBResult (*DrawLines) (
3860           IDirectFBSurface         *thiz,
3861           const DFBRegion          *lines,
3862           unsigned int              num_lines
3863      );
3864 
3865      /*
3866       * Fill a non-textured triangle.
3867       */
3868      DFBResult (*FillTriangle) (
3869           IDirectFBSurface         *thiz,
3870           int                       x1,
3871           int                       y1,
3872           int                       x2,
3873           int                       y2,
3874           int                       x3,
3875           int                       y3
3876      );
3877 
3878      /*
3879       * Fill a bunch of rectangles with a single call.
3880       *
3881       * Fill <b>num</b> rectangles with the current color following the
3882       * drawing flags. Each rectangle specified by a DFBRectangle.
3883       */
3884      DFBResult (*FillRectangles) (
3885           IDirectFBSurface         *thiz,
3886           const DFBRectangle       *rects,
3887           unsigned int              num
3888      );
3889 
3890      /*
3891       * Fill spans specified by x and width.
3892       *
3893       * Fill <b>num</b> spans with the given color following the
3894       * drawing flags. Each span is specified by a DFBSpan.
3895       */
3896      DFBResult (*FillSpans) (
3897           IDirectFBSurface         *thiz,
3898           int                       y,
3899           const DFBSpan            *spans,
3900           unsigned int              num
3901      );
3902 
3903      /*
3904       * Fill a bunch of triangles with a single call.
3905       *
3906       * Fill <b>num</b> triangles with the current color following the
3907       * drawing flags. Each triangle specified by a DFBTriangle.
3908       */
3909      DFBResult (*FillTriangles) (
3910           IDirectFBSurface         *thiz,
3911           const DFBTriangle        *tris,
3912           unsigned int              num
3913      );
3914 
3915 
3916    /** Text functions **/
3917 
3918      /*
3919       * Set the font used by DrawString() and DrawGlyph().
3920       * You can pass NULL here to unset the font.
3921       */
3922      DFBResult (*SetFont) (
3923           IDirectFBSurface         *thiz,
3924           IDirectFBFont            *font
3925      );
3926 
3927      /*
3928       * Get the font associated with a surface.
3929       *
3930       * This function increases the font's reference count.
3931       */
3932      DFBResult (*GetFont) (
3933           IDirectFBSurface         *thiz,
3934           IDirectFBFont           **ret_font
3935      );
3936 
3937      /*
3938       * Draw a string at the specified position with the
3939       * given color following the specified flags.
3940       *
3941       * Bytes specifies the number of bytes to take from the
3942       * string or -1 for the complete NULL-terminated string. You
3943       * need to set a font using the SetFont() method before
3944       * calling this function.
3945       */
3946      DFBResult (*DrawString) (
3947           IDirectFBSurface         *thiz,
3948           const char               *text,
3949           int                       bytes,
3950           int                       x,
3951           int                       y,
3952           DFBSurfaceTextFlags       flags
3953      );
3954 
3955      /*
3956       * Draw a single glyph specified by its character code at the
3957       * specified position with the given color following the
3958       * specified flags.
3959       *
3960       * If font was loaded with the DFFA_NOCHARMAP flag, index specifies
3961       * the raw glyph index in the font.
3962       *
3963       * You need to set a font using the SetFont() method before
3964       * calling this function.
3965       */
3966      DFBResult (*DrawGlyph) (
3967           IDirectFBSurface         *thiz,
3968           unsigned int              character,
3969           int                       x,
3970           int                       y,
3971           DFBSurfaceTextFlags       flags
3972      );
3973 
3974      /*
3975       * Change the encoding used for text rendering.
3976       */
3977      DFBResult (*SetEncoding) (
3978           IDirectFBSurface         *thiz,
3979           DFBTextEncodingID         encoding
3980      );
3981 
3982 
3983    /** Lightweight helpers **/
3984 
3985      /*
3986       * Get an interface to a sub area of this surface.
3987       *
3988       * No image data is duplicated, this is a clipped graphics
3989       * within the original surface. This is very helpful for
3990       * lightweight components in a GUI toolkit.  The new
3991       * surface's state (color, drawingflags, etc.) is
3992       * independent from this one. So it's a handy graphics
3993       * context.  If no rectangle is specified, the whole surface
3994       * (or a part if this surface is a subsurface itself) is
3995       * represented by the new one.
3996       */
3997      DFBResult (*GetSubSurface) (
3998           IDirectFBSurface         *thiz,
3999           const DFBRectangle       *rect,
4000           IDirectFBSurface        **ret_interface
4001      );
4002 
4003 
4004    /** OpenGL **/
4005 
4006      /*
4007       * Get a unique OpenGL context for this surface.
4008       */
4009      DFBResult (*GetGL) (
4010           IDirectFBSurface         *thiz,
4011           IDirectFBGL             **ret_interface
4012      );
4013 
4014 
4015    /** Debug **/
4016 
4017      /*
4018       * Dump the contents of the surface to one or two files.
4019       *
4020       * Creates a PPM file containing the RGB data and a PGM file with
4021       * the alpha data if present.
4022       *
4023       * The complete filenames will be
4024       * <b>directory</b>/<b>prefix</b>_<i>####</i>.ppm for RGB and
4025       * <b>directory</b>/<b>prefix</b>_<i>####</i>.pgm for the alpha channel
4026       * if present. Example: "/directory/prefix_0000.ppm". No existing files
4027       * will be overwritten.
4028       */
4029      DFBResult (*Dump) (
4030           IDirectFBSurface         *thiz,
4031           const char               *directory,
4032           const char               *prefix
4033      );
4034 
4035      /*
4036       * Disable hardware acceleration.
4037       *
4038       * If any function in <b>mask</b> is set, acceleration will not be used for it.<br/>
4039       * Default is DFXL_NONE.
4040       */
4041      DFBResult (*DisableAcceleration) (
4042           IDirectFBSurface         *thiz,
4043           DFBAccelerationMask       mask
4044      );
4045 
4046 
4047    /** Resources **/
4048 
4049      /*
4050       * Release possible reference to source surface.
4051       *
4052       * For performance reasons the last surface that has been used for Blit() and others stays
4053       * attached to the state of the destination surface to save the overhead of reprogramming
4054       * the same values each time.
4055       *
4056       * That leads to the last source being still around regardless of it being released
4057       * via its own interface. The worst case is generation of thumbnails using StretchBlit()
4058       * from a huge surface to a small one. The small thumbnail surface keeps the big one alive,
4059       * because no other blitting will be done to the small surface afterwards.
4060       *
4061       * To solve this, here's the method applications should use in such a case.
4062       */
4063      DFBResult (*ReleaseSource) (
4064           IDirectFBSurface         *thiz
4065      );
4066 
4067 
4068    /** Blitting control **/
4069 
4070      /*
4071       * Set index translation table.
4072       *
4073       * Set the translation table used for fast indexed to indexed
4074       * pixel format conversion.
4075       *
4076       * A negative index means that the pixel will not be written.
4077       *
4078       * Undefined indices will be treated like negative ones.
4079       */
4080      DFBResult (*SetIndexTranslation) (
4081           IDirectFBSurface         *thiz,
4082           const int                *indices,
4083           int                       num_indices
4084      );
4085 
4086 
4087    /** Rendering **/
4088 
4089      /*
4090       * Set options affecting the output of drawing and blitting operations.
4091       *
4092       * None of these is mandatory and therefore unsupported flags will not
4093       * cause a software fallback.
4094       */
4095      DFBResult (*SetRenderOptions) (
4096           IDirectFBSurface         *thiz,
4097           DFBSurfaceRenderOptions   options
4098      );
4099 
4100 
4101    /** Drawing/blitting control **/
4102 
4103      /*
4104       * Set the transformation matrix.
4105       *
4106       * Enable usage of this matrix by setting DSRO_MATRIX via IDirectFBSurface::SetRenderOptions().
4107       *
4108       * The matrix consists of 3x3 fixed point 16.16 values.
4109       * The order in the array is from left to right and from top to bottom.
4110       *
4111       * All drawing and blitting will be transformed:
4112       *
4113       * <pre>
4114       *        X' = (X * v0 + Y * v1 + v2) / (X * v6 + Y * v7 + v8)
4115       *        Y' = (X * v3 + Y * v4 + v5) / (X * v6 + Y * v7 + v8)
4116       * </pre>
4117       */
4118      DFBResult (*SetMatrix) (
4119           IDirectFBSurface         *thiz,
4120           const s32                *matrix
4121      );
4122 
4123      /*
4124       * Set the surface to be used as a mask for blitting.
4125       *
4126       * The <b>mask</b> applies when DSBLIT_SRC_MASK_ALPHA or DSBLIT_SRC_MASK_COLOR is used.
4127       *
4128       * Depending on the <b>flags</b> reading either starts at a fixed location in the mask with
4129       * absolute <b>x</b> and <b>y</b>, or at the same location as in the source, with <b>x</b>
4130       * and <b>y</b> used as an offset.
4131       *
4132       * <i>Example with DSMF_STENCIL:</i>
4133       * <pre>
4134       *        Blit from <b>19,  6</b> in the source
4135       *              and <b> 0,  0</b> in the mask (<b>x =  0, y =  0</b>)
4136       *               or <b>-5, 17</b>             (<b>x = -5, y = 17</b>)
4137       *               or <b>23, 42</b>             (<b>x = 23, y = 42</b>)
4138       * </pre>
4139       *
4140       * <i>Example without:</i>
4141       * <pre>
4142       *        Blit from <b>19,  6</b> in the source
4143       *              and <b>19,  6</b> in the mask (<b>x =  0, y =  0</b>)
4144       *               or <b>14, 23</b>             (<b>x = -5, y = 17</b>)
4145       *               or <b>42, 48</b>             (<b>x = 23, y = 42</b>)
4146       * </pre>
4147       *
4148       * See also IDirectFBSurface::SetBlittingFlags().
4149       */
4150      DFBResult (*SetSourceMask) (
4151           IDirectFBSurface         *thiz,
4152           IDirectFBSurface         *mask,
4153           int                       x,
4154           int                       y,
4155           DFBSurfaceMaskFlags       flags
4156      );
4157 
4158 
4159    /** Lightweight helpers **/
4160 
4161      /*
4162       * Make this a sub surface or adjust the rectangle of this sub surface.
4163       */
4164      DFBResult (*MakeSubSurface) (
4165           IDirectFBSurface         *thiz,
4166           IDirectFBSurface         *from,
4167           const DFBRectangle       *rect
4168      );
4169 
4170 
4171    /** Direct Write/Read **/
4172 
4173      /*
4174       * Write to the surface without the need for (Un)Lock.
4175       *
4176       * <b>rect</b> defines the area inside the surface.
4177       * <br><b>ptr</b> and <b>pitch</b> specify the source.
4178       * <br>The format of the surface and the source data must be the same.
4179       */
4180      DFBResult (*Write) (
4181           IDirectFBSurface         *thiz,
4182           const DFBRectangle       *rect,
4183           const void               *ptr,
4184           int                       pitch
4185      );
4186 
4187      /*
4188       * Read from the surface without the need for (Un)Lock.
4189       *
4190       * <b>rect</b> defines the area inside the surface to be read.
4191       * <br><b>ptr</b> and <b>pitch</b> specify the destination.
4192       * <br>The destination data will have the same format as the surface.
4193       */
4194      DFBResult (*Read) (
4195           IDirectFBSurface         *thiz,
4196           const DFBRectangle       *rect,
4197           void                     *ptr,
4198           int                       pitch
4199      );
4200 
4201 
4202    /** Drawing/blitting control **/
4203 
4204      /*
4205       * Sets color values used for drawing/text functions or
4206       * alpha/color modulation (blitting functions).
4207       */
4208      DFBResult (*SetColors) (
4209           IDirectFBSurface         *thiz,
4210           const DFBColorID         *ids,
4211           const DFBColor           *colors,
4212           unsigned int              num
4213      );
4214 
4215 
4216 
4217    /** Blitting functions **/
4218 
4219      /*
4220       * Blit a bunch of areas at once using secondary source for reading instead of destination.
4221       *
4222       * Source may be the same surface.
4223       */
4224      DFBResult (*BatchBlit2) (
4225           IDirectFBSurface         *thiz,
4226           IDirectFBSurface         *source,
4227           IDirectFBSurface         *source2,
4228           const DFBRectangle       *source_rects,
4229           const DFBPoint           *dest_points,
4230           const DFBPoint           *source2_points,
4231           int                       num
4232      );
4233 
4234    /** Buffer operations **/
4235 
4236      /*
4237       * Returns the physical address of a locked surface.
4238       *
4239       * The surface must exist in a video memory pool.
4240       */
4241      DFBResult (*GetPhysicalAddress) (
4242           IDirectFBSurface *thiz,
4243           unsigned long    *addr
4244      );
4245 
4246    /** Drawing functions **/
4247 
4248      /*
4249       * Fill a bunch of trapezoids with a single call.
4250       *
4251       * Fill <b>num</b> trapezoids with the current color following the
4252       * drawing flags. Each trapezoid specified by a DFBTrapezoid.
4253       */
4254      DFBResult (*FillTrapezoids) (
4255           IDirectFBSurface         *thiz,
4256           const DFBTrapezoid       *traps,
4257           unsigned int              num
4258      );
4259 )
4260 
4261 
4262 /********************
4263  * IDirectFBPalette *
4264  ********************/
4265 
4266 /*
4267  * <i>No summary yet...</i>
4268  */
4269 DEFINE_INTERFACE(   IDirectFBPalette,
4270 
4271    /** Retrieving information **/
4272 
4273      /*
4274       * Return the capabilities of this palette.
4275       */
4276      DFBResult (*GetCapabilities) (
4277           IDirectFBPalette         *thiz,
4278           DFBPaletteCapabilities   *ret_caps
4279      );
4280 
4281      /*
4282       * Get the number of entries in the palette.
4283       */
4284      DFBResult (*GetSize) (
4285           IDirectFBPalette         *thiz,
4286           unsigned int             *ret_size
4287      );
4288 
4289 
4290    /** Palette entries **/
4291 
4292      /*
4293       * Write entries to the palette.
4294       *
4295       * Writes the specified number of entries to the palette at the
4296       * specified offset.
4297       */
4298      DFBResult (*SetEntries) (
4299           IDirectFBPalette         *thiz,
4300           const DFBColor           *entries,
4301           unsigned int              num_entries,
4302           unsigned int              offset
4303      );
4304 
4305      /*
4306       * Read entries from the palette.
4307       *
4308       * Reads the specified number of entries from the palette at the
4309       * specified offset.
4310       */
4311      DFBResult (*GetEntries) (
4312           IDirectFBPalette         *thiz,
4313           DFBColor                 *ret_entries,
4314           unsigned int              num_entries,
4315           unsigned int              offset
4316      );
4317 
4318      /*
4319       * Find the best matching entry.
4320       *
4321       * Searches the map for an entry which best matches the specified color.
4322       */
4323      DFBResult (*FindBestMatch) (
4324           IDirectFBPalette         *thiz,
4325           u8                        r,
4326           u8                        g,
4327           u8                        b,
4328           u8                        a,
4329           unsigned int             *ret_index
4330      );
4331 
4332 
4333    /** Clone **/
4334 
4335      /*
4336       * Create a copy of the palette.
4337       */
4338      DFBResult (*CreateCopy) (
4339           IDirectFBPalette         *thiz,
4340           IDirectFBPalette        **ret_interface
4341      );
4342 
4343 
4344    /** YUV Palette **/
4345 
4346      /*
4347       * Write entries to the palette.
4348       *
4349       * Writes the specified number of entries to the palette at the
4350       * specified offset.
4351       */
4352      DFBResult (*SetEntriesYUV) (
4353           IDirectFBPalette         *thiz,
4354           const DFBColorYUV        *entries,
4355           unsigned int              num_entries,
4356           unsigned int              offset
4357      );
4358 
4359      /*
4360       * Read entries from the palette.
4361       *
4362       * Reads the specified number of entries from the palette at the
4363       * specified offset.
4364       */
4365      DFBResult (*GetEntriesYUV) (
4366           IDirectFBPalette         *thiz,
4367           DFBColorYUV              *ret_entries,
4368           unsigned int              num_entries,
4369           unsigned int              offset
4370      );
4371 
4372      /*
4373       * Find the best matching entry.
4374       *
4375       * Searches the map for an entry which best matches the specified color.
4376       */
4377      DFBResult (*FindBestMatchYUV) (
4378           IDirectFBPalette         *thiz,
4379           u8                        y,
4380           u8                        u,
4381           u8                        v,
4382           u8                        a,
4383           unsigned int             *ret_index
4384      );
4385 )
4386 
4387 
4388 /*
4389  * Specifies whether a key is currently down.
4390  */
4391 typedef enum {
4392      DIKS_UP             = 0x00000000,  /* key is not pressed */
4393      DIKS_DOWN           = 0x00000001   /* key is pressed */
4394 } DFBInputDeviceKeyState;
4395 
4396 /*
4397  * Specifies whether a button is currently pressed.
4398  */
4399 typedef enum {
4400      DIBS_UP             = 0x00000000,  /* button is not pressed */
4401      DIBS_DOWN           = 0x00000001   /* button is pressed */
4402 } DFBInputDeviceButtonState;
4403 
4404 /*
4405  * Flags specifying which buttons are currently down.
4406  */
4407 typedef enum {
4408      DIBM_LEFT           = 0x00000001,  /* left mouse button */
4409      DIBM_RIGHT          = 0x00000002,  /* right mouse button */
4410      DIBM_MIDDLE         = 0x00000004   /* middle mouse button */
4411 } DFBInputDeviceButtonMask;
4412 
4413 /*
4414  * Flags specifying which modifiers are currently pressed.
4415  */
4416 typedef enum {
4417      DIMM_SHIFT     = (1 << DIMKI_SHIFT),    /* Shift key is pressed */
4418      DIMM_CONTROL   = (1 << DIMKI_CONTROL),  /* Control key is pressed */
4419      DIMM_ALT       = (1 << DIMKI_ALT),      /* Alt key is pressed */
4420      DIMM_ALTGR     = (1 << DIMKI_ALTGR),    /* AltGr key is pressed */
4421      DIMM_META      = (1 << DIMKI_META),     /* Meta key is pressed */
4422      DIMM_SUPER     = (1 << DIMKI_SUPER),    /* Super key is pressed */
4423      DIMM_HYPER     = (1 << DIMKI_HYPER)     /* Hyper key is pressed */
4424 } DFBInputDeviceModifierMask;
4425 
4426 
4427 /************************
4428  * IDirectFBInputDevice *
4429  ************************/
4430 
4431 /*
4432  * <i>No summary yet...</i>
4433  */
4434 DEFINE_INTERFACE(   IDirectFBInputDevice,
4435 
4436    /** Retrieving information **/
4437 
4438      /*
4439       * Get the unique device ID.
4440       */
4441      DFBResult (*GetID) (
4442           IDirectFBInputDevice          *thiz,
4443           DFBInputDeviceID              *ret_device_id
4444      );
4445 
4446      /*
4447       * Get a description of this device, i.e. the capabilities.
4448       */
4449      DFBResult (*GetDescription) (
4450           IDirectFBInputDevice          *thiz,
4451           DFBInputDeviceDescription     *ret_desc
4452      );
4453 
4454 
4455    /** Key mapping **/
4456 
4457      /*
4458       * Fetch one entry from the keymap for a specific hardware keycode.
4459       */
4460      DFBResult (*GetKeymapEntry) (
4461           IDirectFBInputDevice          *thiz,
4462           int                            keycode,
4463           DFBInputDeviceKeymapEntry     *ret_entry
4464      );
4465 
4466      /*
4467       * Set one entry of the keymap to the specified entry.
4468       * Each entry has 4 modifier combinations for going from key to symbol.
4469       */
4470      DFBResult (*SetKeymapEntry) (
4471           IDirectFBInputDevice          *thiz,
4472           int                            keycode,
4473           DFBInputDeviceKeymapEntry     *entry
4474      );
4475 
4476      /*
4477       * Load a keymap from the specified file.
4478       * All specified keys will overwrite the current keymap.
4479       * On return of an error, the keymap is in an unspecified state.
4480       * the file must be ASCII containing lines:
4481       * keycode <hw code> = <key id> = <symbol> .... (up to 4 symbols)
4482       * Modifier-key-sensitive keys can be framed between
4483       * capslock: .... :capslock or numlock: ... :numlock.
4484       */
4485      DFBResult (*LoadKeymap) (
4486           IDirectFBInputDevice          *thiz,
4487           char                          *filename
4488      );
4489 
4490    /** Event buffers **/
4491 
4492      /*
4493       * Create an event buffer for this device and attach it.
4494       */
4495      DFBResult (*CreateEventBuffer) (
4496           IDirectFBInputDevice          *thiz,
4497           IDirectFBEventBuffer         **ret_buffer
4498      );
4499 
4500      /*
4501       * Attach an existing event buffer to this device.
4502       *
4503       * NOTE: Attaching multiple times generates multiple events.
4504       *
4505       */
4506      DFBResult (*AttachEventBuffer) (
4507           IDirectFBInputDevice          *thiz,
4508           IDirectFBEventBuffer          *buffer
4509      );
4510 
4511      /*
4512       * Detach an event buffer from this device.
4513       */
4514      DFBResult (*DetachEventBuffer) (
4515           IDirectFBInputDevice          *thiz,
4516           IDirectFBEventBuffer          *buffer
4517      );
4518 
4519 
4520    /** General state queries **/
4521 
4522      /*
4523       * Get the current state of one key.
4524       */
4525      DFBResult (*GetKeyState) (
4526           IDirectFBInputDevice          *thiz,
4527           DFBInputDeviceKeyIdentifier    key_id,
4528           DFBInputDeviceKeyState        *ret_state
4529      );
4530 
4531      /*
4532       * Get the current modifier mask.
4533       */
4534      DFBResult (*GetModifiers) (
4535           IDirectFBInputDevice          *thiz,
4536           DFBInputDeviceModifierMask    *ret_modifiers
4537      );
4538 
4539      /*
4540       * Get the current state of the key locks.
4541       */
4542      DFBResult (*GetLockState) (
4543           IDirectFBInputDevice          *thiz,
4544           DFBInputDeviceLockState       *ret_locks
4545      );
4546 
4547      /*
4548       * Get a mask of currently pressed buttons.
4549       *
4550       * The first button corrensponds to the right most bit.
4551       */
4552      DFBResult (*GetButtons) (
4553           IDirectFBInputDevice          *thiz,
4554           DFBInputDeviceButtonMask      *ret_buttons
4555      );
4556 
4557      /*
4558       * Get the state of a button.
4559       */
4560      DFBResult (*GetButtonState) (
4561           IDirectFBInputDevice          *thiz,
4562           DFBInputDeviceButtonIdentifier button,
4563           DFBInputDeviceButtonState     *ret_state
4564      );
4565 
4566      /*
4567       * Get the current value of the specified axis.
4568       */
4569      DFBResult (*GetAxis) (
4570           IDirectFBInputDevice          *thiz,
4571           DFBInputDeviceAxisIdentifier   axis,
4572           int                           *ret_pos
4573      );
4574 
4575 
4576    /** Specialized queries **/
4577 
4578      /*
4579       * Utility function combining two calls to GetAxis().
4580       *
4581       * You may leave one of the x/y arguments NULL.
4582       */
4583      DFBResult (*GetXY) (
4584           IDirectFBInputDevice          *thiz,
4585           int                           *ret_x,
4586           int                           *ret_y
4587      );
4588 )
4589 
4590 
4591 /*
4592  * Event class.
4593  */
4594 typedef enum {
4595      DFEC_NONE           = 0x00,   /* none of these */
4596      DFEC_INPUT          = 0x01,   /* raw input event */
4597      DFEC_WINDOW         = 0x02,   /* windowing event */
4598      DFEC_USER           = 0x03,   /* custom event for the user of this library */
4599      DFEC_UNIVERSAL      = 0x04,   /* universal event for custom usage with variable size */
4600      DFEC_VIDEOPROVIDER  = 0x05    /* video provider event */
4601 } DFBEventClass;
4602 
4603 /*
4604  * The type of an input event.
4605  */
4606 typedef enum {
4607      DIET_UNKNOWN        = 0,      /* unknown event */
4608      DIET_KEYPRESS,                /* a key is been pressed */
4609      DIET_KEYRELEASE,              /* a key is been released */
4610      DIET_BUTTONPRESS,             /* a (mouse) button is been pressed */
4611      DIET_BUTTONRELEASE,           /* a (mouse) button is been released */
4612      DIET_AXISMOTION               /* mouse/joystick movement */
4613 } DFBInputEventType;
4614 
4615 /*
4616  * Flags defining which additional (optional) event fields are valid.
4617  */
4618 typedef enum {
4619      DIEF_NONE           = 0x0000,   /* no additional fields */
4620      DIEF_TIMESTAMP      = 0x0001,   /* timestamp is valid */
4621      DIEF_AXISABS        = 0x0002,   /* axis and axisabs are valid */
4622      DIEF_AXISREL        = 0x0004,   /* axis and axisrel are valid */
4623 
4624      DIEF_KEYCODE        = 0x0008,   /* used internally by the input core,
4625                                         always set at application level */
4626      DIEF_KEYID          = 0x0010,   /* used internally by the input core,
4627                                         always set at application level */
4628      DIEF_KEYSYMBOL      = 0x0020,   /* used internally by the input core,
4629                                         always set at application level */
4630      DIEF_MODIFIERS      = 0x0040,   /* used internally by the input core,
4631                                         always set at application level */
4632      DIEF_LOCKS          = 0x0080,   /* used internally by the input core,
4633                                         always set at application level */
4634      DIEF_BUTTONS        = 0x0100,   /* used internally by the input core,
4635                                         always set at application level */
4636      DIEF_GLOBAL         = 0x0200,   /* Only for event buffers creates by
4637                                         IDirectFB::CreateInputEventBuffer()
4638                                         with global events enabled.
4639                                         Indicates that the event would have been
4640                                         filtered if the buffer hadn't been
4641                                         global. */
4642      DIEF_REPEAT         = 0x0400,   /* repeated event, e.g. key or button press */
4643      DIEF_FOLLOW         = 0x0800,   /* another event will follow immediately, e.g. x/y axis */
4644 
4645      DIEF_MIN            = 0x1000,   /* minimum value is set, e.g. for absolute axis motion */
4646      DIEF_MAX            = 0x2000,   /* maximum value is set, e.g. for absolute axis motion */
4647 } DFBInputEventFlags;
4648 
4649 /*
4650  * An input event, item of an input buffer.
4651  */
4652 typedef struct {
4653      DFBEventClass                   clazz;      /* clazz of event */
4654 
4655      DFBInputEventType               type;       /* type of event */
4656      DFBInputDeviceID                device_id;  /* source of event */
4657      DFBInputEventFlags              flags;      /* which optional fields
4658                                                     are valid? */
4659 
4660      /* additionally (check flags) */
4661      struct timeval                  timestamp;  /* time of event creation */
4662 
4663 /* DIET_KEYPRESS, DIET_KEYRELEASE */
4664      int                             key_code;   /* hardware keycode, no
4665                                                     mapping, -1 if device
4666                                                     doesn't differentiate
4667                                                     between several keys */
4668      DFBInputDeviceKeyIdentifier     key_id;     /* basic mapping,
4669                                                     modifier independent */
4670      DFBInputDeviceKeySymbol         key_symbol; /* advanced mapping,
4671                                                     unicode compatible,
4672                                                     modifier dependent */
4673      /* additionally (check flags) */
4674      DFBInputDeviceModifierMask      modifiers;  /* pressed modifiers
4675                                                     (optional) */
4676      DFBInputDeviceLockState         locks;      /* active locks
4677                                                     (optional) */
4678 
4679 /* DIET_BUTTONPRESS, DIET_BUTTONRELEASE */
4680      DFBInputDeviceButtonIdentifier  button;     /* in case of a button
4681                                                     event */
4682      DFBInputDeviceButtonMask        buttons;    /* mask of currently
4683                                                     pressed buttons */
4684 
4685 /* DIET_AXISMOTION */
4686      DFBInputDeviceAxisIdentifier    axis;       /* in case of an axis
4687                                                     event */
4688      /* one of these two (check flags) */
4689      int                             axisabs;    /* absolute mouse/
4690                                                     joystick coordinate */
4691      int                             axisrel;    /* relative mouse/
4692                                                     joystick movement */
4693 
4694      /* general information */
4695      int                             min;        /* minimum possible value */
4696      int                             max;        /* maximum possible value */
4697 } DFBInputEvent;
4698 
4699 /*
4700  * Window Event Types - can also be used as flags for event filters.
4701  */
4702 typedef enum {
4703      DWET_NONE           = 0x00000000,
4704 
4705      DWET_POSITION       = 0x00000001,  /* window has been moved by
4706                                            window manager or the
4707                                            application itself */
4708      DWET_SIZE           = 0x00000002,  /* window has been resized
4709                                            by window manager or the
4710                                            application itself */
4711      DWET_CLOSE          = 0x00000004,  /* closing this window has been
4712                                            requested only */
4713      DWET_DESTROYED      = 0x00000008,  /* window got destroyed by global
4714                                            deinitialization function or
4715                                            the application itself */
4716      DWET_GOTFOCUS       = 0x00000010,  /* window got focus */
4717      DWET_LOSTFOCUS      = 0x00000020,  /* window lost focus */
4718 
4719      DWET_KEYDOWN        = 0x00000100,  /* a key has gone down while
4720                                            window has focus */
4721      DWET_KEYUP          = 0x00000200,  /* a key has gone up while
4722                                            window has focus */
4723 
4724      DWET_BUTTONDOWN     = 0x00010000,  /* mouse button went down in
4725                                            the window */
4726      DWET_BUTTONUP       = 0x00020000,  /* mouse button went up in
4727                                            the window */
4728      DWET_MOTION         = 0x00040000,  /* mouse cursor changed its
4729                                            position in window */
4730      DWET_ENTER          = 0x00080000,  /* mouse cursor entered
4731                                            the window */
4732      DWET_LEAVE          = 0x00100000,  /* mouse cursor left the window */
4733 
4734      DWET_WHEEL          = 0x00200000,  /* mouse wheel was moved while
4735                                            window has focus */
4736 
4737      DWET_POSITION_SIZE  = DWET_POSITION | DWET_SIZE,/* initially sent to
4738                                                         window when it's
4739                                                         created */
4740 
4741      DWET_UPDATE         = 0x01000000,
4742 
4743      DWET_ALL            = 0x013F033F   /* all event types */
4744 } DFBWindowEventType;
4745 
4746 /*
4747  * Flags for a window event.
4748  */
4749 typedef enum {
4750      DWEF_NONE           = 0x00000000,  /* none of these */
4751 
4752      DWEF_RETURNED       = 0x00000001,  /* This is a returned event, e.g. unconsumed key. */
4753      DWEF_RELATIVE       = 0x00000002,  /* This is a relative motion event (using DWCF_RELATIVE) */
4754      DWEF_REPEAT         = 0x00000010,  /* repeat event, e.g. repeating key */
4755 
4756      DWEF_ALL            = 0x00000013   /* all of these */
4757 } DFBWindowEventFlags;
4758 
4759 /*
4760  * Video Provider Event Types - can also be used as flags for event filters.
4761  */
4762 typedef enum {
4763      DVPET_NONE           = 0x00000000,
4764      DVPET_STARTED        = 0x00000001,  /* The video provider has started the playback     */
4765      DVPET_STOPPED        = 0x00000002,  /* The video provider has stopped the playback     */
4766      DVPET_SPEEDCHANGE    = 0x00000004,  /* A speed change has occured                      */
4767      DVPET_STREAMCHANGE   = 0x00000008,  /* A stream description change has occured         */
4768      DVPET_FATALERROR     = 0x00000010,  /* A fatal error has occured: restart must be done */
4769      DVPET_FINISHED       = 0x00000020,  /* The video provider has finished the playback    */
4770      DVPET_SURFACECHANGE  = 0x00000040,  /* A surface description change has occured        */
4771      DVPET_FRAMEDECODED   = 0x00000080,  /* A frame has been decoded by the decoder         */
4772      DVPET_FRAMEDISPLAYED = 0x00000100,  /* A frame has been rendered to the output         */
4773      DVPET_DATAEXHAUSTED  = 0x00000200,  /* There is no more data available for consumption */
4774      DVPET_VIDEOACTION    = 0x00000400,  /* An action is required on the video provider     */
4775      DVPET_DATALOW        = 0x00000800,  /* The stream buffer is running low in data (threshold defined by implementation). */
4776      DVPET_DATAHIGH       = 0x00001000,  /* The stream buffer is high. */
4777      DVPET_BUFFERTIMELOW  = 0x00002000,  /* The stream buffer has less than requested playout time buffered. */
4778      DVPET_BUFFERTIMEHIGH = 0x00004000,  /* The stream buffer has more than requested playout time buffered. */
4779      DVPET_ALL            = 0x00007FFF   /* All event types */
4780 } DFBVideoProviderEventType;
4781 
4782 /*
4783  * Event from the windowing system.
4784  */
4785 typedef struct {
4786      DFBEventClass                   clazz;      /* clazz of event */
4787 
4788      DFBWindowEventType              type;       /* type of event */
4789 
4790      /* used by DWET_KEYDOWN, DWET_KEYUP */
4791      DFBWindowEventFlags             flags;      /* event flags */
4792 
4793      DFBWindowID                     window_id;  /* source of event */
4794 
4795      /* used by DWET_MOVE, DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP,
4796         DWET_ENTER, DWET_LEAVE */
4797      int                             x;          /* x position of window
4798                                                     or coordinate within
4799                                                     window */
4800      int                             y;          /* y position of window
4801                                                     or coordinate within
4802                                                     window */
4803 
4804      /* used by DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP,
4805         DWET_ENTER, DWET_LEAVE */
4806      int                             cx;         /* x cursor position */
4807      int                             cy;         /* y cursor position */
4808 
4809      /* used by DWET_WHEEL */
4810      int                             step;       /* wheel step */
4811 
4812      /* used by DWET_RESIZE */
4813      int                             w;          /* width of window */
4814      int                             h;          /* height of window */
4815 
4816      /* used by DWET_KEYDOWN, DWET_KEYUP */
4817      int                             key_code;   /* hardware keycode, no
4818                                                     mapping, -1 if device
4819                                                     doesn't differentiate
4820                                                     between several keys */
4821      DFBInputDeviceKeyIdentifier     key_id;     /* basic mapping,
4822                                                     modifier independent */
4823      DFBInputDeviceKeySymbol         key_symbol; /* advanced mapping,
4824                                                     unicode compatible,
4825                                                     modifier dependent */
4826      DFBInputDeviceModifierMask      modifiers;  /* pressed modifiers */
4827      DFBInputDeviceLockState         locks;      /* active locks */
4828 
4829      /* used by DWET_BUTTONDOWN, DWET_BUTTONUP */
4830      DFBInputDeviceButtonIdentifier  button;     /* button being
4831                                                     pressed or released */
4832      /* used by DWET_MOTION, DWET_BUTTONDOWN, DWET_BUTTONUP */
4833      DFBInputDeviceButtonMask        buttons;    /* mask of currently
4834                                                     pressed buttons */
4835 
4836      struct timeval                  timestamp;  /* always set */
4837 } DFBWindowEvent;
4838 
4839 /*
4840  * Video Provider Event Types - can also be used as flags for event filters.
4841  */
4842 typedef enum {
4843      DVPEDST_UNKNOWN      = 0x00000000, /* Event is valid for unknown Data   */
4844      DVPEDST_AUDIO        = 0x00000001, /* Event is valid for Audio Data     */
4845      DVPEDST_VIDEO        = 0x00000002, /* Event is valid for Video Data     */
4846      DVPEDST_DATA         = 0x00000004, /* Event is valid for Data types     */
4847      DVPEDST_ALL          = 0x00000007, /* Event is valid for all Data types */
4848 
4849 } DFBVideoProviderEventDataSubType;
4850 
4851 /*
4852  * Event from the video provider
4853  */
4854 typedef struct {
4855      DFBEventClass                    clazz;      /* clazz of event */
4856 
4857      DFBVideoProviderEventType        type;       /* type of event */
4858      DFBVideoProviderEventDataSubType data_type;  /* data type that this event is applicable for. */
4859 
4860      int                              data[4];    /* custom data - large enough for 4 ints so that in most cases
4861                                                      memory allocation will not be needed */
4862 } DFBVideoProviderEvent;
4863 
4864 /*
4865  * Event for usage by the user of this library.
4866  */
4867 typedef struct {
4868      DFBEventClass                   clazz;      /* clazz of event */
4869 
4870      unsigned int                    type;       /* custom type */
4871      void                           *data;       /* custom data */
4872 } DFBUserEvent;
4873 
4874 /*
4875  * Universal event for custom usage with variable size.
4876  */
4877 typedef struct {
4878      DFBEventClass                   clazz;      /* clazz of event (DFEC_UNIVERSAL) */
4879      unsigned int                    size;       /* size of this event, minimum is sizeof(DFBUniversalEvent),
4880                                                     e.g. 8 bytes (on 32bit architectures) */
4881 
4882 
4883      /* custom data follows, size of this data is 'size' - sizeof(DFBUniversalEvent) */
4884 } DFBUniversalEvent;
4885 
4886 /*
4887  * General container for a DirectFB Event.
4888  */
4889 typedef union {
4890      DFBEventClass                   clazz;         /* clazz of event */
4891      DFBInputEvent                   input;         /* field for input events */
4892      DFBWindowEvent                  window;        /* field for window events */
4893      DFBUserEvent                    user;          /* field for user-defined events */
4894      DFBUniversalEvent               universal;     /* field for universal events */
4895      DFBVideoProviderEvent           videoprovider; /* field for video provider */
4896 } DFBEvent;
4897 
4898 #define DFB_EVENT(e)          ((DFBEvent *) (e))
4899 
4900 /*
4901  * Statistics about event buffer queue.
4902  */
4903 typedef struct {
4904      unsigned int   num_events;              /* Total number of events in the queue. */
4905 
4906      unsigned int   DFEC_INPUT;              /* Number of input events. */
4907      unsigned int   DFEC_WINDOW;             /* Number of window events. */
4908      unsigned int   DFEC_USER;               /* Number of user events. */
4909      unsigned int   DFEC_UNIVERSAL;          /* Number of universal events. */
4910      unsigned int   DFEC_VIDEOPROVIDER;      /* Number of universal events. */
4911 
4912      unsigned int   DIET_KEYPRESS;
4913      unsigned int   DIET_KEYRELEASE;
4914      unsigned int   DIET_BUTTONPRESS;
4915      unsigned int   DIET_BUTTONRELEASE;
4916      unsigned int   DIET_AXISMOTION;
4917 
4918      unsigned int   DWET_POSITION;
4919      unsigned int   DWET_SIZE;
4920      unsigned int   DWET_CLOSE;
4921      unsigned int   DWET_DESTROYED;
4922      unsigned int   DWET_GOTFOCUS;
4923      unsigned int   DWET_LOSTFOCUS;
4924      unsigned int   DWET_KEYDOWN;
4925      unsigned int   DWET_KEYUP;
4926      unsigned int   DWET_BUTTONDOWN;
4927      unsigned int   DWET_BUTTONUP;
4928      unsigned int   DWET_MOTION;
4929      unsigned int   DWET_ENTER;
4930      unsigned int   DWET_LEAVE;
4931      unsigned int   DWET_WHEEL;
4932      unsigned int   DWET_POSITION_SIZE;
4933 
4934      unsigned int   DVPET_STARTED;
4935      unsigned int   DVPET_STOPPED;
4936      unsigned int   DVPET_SPEEDCHANGE;
4937      unsigned int   DVPET_STREAMCHANGE;
4938      unsigned int   DVPET_FATALERROR;
4939      unsigned int   DVPET_FINISHED;
4940      unsigned int   DVPET_SURFACECHANGE;
4941      unsigned int   DVPET_FRAMEDECODED;
4942      unsigned int   DVPET_FRAMEDISPLAYED;
4943      unsigned int   DVPET_DATAEXHAUSTED;
4944      unsigned int   DVPET_DATALOW;
4945      unsigned int   DVPET_VIDEOACTION;
4946      unsigned int   DVPET_DATAHIGH;
4947      unsigned int   DVPET_BUFFERTIMELOW;
4948      unsigned int   DVPET_BUFFERTIMEHIGH;
4949 } DFBEventBufferStats;
4950 
4951 
4952 /************************
4953  * IDirectFBEventBuffer *
4954  ************************/
4955 
4956 /*
4957  * <i>No summary yet...</i>
4958  */
4959 DEFINE_INTERFACE(   IDirectFBEventBuffer,
4960 
4961 
4962    /** Buffer handling **/
4963 
4964      /*
4965       * Clear all events stored in this buffer.
4966       */
4967      DFBResult (*Reset) (
4968           IDirectFBEventBuffer     *thiz
4969      );
4970 
4971 
4972    /** Waiting for events **/
4973 
4974      /*
4975       * Wait for the next event to occur.
4976       * Thread is idle in the meantime.
4977       */
4978      DFBResult (*WaitForEvent) (
4979           IDirectFBEventBuffer     *thiz
4980      );
4981 
4982      /*
4983       * Block until next event to occur or timeout is reached.
4984       * Thread is idle in the meantime.
4985       */
4986      DFBResult (*WaitForEventWithTimeout) (
4987           IDirectFBEventBuffer     *thiz,
4988           unsigned int              seconds,
4989           unsigned int              milli_seconds
4990      );
4991 
4992 
4993    /** Fetching events **/
4994 
4995      /*
4996       * Get the next event and remove it from the FIFO.
4997       */
4998      DFBResult (*GetEvent) (
4999           IDirectFBEventBuffer     *thiz,
5000           DFBEvent                 *ret_event
5001      );
5002 
5003      /*
5004       * Get the next event but leave it there, i.e. do a preview.
5005       */
5006      DFBResult (*PeekEvent) (
5007           IDirectFBEventBuffer     *thiz,
5008           DFBEvent                 *ret_event
5009      );
5010 
5011      /*
5012       * Check if there is a pending event in the queue. This
5013       * function returns DFB_OK if there is at least one event,
5014       * DFB_BUFFER_EMPTY otherwise.
5015       */
5016      DFBResult (*HasEvent) (
5017           IDirectFBEventBuffer     *thiz
5018      );
5019 
5020 
5021    /** Sending events **/
5022 
5023      /*
5024       * Put an event into the FIFO.
5025       *
5026       * This function does not wait until the event got fetched.
5027       */
5028      DFBResult (*PostEvent) (
5029           IDirectFBEventBuffer     *thiz,
5030           const DFBEvent           *event
5031      );
5032 
5033      /*
5034       * Wake up any thread waiting for events in this buffer.
5035       *
5036       * This method causes any IDirectFBEventBuffer::WaitForEvent() or
5037       * IDirectFBEventBuffer::WaitForEventWithTimeout() call to return with DFB_INTERRUPTED.
5038       *
5039       * It should be used rather than sending wake up messages which
5040       * may pollute the queue and consume lots of CPU and memory compared to
5041       * this 'single code line method'.
5042       */
5043      DFBResult (*WakeUp) (
5044           IDirectFBEventBuffer     *thiz
5045      );
5046 
5047 
5048    /** Special handling **/
5049 
5050      /*
5051       * Create a file descriptor for reading events.
5052       *
5053       * This method provides an alternative for reading events from an event buffer.
5054       * It creates a file descriptor which can be used in select(), poll() or read().
5055       *
5056       * In general only non-threaded applications which already use select() or poll() need it.
5057       *
5058       * <b>Note:</b> This method flushes the event buffer. After calling this method all other
5059       * methods except IDirectFBEventBuffer::PostEvent() will return DFB_UNSUPPORTED.
5060       * Calling this method again will return DFB_BUSY.
5061       */
5062      DFBResult (*CreateFileDescriptor) (
5063           IDirectFBEventBuffer     *thiz,
5064           int                      *ret_fd
5065      );
5066 
5067 
5068    /** Statistics **/
5069 
5070      /*
5071       * Enable/disable collection of event buffer statistics.
5072       */
5073      DFBResult (*EnableStatistics) (
5074           IDirectFBEventBuffer     *thiz,
5075           DFBBoolean                enable
5076      );
5077 
5078      /*
5079       * Query collected event buffer statistics.
5080       */
5081      DFBResult (*GetStatistics) (
5082           IDirectFBEventBuffer     *thiz,
5083           DFBEventBufferStats      *ret_stats
5084      );
5085 )
5086 
5087 /*
5088  * The key selection defines a mode for filtering keys while the window is having the focus.
5089  */
5090 typedef enum {
5091      DWKS_ALL            = 0x00000000,  /* Select all keys (default). */
5092      DWKS_NONE           = 0x00000001,  /* Don't select any key. */
5093      DWKS_LIST           = 0x00000002   /* Select a list of keys. */
5094 } DFBWindowKeySelection;
5095 
5096 typedef enum {
5097      DWGM_DEFAULT        = 0x00000000,  /* Use default values. */
5098      DWGM_FOLLOW         = 0x00000001,  /* Use values of parent window. */
5099      DWGM_RECTANGLE      = 0x00000002,  /* Use pixel values as defined. */
5100      DWGM_LOCATION       = 0x00000003   /* Use relative values as defined. */
5101 } DFBWindowGeometryMode;
5102 
5103 typedef struct {
5104      DFBWindowGeometryMode    mode;
5105 
5106      DFBRectangle             rectangle;
5107      DFBLocation              location;
5108 } DFBWindowGeometry;
5109 
5110 typedef enum {
5111      DWCF_NONE           = 0x00000000,
5112 
5113      DWCF_RELATIVE       = 0x00000001,
5114      DWCF_EXPLICIT       = 0x00000002,
5115      DWCF_UNCLIPPED      = 0x00000004,
5116      DWCF_TRAPPED        = 0x00000008,
5117      DWCF_FIXED          = 0x00000010,
5118      DWCF_INVISIBLE      = 0x00000020,
5119 
5120      DWCF_ALL            = 0x0000003F
5121 } DFBWindowCursorFlags;
5122 
5123 /*******************
5124  * IDirectFBWindow *
5125  *******************/
5126 
5127 /*
5128  * <i>No summary yet...</i>
5129  */
5130 DEFINE_INTERFACE(   IDirectFBWindow,
5131 
5132    /** Retrieving information **/
5133 
5134      /*
5135       * Get the unique window ID.
5136       */
5137      DFBResult (*GetID) (
5138           IDirectFBWindow               *thiz,
5139           DFBWindowID                   *ret_window_id
5140      );
5141 
5142      /*
5143       * Get the current position of this window.
5144       */
5145      DFBResult (*GetPosition) (
5146           IDirectFBWindow               *thiz,
5147           int                           *ret_x,
5148           int                           *ret_y
5149      );
5150 
5151      /*
5152       * Get the size of the window in pixels.
5153       */
5154      DFBResult (*GetSize) (
5155           IDirectFBWindow               *thiz,
5156           int                           *ret_width,
5157           int                           *ret_height
5158      );
5159 
5160 
5161    /** Close & Destroy **/
5162 
5163      /*
5164       * Send a close message to the window.
5165       *
5166       * This function sends a message of type DWET_CLOSE to the window.
5167       * It does NOT actually close it.
5168       */
5169      DFBResult (*Close) (
5170           IDirectFBWindow               *thiz
5171      );
5172 
5173      /*
5174       * Destroys the window and sends a destruction message.
5175       *
5176       * This function sends a message of type DWET_DESTROY to
5177       * the window after removing it from the window stack and
5178       * freeing its data.  Some functions called from this
5179       * interface will return DFB_DESTROYED after that.
5180       */
5181      DFBResult (*Destroy) (
5182           IDirectFBWindow               *thiz
5183      );
5184 
5185 
5186    /** Surface & Scaling **/
5187 
5188      /*
5189       * Get an interface to the backing store surface.
5190       *
5191       * This surface has to be flipped to make previous drawing
5192       * commands visible, i.e. to repaint the windowstack for
5193       * that region.
5194       */
5195      DFBResult (*GetSurface) (
5196           IDirectFBWindow               *thiz,
5197           IDirectFBSurface             **ret_surface
5198      );
5199 
5200      /*
5201       * Resize the surface of a scalable window.
5202       *
5203       * This requires the option DWOP_SCALE.
5204       * See IDirectFBWindow::SetOptions().
5205       */
5206      DFBResult (*ResizeSurface) (
5207           IDirectFBWindow               *thiz,
5208           int                            width,
5209           int                            height
5210      );
5211 
5212 
5213    /** Events **/
5214 
5215      /*
5216       * Create an event buffer for this window and attach it.
5217       */
5218      DFBResult (*CreateEventBuffer) (
5219           IDirectFBWindow               *thiz,
5220           IDirectFBEventBuffer         **ret_buffer
5221      );
5222 
5223      /*
5224       * Attach an existing event buffer to this window.
5225       *
5226       * NOTE: Attaching multiple times generates multiple events.
5227       *
5228       */
5229      DFBResult (*AttachEventBuffer) (
5230           IDirectFBWindow               *thiz,
5231           IDirectFBEventBuffer          *buffer
5232      );
5233 
5234      /*
5235       * Detach an event buffer from this window.
5236       */
5237      DFBResult (*DetachEventBuffer) (
5238           IDirectFBWindow               *thiz,
5239           IDirectFBEventBuffer          *buffer
5240      );
5241 
5242      /*
5243       * Enable specific events to be sent to the window.
5244       *
5245       * The argument is a mask of events that will be set in the
5246       * window's event mask. The default event mask is DWET_ALL.
5247       */
5248      DFBResult (*EnableEvents) (
5249           IDirectFBWindow               *thiz,
5250           DFBWindowEventType             mask
5251      );
5252 
5253      /*
5254       * Disable specific events from being sent to the window.
5255       *
5256       * The argument is a mask of events that will be cleared in
5257       * the window's event mask. The default event mask is DWET_ALL.
5258       */
5259      DFBResult (*DisableEvents) (
5260           IDirectFBWindow               *thiz,
5261           DFBWindowEventType             mask
5262      );
5263 
5264 
5265    /** Options **/
5266 
5267      /*
5268       * Set options controlling appearance and behaviour of the window.
5269       */
5270      DFBResult (*SetOptions) (
5271           IDirectFBWindow               *thiz,
5272           DFBWindowOptions               options
5273      );
5274 
5275      /*
5276       * Get options controlling appearance and behaviour of the window.
5277       */
5278      DFBResult (*GetOptions) (
5279           IDirectFBWindow               *thiz,
5280           DFBWindowOptions              *ret_options
5281      );
5282 
5283      /*
5284       * Set the window color, or colorises the window.
5285       *
5286       * In case you specified DWCAPS_COLOR, this sets the window draw color.
5287       * In case you didn't, it colorises the window with this color; this will darken the window.
5288       * no DWCAPS_COLOR and an opacity of 0 means: no effect.
5289       */
5290      DFBResult (*SetColor) (
5291           IDirectFBWindow               *thiz,
5292           u8                             r,
5293           u8                             g,
5294           u8                             b,
5295           u8                             a
5296      );
5297 
5298      /*
5299       * Set the window color key.
5300       *
5301       * If a pixel of the window matches this color the
5302       * underlying window or the background is visible at this
5303       * point.
5304       */
5305      DFBResult (*SetColorKey) (
5306           IDirectFBWindow               *thiz,
5307           u8                             r,
5308           u8                             g,
5309           u8                             b
5310      );
5311 
5312      /*
5313       * Set the window color key (indexed).
5314       *
5315       * If a pixel (indexed format) of the window matches this
5316       * color index the underlying window or the background is
5317       * visible at this point.
5318       */
5319      DFBResult (*SetColorKeyIndex) (
5320           IDirectFBWindow               *thiz,
5321           unsigned int                   index
5322      );
5323 
5324      /*
5325       * Set the window's global opacity factor.
5326       *
5327       * Set it to "0" to hide a window.
5328       * Setting it to "0xFF" makes the window opaque if
5329       * it has no alpha channel.
5330       */
5331      DFBResult (*SetOpacity) (
5332           IDirectFBWindow               *thiz,
5333           u8                             opacity
5334      );
5335 
5336      /*
5337       * Disable alpha channel blending for one region of the window.
5338       *
5339       * If DWOP_ALPHACHANNEL and DWOP_OPAQUE_REGION are set but not DWOP_COLORKEYING
5340       * and the opacity of the window is 255 the window gets rendered
5341       * without alpha blending within the specified region.
5342       *
5343       * This is extremely useful for alpha blended window decorations while
5344       * the main content stays opaque and gets rendered faster.
5345       */
5346      DFBResult (*SetOpaqueRegion) (
5347           IDirectFBWindow               *thiz,
5348           int                            x1,
5349           int                            y1,
5350           int                            x2,
5351           int                            y2
5352      );
5353 
5354      /*
5355       * Get the current opacity factor of this window.
5356       */
5357      DFBResult (*GetOpacity) (
5358           IDirectFBWindow               *thiz,
5359           u8                            *ret_opacity
5360      );
5361 
5362      /*
5363       * Bind a cursor shape to this window.
5364       *
5365       * This method will set a per-window cursor shape. Everytime
5366       * the cursor enters this window, the specified shape is set.
5367       *
5368       * Passing NULL will unbind a set shape and release its surface.
5369       */
5370      DFBResult (*SetCursorShape) (
5371           IDirectFBWindow               *thiz,
5372           IDirectFBSurface              *shape,
5373           int                            hot_x,
5374           int                            hot_y
5375      );
5376 
5377 
5378    /** Position and Size **/
5379 
5380      /*
5381       * Move the window by the specified distance.
5382       */
5383      DFBResult (*Move) (
5384           IDirectFBWindow               *thiz,
5385           int                            dx,
5386           int                            dy
5387      );
5388 
5389      /*
5390       * Move the window to the specified coordinates.
5391       */
5392      DFBResult (*MoveTo) (
5393           IDirectFBWindow               *thiz,
5394           int                            x,
5395           int                            y
5396      );
5397 
5398      /*
5399       * Resize the window.
5400       */
5401      DFBResult (*Resize) (
5402           IDirectFBWindow               *thiz,
5403           int                            width,
5404           int                            height
5405      );
5406 
5407      /*
5408       * Set position and size in one step.
5409       */
5410      DFBResult (*SetBounds) (
5411           IDirectFBWindow               *thiz,
5412           int                            x,
5413           int                            y,
5414           int                            width,
5415           int                            height
5416      );
5417 
5418 
5419    /** Stacking **/
5420 
5421      /*
5422       * Put the window into a specific stacking class.
5423       */
5424      DFBResult (*SetStackingClass) (
5425           IDirectFBWindow               *thiz,
5426           DFBWindowStackingClass         stacking_class
5427      );
5428 
5429      /*
5430       * Raise the window by one within the window stack.
5431       */
5432      DFBResult (*Raise) (
5433           IDirectFBWindow               *thiz
5434      );
5435 
5436      /*
5437       * Lower the window by one within the window stack.
5438       */
5439      DFBResult (*Lower) (
5440           IDirectFBWindow               *thiz
5441      );
5442 
5443      /*
5444       * Put the window on the top of the window stack.
5445       */
5446      DFBResult (*RaiseToTop) (
5447           IDirectFBWindow               *thiz
5448      );
5449 
5450      /*
5451       * Send a window to the bottom of the window stack.
5452       */
5453      DFBResult (*LowerToBottom) (
5454           IDirectFBWindow               *thiz
5455      );
5456 
5457      /*
5458       * Put a window on top of another window.
5459       */
5460      DFBResult (*PutAtop) (
5461           IDirectFBWindow               *thiz,
5462           IDirectFBWindow               *lower
5463      );
5464 
5465      /*
5466       * Put a window below another window.
5467       */
5468      DFBResult (*PutBelow) (
5469           IDirectFBWindow               *thiz,
5470           IDirectFBWindow               *upper
5471      );
5472 
5473 
5474    /** Binding **/
5475 
5476      /*
5477       * Bind a window at the specified position of this window.
5478       *
5479       * After binding, bound window will be automatically moved
5480       * when this window moves to a new position.<br>
5481       * Binding the same window to multiple windows is not supported.
5482       * Subsequent call to Bind() automatically unbounds the bound window
5483       * before binding it again.<br>
5484       * To move the bound window to a new position call Bind() again
5485       * with the new coordinates.
5486       */
5487      DFBResult (*Bind) (
5488           IDirectFBWindow               *thiz,
5489           IDirectFBWindow               *window,
5490           int                            x,
5491           int                            y
5492      );
5493 
5494      /*
5495       * Unbind a window from this window.
5496       */
5497      DFBResult (*Unbind) (
5498           IDirectFBWindow               *thiz,
5499           IDirectFBWindow               *window
5500      );
5501 
5502 
5503    /** Focus handling **/
5504 
5505      /*
5506       * Pass the focus to this window.
5507       */
5508      DFBResult (*RequestFocus) (
5509           IDirectFBWindow               *thiz
5510      );
5511 
5512      /*
5513       * Grab the keyboard, i.e. all following keyboard events are
5514       * sent to this window ignoring the focus.
5515       */
5516      DFBResult (*GrabKeyboard) (
5517           IDirectFBWindow               *thiz
5518      );
5519 
5520      /*
5521       * Ungrab the keyboard, i.e. switch to standard key event
5522       * dispatching.
5523       */
5524      DFBResult (*UngrabKeyboard) (
5525           IDirectFBWindow               *thiz
5526      );
5527 
5528      /*
5529       * Grab the pointer, i.e. all following mouse events are
5530       * sent to this window ignoring the focus.
5531       */
5532      DFBResult (*GrabPointer) (
5533           IDirectFBWindow               *thiz
5534      );
5535 
5536      /*
5537       * Ungrab the pointer, i.e. switch to standard mouse event
5538       * dispatching.
5539       */
5540      DFBResult (*UngrabPointer) (
5541           IDirectFBWindow               *thiz
5542      );
5543 
5544      /*
5545       * Grab a specific key, i.e. all following events of this key are
5546       * sent to this window ignoring the focus.
5547       */
5548      DFBResult (*GrabKey) (
5549           IDirectFBWindow               *thiz,
5550           DFBInputDeviceKeySymbol        symbol,
5551           DFBInputDeviceModifierMask     modifiers
5552      );
5553 
5554      /*
5555       * Ungrab a specific key, i.e. switch to standard key event
5556       * dispatching.
5557       */
5558      DFBResult (*UngrabKey) (
5559           IDirectFBWindow               *thiz,
5560           DFBInputDeviceKeySymbol        symbol,
5561           DFBInputDeviceModifierMask     modifiers
5562      );
5563 
5564 
5565    /** Key selection **/
5566 
5567      /*
5568       * Selects a mode for filtering keys while being focused.
5569       *
5570       * The <b>selection</b> defines whether all, none or a specific set (list) of keys is selected.
5571       * In case of a specific set, the <b>keys</b> array with <b>num_keys</b> has to be provided.
5572       *
5573       * Multiple calls to this method are possible. Each overrides all settings from the previous call.
5574       */
5575      DFBResult (*SetKeySelection) (
5576           IDirectFBWindow               *thiz,
5577           DFBWindowKeySelection          selection,
5578           const DFBInputDeviceKeySymbol *keys,
5579           unsigned int                   num_keys
5580      );
5581 
5582      /*
5583       * Grab all unselected (filtered out) keys.
5584       *
5585       * Unselected keys are those not selected by the focused window. These keys won't be sent
5586       * to that window. Instead one window in the stack can collect them.
5587       *
5588       * See also IDirectFBWindow::UngrabUnselectedKeys() and IDirectFBWindow::SetKeySelection().
5589       */
5590      DFBResult (*GrabUnselectedKeys) (
5591           IDirectFBWindow               *thiz
5592      );
5593 
5594      /*
5595       * Release the grab of unselected (filtered out) keys.
5596       *
5597       * See also IDirectFBWindow::GrabUnselectedKeys() and IDirectFBWindow::SetKeySelection().
5598       */
5599      DFBResult (*UngrabUnselectedKeys) (
5600           IDirectFBWindow               *thiz
5601      );
5602 
5603 
5604    /** Advanced Geometry **/
5605 
5606      /*
5607       * Set area of surface to be shown in window.
5608       *
5609       * Default and maximum is to show whole surface.
5610       */
5611      DFBResult (*SetSrcGeometry) (
5612           IDirectFBWindow               *thiz,
5613           const DFBWindowGeometry       *geometry
5614      );
5615 
5616      /*
5617       * Set destination location of window within its bounds.
5618       *
5619       * Default and maximum is to fill whole bounds.
5620       */
5621      DFBResult (*SetDstGeometry) (
5622           IDirectFBWindow               *thiz,
5623           const DFBWindowGeometry       *geometry
5624      );
5625 
5626 
5627    /** Properties **/
5628 
5629      /*
5630       * Set property controlling appearance and behaviour of the window.
5631       */
5632      DFBResult (*SetProperty) (
5633           IDirectFBWindow               *thiz,
5634           const char                    *key,
5635           void                          *value,
5636           void                         **ret_old_value
5637      );
5638 
5639      /*
5640       * Get property controlling appearance and behaviour of the window.
5641       */
5642      DFBResult (*GetProperty) (
5643           IDirectFBWindow               *thiz,
5644           const char                    *key,
5645           void                         **ret_value
5646      );
5647 
5648      /*
5649       * Remove property controlling appearance and behaviour of the window.
5650       */
5651      DFBResult (*RemoveProperty) (
5652           IDirectFBWindow               *thiz,
5653           const char                    *key,
5654           void                         **ret_value
5655      );
5656 
5657      /*
5658       * Set window rotation.
5659       */
5660      DFBResult (*SetRotation) (
5661           IDirectFBWindow               *thiz,
5662           int                            rotation
5663      );
5664 
5665 
5666    /** Association **/
5667 
5668      /*
5669       * Change the window association.
5670       *
5671       * If <b>window_id</b> is 0, the window will be dissociated.
5672       */
5673      DFBResult (*SetAssociation) (
5674           IDirectFBWindow               *thiz,
5675           DFBWindowID                    window_id
5676      );
5677 
5678 
5679    /** Application ID **/
5680 
5681      /*
5682       * Set application ID.
5683       *
5684       * The usage of the application ID is not imposed by DirectFB
5685       * and can be used at will by the application. Any change will
5686       * be notified, and as such, an application manager using SaWMan
5687       * can be used to act on any change.
5688       */
5689      DFBResult (*SetApplicationID) (
5690           IDirectFBWindow               *thiz,
5691           unsigned long                  application_id
5692      );
5693 
5694      /*
5695       * Get current application ID.
5696       */
5697      DFBResult (*GetApplicationID) (
5698           IDirectFBWindow               *thiz,
5699           unsigned long                 *ret_application_id
5700      );
5701 
5702 
5703    /** Updates **/
5704 
5705      /*
5706       * Signal start of window content updates.
5707       */
5708      DFBResult (*BeginUpdates) (
5709           IDirectFBWindow               *thiz,
5710           const DFBRegion               *update
5711      );
5712 
5713 
5714    /** Events **/
5715 
5716      /*
5717       * Send event
5718       */
5719      DFBResult (*SendEvent) (
5720           IDirectFBWindow               *thiz,
5721           const DFBWindowEvent          *event
5722      );
5723 
5724 
5725    /** Cursor **/
5726 
5727      /*
5728       * Set cursor flags (active when in focus).
5729       */
5730      DFBResult (*SetCursorFlags) (
5731           IDirectFBWindow               *thiz,
5732           DFBWindowCursorFlags           flags
5733      );
5734 
5735      /*
5736       * Set cursor resolution (coordinate space for cursor within window).
5737       *
5738       * The default cursor resolution is the surface dimensions.
5739       */
5740      DFBResult (*SetCursorResolution) (
5741           IDirectFBWindow               *thiz,
5742           const DFBDimension            *resolution
5743      );
5744 
5745      /*
5746       * Set cursor position within window coordinates (surface or cursor resolution).
5747       */
5748      DFBResult (*SetCursorPosition) (
5749           IDirectFBWindow               *thiz,
5750           int                            x,
5751           int                            y
5752      );
5753 )
5754 
5755 
5756 /*
5757  * Called for each provided text encoding.
5758  */
5759 typedef DFBEnumerationResult (*DFBTextEncodingCallback) (
5760      DFBTextEncodingID    encoding_id,
5761      const char          *name,
5762      void                *context
5763 );
5764 
5765 /*****************
5766  * IDirectFBFont *
5767  *****************/
5768 
5769 /*
5770  * <i>No summary yet...</i>
5771  */
5772 DEFINE_INTERFACE(   IDirectFBFont,
5773 
5774    /** Retrieving information **/
5775 
5776      /*
5777       * Get the distance from the baseline to the top of the
5778       * logical extents of this font.
5779       */
5780      DFBResult (*GetAscender) (
5781           IDirectFBFont            *thiz,
5782           int                      *ret_ascender
5783      );
5784 
5785      /*
5786       * Get the distance from the baseline to the bottom of
5787       * the logical extents of this font.
5788       *
5789       * This is a negative value!
5790       */
5791      DFBResult (*GetDescender) (
5792           IDirectFBFont            *thiz,
5793           int                      *ret_descender
5794      );
5795 
5796      /*
5797       * Get the logical height of this font. This is the
5798       * distance from one baseline to the next when writing
5799       * several lines of text. Note that this value does not
5800       * correspond the height value specified when loading the
5801       * font.
5802       */
5803      DFBResult (*GetHeight) (
5804           IDirectFBFont            *thiz,
5805           int                      *ret_height
5806      );
5807 
5808      /*
5809       * Get the maximum character width.
5810       *
5811       * This is a somewhat dubious value. Not all fonts
5812       * specify it correcly. It can give you an idea of
5813       * the maximum expected width of a rendered string.
5814       */
5815      DFBResult (*GetMaxAdvance) (
5816           IDirectFBFont            *thiz,
5817           int                      *ret_maxadvance
5818      );
5819 
5820      /*
5821       * Get the kerning to apply between two glyphs specified by
5822       * their character codes.
5823       */
5824      DFBResult (*GetKerning) (
5825           IDirectFBFont            *thiz,
5826           unsigned int              prev,
5827           unsigned int              current,
5828           int                      *ret_kern_x,
5829           int                      *ret_kern_y
5830      );
5831 
5832 
5833    /** Measurements **/
5834 
5835      /*
5836       * Get the logical width of the specified string
5837       * as if it were drawn with this font.
5838       *
5839       * Bytes specifies the number of bytes to take from the
5840       * string or -1 for the complete NULL-terminated string.
5841       *
5842       * The returned width may be different than the actual drawn
5843       * width of the text since this function returns the logical
5844       * width that should be used to layout the text. A negative
5845       * width indicates right-to-left rendering.
5846       */
5847      DFBResult (*GetStringWidth) (
5848           IDirectFBFont            *thiz,
5849           const char               *text,
5850           int                       bytes,
5851           int                      *ret_width
5852      );
5853 
5854      /*
5855       * Get the logical and real extents of the specified
5856       * string as if it were drawn with this font.
5857       *
5858       * Bytes specifies the number of bytes to take from the
5859       * string or -1 for the complete NULL-terminated string.
5860       *
5861       * The logical rectangle describes the typographic extents
5862       * and should be used to layout text. The ink rectangle
5863       * describes the smallest rectangle containing all pixels
5864       * that are touched when drawing the string. If you only
5865       * need one of the rectangles, pass NULL for the other one.
5866       *
5867       * The ink rectangle is guaranteed to be a valid rectangle
5868       * with positive width and height, while the logical
5869       * rectangle may have negative width indicating right-to-left
5870       * layout.
5871       *
5872       * The rectangle offsets are reported relative to the
5873       * baseline and refer to the text being drawn using
5874       * DSTF_LEFT.
5875       */
5876      DFBResult (*GetStringExtents) (
5877           IDirectFBFont            *thiz,
5878           const char               *text,
5879           int                       bytes,
5880           DFBRectangle             *ret_logical_rect,
5881           DFBRectangle             *ret_ink_rect
5882      );
5883 
5884      /*
5885       * Get the extents of a glyph specified by its character code.
5886       *
5887       * The rectangle describes the the smallest rectangle
5888       * containing all pixels that are touched when drawing the
5889       * glyph. It is reported relative to the baseline. If you
5890       * only need the advance, pass NULL for the rectangle.
5891       *
5892       * The advance describes the horizontal offset to the next
5893       * glyph (without kerning applied). It may be a negative
5894       * value indicating left-to-right rendering. If you don't
5895       * need this value, pass NULL for advance.
5896       */
5897      DFBResult (*GetGlyphExtents) (
5898           IDirectFBFont            *thiz,
5899           unsigned int              character,
5900           DFBRectangle             *ret_rect,
5901           int                      *ret_advance
5902      );
5903 
5904      /*
5905       * Get the next explicit or automatic break within a string
5906       * along with the logical width of the text, the string length,
5907       * and a pointer to the next text line.
5908       *
5909       * The bytes specifies the maximum number of bytes to take from the
5910       * string or -1 for complete NULL-terminated string.
5911       *
5912       * The max_width specifies logical width of column onto which
5913       * the text will be drawn. Then the logical width of fitted
5914       * text is returned in ret_width. The returned width may overlap
5915       * the max width specified if there's only one character
5916       * that fits.
5917       *
5918       * The number of characters that fit into this column is returned
5919       * by the ret_str_length. Note that you can not use this value as
5920       * the number of bytes to take when using DrawString() as it
5921       * represents to the number of characters, not the number of
5922       * bytes.
5923       *
5924       * In ret_next_line a pointer to the next line of text is
5925       * returned. This will point to NULL or the end of the string if
5926       * there's no more break.
5927       */
5928      DFBResult (*GetStringBreak) (
5929           IDirectFBFont            *thiz,
5930           const char               *text,
5931           int                       bytes,
5932           int                       max_width,
5933           int                      *ret_width,
5934           int                      *ret_str_length,
5935           const char              **ret_next_line
5936      );
5937 
5938    /** Encodings **/
5939 
5940      /*
5941       * Change the default encoding used when the font is set at a surface.
5942       *
5943       * It's also the encoding used for the measurement functions
5944       * of this interface, e.g. IDirectFBFont::GetStringExtents().
5945       */
5946      DFBResult (*SetEncoding) (
5947           IDirectFBFont            *thiz,
5948           DFBTextEncodingID         encoding
5949      );
5950 
5951      /*
5952       * Enumerate all provided text encodings.
5953       */
5954      DFBResult (*EnumEncodings) (
5955           IDirectFBFont            *thiz,
5956           DFBTextEncodingCallback   callback,
5957           void                     *context
5958      );
5959 
5960      /*
5961       * Find an encoding by its name.
5962       */
5963      DFBResult (*FindEncoding) (
5964           IDirectFBFont            *thiz,
5965           const char               *name,
5966           DFBTextEncodingID        *ret_encoding
5967      );
5968 
5969 
5970    /** Resources **/
5971 
5972      /*
5973       * Dispose resources used by the font.
5974       *
5975       * Keeps font usable, recreating resources as needed.
5976       */
5977      DFBResult (*Dispose) (
5978           IDirectFBFont            *thiz
5979      );
5980 
5981 
5982    /** Measurements **/
5983 
5984      /*
5985       * Get the line spacing vector of this font. This is the
5986       * displacement vector from one line to the next when writing
5987       * several lines of text. It differs from the height only
5988       * when the font is rotated.
5989       */
5990      DFBResult (*GetLineSpacingVector) (
5991           IDirectFBFont            *thiz,
5992           int                      *ret_xspacing,
5993           int                      *ret_yspacing
5994      );
5995 
5996      /*
5997       * Get the extents of a glyph specified by its character code (extended version).
5998       *
5999       * The rectangle describes the the smallest rectangle
6000       * containing all pixels that are touched when drawing the
6001       * glyph. It is reported relative to the baseline. If you
6002       * only need the advance, pass NULL for the rectangle.
6003       *
6004       * The advance describes the horizontal offset to the next
6005       * glyph (without kerning applied). It may be a negative
6006       * value indicating left-to-right rendering. If you don't
6007       * need this value, pass NULL for advance.
6008       */
6009      DFBResult (*GetGlyphExtentsXY) (
6010           IDirectFBFont            *thiz,
6011           unsigned int              character,
6012           DFBRectangle             *ret_rect,
6013           int                      *ret_xadvance,
6014           int                      *ret_yadvance
6015      );
6016 )
6017 
6018 /*
6019  * Capabilities of an image.
6020  */
6021 typedef enum {
6022      DICAPS_NONE            = 0x00000000,  /* None of these.            */
6023      DICAPS_ALPHACHANNEL    = 0x00000001,  /* The image data contains an
6024                                               alphachannel.             */
6025      DICAPS_COLORKEY        = 0x00000002   /* The image has a colorkey,
6026                                               e.g. the transparent color
6027                                               of a GIF image.           */
6028 } DFBImageCapabilities;
6029 
6030 /*
6031  * Information about an image including capabilities and values
6032  * belonging to available capabilities.
6033  */
6034 typedef struct {
6035      DFBImageCapabilities     caps;        /* capabilities              */
6036 
6037      u8                       colorkey_r;  /* colorkey red channel      */
6038      u8                       colorkey_g;  /* colorkey green channel    */
6039      u8                       colorkey_b;  /* colorkey blue channel     */
6040 } DFBImageDescription;
6041 
6042 
6043 typedef enum {
6044         DIRCR_OK,
6045         DIRCR_ABORT
6046 } DIRenderCallbackResult;
6047 /*
6048  * Called whenever a chunk of the image is decoded.
6049  * Has to be registered with IDirectFBImageProvider::SetRenderCallback().
6050  */
6051 typedef DIRenderCallbackResult (*DIRenderCallback)(DFBRectangle *rect, void *ctx);
6052 
6053 /**************************
6054  * IDirectFBImageProvider *
6055  **************************/
6056 
6057 /*
6058  * <i>No summary yet...</i>
6059  */
6060 DEFINE_INTERFACE(   IDirectFBImageProvider,
6061 
6062    /** Retrieving information **/
6063 
6064      /*
6065       * Get a surface description that best matches the image
6066       * contained in the file.
6067       *
6068       * For opaque image formats the pixel format of the primary
6069       * layer is used. For images with alpha channel an ARGB
6070       * surface description is returned.
6071       */
6072      DFBResult (*GetSurfaceDescription) (
6073           IDirectFBImageProvider   *thiz,
6074           DFBSurfaceDescription    *ret_dsc
6075      );
6076 
6077      /*
6078       * Get a description of the image.
6079       *
6080       * This includes stuff that does not belong into the surface
6081       * description, e.g. a colorkey of a transparent GIF.
6082       */
6083      DFBResult (*GetImageDescription) (
6084           IDirectFBImageProvider   *thiz,
6085           DFBImageDescription      *ret_dsc
6086      );
6087 
6088 
6089    /** Rendering **/
6090 
6091      /*
6092       * Render the file contents into the destination contents
6093       * doing automatic scaling and color format conversion.
6094       *
6095       * If the image file has an alpha channel it is rendered
6096       * with alpha channel if the destination surface is of the
6097       * ARGB pixelformat. Otherwise, transparent areas are
6098       * blended over a black background.
6099       *
6100       * If a destination rectangle is specified, the rectangle is
6101       * clipped to the destination surface. If NULL is passed as
6102       * destination rectangle, the whole destination surface is
6103       * taken. The image is stretched to fill the rectangle.
6104       */
6105      DFBResult (*RenderTo) (
6106           IDirectFBImageProvider   *thiz,
6107           IDirectFBSurface         *destination,
6108           const DFBRectangle       *destination_rect
6109      );
6110 
6111      /*
6112       * Registers a callback for progressive image loading.
6113       *
6114       * The function is called each time a chunk of the image is decoded.
6115       */
6116      DFBResult (*SetRenderCallback) (
6117           IDirectFBImageProvider   *thiz,
6118           DIRenderCallback          callback,
6119           void                     *callback_data
6120      );
6121 
6122 
6123    /** Encoding **/
6124 
6125      /*
6126       * Encode a portion of a surface.
6127       */
6128      DFBResult (*WriteBack) (
6129           IDirectFBImageProvider   *thiz,
6130           IDirectFBSurface         *surface,
6131           const DFBRectangle       *src_rect,
6132           const char               *filename
6133      );
6134 )
6135 
6136 /*
6137  * Capabilities of an audio/video stream.
6138  */
6139 typedef enum {
6140      DVSCAPS_NONE         = 0x00000000, /* None of these.         */
6141      DVSCAPS_VIDEO        = 0x00000001, /* Stream contains video. */
6142      DVSCAPS_AUDIO        = 0x00000002  /* Stream contains audio. */
6143      /* DVSCAPS_SUBPICTURE ?! */
6144 } DFBStreamCapabilities;
6145 
6146 #define DFB_STREAM_DESC_ENCODING_LENGTH   30
6147 
6148 #define DFB_STREAM_DESC_TITLE_LENGTH     255
6149 
6150 #define DFB_STREAM_DESC_AUTHOR_LENGTH    255
6151 
6152 #define DFB_STREAM_DESC_ALBUM_LENGTH     255
6153 
6154 #define DFB_STREAM_DESC_GENRE_LENGTH      32
6155 
6156 #define DFB_STREAM_DESC_COMMENT_LENGTH   255
6157 
6158 /*
6159  * Informations about an audio/video stream.
6160  */
6161 typedef struct {
6162      DFBStreamCapabilities  caps;         /* capabilities */
6163 
6164      struct {
6165           char              encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "MPEG4") */
6166           double            framerate;    /* number of frames per second */
6167           double            aspect;       /* frame aspect ratio */
6168           int               bitrate;      /* amount of bits per second */
6169     	  int               afd;          /* Active Format Descriptor */
6170     	  int               width;        /* Width as reported by Sequence Header */
6171     	  int               height;       /* Height as reported by Sequence Header */
6172      } video;                             /* struct containing the above encoding properties for video */
6173 
6174      struct {
6175           char              encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "AAC") */
6176           int               samplerate;   /* number of samples per second */
6177           int               channels;     /* number of channels per sample */
6178           int               bitrate;      /* amount of bits per second */
6179      } audio;                             /* struct containing the above four encoding properties for audio */
6180 
6181      char                   title[DFB_STREAM_DESC_TITLE_LENGTH];     /* title   */
6182      char                   author[DFB_STREAM_DESC_AUTHOR_LENGTH];   /* author  */
6183      char                   album[DFB_STREAM_DESC_ALBUM_LENGTH];     /* album   */
6184      short                  year;                                    /* year    */
6185      char                   genre[DFB_STREAM_DESC_GENRE_LENGTH];     /* genre   */
6186      char                   comment[DFB_STREAM_DESC_COMMENT_LENGTH]; /* comment */
6187 } DFBStreamDescription;
6188 
6189 /*
6190  * Type of an audio stream.
6191  */
6192 typedef enum {
6193      DSF_ES         = 0x00000000, /* ES.  */
6194      DSF_PES        = 0x00000001, /* PES. */
6195 } DFBStreamFormat;
6196 
6197 /*
6198  * Stream attributes for an audio/video stream.
6199  */
6200 typedef struct {
6201      struct {
6202           char            encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "MPEG4") */
6203           DFBStreamFormat format;                                    /* format of the video stream */
6204      } video;                           /* struct containing the above two encoding properties for video */
6205 
6206      struct {
6207           char            encoding[DFB_STREAM_DESC_ENCODING_LENGTH]; /* encoding (e.g. "AAC") */
6208           DFBStreamFormat format;                                    /* format of the audio stream */
6209      } audio;                           /* struct containing the above two encoding properties for audio */
6210 } DFBStreamAttributes;
6211 
6212 /*
6213  * Buffer levels and occupancy for Audio/Video input buffers.
6214  */
6215 typedef struct {
6216      DFBStreamCapabilities valid;        /* Which of the Audio / Video sections are valid. */
6217 
6218      struct {
6219          unsigned int  buffer_size;      /* Size in bytes of the input buffer to video decoder */
6220          unsigned int  minimum_level;    /* The level at which a DVPET_DATALOW event will be generated. */
6221          unsigned int  maximum_level;    /* The level at which a DVPET_DATAHIGH event will be generated. */
6222          unsigned int  current_level;    /* Current fill level of video input buffer.*/
6223      } video;                           /* struct containing the above two encoding properties for video */
6224 
6225      struct {
6226          unsigned int  buffer_size;      /* Size in bytes of the input buffer to audio decoder */
6227          unsigned int  minimum_level;    /* The level at which a DVPET_DATALOW event will be generated. */
6228          unsigned int  maximum_level;    /* The level at which a DVPET_DATAHIGH event will be generated. */
6229          unsigned int  current_level;    /* Current fill level of audio input buffer.*/
6230      } audio;                           /* struct containing the above two encoding properties for audio */
6231 } DFBBufferOccupancy;
6232 
6233 /*
6234  * Buffer thresholds for Audio and Video.
6235  */
6236 typedef struct {
6237      DFBStreamCapabilities selection;    /* Which of the Audio / Video are we setting? */
6238 
6239      struct {
6240           unsigned int  minimum_level;   /* The level at which a DVPET_DATALOW event will be generated. */
6241           unsigned int  maximum_level;   /* The level at which a DVPET_DATAHIGH event will be generated. */
6242           unsigned int  minimum_time;    /* The level at which a DVPET_BUFFERTIMELOW event will be generated. */
6243           unsigned int  maximum_time;    /* The level at which a DVPET_BUFFERTIMEHIGH event will be generated. */
6244      } video;                           /* struct containing the above two encoding properties for video */
6245 
6246      struct {
6247           unsigned int  minimum_level;   /* The level at which a DVPET_DATALOW event will be generated. */
6248           unsigned int  maximum_level;   /* The level at which a DVPET_DATAHIGH event will be generated. */
6249           unsigned int  minimum_time;    /* The level at which a DVPET_BUFFERTIMELOW event will be generated. */
6250           unsigned int  maximum_time;    /* The level at which a DVPET_BUFFERTIMEHIGH event will be generated. */
6251      } audio;                           /* struct containing the above two encoding properties for audio */
6252 } DFBBufferThresholds;
6253 
6254 /*
6255  * Called for each written frame.
6256  */
6257 typedef void (*DVFrameCallback)(void *ctx);
6258 
6259 
6260 /**************************
6261  * IDirectFBVideoProvider *
6262  **************************/
6263 
6264 /*
6265  * <i>No summary yet...</i>
6266  */
6267 DEFINE_INTERFACE(   IDirectFBVideoProvider,
6268 
6269    /** Retrieving information **/
6270 
6271      /*
6272       * Retrieve information about the video provider's
6273       * capabilities.
6274       */
6275      DFBResult (*GetCapabilities) (
6276           IDirectFBVideoProvider        *thiz,
6277           DFBVideoProviderCapabilities  *ret_caps
6278      );
6279 
6280      /*
6281       * Get a surface description that best matches the video
6282       * contained in the file.
6283       */
6284      DFBResult (*GetSurfaceDescription) (
6285           IDirectFBVideoProvider   *thiz,
6286           DFBSurfaceDescription    *ret_dsc
6287      );
6288 
6289      /*
6290       * Get a description of the video stream.
6291       */
6292      DFBResult (*GetStreamDescription) (
6293           IDirectFBVideoProvider   *thiz,
6294           DFBStreamDescription     *ret_dsc
6295      );
6296 
6297 
6298    /** Playback **/
6299 
6300      /*
6301       * Play the video rendering it into the specified rectangle
6302       * of the destination surface.
6303       *
6304       * Optionally a callback can be registered that is called
6305       * for each rendered frame. This is especially important if
6306       * you are playing to a flipping surface. In this case, you
6307       * should flip the destination surface in your callback.
6308       */
6309      DFBResult (*PlayTo) (
6310           IDirectFBVideoProvider   *thiz,
6311           IDirectFBSurface         *destination,
6312           const DFBRectangle       *destination_rect,
6313           DVFrameCallback           callback,
6314           void                     *ctx
6315      );
6316 
6317      /*
6318       * Stop rendering into the destination surface.
6319       */
6320      DFBResult (*Stop) (
6321           IDirectFBVideoProvider   *thiz
6322      );
6323 
6324      /*
6325       * Get the status of the playback.
6326       */
6327      DFBResult (*GetStatus) (
6328           IDirectFBVideoProvider   *thiz,
6329           DFBVideoProviderStatus   *ret_status
6330      );
6331 
6332 
6333    /** Media Control **/
6334 
6335      /*
6336       * Seeks to a position within the stream.
6337       */
6338      DFBResult (*SeekTo) (
6339           IDirectFBVideoProvider   *thiz,
6340           double                    seconds
6341      );
6342 
6343      /*
6344       * Gets current position within the stream.
6345       */
6346      DFBResult (*GetPos) (
6347           IDirectFBVideoProvider   *thiz,
6348           double                   *ret_seconds
6349      );
6350 
6351      /*
6352       * Gets the length of the stream.
6353       */
6354      DFBResult (*GetLength) (
6355           IDirectFBVideoProvider   *thiz,
6356           double                   *ret_seconds
6357      );
6358 
6359    /** Color Adjustment **/
6360 
6361      /*
6362       * Gets the current video color settings.
6363       */
6364      DFBResult (*GetColorAdjustment) (
6365           IDirectFBVideoProvider   *thiz,
6366           DFBColorAdjustment       *ret_adj
6367      );
6368 
6369      /*
6370       * Adjusts the video colors.
6371       *
6372       * This function only has an effect if the video provider
6373       * supports this operation. Check the providers capabilities
6374       * to find out if this is the case.
6375       */
6376      DFBResult (*SetColorAdjustment) (
6377           IDirectFBVideoProvider   *thiz,
6378           const DFBColorAdjustment *adj
6379      );
6380 
6381    /** Interactivity **/
6382 
6383      /*
6384       * Send an input or window event.
6385       *
6386       * This method allows to redirect events to an interactive
6387       * video provider. Events must be relative to the specified
6388       * rectangle of the destination surface.
6389       */
6390      DFBResult (*SendEvent) (
6391           IDirectFBVideoProvider   *thiz,
6392           const DFBEvent           *event
6393      );
6394 
6395    /** Advanced control **/
6396 
6397      /*
6398       * Set the flags controlling playback mode.
6399       */
6400      DFBResult (*SetPlaybackFlags) (
6401           IDirectFBVideoProvider        *thiz,
6402           DFBVideoProviderPlaybackFlags  flags
6403      );
6404 
6405      /*
6406       * Set the speed multiplier.
6407       *
6408       * Values below 1.0 reduce playback speed
6409       * while values over 1.0 increase it.<br>
6410       * Specifying a value of 0.0 has the effect of
6411       * putting the playback in pause mode without
6412       * stopping the video provider.
6413       */
6414      DFBResult (*SetSpeed) (
6415           IDirectFBVideoProvider   *thiz,
6416           double                    multiplier
6417      );
6418 
6419      /*
6420       * Get current speed multiplier.
6421       */
6422      DFBResult (*GetSpeed) (
6423           IDirectFBVideoProvider   *thiz,
6424           double                   *ret_multiplier
6425      );
6426 
6427      /*
6428       * Set volume level.
6429       *
6430       * Values between 0.0f and 1.0f adjust the volume level.
6431       * Values over 1.0f increase the amplification level.
6432       */
6433      DFBResult (*SetVolume) (
6434           IDirectFBVideoProvider   *thiz,
6435           float                     level
6436      );
6437 
6438      /*
6439       * Get volume level.
6440       */
6441      DFBResult (*GetVolume) (
6442           IDirectFBVideoProvider   *thiz,
6443           float                    *ret_level
6444      );
6445 
6446      /*
6447       * Set the stream attributes.
6448       * May have a wrapper with different media types types encapsulated.
6449       * Can use this method to indicate the content type.
6450       */
6451      DFBResult (*SetStreamAttributes) (
6452           IDirectFBVideoProvider   *thiz,
6453           DFBStreamAttributes       attr
6454      );
6455 
6456      /*
6457       * Set the audio units that are being used for output.
6458       * May have multiple audio outputs and need to configure them on/off
6459       * dynamically.
6460       */
6461      DFBResult (*SetAudioOutputs) (
6462           IDirectFBVideoProvider     *thiz,
6463           DFBVideoProviderAudioUnits *audioUnits
6464      );
6465 
6466      /*
6467       * Get the audio units that are being used for output.
6468       */
6469      DFBResult (*GetAudioOutputs) (
6470           IDirectFBVideoProvider     *thiz,
6471           DFBVideoProviderAudioUnits *audioUnits
6472      );
6473 
6474      /*
6475       * Set the audio delay
6476       *
6477       * The parameter is in microseconds. Values < 0 make audio earlier, > 0 make audio later.
6478       */
6479       DFBResult (*SetAudioDelay) (
6480           IDirectFBVideoProvider     *thiz,
6481           long                        delay
6482       );
6483 
6484 
6485   /** Event buffers **/
6486 
6487      /*
6488       * Create an event buffer for this video provider and attach it.
6489       */
6490      DFBResult (*CreateEventBuffer) (
6491           IDirectFBVideoProvider     *thiz,
6492           IDirectFBEventBuffer      **ret_buffer
6493      );
6494 
6495      /*
6496       * Attach an existing event buffer to this video provider.
6497       *
6498       * NOTE: Attaching multiple times generates multiple events.
6499       */
6500      DFBResult (*AttachEventBuffer) (
6501           IDirectFBVideoProvider     *thiz,
6502           IDirectFBEventBuffer       *buffer
6503      );
6504 
6505      /*
6506       * Enable specific events to be sent from the video provider.
6507       *
6508       * The argument is a mask of events that will be set in the
6509       * videoproviders's event mask. The default event mask is DVPET_ALL.
6510       */
6511      DFBResult (*EnableEvents) (
6512           IDirectFBVideoProvider     *thiz,
6513           DFBVideoProviderEventType   mask
6514      );
6515 
6516      /*
6517       * Disable specific events from being sent from the video provider
6518       *
6519       * The argument is a mask of events that will be cleared in
6520       * the video providers's event mask. The default event mask is DWET_ALL.
6521       */
6522      DFBResult (*DisableEvents) (
6523           IDirectFBVideoProvider     *thiz,
6524           DFBVideoProviderEventType   mask
6525      );
6526 
6527      /*
6528       * Detach an event buffer from this video provider.
6529       */
6530      DFBResult (*DetachEventBuffer) (
6531           IDirectFBVideoProvider     *thiz,
6532           IDirectFBEventBuffer       *buffer
6533      );
6534 
6535 
6536   /** Buffer control **/
6537 
6538      /*
6539       * Get buffer occupancy (A/V) when playing this stream.
6540       */
6541      DFBResult (*GetBufferOccupancy) (
6542           IDirectFBVideoProvider   *thiz,
6543           DFBBufferOccupancy       *ret_occ
6544      );
6545 
6546      /*
6547       * Set buffer thresholds for the Audio / Video playback.
6548       */
6549      DFBResult (*SetBufferThresholds) (
6550           IDirectFBVideoProvider   *thiz,
6551           DFBBufferThresholds       thresh
6552      );
6553 
6554      /*
6555       * Get buffer thresholds for the Audio / Video playback.
6556       */
6557      DFBResult (*GetBufferThresholds) (
6558           IDirectFBVideoProvider   *thiz,
6559           DFBBufferThresholds      *ret_thresh
6560      );
6561 )
6562 
6563 /***********************
6564  * IDirectFBDataBuffer *
6565  ***********************/
6566 
6567 /*
6568  * <i>No summary yet...</i>
6569  */
6570 DEFINE_INTERFACE(   IDirectFBDataBuffer,
6571 
6572 
6573    /** Buffer handling **/
6574 
6575      /*
6576       * Flushes all data in this buffer.
6577       *
6578       * This method only applies to streaming buffers.
6579       */
6580      DFBResult (*Flush) (
6581           IDirectFBDataBuffer      *thiz
6582      );
6583 
6584      /*
6585       * Finish writing into a streaming buffer.
6586       *
6587       * Subsequent calls to PutData will fail,
6588       * while attempts to fetch data from the buffer will return EOF
6589       * unless there is still data available.
6590       */
6591      DFBResult (*Finish) (
6592           IDirectFBDataBuffer      *thiz
6593      );
6594 
6595      /*
6596       * Seeks to a given byte position.
6597       *
6598       * This method only applies to static buffers.
6599       */
6600      DFBResult (*SeekTo) (
6601           IDirectFBDataBuffer      *thiz,
6602           unsigned int              offset
6603      );
6604 
6605      /*
6606       * Get the current byte position within a static buffer.
6607       *
6608       * This method only applies to static buffers.
6609       */
6610      DFBResult (*GetPosition) (
6611           IDirectFBDataBuffer      *thiz,
6612           unsigned int             *ret_offset
6613      );
6614 
6615      /*
6616       * Get the length of a static or streaming buffer in bytes.
6617       *
6618       * The length of a static buffer is its static size.
6619       * A streaming buffer has a variable length reflecting
6620       * the amount of buffered data.
6621       */
6622      DFBResult (*GetLength) (
6623           IDirectFBDataBuffer      *thiz,
6624           unsigned int             *ret_length
6625      );
6626 
6627    /** Waiting for data **/
6628 
6629      /*
6630       * Wait for data to be available.
6631       * Thread is idle in the meantime.
6632       *
6633       * This method blocks until at least the specified number of bytes
6634       * is available.
6635       */
6636      DFBResult (*WaitForData) (
6637           IDirectFBDataBuffer      *thiz,
6638           unsigned int              length
6639      );
6640 
6641      /*
6642       * Wait for data to be available within an amount of time.
6643       * Thread is idle in the meantime.
6644       *
6645       * This method blocks until at least the specified number of bytes
6646       * is available or the timeout is reached.
6647       */
6648      DFBResult (*WaitForDataWithTimeout) (
6649           IDirectFBDataBuffer      *thiz,
6650           unsigned int              length,
6651           unsigned int              seconds,
6652           unsigned int              milli_seconds
6653      );
6654 
6655 
6656    /** Retrieving data **/
6657 
6658      /*
6659       * Fetch data from a streaming or static buffer.
6660       *
6661       * Static buffers will increase the data pointer.
6662       * Streaming buffers will flush the data portion.
6663       *
6664       * The maximum number of bytes to fetch is specified by "length",
6665       * the actual number of bytes fetched is returned via "read".
6666       */
6667      DFBResult (*GetData) (
6668           IDirectFBDataBuffer      *thiz,
6669           unsigned int              length,
6670           void                     *ret_data,
6671           unsigned int             *ret_read
6672      );
6673 
6674      /*
6675       * Peek data from a streaming or static buffer.
6676       *
6677       * Unlike GetData() this method won't increase the data
6678       * pointer or flush any portions of the data held.
6679       *
6680       * Additionally an offset relative to the current data pointer
6681       * or beginning of the streaming buffer can be specified.
6682       *
6683       * The maximum number of bytes to peek is specified by "length",
6684       * the actual number of bytes peeked is returned via "read".
6685       */
6686      DFBResult (*PeekData) (
6687           IDirectFBDataBuffer      *thiz,
6688           unsigned int              length,
6689           int                       offset,
6690           void                     *ret_data,
6691           unsigned int             *ret_read
6692      );
6693 
6694      /*
6695       * Check if there is data available.
6696       *
6697       * This method returns DFB_OK if there is data available,
6698       * DFB_BUFFER_EMPTY otherwise.
6699       */
6700      DFBResult (*HasData) (
6701           IDirectFBDataBuffer      *thiz
6702      );
6703 
6704 
6705    /** Providing data **/
6706 
6707      /*
6708       * Appends a block of data to a streaming buffer.
6709       *
6710       * This method does not wait until the data got fetched.
6711       *
6712       * Static buffers don't support this method.
6713       */
6714      DFBResult (*PutData) (
6715           IDirectFBDataBuffer      *thiz,
6716           const void               *data,
6717           unsigned int              length
6718      );
6719 
6720 
6721    /** Media from data **/
6722 
6723      /*
6724       * Creates an image provider using the buffers data.
6725       */
6726      DFBResult (*CreateImageProvider) (
6727           IDirectFBDataBuffer      *thiz,
6728           IDirectFBImageProvider  **interface
6729      );
6730 
6731      /*
6732       * Creates a video provider using the buffers data.
6733       */
6734      DFBResult (*CreateVideoProvider) (
6735           IDirectFBDataBuffer      *thiz,
6736           IDirectFBVideoProvider  **interface
6737      );
6738 
6739      /*
6740       * Load a font using the buffer's data, given a description
6741       * of how to load the glyphs.
6742       */
6743      DFBResult (*CreateFont) (
6744           IDirectFBDataBuffer       *thiz,
6745           const DFBFontDescription  *desc,
6746           IDirectFBFont            **interface
6747      );
6748 )
6749 
6750 #ifdef __cplusplus
6751 }
6752 #endif
6753 
6754 #endif
6755