/work/prefix/include/QtGui/qpainter.h
Line | Count | Source |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #ifndef QPAINTER_H |
6 | | #define QPAINTER_H |
7 | | |
8 | | #include <QtGui/qtguiglobal.h> |
9 | | #include <QtCore/qnamespace.h> |
10 | | #include <QtCore/qrect.h> |
11 | | #include <QtCore/qpoint.h> |
12 | | #include <QtCore/qscopedpointer.h> |
13 | | #include <QtGui/qpixmap.h> |
14 | | #include <QtGui/qimage.h> |
15 | | #include <QtGui/qtextoption.h> |
16 | | #include <memory> |
17 | | |
18 | | #ifndef QT_INCLUDE_COMPAT |
19 | | #include <QtGui/qpolygon.h> |
20 | | #include <QtGui/qpen.h> |
21 | | #include <QtGui/qbrush.h> |
22 | | #include <QtGui/qtransform.h> |
23 | | #include <QtGui/qfontinfo.h> |
24 | | #include <QtGui/qfontmetrics.h> |
25 | | #endif |
26 | | |
27 | | QT_BEGIN_NAMESPACE |
28 | | |
29 | | |
30 | | class QBrush; |
31 | | class QFontInfo; |
32 | | class QFontMetrics; |
33 | | class QPaintDevice; |
34 | | class QPainterPath; |
35 | | class QPainterPrivate; |
36 | | class QPen; |
37 | | class QPolygon; |
38 | | class QTextItem; |
39 | | class QTextEngine; |
40 | | class QTransform; |
41 | | class QStaticText; |
42 | | class QGlyphRun; |
43 | | |
44 | | class QPainterPrivateDeleter; |
45 | | |
46 | | class Q_GUI_EXPORT QPainter |
47 | | { |
48 | | Q_DECLARE_PRIVATE(QPainter) |
49 | | Q_GADGET |
50 | | |
51 | | public: |
52 | | enum RenderHint { |
53 | | Antialiasing = 0x01, |
54 | | TextAntialiasing = 0x02, |
55 | | SmoothPixmapTransform = 0x04, |
56 | | VerticalSubpixelPositioning = 0x08, |
57 | | LosslessImageRendering = 0x40, |
58 | | NonCosmeticBrushPatterns = 0x80 |
59 | | }; |
60 | | Q_ENUM(RenderHint) |
61 | | |
62 | | Q_DECLARE_FLAGS(RenderHints, RenderHint) |
63 | | Q_FLAG(RenderHints) |
64 | | |
65 | | class PixmapFragment { |
66 | | public: |
67 | | qreal x; |
68 | | qreal y; |
69 | | qreal sourceLeft; |
70 | | qreal sourceTop; |
71 | | qreal width; |
72 | | qreal height; |
73 | | qreal scaleX; |
74 | | qreal scaleY; |
75 | | qreal rotation; |
76 | | qreal opacity; |
77 | | static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect, |
78 | | qreal scaleX = 1, qreal scaleY = 1, |
79 | | qreal rotation = 0, qreal opacity = 1); |
80 | | }; |
81 | | |
82 | | enum PixmapFragmentHint { |
83 | | OpaqueHint = 0x01 |
84 | | }; |
85 | | |
86 | | Q_DECLARE_FLAGS(PixmapFragmentHints, PixmapFragmentHint) |
87 | | |
88 | | QPainter(); |
89 | | explicit QPainter(QPaintDevice *); |
90 | | ~QPainter(); |
91 | | |
92 | | QPaintDevice *device() const; |
93 | | |
94 | | bool begin(QPaintDevice *); |
95 | | bool end(); |
96 | | bool isActive() const; |
97 | | |
98 | | enum CompositionMode { |
99 | | CompositionMode_SourceOver, |
100 | | CompositionMode_DestinationOver, |
101 | | CompositionMode_Clear, |
102 | | CompositionMode_Source, |
103 | | CompositionMode_Destination, |
104 | | CompositionMode_SourceIn, |
105 | | CompositionMode_DestinationIn, |
106 | | CompositionMode_SourceOut, |
107 | | CompositionMode_DestinationOut, |
108 | | CompositionMode_SourceAtop, |
109 | | CompositionMode_DestinationAtop, |
110 | | CompositionMode_Xor, |
111 | | |
112 | | //svg 1.2 blend modes |
113 | | CompositionMode_Plus, |
114 | | CompositionMode_Multiply, |
115 | | CompositionMode_Screen, |
116 | | CompositionMode_Overlay, |
117 | | CompositionMode_Darken, |
118 | | CompositionMode_Lighten, |
119 | | CompositionMode_ColorDodge, |
120 | | CompositionMode_ColorBurn, |
121 | | CompositionMode_HardLight, |
122 | | CompositionMode_SoftLight, |
123 | | CompositionMode_Difference, |
124 | | CompositionMode_Exclusion, |
125 | | |
126 | | // ROPs |
127 | | RasterOp_SourceOrDestination, |
128 | | RasterOp_SourceAndDestination, |
129 | | RasterOp_SourceXorDestination, |
130 | | RasterOp_NotSourceAndNotDestination, |
131 | | RasterOp_NotSourceOrNotDestination, |
132 | | RasterOp_NotSourceXorDestination, |
133 | | RasterOp_NotSource, |
134 | | RasterOp_NotSourceAndDestination, |
135 | | RasterOp_SourceAndNotDestination, |
136 | | RasterOp_NotSourceOrDestination, |
137 | | RasterOp_SourceOrNotDestination, |
138 | | RasterOp_ClearDestination, |
139 | | RasterOp_SetDestination, |
140 | | RasterOp_NotDestination, |
141 | | |
142 | | NCompositionModes |
143 | | }; |
144 | | void setCompositionMode(CompositionMode mode); |
145 | | CompositionMode compositionMode() const; |
146 | | |
147 | | const QFont &font() const; |
148 | | void setFont(const QFont &f); |
149 | | |
150 | | QFontMetrics fontMetrics() const; |
151 | | QFontInfo fontInfo() const; |
152 | | |
153 | | void setPen(const QColor &color); |
154 | | QT_GUI_INLINE_SINCE(6, 11) |
155 | | void setPen(const QPen &pen); |
156 | 0 | void setPen(QPen &&pen) { doSetPen(pen, &pen); } |
157 | | void setPen(Qt::PenStyle style); |
158 | | const QPen &pen() const; |
159 | | |
160 | | QT_GUI_INLINE_SINCE(6, 11) |
161 | | void setBrush(const QBrush &brush); |
162 | 0 | void setBrush(QBrush &&brush) { doSetBrush(brush, &brush); } |
163 | | void setBrush(Qt::BrushStyle style); |
164 | | void setBrush(QColor color); |
165 | 0 | void setBrush(Qt::GlobalColor color) { setBrush(QColor(color)); } |
166 | | const QBrush &brush() const; |
167 | | |
168 | | // attributes/modes |
169 | | void setBackgroundMode(Qt::BGMode mode); |
170 | | Qt::BGMode backgroundMode() const; |
171 | | |
172 | | QPoint brushOrigin() const; |
173 | | QPointF brushOriginF() const; |
174 | | inline void setBrushOrigin(int x, int y); |
175 | | inline void setBrushOrigin(const QPoint &); |
176 | | void setBrushOrigin(const QPointF &); |
177 | | |
178 | | void setBackground(const QBrush &bg); |
179 | | const QBrush &background() const; |
180 | | |
181 | | qreal opacity() const; |
182 | | void setOpacity(qreal opacity); |
183 | | |
184 | | // Clip functions |
185 | | QRegion clipRegion() const; |
186 | | QPainterPath clipPath() const; |
187 | | |
188 | | void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip); |
189 | | void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip); |
190 | | inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip); |
191 | | |
192 | | void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip); |
193 | | |
194 | | void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip); |
195 | | |
196 | | void setClipping(bool enable); |
197 | | bool hasClipping() const; |
198 | | |
199 | | QRectF clipBoundingRect() const; |
200 | | |
201 | | void save(); |
202 | | void restore(); |
203 | | |
204 | | // XForm functions |
205 | | void setTransform(const QTransform &transform, bool combine = false); |
206 | | const QTransform &transform() const; |
207 | | const QTransform &deviceTransform() const; |
208 | | void resetTransform(); |
209 | | |
210 | | void setWorldTransform(const QTransform &matrix, bool combine = false); |
211 | | const QTransform &worldTransform() const; |
212 | | |
213 | | QTransform combinedTransform() const; |
214 | | |
215 | | void setWorldMatrixEnabled(bool enabled); |
216 | | bool worldMatrixEnabled() const; |
217 | | |
218 | | void scale(qreal sx, qreal sy); |
219 | | void shear(qreal sh, qreal sv); |
220 | | void rotate(qreal a); |
221 | | |
222 | | void translate(const QPointF &offset); |
223 | | inline void translate(const QPoint &offset); |
224 | | inline void translate(qreal dx, qreal dy); |
225 | | |
226 | | QRect window() const; |
227 | | void setWindow(const QRect &window); |
228 | | inline void setWindow(int x, int y, int w, int h); |
229 | | |
230 | | QRect viewport() const; |
231 | | void setViewport(const QRect &viewport); |
232 | | inline void setViewport(int x, int y, int w, int h); |
233 | | |
234 | | void setViewTransformEnabled(bool enable); |
235 | | bool viewTransformEnabled() const; |
236 | | |
237 | | // drawing functions |
238 | | void strokePath(const QPainterPath &path, const QPen &pen); |
239 | | void fillPath(const QPainterPath &path, const QBrush &brush); |
240 | | void drawPath(const QPainterPath &path); |
241 | | |
242 | | inline void drawPoint(const QPointF &pt); |
243 | | inline void drawPoint(const QPoint &p); |
244 | | inline void drawPoint(int x, int y); |
245 | | |
246 | | void drawPoints(const QPointF *points, int pointCount); |
247 | | inline void drawPoints(const QPolygonF &points); |
248 | | void drawPoints(const QPoint *points, int pointCount); |
249 | | inline void drawPoints(const QPolygon &points); |
250 | | |
251 | | inline void drawLine(const QLineF &line); |
252 | | inline void drawLine(const QLine &line); |
253 | | inline void drawLine(int x1, int y1, int x2, int y2); |
254 | | inline void drawLine(const QPoint &p1, const QPoint &p2); |
255 | | inline void drawLine(const QPointF &p1, const QPointF &p2); |
256 | | |
257 | | void drawLines(const QLineF *lines, int lineCount); |
258 | | inline void drawLines(const QList<QLineF> &lines); |
259 | | void drawLines(const QPointF *pointPairs, int lineCount); |
260 | | inline void drawLines(const QList<QPointF> &pointPairs); |
261 | | void drawLines(const QLine *lines, int lineCount); |
262 | | inline void drawLines(const QList<QLine> &lines); |
263 | | void drawLines(const QPoint *pointPairs, int lineCount); |
264 | | inline void drawLines(const QList<QPoint> &pointPairs); |
265 | | |
266 | | inline void drawRect(const QRectF &rect); |
267 | | inline void drawRect(int x1, int y1, int w, int h); |
268 | | inline void drawRect(const QRect &rect); |
269 | | |
270 | | void drawRects(const QRectF *rects, int rectCount); |
271 | | inline void drawRects(const QList<QRectF> &rectangles); |
272 | | void drawRects(const QRect *rects, int rectCount); |
273 | | inline void drawRects(const QList<QRect> &rectangles); |
274 | | |
275 | | void drawEllipse(const QRectF &r); |
276 | | void drawEllipse(const QRect &r); |
277 | | inline void drawEllipse(int x, int y, int w, int h); |
278 | | |
279 | | inline void drawEllipse(const QPointF ¢er, qreal rx, qreal ry); |
280 | | inline void drawEllipse(const QPoint ¢er, int rx, int ry); |
281 | | |
282 | | void drawPolyline(const QPointF *points, int pointCount); |
283 | | inline void drawPolyline(const QPolygonF &polyline); |
284 | | void drawPolyline(const QPoint *points, int pointCount); |
285 | | inline void drawPolyline(const QPolygon &polygon); |
286 | | |
287 | | void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill); |
288 | | inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill); |
289 | | void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill); |
290 | | inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill); |
291 | | |
292 | | void drawConvexPolygon(const QPointF *points, int pointCount); |
293 | | inline void drawConvexPolygon(const QPolygonF &polygon); |
294 | | void drawConvexPolygon(const QPoint *points, int pointCount); |
295 | | inline void drawConvexPolygon(const QPolygon &polygon); |
296 | | |
297 | | void drawArc(const QRectF &rect, int a, int alen); |
298 | | inline void drawArc(const QRect &, int a, int alen); |
299 | | inline void drawArc(int x, int y, int w, int h, int a, int alen); |
300 | | |
301 | | void drawPie(const QRectF &rect, int a, int alen); |
302 | | inline void drawPie(int x, int y, int w, int h, int a, int alen); |
303 | | inline void drawPie(const QRect &, int a, int alen); |
304 | | |
305 | | void drawChord(const QRectF &rect, int a, int alen); |
306 | | inline void drawChord(int x, int y, int w, int h, int a, int alen); |
307 | | inline void drawChord(const QRect &, int a, int alen); |
308 | | |
309 | | void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, |
310 | | Qt::SizeMode mode = Qt::AbsoluteSize); |
311 | | inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, |
312 | | Qt::SizeMode mode = Qt::AbsoluteSize); |
313 | | inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, |
314 | | Qt::SizeMode mode = Qt::AbsoluteSize); |
315 | | |
316 | | void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF()); |
317 | | inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0); |
318 | | inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint()); |
319 | | #ifndef QT_NO_PICTURE |
320 | | void drawPicture(const QPointF &p, const QPicture &picture); |
321 | | inline void drawPicture(int x, int y, const QPicture &picture); |
322 | | inline void drawPicture(const QPoint &p, const QPicture &picture); |
323 | | #endif |
324 | | |
325 | | void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect); |
326 | | inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect); |
327 | | inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm, |
328 | | int sx, int sy, int sw, int sh); |
329 | | inline void drawPixmap(int x, int y, const QPixmap &pm, |
330 | | int sx, int sy, int sw, int sh); |
331 | | inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr); |
332 | | inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr); |
333 | | void drawPixmap(const QPointF &p, const QPixmap &pm); |
334 | | inline void drawPixmap(const QPoint &p, const QPixmap &pm); |
335 | | inline void drawPixmap(int x, int y, const QPixmap &pm); |
336 | | inline void drawPixmap(const QRect &r, const QPixmap &pm); |
337 | | inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm); |
338 | | |
339 | | void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, |
340 | | const QPixmap &pixmap, PixmapFragmentHints hints = PixmapFragmentHints()); |
341 | | |
342 | | void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, |
343 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
344 | | inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, |
345 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
346 | | inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr, |
347 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
348 | | inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr, |
349 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
350 | | inline void drawImage(const QRectF &r, const QImage &image); |
351 | | inline void drawImage(const QRect &r, const QImage &image); |
352 | | void drawImage(const QPointF &p, const QImage &image); |
353 | | inline void drawImage(const QPoint &p, const QImage &image); |
354 | | inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0, |
355 | | int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor); |
356 | | |
357 | | void setLayoutDirection(Qt::LayoutDirection direction); |
358 | | Qt::LayoutDirection layoutDirection() const; |
359 | | |
360 | | #if !defined(QT_NO_RAWFONT) |
361 | | void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun); |
362 | | #endif |
363 | | |
364 | | void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText); |
365 | | inline void drawStaticText(const QPoint &topLeftPosition, const QStaticText &staticText); |
366 | | inline void drawStaticText(int left, int top, const QStaticText &staticText); |
367 | | |
368 | | void drawText(const QPointF &p, const QString &s); |
369 | | inline void drawText(const QPoint &p, const QString &s); |
370 | | inline void drawText(int x, int y, const QString &s); |
371 | | |
372 | | void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding); |
373 | | |
374 | | void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = nullptr); |
375 | | void drawText(const QRect &r, int flags, const QString &text, QRect *br = nullptr); |
376 | | inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = nullptr); |
377 | | |
378 | | void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption()); |
379 | | |
380 | | QRectF boundingRect(const QRectF &rect, int flags, const QString &text); |
381 | | QRect boundingRect(const QRect &rect, int flags, const QString &text); |
382 | | inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text); |
383 | | |
384 | | QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption()); |
385 | | |
386 | | void drawTextItem(const QPointF &p, const QTextItem &ti); |
387 | | inline void drawTextItem(int x, int y, const QTextItem &ti); |
388 | | inline void drawTextItem(const QPoint &p, const QTextItem &ti); |
389 | | |
390 | | void fillRect(const QRectF &, const QBrush &); |
391 | | inline void fillRect(int x, int y, int w, int h, const QBrush &); |
392 | | void fillRect(const QRect &, const QBrush &); |
393 | | |
394 | | void fillRect(const QRectF &, const QColor &color); |
395 | | inline void fillRect(int x, int y, int w, int h, const QColor &color); |
396 | | void fillRect(const QRect &, const QColor &color); |
397 | | |
398 | | inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c); |
399 | | inline void fillRect(const QRect &r, Qt::GlobalColor c); |
400 | | inline void fillRect(const QRectF &r, Qt::GlobalColor c); |
401 | | |
402 | | inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style); |
403 | | inline void fillRect(const QRect &r, Qt::BrushStyle style); |
404 | | inline void fillRect(const QRectF &r, Qt::BrushStyle style); |
405 | | |
406 | | inline void fillRect(int x, int y, int w, int h, QGradient::Preset preset); |
407 | | inline void fillRect(const QRect &r, QGradient::Preset preset); |
408 | | inline void fillRect(const QRectF &r, QGradient::Preset preset); |
409 | | |
410 | | void eraseRect(const QRectF &); |
411 | | inline void eraseRect(int x, int y, int w, int h); |
412 | | inline void eraseRect(const QRect &); |
413 | | |
414 | | void setRenderHint(RenderHint hint, bool on = true); |
415 | | void setRenderHints(RenderHints hints, bool on = true); |
416 | | RenderHints renderHints() const; |
417 | 0 | inline bool testRenderHint(RenderHint hint) const { return bool(renderHints() & hint); } |
418 | | |
419 | | QPaintEngine *paintEngine() const; |
420 | | |
421 | | void beginNativePainting(); |
422 | | void endNativePainting(); |
423 | | |
424 | | private: |
425 | | Q_DISABLE_COPY(QPainter) |
426 | | |
427 | | void doSetPen(const QPen &lvalue, QPen *rvalue); |
428 | | void doSetBrush(const QBrush &lvalue, QBrush *rvalue); |
429 | | |
430 | | std::unique_ptr<QPainterPrivate> d_ptr; |
431 | | |
432 | | friend class QWidget; |
433 | | friend class QFontEngine; |
434 | | friend class QFontEngineBox; |
435 | | friend class QFontEngineFT; |
436 | | friend class QFontEngineMac; |
437 | | friend class QFontEngineWin; |
438 | | friend class QPaintEngine; |
439 | | friend class QPaintEngineExPrivate; |
440 | | friend class QOpenGLPaintEngine; |
441 | | friend class QWin32PaintEngine; |
442 | | friend class QWin32PaintEnginePrivate; |
443 | | friend class QRasterPaintEngine; |
444 | | friend class QAlphaPaintEngine; |
445 | | friend class QPreviewPaintEngine; |
446 | | friend class QTextEngine; |
447 | | }; |
448 | | Q_DECLARE_TYPEINFO(QPainter::PixmapFragment, Q_RELOCATABLE_TYPE); |
449 | | |
450 | | Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints) |
451 | | |
452 | | // |
453 | | // functions |
454 | | // |
455 | | inline void QPainter::drawLine(const QLineF &l) |
456 | 0 | { |
457 | 0 | drawLines(&l, 1); |
458 | 0 | } |
459 | | |
460 | | inline void QPainter::drawLine(const QLine &line) |
461 | 0 | { |
462 | 0 | drawLines(&line, 1); |
463 | 0 | } |
464 | | |
465 | | inline void QPainter::drawLine(int x1, int y1, int x2, int y2) |
466 | 0 | { |
467 | 0 | QLine l(x1, y1, x2, y2); |
468 | 0 | drawLines(&l, 1); |
469 | 0 | } |
470 | | |
471 | | inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2) |
472 | 0 | { |
473 | 0 | QLine l(p1, p2); |
474 | 0 | drawLines(&l, 1); |
475 | 0 | } |
476 | | |
477 | | inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2) |
478 | 0 | { |
479 | 0 | drawLine(QLineF(p1, p2)); |
480 | 0 | } |
481 | | |
482 | | inline void QPainter::drawLines(const QList<QLineF> &lines) |
483 | 0 | { |
484 | 0 | drawLines(lines.constData(), int(lines.size())); |
485 | 0 | } |
486 | | |
487 | | inline void QPainter::drawLines(const QList<QLine> &lines) |
488 | 0 | { |
489 | 0 | drawLines(lines.constData(), int(lines.size())); |
490 | 0 | } |
491 | | |
492 | | inline void QPainter::drawLines(const QList<QPointF> &pointPairs) |
493 | 0 | { |
494 | 0 | drawLines(pointPairs.constData(), int(pointPairs.size() / 2)); |
495 | 0 | } |
496 | | |
497 | | inline void QPainter::drawLines(const QList<QPoint> &pointPairs) |
498 | 0 | { |
499 | 0 | drawLines(pointPairs.constData(), int(pointPairs.size() / 2)); |
500 | 0 | } |
501 | | |
502 | | inline void QPainter::drawPolyline(const QPolygonF &polyline) |
503 | 0 | { |
504 | 0 | drawPolyline(polyline.constData(), int(polyline.size())); |
505 | 0 | } |
506 | | |
507 | | inline void QPainter::drawPolyline(const QPolygon &polyline) |
508 | 0 | { |
509 | 0 | drawPolyline(polyline.constData(), int(polyline.size())); |
510 | 0 | } |
511 | | |
512 | | inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule) |
513 | 0 | { |
514 | 0 | drawPolygon(polygon.constData(), int(polygon.size()), fillRule); |
515 | 0 | } |
516 | | |
517 | | inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule) |
518 | 0 | { |
519 | 0 | drawPolygon(polygon.constData(), int(polygon.size()), fillRule); |
520 | 0 | } |
521 | | |
522 | | inline void QPainter::drawConvexPolygon(const QPolygonF &poly) |
523 | 0 | { |
524 | 0 | drawConvexPolygon(poly.constData(), int(poly.size())); |
525 | 0 | } |
526 | | |
527 | | inline void QPainter::drawConvexPolygon(const QPolygon &poly) |
528 | 0 | { |
529 | 0 | drawConvexPolygon(poly.constData(), int(poly.size())); |
530 | 0 | } |
531 | | |
532 | | inline void QPainter::drawRect(const QRectF &rect) |
533 | 12.3k | { |
534 | 12.3k | drawRects(&rect, 1); |
535 | 12.3k | } |
536 | | |
537 | | inline void QPainter::drawRect(int x, int y, int w, int h) |
538 | 0 | { |
539 | 0 | QRect r(x, y, w, h); |
540 | 0 | drawRects(&r, 1); |
541 | 0 | } |
542 | | |
543 | | inline void QPainter::drawRect(const QRect &r) |
544 | 0 | { |
545 | 0 | drawRects(&r, 1); |
546 | 0 | } |
547 | | |
548 | | inline void QPainter::drawRects(const QList<QRectF> &rects) |
549 | 0 | { |
550 | 0 | drawRects(rects.constData(), int(rects.size())); |
551 | 0 | } |
552 | | |
553 | | inline void QPainter::drawRects(const QList<QRect> &rects) |
554 | 0 | { |
555 | 0 | drawRects(rects.constData(), int(rects.size())); |
556 | 0 | } |
557 | | |
558 | | inline void QPainter::drawPoint(const QPointF &p) |
559 | 0 | { |
560 | 0 | drawPoints(&p, 1); |
561 | 0 | } |
562 | | |
563 | | inline void QPainter::drawPoint(int x, int y) |
564 | 0 | { |
565 | 0 | QPoint p(x, y); |
566 | 0 | drawPoints(&p, 1); |
567 | 0 | } |
568 | | |
569 | | inline void QPainter::drawPoint(const QPoint &p) |
570 | 0 | { |
571 | 0 | drawPoints(&p, 1); |
572 | 0 | } |
573 | | |
574 | | inline void QPainter::drawPoints(const QPolygonF &points) |
575 | 0 | { |
576 | 0 | drawPoints(points.constData(), int(points.size())); |
577 | 0 | } |
578 | | |
579 | | inline void QPainter::drawPoints(const QPolygon &points) |
580 | 0 | { |
581 | 0 | drawPoints(points.constData(), int(points.size())); |
582 | 0 | } |
583 | | |
584 | | inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, |
585 | | Qt::SizeMode mode) |
586 | 0 | { |
587 | 0 | drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode); |
588 | 0 | } |
589 | | |
590 | | inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, |
591 | | Qt::SizeMode mode) |
592 | 0 | { |
593 | 0 | drawRoundedRect(QRectF(rect), xRadius, yRadius, mode); |
594 | 0 | } |
595 | | |
596 | | inline void QPainter::drawEllipse(int x, int y, int w, int h) |
597 | 0 | { |
598 | 0 | drawEllipse(QRect(x, y, w, h)); |
599 | 0 | } |
600 | | |
601 | | inline void QPainter::drawEllipse(const QPointF ¢er, qreal rx, qreal ry) |
602 | 0 | { |
603 | 0 | drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry)); |
604 | 0 | } |
605 | | |
606 | | inline void QPainter::drawEllipse(const QPoint ¢er, int rx, int ry) |
607 | 0 | { |
608 | 0 | drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry)); |
609 | 0 | } |
610 | | |
611 | | inline void QPainter::drawArc(const QRect &r, int a, int alen) |
612 | 0 | { |
613 | 0 | drawArc(QRectF(r), a, alen); |
614 | 0 | } |
615 | | |
616 | | inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen) |
617 | 0 | { |
618 | 0 | drawArc(QRectF(x, y, w, h), a, alen); |
619 | 0 | } |
620 | | |
621 | | inline void QPainter::drawPie(const QRect &rect, int a, int alen) |
622 | 0 | { |
623 | 0 | drawPie(QRectF(rect), a, alen); |
624 | 0 | } |
625 | | |
626 | | inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen) |
627 | 0 | { |
628 | 0 | drawPie(QRectF(x, y, w, h), a, alen); |
629 | 0 | } |
630 | | |
631 | | inline void QPainter::drawChord(const QRect &rect, int a, int alen) |
632 | 0 | { |
633 | 0 | drawChord(QRectF(rect), a, alen); |
634 | 0 | } |
635 | | |
636 | | inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen) |
637 | 0 | { |
638 | 0 | drawChord(QRectF(x, y, w, h), a, alen); |
639 | 0 | } |
640 | | |
641 | | inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op) |
642 | 0 | { |
643 | 0 | setClipRect(QRect(x, y, w, h), op); |
644 | 0 | } |
645 | | |
646 | | inline void QPainter::eraseRect(const QRect &rect) |
647 | 0 | { |
648 | 0 | eraseRect(QRectF(rect)); |
649 | 0 | } |
650 | | |
651 | | inline void QPainter::eraseRect(int x, int y, int w, int h) |
652 | 0 | { |
653 | 0 | eraseRect(QRectF(x, y, w, h)); |
654 | 0 | } |
655 | | |
656 | | inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b) |
657 | 0 | { |
658 | 0 | fillRect(QRect(x, y, w, h), b); |
659 | 0 | } |
660 | | |
661 | | inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b) |
662 | 0 | { |
663 | 0 | fillRect(QRect(x, y, w, h), b); |
664 | 0 | } |
665 | | |
666 | | inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c) |
667 | 0 | { |
668 | 0 | fillRect(QRect(x, y, w, h), QColor(c)); |
669 | 0 | } |
670 | | |
671 | | inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c) |
672 | 0 | { |
673 | 0 | fillRect(r, QColor(c)); |
674 | 0 | } |
675 | | |
676 | | inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c) |
677 | 0 | { |
678 | 0 | fillRect(r, QColor(c)); |
679 | 0 | } |
680 | | |
681 | | inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style) |
682 | 0 | { |
683 | 0 | fillRect(QRectF(x, y, w, h), QBrush(style)); |
684 | 0 | } |
685 | | |
686 | | inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style) |
687 | 0 | { |
688 | 0 | fillRect(QRectF(r), QBrush(style)); |
689 | 0 | } |
690 | | |
691 | | inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style) |
692 | 0 | { |
693 | 0 | fillRect(r, QBrush(style)); |
694 | 0 | } |
695 | | |
696 | | inline void QPainter::fillRect(int x, int y, int w, int h, QGradient::Preset p) |
697 | 0 | { |
698 | 0 | fillRect(QRect(x, y, w, h), QGradient(p)); |
699 | 0 | } |
700 | | |
701 | | inline void QPainter::fillRect(const QRect &r, QGradient::Preset p) |
702 | 0 | { |
703 | 0 | fillRect(r, QGradient(p)); |
704 | 0 | } |
705 | | |
706 | | inline void QPainter::fillRect(const QRectF &r, QGradient::Preset p) |
707 | 0 | { |
708 | 0 | fillRect(r, QGradient(p)); |
709 | 0 | } |
710 | | |
711 | | #if QT_GUI_INLINE_IMPL_SINCE(6, 11) |
712 | | |
713 | | void QPainter::setPen(const QPen &p) |
714 | | { |
715 | | doSetPen(p, nullptr); |
716 | | } |
717 | | |
718 | | void QPainter::setBrush(const QBrush &b) |
719 | | { |
720 | | doSetBrush(b, nullptr); |
721 | | } |
722 | | |
723 | | #endif // QT_GUI_INLINE_IMPL_SINCE(6, 11) |
724 | | |
725 | | |
726 | | inline void QPainter::setBrushOrigin(int x, int y) |
727 | 0 | { |
728 | 0 | setBrushOrigin(QPoint(x, y)); |
729 | 0 | } |
730 | | |
731 | | inline void QPainter::setBrushOrigin(const QPoint &p) |
732 | 0 | { |
733 | 0 | setBrushOrigin(QPointF(p)); |
734 | 0 | } |
735 | | |
736 | | inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset) |
737 | 0 | { |
738 | 0 | drawTiledPixmap(QRectF(rect), pm, QPointF(offset)); |
739 | 0 | } |
740 | | |
741 | | inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy) |
742 | 0 | { |
743 | 0 | drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy)); |
744 | 0 | } |
745 | | |
746 | | inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect) |
747 | 0 | { |
748 | 0 | drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect)); |
749 | 0 | } |
750 | | |
751 | | inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm) |
752 | 0 | { |
753 | 0 | drawPixmap(QPointF(p), pm); |
754 | 0 | } |
755 | | |
756 | | inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm) |
757 | 0 | { |
758 | 0 | drawPixmap(QRectF(r), pm, QRectF()); |
759 | 0 | } |
760 | | |
761 | | inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm) |
762 | 0 | { |
763 | 0 | drawPixmap(QPointF(x, y), pm); |
764 | 0 | } |
765 | | |
766 | | inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm) |
767 | 0 | { |
768 | 0 | drawPixmap(QRectF(x, y, w, h), pm, QRectF()); |
769 | 0 | } |
770 | | |
771 | | inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm, |
772 | | int sx, int sy, int sw, int sh) |
773 | 0 | { |
774 | 0 | drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh)); |
775 | 0 | } |
776 | | |
777 | | inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm, |
778 | | int sx, int sy, int sw, int sh) |
779 | 0 | { |
780 | 0 | drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh)); |
781 | 0 | } |
782 | | |
783 | | inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr) |
784 | 0 | { |
785 | 0 | drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr); |
786 | 0 | } |
787 | | |
788 | | inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr) |
789 | 0 | { |
790 | 0 | drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr); |
791 | 0 | } |
792 | | |
793 | | inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti) |
794 | 0 | { |
795 | 0 | drawTextItem(QPointF(x, y), ti); |
796 | 0 | } |
797 | | |
798 | | inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, |
799 | | Qt::ImageConversionFlags flags) |
800 | 0 | { |
801 | 0 | drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags); |
802 | 0 | } |
803 | | |
804 | | inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr, |
805 | | Qt::ImageConversionFlags flags) |
806 | 0 | { |
807 | 0 | drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags); |
808 | 0 | } |
809 | | |
810 | | inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr, |
811 | | Qt::ImageConversionFlags flags) |
812 | 0 | { |
813 | 0 | drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags); |
814 | 0 | } |
815 | | |
816 | | |
817 | | inline void QPainter::drawImage(const QRectF &r, const QImage &image) |
818 | 0 | { |
819 | 0 | drawImage(r, image, QRect(0, 0, image.width(), image.height())); |
820 | 0 | } |
821 | | |
822 | | inline void QPainter::drawImage(const QRect &r, const QImage &image) |
823 | 0 | { |
824 | 0 | drawImage(r, image, QRectF(0, 0, image.width(), image.height())); |
825 | 0 | } |
826 | | |
827 | | inline void QPainter::drawImage(const QPoint &p, const QImage &image) |
828 | 0 | { |
829 | 0 | drawImage(QPointF(p), image); |
830 | 0 | } |
831 | | |
832 | | inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh, |
833 | | Qt::ImageConversionFlags flags) |
834 | 0 | { |
835 | 0 | if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor) |
836 | 0 | drawImage(QPointF(x, y), image); |
837 | 0 | else |
838 | 0 | drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags); |
839 | 0 | } |
840 | | |
841 | | inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText) |
842 | 0 | { |
843 | 0 | drawStaticText(QPointF(p), staticText); |
844 | 0 | } |
845 | | |
846 | | inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText) |
847 | 0 | { |
848 | 0 | drawStaticText(QPointF(x, y), staticText); |
849 | 0 | } |
850 | | |
851 | | inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti) |
852 | 0 | { |
853 | 0 | drawTextItem(QPointF(p), ti); |
854 | 0 | } |
855 | | |
856 | | inline void QPainter::drawText(const QPoint &p, const QString &s) |
857 | 0 | { |
858 | 0 | drawText(QPointF(p), s); |
859 | 0 | } |
860 | | |
861 | | inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br) |
862 | 0 | { |
863 | 0 | drawText(QRect(x, y, w, h), flags, str, br); |
864 | 0 | } |
865 | | |
866 | | inline void QPainter::drawText(int x, int y, const QString &s) |
867 | 0 | { |
868 | 0 | drawText(QPointF(x, y), s); |
869 | 0 | } |
870 | | |
871 | | inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text) |
872 | 0 | { |
873 | 0 | return boundingRect(QRect(x, y, w, h), flags, text); |
874 | 0 | } |
875 | | |
876 | | inline void QPainter::translate(qreal dx, qreal dy) |
877 | 0 | { |
878 | 0 | translate(QPointF(dx, dy)); |
879 | 0 | } |
880 | | |
881 | | inline void QPainter::translate(const QPoint &offset) |
882 | 0 | { |
883 | 0 | translate(offset.x(), offset.y()); |
884 | 0 | } |
885 | | |
886 | | inline void QPainter::setViewport(int x, int y, int w, int h) |
887 | 0 | { |
888 | 0 | setViewport(QRect(x, y, w, h)); |
889 | 0 | } |
890 | | |
891 | | inline void QPainter::setWindow(int x, int y, int w, int h) |
892 | 0 | { |
893 | 0 | setWindow(QRect(x, y, w, h)); |
894 | 0 | } |
895 | | |
896 | | #ifndef QT_NO_PICTURE |
897 | | inline void QPainter::drawPicture(int x, int y, const QPicture &p) |
898 | 0 | { |
899 | 0 | drawPicture(QPoint(x, y), p); |
900 | 0 | } |
901 | | |
902 | | inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p) |
903 | 0 | { |
904 | 0 | drawPicture(QPointF(pt), p); |
905 | 0 | } |
906 | | #endif |
907 | | |
908 | | QT_END_NAMESPACE |
909 | | |
910 | | #endif // QPAINTER_H |