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