Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the documentation of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:FDL$
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 The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Free Documentation License Usage
18** Alternatively, this file may be used under the terms of the GNU Free
19** Documentation License version 1.3 as published by the Free Software
20** Foundation and appearing in the file included in the packaging of
21** this file. Please review the following information to ensure
22** the GNU Free Documentation License version 1.3 requirements
23** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
24** $QT_END_LICENSE$
25**
26****************************************************************************/
27
28/*!
29 \class QPaintDevice
30 \brief The QPaintDevice class is the base class of objects that
31 can be painted on with QPainter.
32
33 \ingroup painting
34 \inmodule QtGui
35
36 A paint device is an abstraction of a two-dimensional space that
37 can be drawn on using a QPainter. Its default coordinate system has
38 its origin located at the top-left position. X increases to the
39 right and Y increases downwards. The unit is one pixel.
40
41 The drawing capabilities of QPaintDevice are currently implemented
42 by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and
43 QPrinter subclasses.
44
45 To implement support for a new backend, you must derive from
46 QPaintDevice and reimplement the virtual paintEngine() function to
47 tell QPainter which paint engine should be used to draw on this
48 particular device. Note that you also must create a corresponding
49 paint engine to be able to draw on the device, i.e derive from
50 QPaintEngine and reimplement its virtual functions.
51
52 \warning Qt requires that a QGuiApplication object exists before
53 any paint devices can be created. Paint devices access window
54 system resources, and these resources are not initialized before
55 an application object is created.
56
57 The QPaintDevice class provides several functions returning the
58 various device metrics: The depth() function returns its bit depth
59 (number of bit planes). The height() function returns its height
60 in default coordinate system units (e.g. pixels for QPixmap and
61 QWidget) while heightMM() returns the height of the device in
62 millimeters. Similiarily, the width() and widthMM() functions
63 return the width of the device in default coordinate system units
64 and in millimeters, respectively. Alternatively, the protected
65 metric() function can be used to retrieve the metric information
66 by specifying the desired PaintDeviceMetric as argument.
67
68 The logicalDpiX() and logicalDpiY() functions return the
69 horizontal and vertical resolution of the device in dots per
70 inch. The physicalDpiX() and physicalDpiY() functions also return
71 the resolution of the device in dots per inch, but note that if
72 the logical and physical resolution differ, the corresponding
73 QPaintEngine must handle the mapping. Finally, the colorCount()
74 function returns the number of different colors available for the
75 paint device.
76
77 \sa QPaintEngine, QPainter, {Coordinate System}, {Paint System}
78*/
79
80/*!
81 \enum QPaintDevice::PaintDeviceMetric
82
83 Describes the various metrics of a paint device.
84
85 \value PdmWidth The width of the paint device in default
86 coordinate system units (e.g. pixels for QPixmap and QWidget). See
87 also width().
88
89 \value PdmHeight The height of the paint device in default
90 coordinate system units (e.g. pixels for QPixmap and QWidget). See
91 also height().
92
93 \value PdmWidthMM The width of the paint device in millimeters. See
94 also widthMM().
95
96 \value PdmHeightMM The height of the paint device in millimeters. See
97 also heightMM().
98
99 \value PdmNumColors The number of different colors available for
100 the paint device. See also colorCount().
101
102 \value PdmDepth The bit depth (number of bit planes) of the paint
103 device. See also depth().
104
105 \value PdmDpiX The horizontal resolution of the device in dots per
106 inch. See also logicalDpiX().
107
108 \value PdmDpiY The vertical resolution of the device in dots per inch. See
109 also logicalDpiY().
110
111 \value PdmPhysicalDpiX The horizontal resolution of the device in
112 dots per inch. See also physicalDpiX().
113
114 \value PdmPhysicalDpiY The vertical resolution of the device in
115 dots per inch. See also physicalDpiY().
116
117 \value PdmDevicePixelRatio The device pixel ratio for device. Common
118 values are 1 for normal-dpi displays and 2 for high-dpi "retina"
119 displays.
120
121 \value PdmDevicePixelRatioScaled The scaled device pixel ratio for the device.
122 This is identical to PdmDevicePixelRatio, except that the value is scaled by a
123 constant factor in order to support paint devices with fractional scale factors.
124 The constant scaling factor used is devicePixelRatioFScale(). This enum value
125 has been introduced in Qt 5.6.
126
127 \sa metric(), devicePixelRatioF()
128*/
129
130/*!
131 \fn QPaintDevice::QPaintDevice()
132
133 Constructs a paint device. This constructor can be invoked only from
134 subclasses of QPaintDevice.
135*/
136
137/*!
138 \fn QPaintDevice::~QPaintDevice()
139
140 Destroys the paint device and frees window system resources.
141*/
142
143/*!
144 \fn int QPaintDevice::devType() const
145
146 \internal
147
148 Returns the device type identifier, which is QInternal::Widget
149 if the device is a QWidget, QInternal::Pixmap if it's a
150 QPixmap, QInternal::Printer if it's a QPrinter,
151 QInternal::Picture if it's a QPicture, or
152 QInternal::UnknownDevice in other cases.
153*/
154
155/*!
156 \fn bool QPaintDevice::paintingActive() const
157
158 Returns \c true if the device is currently being painted on, i.e. someone has
159 called QPainter::begin() but not yet called QPainter::end() for
160 this device; otherwise returns \c false.
161
162 \sa QPainter::isActive()
163*/
164
165/*!
166 \fn QPaintEngine *QPaintDevice::paintEngine() const
167
168 Returns a pointer to the paint engine used for drawing on the
169 device.
170*/
171
172/*!
173 \fn int QPaintDevice::metric(PaintDeviceMetric metric) const
174
175 Returns the metric information for the given paint device \a metric.
176
177 \sa PaintDeviceMetric
178*/
179
180/*!
181 \fn int QPaintDevice::width() const
182
183 Returns the width of the paint device in default coordinate system
184 units (e.g. pixels for QPixmap and QWidget).
185
186 \sa widthMM()
187*/
188
189/*!
190 \fn int QPaintDevice::height() const
191
192 Returns the height of the paint device in default coordinate
193 system units (e.g. pixels for QPixmap and QWidget).
194
195 \sa heightMM()
196*/
197
198/*!
199 \fn int QPaintDevice::widthMM() const
200
201 Returns the width of the paint device in millimeters. Due to platform
202 limitations it may not be possible to use this function to determine
203 the actual physical size of a widget on the screen.
204
205 \sa width()
206*/
207
208/*!
209 \fn int QPaintDevice::heightMM() const
210
211 Returns the height of the paint device in millimeters. Due to platform
212 limitations it may not be possible to use this function to determine
213 the actual physical size of a widget on the screen.
214
215 \sa height()
216*/
217
218/*!
219 \fn int QPaintDevice::colorCount() const
220
221 Returns the number of different colors available for the paint
222 device. If the number of colors available is too great to be
223 represented by the int data type, then INT_MAX will be returned
224 instead.
225*/
226
227/*!
228 \fn int QPaintDevice::depth() const
229
230 Returns the bit depth (number of bit planes) of the paint device.
231*/
232
233/*!
234 \fn int QPaintDevice::logicalDpiX() const
235
236 Returns the horizontal resolution of the device in dots per inch,
237 which is used when computing font sizes. For X11, this is usually
238 the same as could be computed from widthMM().
239
240 Note that if the logicalDpiX() doesn't equal the physicalDpiX(),
241 the corresponding QPaintEngine must handle the resolution mapping.
242
243 \sa logicalDpiY(), physicalDpiX()
244*/
245
246/*!
247 \fn int QPaintDevice::logicalDpiY() const
248
249 Returns the vertical resolution of the device in dots per inch,
250 which is used when computing font sizes. For X11, this is usually
251 the same as could be computed from heightMM().
252
253 Note that if the logicalDpiY() doesn't equal the physicalDpiY(),
254 the corresponding QPaintEngine must handle the resolution mapping.
255
256 \sa logicalDpiX(), physicalDpiY()
257*/
258
259/*!
260 \fn int QPaintDevice::physicalDpiX() const
261
262 Returns the horizontal resolution of the device in dots per inch.
263 For example, when printing, this resolution refers to the physical
264 printer's resolution. The logical DPI on the other hand, refers to
265 the resolution used by the actual paint engine.
266
267 Note that if the physicalDpiX() doesn't equal the logicalDpiX(),
268 the corresponding QPaintEngine must handle the resolution mapping.
269
270 \sa physicalDpiY(), logicalDpiX()
271*/
272
273/*!
274 \fn int QPaintDevice::physicalDpiY() const
275
276 Returns the horizontal resolution of the device in dots per inch.
277 For example, when printing, this resolution refers to the physical
278 printer's resolution. The logical DPI on the other hand, refers to
279 the resolution used by the actual paint engine.
280
281 Note that if the physicalDpiY() doesn't equal the logicalDpiY(),
282 the corresponding QPaintEngine must handle the resolution mapping.
283
284 \sa physicalDpiX(), logicalDpiY()
285*/
286
287/*!
288 \fn int QPaintDevice::devicePixelRatio() const
289
290 Returns the device pixel ratio for device.
291
292 Common values are 1 for normal-dpi displays and 2 for high-dpi
293 "retina" displays.
294*/
295
296/*!
297 \fn qreal QPaintDevice::devicePixelRatioF() const
298
299 Returns the device pixel ratio for the device as a floating point number.
300
301 \since 5.6
302*/
303
304/*!
305 \fn qreal QPaintDevice::devicePixelRatioFScale()
306
307 \internal
308
309 Returns the scaling factor used for \c PdmDevicePixelRatioScaled. Classes
310 that are not QPaintDevice subclasses are implementing metric(), and need to
311 access this constant. Since it's a qreal, it cannot be an enum, and an inline
312 function is more efficient than a static member variable.
313
314 \since 5.6
315*/
316

Warning: That file was not part of the compilation database. It may have many parsing errors.