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