Qt 4.8
pvrqwsdrawable.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef PVRQWSDRAWABLE_H
43 #define PVRQWSDRAWABLE_H
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 typedef struct {
50  int x, y, width, height;
51 } PvrQwsRect;
52 
53 typedef enum
54 {
58 
60 
61 typedef enum
62 {
69 
71 
73 
74 typedef void (*PvrQwsSwapFunction)
75  (PvrQwsDrawable *drawable, void *userData, int repaintOnly);
76 
77 /* Open the display and prepare for window operations. The display
78  can be opened multiple times and each time is reference counted.
79  The display will be finally closed when the same number of
80  calls to pvrQwsDisplayClose() have been encountered */
81 int pvrQwsDisplayOpen(void);
82 
83 /* Close the display */
84 void pvrQwsDisplayClose(void);
85 
86 /* Determine if the display is already open */
87 int pvrQwsDisplayIsOpen(void);
88 
89 /* Create a window that represents a particular framebuffer screen.
90  Initially the visible region will be the whole screen. If the screen
91  window has already been created, then will return the same value */
93 
94 /* Create a top-level window on a particular framebuffer screen.
95  Initially the window will not have a visible region */
97 
98 /* Fetch an existing window for a window id and increase its refcount */
100 
101 /* Release the refcount on a window. Returns 1 if refcount is zero */
102 int pvrQwsReleaseWindow(PvrQwsDrawable *drawable);
103 
104 /* Create an off-screen pixmap */
105 PvrQwsDrawable *pvrQwsCreatePixmap(int width, int height, int screen);
106 
107 /* Destroy a previously-created drawable. Will not destroy screens. */
108 void pvrQwsDestroyDrawable(PvrQwsDrawable *drawable);
109 
110 /* Get a drawable's type */
111 PvrQwsDrawableType pvrQwsGetDrawableType(PvrQwsDrawable *drawable);
112 
113 /* Sets the visible region for a window or screen drawable. Pixels within
114  the specified rectangles will be copied to the framebuffer when the window
115  or screen is swapped. The rectangles should be in global co-ordinates */
117  (PvrQwsDrawable *drawable, const PvrQwsRect *rects, int numRects);
118 
119 /* Clear the visible region for a window or screen drawable,
120  effectively removing it from the screen */
122 
123 /* Set the geometry for a drawable. This can only be used on windows */
124 void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect);
125 
126 /* Get the current geometry for a drawable */
128 
129 /* Set the rotation angle in degrees */
130 void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle);
131 
132 /* Get the line stride for a drawable. Returns zero if the buffers
133  are not allocated or have been invalidated */
134 int pvrQwsGetStride(PvrQwsDrawable *drawable);
135 
136 /* Get the pixel format for a drawable */
137 PvrQwsPixelFormat pvrQwsGetPixelFormat(PvrQwsDrawable *drawable);
138 
139 /* Get a pointer to the beginning of a drawable's current render buffer.
140  Returns null if the buffers are not allocated or have been invalidated */
141 void *pvrQwsGetRenderBuffer(PvrQwsDrawable *drawable);
142 
143 /* Allocate the buffers associated with a drawable. We allocate one buffer
144  for pixmaps, and several for windows and screens */
145 int pvrQwsAllocBuffers(PvrQwsDrawable *drawable);
146 
147 /* Free the buffers associated with a drawable */
148 void pvrQwsFreeBuffers(PvrQwsDrawable *drawable);
149 
150 /* Invalidate the buffers associated with a drawable. The buffers will
151  still be allocated but the next attempt to swap the buffers will fail */
153 
154 /* Swap the back buffers for a window or screen and copy to the framebuffer */
155 int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly);
156 
157 /* Set the swap function for a drawable. When pvrQwsSwapBuffers()
158  is called on the drawable, the supplied function will be called
159  instead of copying the drawable contents to the screen. This allows
160  higher-level compositors to know when a drawable has changed.
161  The swap function can be set to null to return to normal processing */
163  (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData);
164 
165 #ifdef __cplusplus
166 };
167 #endif
168 
169 #endif
int pvrQwsDisplayIsOpen(void)
PvrQwsPixelFormat
void pvrQwsDestroyDrawable(PvrQwsDrawable *drawable)
void(* PvrQwsSwapFunction)(PvrQwsDrawable *drawable, void *userData, int repaintOnly)
PvrQwsDrawableType
PvrQwsDrawable * pvrQwsFetchWindow(long winId)
int pvrQwsAllocBuffers(PvrQwsDrawable *drawable)
void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle)
int pvrQwsReleaseWindow(PvrQwsDrawable *drawable)
void pvrQwsFreeBuffers(PvrQwsDrawable *drawable)
int pvrQwsGetStride(PvrQwsDrawable *drawable)
PvrQwsDrawable * pvrQwsCreateWindow(int screen, long winId, const PvrQwsRect *rect)
void pvrQwsInvalidateBuffers(PvrQwsDrawable *drawable)
PvrQwsDrawableType pvrQwsGetDrawableType(PvrQwsDrawable *drawable)
qreal angle(const QPointF &p1, const QPointF &p2)
PvrQwsDrawable * pvrQwsScreenWindow(int screen)
int pvrQwsDisplayOpen(void)
int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly)
PvrQwsDrawable * pvrQwsCreatePixmap(int width, int height, int screen)
void pvrQwsSetSwapFunction(PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData)
void * pvrQwsGetRenderBuffer(PvrQwsDrawable *drawable)
void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect)
PvrQwsPixelFormat pvrQwsGetPixelFormat(PvrQwsDrawable *drawable)
void pvrQwsDisplayClose(void)
void pvrQwsClearVisibleRegion(PvrQwsDrawable *drawable)
void pvrQwsSetVisibleRegion(PvrQwsDrawable *drawable, const PvrQwsRect *rects, int numRects)
void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect)