c6c0e39ba0a4626355e2b48da457c2b5e7b09920
[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     };
99
100     Q_DECLARE_FLAGS(RenderHints, RenderHint)
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 = 0);
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=0);
421     void drawText(const QRect &r, int flags, const QString &text, QRect *br=0);
422     inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br=0);
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     void eraseRect(const QRectF &);
453     inline void eraseRect(int x, int y, int w, int h);
454     inline void eraseRect(const QRect &);
455
456     void setRenderHint(RenderHint hint, bool on = true);
457     void setRenderHints(RenderHints hints, bool on = true);
458     RenderHints renderHints() const;
459     inline bool testRenderHint(RenderHint hint) const { return renderHints() & hint; }
460
461     QPaintEngine *paintEngine() const;
462
463     static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
464                               const QPoint& offset = QPoint());
465     static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0);
466     static void restoreRedirected(const QPaintDevice *device);
467
468     void beginNativePainting();
469     void endNativePainting();
470
471 private:
472     Q_DISABLE_COPY(QPainter)
473
474     QScopedPointer<QPainterPrivate> d_ptr;
475
476     friend class QWidget;
477     friend class QFontEngine;
478     friend class QFontEngineBox;
479     friend class QFontEngineFT;
480     friend class QFontEngineMac;
481     friend class QFontEngineWin;
482     friend class QPaintEngine;
483     friend class QPaintEngineExPrivate;
484     friend class QOpenGLPaintEngine;
485     friend class QWin32PaintEngine;
486     friend class QWin32PaintEnginePrivate;
487     friend class QRasterPaintEngine;
488     friend class QAlphaPaintEngine;
489     friend class QPreviewPaintEngine;
490     friend class QTextEngine;
491 };
492
493 Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
494
495 //
496 // functions
497 //
498 inline void QPainter::drawLine(const QLineF &l)
499 {
500     drawLines(&l, 1);
501 }
502
503 inline void QPainter::drawLine(const QLine &line)
504 {
505     drawLines(&line, 1);
506 }
507
508 inline 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
514 inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
515 {
516     QLine l(p1, p2);
517     drawLines(&l, 1);
518 }
519
520 inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
521 {
522     drawLine(QLineF(p1, p2));
523 }
524
525 inline void QPainter::drawLines(const QVector<QLineF> &lines)
526 {
527     drawLines(lines.constData(), lines.size());
528 }
529
530 inline void QPainter::drawLines(const QVector<QLine> &lines)
531 {
532     drawLines(lines.constData(), lines.size());
533 }
534
535 inline void QPainter::drawLines(const QVector<QPointF> &pointPairs)
536 {
537     drawLines(pointPairs.constData(), pointPairs.size() / 2);
538 }
539
540 inline void QPainter::drawLines(const QVector<QPoint> &pointPairs)
541 {
542     drawLines(pointPairs.constData(), pointPairs.size() / 2);
543 }
544
545 inline void QPainter::drawPolyline(const QPolygonF &polyline)
546 {
547     drawPolyline(polyline.constData(), polyline.size());
548 }
549
550 inline void QPainter::drawPolyline(const QPolygon &polyline)
551 {
552     drawPolyline(polyline.constData(), polyline.size());
553 }
554
555 inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
556 {
557     drawPolygon(polygon.constData(), polygon.size(), fillRule);
558 }
559
560 inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
561 {
562     drawPolygon(polygon.constData(), polygon.size(), fillRule);
563 }
564
565 inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
566 {
567     drawConvexPolygon(poly.constData(), poly.size());
568 }
569
570 inline void QPainter::drawConvexPolygon(const QPolygon &poly)
571 {
572     drawConvexPolygon(poly.constData(), poly.size());
573 }
574
575 inline void QPainter::drawRect(const QRectF &rect)
576 {
577     drawRects(&rect, 1);
578 }
579
580 inline 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
586 inline void QPainter::drawRect(const QRect &r)
587 {
588     drawRects(&r, 1);
589 }
590
591 inline void QPainter::drawRects(const QVector<QRectF> &rects)
592 {
593     drawRects(rects.constData(), rects.size());
594 }
595
596 inline void QPainter::drawRects(const QVector<QRect> &rects)
597 {
598     drawRects(rects.constData(), rects.size());
599 }
600
601 inline void QPainter::drawPoint(const QPointF &p)
602 {
603     drawPoints(&p, 1);
604 }
605
606 inline void QPainter::drawPoint(int x, int y)
607 {
608     QPoint p(x, y);
609     drawPoints(&p, 1);
610 }
611
612 inline void QPainter::drawPoint(const QPoint &p)
613 {
614     drawPoints(&p, 1);
615 }
616
617 inline void QPainter::drawPoints(const QPolygonF &points)
618 {
619     drawPoints(points.constData(), points.size());
620 }
621
622 inline void QPainter::drawPoints(const QPolygon &points)
623 {
624     drawPoints(points.constData(), points.size());
625 }
626
627 inline 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
632 inline void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
633 {
634     drawRoundRect(QRectF(rect), xRnd, yRnd);
635 }
636
637 inline 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
643 inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
644                             Qt::SizeMode mode)
645 {
646     drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
647 }
648
649 inline void QPainter::drawEllipse(int x, int y, int w, int h)
650 {
651     drawEllipse(QRect(x, y, w, h));
652 }
653
654 inline 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
659 inline 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
664 inline void QPainter::drawArc(const QRect &r, int a, int alen)
665 {
666     drawArc(QRectF(r), a, alen);
667 }
668
669 inline 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
674 inline void QPainter::drawPie(const QRect &rect, int a, int alen)
675 {
676     drawPie(QRectF(rect), a, alen);
677 }
678
679 inline 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
684 inline void QPainter::drawChord(const QRect &rect, int a, int alen)
685 {
686     drawChord(QRectF(rect), a, alen);
687 }
688
689 inline 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
694 inline 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
699 inline void QPainter::eraseRect(const QRect &rect)
700 {
701     eraseRect(QRectF(rect));
702 }
703
704 inline void QPainter::eraseRect(int x, int y, int w, int h)
705 {
706     eraseRect(QRectF(x, y, w, h));
707 }
708
709 inline 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
714 inline 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
719 inline 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
724 inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
725 {
726     fillRect(r, QColor(c));
727 }
728
729 inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
730 {
731     fillRect(r, QColor(c));
732 }
733
734 inline 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
739 inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
740 {
741     fillRect(QRectF(r), QBrush(style));
742 }
743
744 inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
745 {
746     fillRect(r, QBrush(style));
747 }
748
749
750 inline void QPainter::setBrushOrigin(int x, int y)
751 {
752     setBrushOrigin(QPoint(x, y));
753 }
754
755 inline void QPainter::setBrushOrigin(const QPoint &p)
756 {
757     setBrushOrigin(QPointF(p));
758 }
759
760 inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
761 {
762     drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
763 }
764
765 inline 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
770 inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
771 {
772     drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
773 }
774
775 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
776 {
777     drawPixmap(QPointF(p), pm);
778 }
779
780 inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
781 {
782     drawPixmap(QRectF(r), pm, QRectF());
783 }
784
785 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
786 {
787     drawPixmap(QPointF(x, y), pm);
788 }
789
790 inline 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
795 inline 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
801 inline 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
807 inline 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
812 inline 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
817 inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
818 {
819     drawTextItem(QPointF(x, y), ti);
820 }
821
822 inline 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
828 inline 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
834 inline 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
841 inline void QPainter::drawImage(const QRectF &r, const QImage &image)
842 {
843     drawImage(r, image, QRect(0, 0, image.width(), image.height()));
844 }
845
846 inline void QPainter::drawImage(const QRect &r, const QImage &image)
847 {
848     drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
849 }
850
851 inline void QPainter::drawImage(const QPoint &p, const QImage &image)
852 {
853     drawImage(QPointF(p), image);
854 }
855
856 inline 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
865 inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText)
866 {
867     drawStaticText(QPointF(p), staticText);
868 }
869
870 inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText)
871 {
872     drawStaticText(QPointF(x, y), staticText);
873 }
874
875 inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
876 {
877     drawTextItem(QPointF(p), ti);
878 }
879
880 inline void QPainter::drawText(const QPoint &p, const QString &s)
881 {
882     drawText(QPointF(p), s);
883 }
884
885 inline 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
890 inline void QPainter::drawText(int x, int y, const QString &s)
891 {
892     drawText(QPointF(x, y), s);
893 }
894
895 inline 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
900 inline void QPainter::translate(qreal dx, qreal dy)
901 {
902     translate(QPointF(dx, dy));
903 }
904
905 inline void QPainter::translate(const QPoint &offset)
906 {
907     translate(offset.x(), offset.y());
908 }
909
910 inline void QPainter::setViewport(int x, int y, int w, int h)
911 {
912     setViewport(QRect(x, y, w, h));
913 }
914
915 inline 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
921 inline void QPainter::drawPicture(int x, int y, const QPicture &p)
922 {
923     drawPicture(QPoint(x, y), p);
924 }
925
926 inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
927 {
928     drawPicture(QPointF(pt), p);
929 }
930 #endif
931
932 QT_END_NAMESPACE
933
934 QT_END_HEADER
935
936 #endif // QPAINTER_H