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