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 void eraseRect(const QRectF &);
452 inline void eraseRect(int x, int y, int w, int h);
453 inline void eraseRect(const QRect &);
454
455 void setRenderHint(RenderHint hint, bool on = true);
456 void setRenderHints(RenderHints hints, bool on = true);
457 RenderHints renderHints() const;
458 inline bool testRenderHint(RenderHint hint) const { return renderHints() & hint; }
459
460 QPaintEngine *paintEngine() const;
461
462 static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
463 const QPoint& offset = QPoint());
464 static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = nullptr);
465 static void restoreRedirected(const QPaintDevice *device);
466
467 void beginNativePainting();
468 void endNativePainting();
469
470private:
471 Q_DISABLE_COPY(QPainter)
472
473 QScopedPointer<QPainterPrivate> d_ptr;
474
475 friend class QWidget;
476 friend class QFontEngine;
477 friend class QFontEngineBox;
478 friend class QFontEngineFT;
479 friend class QFontEngineMac;
480 friend class QFontEngineWin;
481 friend class QPaintEngine;
482 friend class QPaintEngineExPrivate;
483 friend class QOpenGLPaintEngine;
484 friend class QWin32PaintEngine;
485 friend class QWin32PaintEnginePrivate;
486 friend class QRasterPaintEngine;
487 friend class QAlphaPaintEngine;
488 friend class QPreviewPaintEngine;
489 friend class QTextEngine;
490};
491Q_DECLARE_TYPEINFO(QPainter::PixmapFragment, Q_RELOCATABLE_TYPE);
492
493Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
494
495//
496// functions
497//
498inline void QPainter::drawLine(const QLineF &l)
499{
500 drawLines(&l, 1);
501}
502
503inline void QPainter::drawLine(const QLine &line)
504{
505 drawLines(&line, 1);
506}
507
508inline void QPainter::drawLine(int x1, int y1, int x2, int y2)
509{
510 QLine l(x1, y1, x2, y2);
511 drawLines(&l, 1);
512}
513
514inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
515{
516 QLine l(p1, p2);
517 drawLines(&l, 1);
518}
519
520inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
521{
522 drawLine(QLineF(p1, p2));
523}
524
525inline void QPainter::drawLines(const QVector<QLineF> &lines)
526{
527 drawLines(lines.constData(), lines.size());
528}
529
530inline void QPainter::drawLines(const QVector<QLine> &lines)
531{
532 drawLines(lines.constData(), lines.size());
533}
534
535inline void QPainter::drawLines(const QVector<QPointF> &pointPairs)
536{
537 drawLines(pointPairs.constData(), pointPairs.size() / 2);
538}
539
540inline void QPainter::drawLines(const QVector<QPoint> &pointPairs)
541{
542 drawLines(pointPairs.constData(), pointPairs.size() / 2);
543}
544
545inline void QPainter::drawPolyline(const QPolygonF &polyline)
546{
547 drawPolyline(polyline.constData(), polyline.size());
548}
549
550inline void QPainter::drawPolyline(const QPolygon &polyline)
551{
552 drawPolyline(polyline.constData(), polyline.size());
553}
554
555inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
556{
557 drawPolygon(polygon.constData(), polygon.size(), fillRule);
558}
559
560inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
561{
562 drawPolygon(polygon.constData(), polygon.size(), fillRule);
563}
564
565inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
566{
567 drawConvexPolygon(poly.constData(), poly.size());
568}
569
570inline void QPainter::drawConvexPolygon(const QPolygon &poly)
571{
572 drawConvexPolygon(poly.constData(), poly.size());
573}
574
575inline void QPainter::drawRect(const QRectF &rect)
576{
577 drawRects(&rect, 1);
578}
579
580inline void QPainter::drawRect(int x, int y, int w, int h)
581{
582 QRect r(x, y, w, h);
583 drawRects(&r, 1);
584}
585
586inline void QPainter::drawRect(const QRect &r)
587{
588 drawRects(&r, 1);
589}
590
591inline void QPainter::drawRects(const QVector<QRectF> &rects)
592{
593 drawRects(rects.constData(), rects.size());
594}
595
596inline void QPainter::drawRects(const QVector<QRect> &rects)
597{
598 drawRects(rects.constData(), rects.size());
599}
600
601inline void QPainter::drawPoint(const QPointF &p)
602{
603 drawPoints(&p, 1);
604}
605
606inline void QPainter::drawPoint(int x, int y)
607{
608 QPoint p(x, y);
609 drawPoints(&p, 1);
610}
611
612inline void QPainter::drawPoint(const QPoint &p)
613{
614 drawPoints(&p, 1);
615}
616
617inline void QPainter::drawPoints(const QPolygonF &points)
618{
619 drawPoints(points.constData(), points.size());
620}
621
622inline void QPainter::drawPoints(const QPolygon &points)
623{
624 drawPoints(points.constData(), points.size());
625}
626
627inline void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
628{
629 drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
630}
631
632inline void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
633{
634 drawRoundRect(QRectF(rect), xRnd, yRnd);
635}
636
637inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
638 Qt::SizeMode mode)
639{
640 drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
641}
642
643inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
644 Qt::SizeMode mode)
645{
646 drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
647}
648
649inline void QPainter::drawEllipse(int x, int y, int w, int h)
650{
651 drawEllipse(QRect(x, y, w, h));
652}
653
654inline void QPainter::drawEllipse(const QPointF &center, qreal rx, qreal ry)
655{
656 drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
657}
658
659inline void QPainter::drawEllipse(const QPoint &center, int rx, int ry)
660{
661 drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
662}
663
664inline void QPainter::drawArc(const QRect &r, int a, int alen)
665{
666 drawArc(QRectF(r), a, alen);
667}
668
669inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen)
670{
671 drawArc(QRectF(x, y, w, h), a, alen);
672}
673
674inline void QPainter::drawPie(const QRect &rect, int a, int alen)
675{
676 drawPie(QRectF(rect), a, alen);
677}
678
679inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen)
680{
681 drawPie(QRectF(x, y, w, h), a, alen);
682}
683
684inline void QPainter::drawChord(const QRect &rect, int a, int alen)
685{
686 drawChord(QRectF(rect), a, alen);
687}
688
689inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen)
690{
691 drawChord(QRectF(x, y, w, h), a, alen);
692}
693
694inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op)
695{
696 setClipRect(QRect(x, y, w, h), op);
697}
698
699inline void QPainter::eraseRect(const QRect &rect)
700{
701 eraseRect(QRectF(rect));
702}
703
704inline void QPainter::eraseRect(int x, int y, int w, int h)
705{
706 eraseRect(QRectF(x, y, w, h));
707}
708
709inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b)
710{
711 fillRect(QRect(x, y, w, h), b);
712}
713
714inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b)
715{
716 fillRect(QRect(x, y, w, h), b);
717}
718
719inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c)
720{
721 fillRect(QRect(x, y, w, h), QColor(c));
722}
723
724inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
725{
726 fillRect(r, QColor(c));
727}
728
729inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
730{
731 fillRect(r, QColor(c));
732}
733
734inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style)
735{
736 fillRect(QRectF(x, y, w, h), QBrush(style));
737}
738
739inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
740{
741 fillRect(QRectF(r), QBrush(style));
742}
743
744inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
745{
746 fillRect(r, QBrush(style));
747}
748
749
750inline void QPainter::setBrushOrigin(int x, int y)
751{
752 setBrushOrigin(QPoint(x, y));
753}
754
755inline void QPainter::setBrushOrigin(const QPoint &p)
756{
757 setBrushOrigin(QPointF(p));
758}
759
760inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
761{
762 drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
763}
764
765inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy)
766{
767 drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy));
768}
769
770inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
771{
772 drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
773}
774
775inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
776{
777 drawPixmap(QPointF(p), pm);
778}
779
780inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
781{
782 drawPixmap(QRectF(r), pm, QRectF());
783}
784
785inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
786{
787 drawPixmap(QPointF(x, y), pm);
788}
789
790inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm)
791{
792 drawPixmap(QRectF(x, y, w, h), pm, QRectF());
793}
794
795inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
796 int sx, int sy, int sw, int sh)
797{
798 drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh));
799}
800
801inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
802 int sx, int sy, int sw, int sh)
803{
804 drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh));
805}
806
807inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr)
808{
809 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
810}
811
812inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr)
813{
814 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
815}
816
817inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
818{
819 drawTextItem(QPointF(x, y), ti);
820}
821
822inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
823 Qt::ImageConversionFlags flags)
824{
825 drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags);
826}
827
828inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
829 Qt::ImageConversionFlags flags)
830{
831 drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags);
832}
833
834inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr,
835 Qt::ImageConversionFlags flags)
836{
837 drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags);
838}
839
840
841inline void QPainter::drawImage(const QRectF &r, const QImage &image)
842{
843 drawImage(r, image, QRect(0, 0, image.width(), image.height()));
844}
845
846inline void QPainter::drawImage(const QRect &r, const QImage &image)
847{
848 drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
849}
850
851inline void QPainter::drawImage(const QPoint &p, const QImage &image)
852{
853 drawImage(QPointF(p), image);
854}
855
856inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh,
857 Qt::ImageConversionFlags flags)
858{
859 if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor)
860 drawImage(QPointF(x, y), image);
861 else
862 drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags);
863}
864
865inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText)
866{
867 drawStaticText(QPointF(p), staticText);
868}
869
870inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText)
871{
872 drawStaticText(QPointF(x, y), staticText);
873}
874
875inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
876{
877 drawTextItem(QPointF(p), ti);
878}
879
880inline void QPainter::drawText(const QPoint &p, const QString &s)
881{
882 drawText(QPointF(p), s);
883}
884
885inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br)
886{
887 drawText(QRect(x, y, w, h), flags, str, br);
888}
889
890inline void QPainter::drawText(int x, int y, const QString &s)
891{
892 drawText(QPointF(x, y), s);
893}
894
895inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text)
896{
897 return boundingRect(QRect(x, y, w, h), flags, text);
898}
899
900inline void QPainter::translate(qreal dx, qreal dy)
901{
902 translate(QPointF(dx, dy));
903}
904
905inline void QPainter::translate(const QPoint &offset)
906{
907 translate(offset.x(), offset.y());
908}
909
910inline void QPainter::setViewport(int x, int y, int w, int h)
911{
912 setViewport(QRect(x, y, w, h));
913}
914
915inline void QPainter::setWindow(int x, int y, int w, int h)
916{
917 setWindow(QRect(x, y, w, h));
918}
919
920#ifndef QT_NO_PICTURE
921inline void QPainter::drawPicture(int x, int y, const QPicture &p)
922{
923 drawPicture(QPoint(x, y), p);
924}
925
926inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
927{
928 drawPicture(QPointF(pt), p);
929}
930#endif
931
932QT_END_NAMESPACE
933
934#endif // QPAINTER_H
935