source: trunk/doc/html/qpaintdevice-h.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 14.4 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qpaintdevice.h:1 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>qpaintdevice.h Include File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qpaintdevice.h</h1>
33
34<p>This is the verbatim text of the qpaintdevice.h include file. It is provided only for illustration; the copyright remains with Trolltech.
35<hr>
36<pre>
37/****************************************************************************
38** $Id: qpaintdevice-h.html 2051 2007-02-21 10:04:20Z chehrlic $
39**
40** Definition of QPaintDevice class
41**
42** Created : 940721
43**
44** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
45**
46** This file is part of the kernel module of the Qt GUI Toolkit.
47**
48** This file may be distributed under the terms of the Q Public License
49** as defined by Trolltech ASA of Norway and appearing in the file
50** LICENSE.QPL included in the packaging of this file.
51**
52** This file may be distributed and/or modified under the terms of the
53** GNU General Public License version 2 as published by the Free Software
54** Foundation and appearing in the file LICENSE.GPL included in the
55** packaging of this file.
56**
57** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
58** licenses may use this file in accordance with the Qt Commercial License
59** Agreement provided with the Software.
60**
61** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
62** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63**
64** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
65** information about Qt Commercial License Agreements.
66** See http://www.trolltech.com/qpl/ for QPL licensing information.
67** See http://www.trolltech.com/gpl/ for GPL licensing information.
68**
69** Contact info@trolltech.com if any conditions of this licensing are
70** not clear to you.
71**
72**********************************************************************/
73
74#ifndef QPAINTDEVICE_H
75#define QPAINTDEVICE_H
76
77#ifndef QT_H
78#include "qwindowdefs.h"
79#include "qrect.h"
80#endif // QT_H
81
82#if defined(Q_WS_QWS)
83class QWSDisplay;
84class QGfx;
85#endif
86
87class QIODevice;
88class QString;
89class QTextItem;
90
91
92#if defined(Q_WS_X11)
93struct QPaintDeviceX11Data;
94#endif
95
96union QPDevCmdParam {
97 int ival;
98 int *ivec;
99 QString *str;
100 const QPoint *point;
101 const QRect *rect;
102 const QPointArray *ptarr;
103 const QPixmap *pixmap;
104 const QImage *image;
105 const QColor *color;
106 const QFont *font;
107 const QPen *pen;
108 const QBrush *brush;
109 const QRegion *rgn;
110 const QWMatrix *matrix;
111 const QTextItem *textItem;
112 QIODevice *device;
113};
114
115
116
117class Q_EXPORT QPaintDevice // device for QPainter
118{
119public:
120 virtual ~QPaintDevice();
121
122 int devType() const;
123 bool isExtDev() const;
124 bool paintingActive() const;
125
126 virtual void setResolution( int );
127 virtual int resolution() const;
128
129 // Windows: get device context
130 // X-Windows: get drawable
131#if defined(Q_WS_WIN)
132 virtual HDC handle() const;
133#elif defined(Q_WS_X11)
134 virtual Qt::HANDLE handle() const;
135 virtual Qt::HANDLE x11RenderHandle() const;
136#elif defined(Q_WS_MAC)
137 virtual Qt::HANDLE handle() const;
138#elif defined(Q_WS_QWS)
139 virtual Qt::HANDLE handle() const;
140#endif
141
142#if defined(Q_WS_X11)
143 Display *x11Display() const;
144 int x11Screen() const;
145 int x11Depth() const;
146 int x11Cells() const;
147 Qt::HANDLE x11Colormap() const;
148 bool x11DefaultColormap() const;
149 void *x11Visual() const;
150 bool x11DefaultVisual() const;
151
152 static Display *x11AppDisplay();
153 static int x11AppScreen();
154
155 static int x11AppDpiX();
156 static int x11AppDpiY();
157 static void x11SetAppDpiX(int);
158 static void x11SetAppDpiY(int);
159 static int x11AppDepth();
160 static int x11AppCells();
161 static Qt::HANDLE x11AppRootWindow();
162 static Qt::HANDLE x11AppColormap();
163 static bool x11AppDefaultColormap();
164 static void *x11AppVisual();
165 static bool x11AppDefaultVisual();
166
167 // ### in 4.0, the above need to go away, the below needs to take a -1 default
168 // argument, signifying the default screen...
169 static int x11AppDepth( int screen );
170 static int x11AppCells( int screen );
171 static Qt::HANDLE x11AppRootWindow( int screen );
172 static Qt::HANDLE x11AppColormap( int screen );
173 static void *x11AppVisual( int screen );
174 static bool x11AppDefaultColormap( int screen );
175 static bool x11AppDefaultVisual( int screen );
176 static int x11AppDpiX( int );
177 static int x11AppDpiY( int );
178 static void x11SetAppDpiX( int, int );
179 static void x11SetAppDpiY( int, int );
180#endif
181
182#if defined(Q_WS_QWS)
183 static QWSDisplay *qwsDisplay();
184 virtual unsigned char * scanLine(int) const;
185 virtual int bytesPerLine() const;
186 virtual QGfx * graphicsContext(bool clip_children=TRUE) const;
187#endif
188
189 enum PDevCmd {
190 PdcNOP = 0, // &lt;void&gt;
191 PdcDrawPoint = 1, // point
192 PdcDrawFirst = PdcDrawPoint,
193 PdcMoveTo = 2, // point
194 PdcLineTo = 3, // point
195 PdcDrawLine = 4, // point,point
196 PdcDrawRect = 5, // rect
197 PdcDrawRoundRect = 6, // rect,ival,ival
198 PdcDrawEllipse = 7, // rect
199 PdcDrawArc = 8, // rect,ival,ival
200 PdcDrawPie = 9, // rect,ival,ival
201 PdcDrawChord = 10, // rect,ival,ival
202 PdcDrawLineSegments = 11, // ptarr
203 PdcDrawPolyline = 12, // ptarr
204 PdcDrawPolygon = 13, // ptarr,ival
205 PdcDrawCubicBezier = 14, // ptarr
206 PdcDrawText = 15, // point,str
207 PdcDrawTextFormatted = 16, // rect,ival,str
208 PdcDrawPixmap = 17, // rect,pixmap
209 PdcDrawImage = 18, // rect,image
210 PdcDrawText2 = 19, // point,str
211 PdcDrawText2Formatted = 20, // rect,ival,str
212 PdcDrawTextItem = 21,
213 PdcDrawLast = PdcDrawTextItem,
214
215 // no painting commands below PdcDrawLast.
216
217 PdcBegin = 30, // &lt;void&gt;
218 PdcEnd = 31, // &lt;void&gt;
219 PdcSave = 32, // &lt;void&gt;
220 PdcRestore = 33, // &lt;void&gt;
221 PdcSetdev = 34, // device - PRIVATE
222 PdcSetBkColor = 40, // color
223 PdcSetBkMode = 41, // ival
224 PdcSetROP = 42, // ival
225 PdcSetBrushOrigin = 43, // point
226 PdcSetFont = 45, // font
227 PdcSetPen = 46, // pen
228 PdcSetBrush = 47, // brush
229 PdcSetTabStops = 48, // ival
230 PdcSetTabArray = 49, // ival,ivec
231 PdcSetUnit = 50, // ival
232 PdcSetVXform = 51, // ival
233 PdcSetWindow = 52, // rect
234 PdcSetViewport = 53, // rect
235 PdcSetWXform = 54, // ival
236 PdcSetWMatrix = 55, // matrix,ival
237 PdcSaveWMatrix = 56,
238 PdcRestoreWMatrix = 57,
239 PdcSetClip = 60, // ival
240 PdcSetClipRegion = 61, // rgn
241
242 PdcReservedStart = 0, // codes 0-199 are reserved
243 PdcReservedStop = 199 // for Qt
244 };
245
246protected:
247 QPaintDevice( uint devflags );
248
249#if defined(Q_WS_WIN)
250 HDC hdc; // device context
251#elif defined(Q_WS_X11)
252 Qt::HANDLE hd; // handle to drawable
253 Qt::HANDLE rendhd; // handle to RENDER pict
254
255 void copyX11Data( const QPaintDevice * );
256 void cloneX11Data( const QPaintDevice * );
257 virtual void setX11Data( const QPaintDeviceX11Data* );
258 QPaintDeviceX11Data* getX11Data( bool def=FALSE ) const;
259#elif defined(Q_WS_MAC)
260#if !defined( QMAC_NO_QUARTZ )
261 CGContextRef ctx;
262#endif
263 void * hd;
264#elif defined(Q_WS_QWS)
265 Qt::HANDLE hd;
266#endif
267
268 virtual bool cmd( int, QPainter *, QPDevCmdParam * );
269 virtual int metric( int ) const;
270 virtual int fontMet( QFont *, int, const char * = 0, int = 0 ) const;
271 virtual int fontInf( QFont *, int ) const;
272
273 ushort devFlags; // device flags
274 ushort painters; // refcount
275
276 friend class QPainter;
277 friend class QPaintDeviceMetrics;
278#if defined(Q_WS_MAC)
279#ifndef QMAC_NO_QUARTZ
280 virtual CGContextRef macCGContext(bool clipped=TRUE) const;
281#endif
282 friend Q_EXPORT void unclippedScaledBitBlt( QPaintDevice *, int, int, int, int,
283 const QPaintDevice *, int, int, int, int, Qt::RasterOp, bool, bool );
284#else
285 friend Q_EXPORT void bitBlt( QPaintDevice *, int, int,
286 const QPaintDevice *,
287 int, int, int, int, Qt::RasterOp, bool );
288#endif
289#if defined(Q_WS_X11)
290 friend void qt_init_internal( int *, char **, Display *, Qt::HANDLE, Qt::HANDLE );
291 friend void qt_cleanup();
292#endif
293
294private:
295#if defined(Q_WS_X11)
296 static Display *x_appdisplay;
297 static int x_appscreen;
298
299 static int x_appdepth;
300 static int x_appcells;
301 static Qt::HANDLE x_approotwindow;
302 static Qt::HANDLE x_appcolormap;
303 static bool x_appdefcolormap;
304 static void *x_appvisual;
305 static bool x_appdefvisual;
306
307 // ### in 4.0, remove the above, and replace with the below
308 static int *x_appdepth_arr;
309 static int *x_appcells_arr;
310 static Qt::HANDLE *x_approotwindow_arr;
311 static Qt::HANDLE *x_appcolormap_arr;
312 static bool *x_appdefcolormap_arr;
313 static void **x_appvisual_arr;
314 static bool *x_appdefvisual_arr;
315
316 QPaintDeviceX11Data* x11Data;
317#endif
318
319private: // Disabled copy constructor and operator=
320#if defined(Q_DISABLE_COPY)
321 QPaintDevice( const QPaintDevice &amp; );
322 QPaintDevice &amp;operator=( const QPaintDevice &amp; );
323#endif
324};
325
326
327Q_EXPORT
328void bitBlt( QPaintDevice *dst, int dx, int dy,
329 const QPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
330 Qt::RasterOp = Qt::CopyROP, bool ignoreMask=FALSE );
331
332Q_EXPORT
333void bitBlt( QPaintDevice *dst, int dx, int dy,
334 const QImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
335 int conversion_flags=0 );
336
337
338#if defined(Q_WS_X11)
339
340struct Q_EXPORT QPaintDeviceX11Data : public QShared {
341 Display* x_display;
342 int x_screen;
343 int x_depth;
344 int x_cells;
345 Qt::HANDLE x_colormap;
346 bool x_defcolormap;
347 void* x_visual;
348 bool x_defvisual;
349};
350
351#endif
352
353/*****************************************************************************
354 Inline functions
355 *****************************************************************************/
356
357inline int QPaintDevice::devType() const
358{ return devFlags &amp; QInternal::DeviceTypeMask; }
359
360inline bool QPaintDevice::isExtDev() const
361{ return (devFlags &amp; QInternal::ExternalDevice) != 0; }
362
363inline bool QPaintDevice::paintingActive() const
364{ return painters != 0; }
365
366#if defined(Q_WS_X11)
367inline Display *QPaintDevice::x11Display() const
368{ return x11Data ? x11Data-&gt;x_display : x_appdisplay; }
369
370inline int QPaintDevice::x11Screen() const
371{ return x11Data ? x11Data-&gt;x_screen : x_appscreen; }
372
373inline int QPaintDevice::x11Depth() const
374{ return x11Data ? x11Data-&gt;x_depth : x_appdepth; }
375
376inline int QPaintDevice::x11Cells() const
377{ return x11Data ? x11Data-&gt;x_cells : x_appcells; }
378
379inline Qt::HANDLE QPaintDevice::x11Colormap() const
380{ return x11Data ? x11Data-&gt;x_colormap : x_appcolormap; }
381
382inline bool QPaintDevice::x11DefaultColormap() const
383{ return x11Data ? x11Data-&gt;x_defcolormap : x_appdefcolormap; }
384
385inline void *QPaintDevice::x11Visual() const
386{ return x11Data ? x11Data-&gt;x_visual : x_appvisual; }
387
388inline bool QPaintDevice::x11DefaultVisual() const
389{ return x11Data ? x11Data-&gt;x_defvisual : x_appdefvisual; }
390
391inline Display *QPaintDevice::x11AppDisplay()
392{ return x_appdisplay; }
393
394inline int QPaintDevice::x11AppScreen()
395{ return x_appscreen; }
396
397inline int QPaintDevice::x11AppDepth( int screen )
398{ return x_appdepth_arr[ screen == -1 ? x_appscreen : screen ]; }
399
400inline int QPaintDevice::x11AppCells( int screen )
401{ return x_appcells_arr[ screen == -1 ? x_appscreen : screen ]; }
402
403inline Qt::HANDLE QPaintDevice::x11AppRootWindow( int screen )
404{ return x_approotwindow_arr[ screen == -1 ? x_appscreen : screen ]; }
405
406inline Qt::HANDLE QPaintDevice::x11AppColormap( int screen )
407{ return x_appcolormap_arr[ screen == -1 ? x_appscreen : screen ]; }
408
409inline bool QPaintDevice::x11AppDefaultColormap( int screen )
410{ return x_appdefcolormap_arr[ screen == -1 ? x_appscreen : screen ]; }
411
412inline void *QPaintDevice::x11AppVisual( int screen )
413{ return x_appvisual_arr[ screen == -1 ? x_appscreen : screen ]; }
414
415inline bool QPaintDevice::x11AppDefaultVisual( int screen )
416{ return x_appdefvisual_arr[ screen == -1 ? x_appscreen : screen ]; }
417
418inline int QPaintDevice::x11AppDepth()
419{ return x_appdepth; }
420
421inline int QPaintDevice::x11AppCells()
422{ return x_appcells; }
423
424inline Qt::HANDLE QPaintDevice::x11AppRootWindow()
425{ return x_approotwindow; }
426
427inline Qt::HANDLE QPaintDevice::x11AppColormap()
428{ return x_appcolormap; }
429
430inline bool QPaintDevice::x11AppDefaultColormap()
431{ return x_appdefcolormap; }
432
433inline void *QPaintDevice::x11AppVisual()
434{ return x_appvisual; }
435
436inline bool QPaintDevice::x11AppDefaultVisual()
437{ return x_appdefvisual; }
438
439#endif // Q_WS_X11
440
441
442Q_EXPORT
443inline void bitBlt( QPaintDevice *dst, const QPoint &amp;dp,
444 const QPaintDevice *src, const QRect &amp;sr =QRect(0,0,-1,-1),
445 Qt::RasterOp rop=Qt::CopyROP, bool ignoreMask=FALSE )
446{
447 bitBlt( dst, dp.x(), dp.y(), src, sr.x(), sr.y(), sr.width(), sr.height(),
448 rop, ignoreMask );
449}
450
451
452
453
454#endif // QPAINTDEVICE_H
455</pre>
456<!-- eof -->
457<p><address><hr><div align=center>
458<table width=100% cellspacing=0 border=0><tr>
459<td>Copyright &copy; 2007
460<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
461<td align=right><div align=right>Qt 3.3.8</div>
462</table></div></address></body>
463</html>
Note: See TracBrowser for help on using the repository browser.