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