Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 09:08:16

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QPAINTER_H
0005 #define QPAINTER_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qnamespace.h>
0009 #include <QtCore/qrect.h>
0010 #include <QtCore/qpoint.h>
0011 #include <QtCore/qscopedpointer.h>
0012 #include <QtGui/qpixmap.h>
0013 #include <QtGui/qimage.h>
0014 #include <QtGui/qtextoption.h>
0015 #include <memory>
0016 
0017 #ifndef QT_INCLUDE_COMPAT
0018 #include <QtGui/qpolygon.h>
0019 #include <QtGui/qpen.h>
0020 #include <QtGui/qbrush.h>
0021 #include <QtGui/qtransform.h>
0022 #include <QtGui/qfontinfo.h>
0023 #include <QtGui/qfontmetrics.h>
0024 #endif
0025 
0026 QT_BEGIN_NAMESPACE
0027 
0028 
0029 class QBrush;
0030 class QFontInfo;
0031 class QFontMetrics;
0032 class QPaintDevice;
0033 class QPainterPath;
0034 class QPainterPrivate;
0035 class QPen;
0036 class QPolygon;
0037 class QTextItem;
0038 class QTextEngine;
0039 class QTransform;
0040 class QStaticText;
0041 class QGlyphRun;
0042 
0043 class QPainterPrivateDeleter;
0044 
0045 class Q_GUI_EXPORT QPainter
0046 {
0047     Q_DECLARE_PRIVATE(QPainter)
0048     Q_GADGET
0049 
0050 public:
0051     enum RenderHint {
0052         Antialiasing = 0x01,
0053         TextAntialiasing = 0x02,
0054         SmoothPixmapTransform = 0x04,
0055         VerticalSubpixelPositioning = 0x08,
0056         LosslessImageRendering = 0x40,
0057         NonCosmeticBrushPatterns = 0x80
0058     };
0059     Q_ENUM(RenderHint)
0060 
0061     Q_DECLARE_FLAGS(RenderHints, RenderHint)
0062     Q_FLAG(RenderHints)
0063 
0064     class PixmapFragment {
0065     public:
0066         qreal x;
0067         qreal y;
0068         qreal sourceLeft;
0069         qreal sourceTop;
0070         qreal width;
0071         qreal height;
0072         qreal scaleX;
0073         qreal scaleY;
0074         qreal rotation;
0075         qreal opacity;
0076         static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect,
0077                                             qreal scaleX = 1, qreal scaleY = 1,
0078                                             qreal rotation = 0, qreal opacity = 1);
0079     };
0080 
0081     enum PixmapFragmentHint {
0082         OpaqueHint = 0x01
0083     };
0084 
0085     Q_DECLARE_FLAGS(PixmapFragmentHints, PixmapFragmentHint)
0086 
0087     QPainter();
0088     explicit QPainter(QPaintDevice *);
0089     ~QPainter();
0090 
0091     QPaintDevice *device() const;
0092 
0093     bool begin(QPaintDevice *);
0094     bool end();
0095     bool isActive() const;
0096 
0097     enum CompositionMode {
0098         CompositionMode_SourceOver,
0099         CompositionMode_DestinationOver,
0100         CompositionMode_Clear,
0101         CompositionMode_Source,
0102         CompositionMode_Destination,
0103         CompositionMode_SourceIn,
0104         CompositionMode_DestinationIn,
0105         CompositionMode_SourceOut,
0106         CompositionMode_DestinationOut,
0107         CompositionMode_SourceAtop,
0108         CompositionMode_DestinationAtop,
0109         CompositionMode_Xor,
0110 
0111         //svg 1.2 blend modes
0112         CompositionMode_Plus,
0113         CompositionMode_Multiply,
0114         CompositionMode_Screen,
0115         CompositionMode_Overlay,
0116         CompositionMode_Darken,
0117         CompositionMode_Lighten,
0118         CompositionMode_ColorDodge,
0119         CompositionMode_ColorBurn,
0120         CompositionMode_HardLight,
0121         CompositionMode_SoftLight,
0122         CompositionMode_Difference,
0123         CompositionMode_Exclusion,
0124 
0125         // ROPs
0126         RasterOp_SourceOrDestination,
0127         RasterOp_SourceAndDestination,
0128         RasterOp_SourceXorDestination,
0129         RasterOp_NotSourceAndNotDestination,
0130         RasterOp_NotSourceOrNotDestination,
0131         RasterOp_NotSourceXorDestination,
0132         RasterOp_NotSource,
0133         RasterOp_NotSourceAndDestination,
0134         RasterOp_SourceAndNotDestination,
0135         RasterOp_NotSourceOrDestination,
0136         RasterOp_SourceOrNotDestination,
0137         RasterOp_ClearDestination,
0138         RasterOp_SetDestination,
0139         RasterOp_NotDestination,
0140 
0141         NCompositionModes
0142     };
0143     void setCompositionMode(CompositionMode mode);
0144     CompositionMode compositionMode() const;
0145 
0146     const QFont &font() const;
0147     void setFont(const QFont &f);
0148 
0149     QFontMetrics fontMetrics() const;
0150     QFontInfo fontInfo() const;
0151 
0152     void setPen(const QColor &color);
0153     void setPen(const QPen &pen);
0154     void setPen(Qt::PenStyle style);
0155     const QPen &pen() const;
0156 
0157     void setBrush(const QBrush &brush);
0158     void setBrush(Qt::BrushStyle style);
0159     void setBrush(QColor color);
0160     void setBrush(Qt::GlobalColor color) { setBrush(QColor(color)); }
0161     const QBrush &brush() const;
0162 
0163     // attributes/modes
0164     void setBackgroundMode(Qt::BGMode mode);
0165     Qt::BGMode backgroundMode() const;
0166 
0167     QPoint brushOrigin() const;
0168     inline void setBrushOrigin(int x, int y);
0169     inline void setBrushOrigin(const QPoint &);
0170     void setBrushOrigin(const QPointF &);
0171 
0172     void setBackground(const QBrush &bg);
0173     const QBrush &background() const;
0174 
0175     qreal opacity() const;
0176     void setOpacity(qreal opacity);
0177 
0178     // Clip functions
0179     QRegion clipRegion() const;
0180     QPainterPath clipPath() const;
0181 
0182     void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip);
0183     void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip);
0184     inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip);
0185 
0186     void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip);
0187 
0188     void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip);
0189 
0190     void setClipping(bool enable);
0191     bool hasClipping() const;
0192 
0193     QRectF clipBoundingRect() const;
0194 
0195     void save();
0196     void restore();
0197 
0198     // XForm functions
0199     void setTransform(const QTransform &transform, bool combine = false);
0200     const QTransform &transform() const;
0201     const QTransform &deviceTransform() const;
0202     void resetTransform();
0203 
0204     void setWorldTransform(const QTransform &matrix, bool combine = false);
0205     const QTransform &worldTransform() const;
0206 
0207     QTransform combinedTransform() const;
0208 
0209     void setWorldMatrixEnabled(bool enabled);
0210     bool worldMatrixEnabled() const;
0211 
0212     void scale(qreal sx, qreal sy);
0213     void shear(qreal sh, qreal sv);
0214     void rotate(qreal a);
0215 
0216     void translate(const QPointF &offset);
0217     inline void translate(const QPoint &offset);
0218     inline void translate(qreal dx, qreal dy);
0219 
0220     QRect window() const;
0221     void setWindow(const QRect &window);
0222     inline void setWindow(int x, int y, int w, int h);
0223 
0224     QRect viewport() const;
0225     void setViewport(const QRect &viewport);
0226     inline void setViewport(int x, int y, int w, int h);
0227 
0228     void setViewTransformEnabled(bool enable);
0229     bool viewTransformEnabled() const;
0230 
0231     // drawing functions
0232     void strokePath(const QPainterPath &path, const QPen &pen);
0233     void fillPath(const QPainterPath &path, const QBrush &brush);
0234     void drawPath(const QPainterPath &path);
0235 
0236     inline void drawPoint(const QPointF &pt);
0237     inline void drawPoint(const QPoint &p);
0238     inline void drawPoint(int x, int y);
0239 
0240     void drawPoints(const QPointF *points, int pointCount);
0241     inline void drawPoints(const QPolygonF &points);
0242     void drawPoints(const QPoint *points, int pointCount);
0243     inline void drawPoints(const QPolygon &points);
0244 
0245     inline void drawLine(const QLineF &line);
0246     inline void drawLine(const QLine &line);
0247     inline void drawLine(int x1, int y1, int x2, int y2);
0248     inline void drawLine(const QPoint &p1, const QPoint &p2);
0249     inline void drawLine(const QPointF &p1, const QPointF &p2);
0250 
0251     void drawLines(const QLineF *lines, int lineCount);
0252     inline void drawLines(const QList<QLineF> &lines);
0253     void drawLines(const QPointF *pointPairs, int lineCount);
0254     inline void drawLines(const QList<QPointF> &pointPairs);
0255     void drawLines(const QLine *lines, int lineCount);
0256     inline void drawLines(const QList<QLine> &lines);
0257     void drawLines(const QPoint *pointPairs, int lineCount);
0258     inline void drawLines(const QList<QPoint> &pointPairs);
0259 
0260     inline void drawRect(const QRectF &rect);
0261     inline void drawRect(int x1, int y1, int w, int h);
0262     inline void drawRect(const QRect &rect);
0263 
0264     void drawRects(const QRectF *rects, int rectCount);
0265     inline void drawRects(const QList<QRectF> &rectangles);
0266     void drawRects(const QRect *rects, int rectCount);
0267     inline void drawRects(const QList<QRect> &rectangles);
0268 
0269     void drawEllipse(const QRectF &r);
0270     void drawEllipse(const QRect &r);
0271     inline void drawEllipse(int x, int y, int w, int h);
0272 
0273     inline void drawEllipse(const QPointF &center, qreal rx, qreal ry);
0274     inline void drawEllipse(const QPoint &center, int rx, int ry);
0275 
0276     void drawPolyline(const QPointF *points, int pointCount);
0277     inline void drawPolyline(const QPolygonF &polyline);
0278     void drawPolyline(const QPoint *points, int pointCount);
0279     inline void drawPolyline(const QPolygon &polygon);
0280 
0281     void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
0282     inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
0283     void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
0284     inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
0285 
0286     void drawConvexPolygon(const QPointF *points, int pointCount);
0287     inline void drawConvexPolygon(const QPolygonF &polygon);
0288     void drawConvexPolygon(const QPoint *points, int pointCount);
0289     inline void drawConvexPolygon(const QPolygon &polygon);
0290 
0291     void drawArc(const QRectF &rect, int a, int alen);
0292     inline void drawArc(const QRect &, int a, int alen);
0293     inline void drawArc(int x, int y, int w, int h, int a, int alen);
0294 
0295     void drawPie(const QRectF &rect, int a, int alen);
0296     inline void drawPie(int x, int y, int w, int h, int a, int alen);
0297     inline void drawPie(const QRect &, int a, int alen);
0298 
0299     void drawChord(const QRectF &rect, int a, int alen);
0300     inline void drawChord(int x, int y, int w, int h, int a, int alen);
0301     inline void drawChord(const QRect &, int a, int alen);
0302 
0303     void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
0304                          Qt::SizeMode mode = Qt::AbsoluteSize);
0305     inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
0306                                 Qt::SizeMode mode = Qt::AbsoluteSize);
0307     inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
0308                                 Qt::SizeMode mode = Qt::AbsoluteSize);
0309 
0310     void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
0311     inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
0312     inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
0313 #ifndef QT_NO_PICTURE
0314     void drawPicture(const QPointF &p, const QPicture &picture);
0315     inline void drawPicture(int x, int y, const QPicture &picture);
0316     inline void drawPicture(const QPoint &p, const QPicture &picture);
0317 #endif
0318 
0319     void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
0320     inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
0321     inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
0322                            int sx, int sy, int sw, int sh);
0323     inline void drawPixmap(int x, int y, const QPixmap &pm,
0324                            int sx, int sy, int sw, int sh);
0325     inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
0326     inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
0327     void drawPixmap(const QPointF &p, const QPixmap &pm);
0328     inline void drawPixmap(const QPoint &p, const QPixmap &pm);
0329     inline void drawPixmap(int x, int y, const QPixmap &pm);
0330     inline void drawPixmap(const QRect &r, const QPixmap &pm);
0331     inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
0332 
0333     void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount,
0334                              const QPixmap &pixmap, PixmapFragmentHints hints = PixmapFragmentHints());
0335 
0336     void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect,
0337                    Qt::ImageConversionFlags flags = Qt::AutoColor);
0338     inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
0339                           Qt::ImageConversionFlags flags = Qt::AutoColor);
0340     inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
0341                           Qt::ImageConversionFlags flags = Qt::AutoColor);
0342     inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr,
0343                           Qt::ImageConversionFlags flags = Qt::AutoColor);
0344     inline void drawImage(const QRectF &r, const QImage &image);
0345     inline void drawImage(const QRect &r, const QImage &image);
0346     void drawImage(const QPointF &p, const QImage &image);
0347     inline void drawImage(const QPoint &p, const QImage &image);
0348     inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0,
0349                           int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor);
0350 
0351     void setLayoutDirection(Qt::LayoutDirection direction);
0352     Qt::LayoutDirection layoutDirection() const;
0353 
0354 #if !defined(QT_NO_RAWFONT)
0355     void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun);
0356 #endif
0357 
0358     void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText);
0359     inline void drawStaticText(const QPoint &topLeftPosition, const QStaticText &staticText);
0360     inline void drawStaticText(int left, int top, const QStaticText &staticText);
0361 
0362     void drawText(const QPointF &p, const QString &s);
0363     inline void drawText(const QPoint &p, const QString &s);
0364     inline void drawText(int x, int y, const QString &s);
0365 
0366     void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding);
0367 
0368     void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = nullptr);
0369     void drawText(const QRect &r, int flags, const QString &text, QRect *br = nullptr);
0370     inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = nullptr);
0371 
0372     void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption());
0373 
0374     QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
0375     QRect boundingRect(const QRect &rect, int flags, const QString &text);
0376     inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
0377 
0378     QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption());
0379 
0380     void drawTextItem(const QPointF &p, const QTextItem &ti);
0381     inline void drawTextItem(int x, int y, const QTextItem &ti);
0382     inline void drawTextItem(const QPoint &p, const QTextItem &ti);
0383 
0384     void fillRect(const QRectF &, const QBrush &);
0385     inline void fillRect(int x, int y, int w, int h, const QBrush &);
0386     void fillRect(const QRect &, const QBrush &);
0387 
0388     void fillRect(const QRectF &, const QColor &color);
0389     inline void fillRect(int x, int y, int w, int h, const QColor &color);
0390     void fillRect(const QRect &, const QColor &color);
0391 
0392     inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
0393     inline void fillRect(const QRect &r, Qt::GlobalColor c);
0394     inline void fillRect(const QRectF &r, Qt::GlobalColor c);
0395 
0396     inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
0397     inline void fillRect(const QRect &r, Qt::BrushStyle style);
0398     inline void fillRect(const QRectF &r, Qt::BrushStyle style);
0399 
0400     inline void fillRect(int x, int y, int w, int h, QGradient::Preset preset);
0401     inline void fillRect(const QRect &r, QGradient::Preset preset);
0402     inline void fillRect(const QRectF &r, QGradient::Preset preset);
0403 
0404     void eraseRect(const QRectF &);
0405     inline void eraseRect(int x, int y, int w, int h);
0406     inline void eraseRect(const QRect &);
0407 
0408     void setRenderHint(RenderHint hint, bool on = true);
0409     void setRenderHints(RenderHints hints, bool on = true);
0410     RenderHints renderHints() const;
0411     inline bool testRenderHint(RenderHint hint) const { return bool(renderHints() & hint); }
0412 
0413     QPaintEngine *paintEngine() const;
0414 
0415     void beginNativePainting();
0416     void endNativePainting();
0417 
0418 private:
0419     Q_DISABLE_COPY(QPainter)
0420 
0421     std::unique_ptr<QPainterPrivate> d_ptr;
0422 
0423     friend class QWidget;
0424     friend class QFontEngine;
0425     friend class QFontEngineBox;
0426     friend class QFontEngineFT;
0427     friend class QFontEngineMac;
0428     friend class QFontEngineWin;
0429     friend class QPaintEngine;
0430     friend class QPaintEngineExPrivate;
0431     friend class QOpenGLPaintEngine;
0432     friend class QWin32PaintEngine;
0433     friend class QWin32PaintEnginePrivate;
0434     friend class QRasterPaintEngine;
0435     friend class QAlphaPaintEngine;
0436     friend class QPreviewPaintEngine;
0437     friend class QTextEngine;
0438 };
0439 Q_DECLARE_TYPEINFO(QPainter::PixmapFragment, Q_RELOCATABLE_TYPE);
0440 
0441 Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
0442 
0443 //
0444 // functions
0445 //
0446 inline void QPainter::drawLine(const QLineF &l)
0447 {
0448     drawLines(&l, 1);
0449 }
0450 
0451 inline void QPainter::drawLine(const QLine &line)
0452 {
0453     drawLines(&line, 1);
0454 }
0455 
0456 inline void QPainter::drawLine(int x1, int y1, int x2, int y2)
0457 {
0458     QLine l(x1, y1, x2, y2);
0459     drawLines(&l, 1);
0460 }
0461 
0462 inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
0463 {
0464     QLine l(p1, p2);
0465     drawLines(&l, 1);
0466 }
0467 
0468 inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
0469 {
0470     drawLine(QLineF(p1, p2));
0471 }
0472 
0473 inline void QPainter::drawLines(const QList<QLineF> &lines)
0474 {
0475     drawLines(lines.constData(), int(lines.size()));
0476 }
0477 
0478 inline void QPainter::drawLines(const QList<QLine> &lines)
0479 {
0480     drawLines(lines.constData(), int(lines.size()));
0481 }
0482 
0483 inline void QPainter::drawLines(const QList<QPointF> &pointPairs)
0484 {
0485     drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
0486 }
0487 
0488 inline void QPainter::drawLines(const QList<QPoint> &pointPairs)
0489 {
0490     drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
0491 }
0492 
0493 inline void QPainter::drawPolyline(const QPolygonF &polyline)
0494 {
0495     drawPolyline(polyline.constData(), int(polyline.size()));
0496 }
0497 
0498 inline void QPainter::drawPolyline(const QPolygon &polyline)
0499 {
0500     drawPolyline(polyline.constData(), int(polyline.size()));
0501 }
0502 
0503 inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
0504 {
0505     drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
0506 }
0507 
0508 inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
0509 {
0510     drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
0511 }
0512 
0513 inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
0514 {
0515     drawConvexPolygon(poly.constData(), int(poly.size()));
0516 }
0517 
0518 inline void QPainter::drawConvexPolygon(const QPolygon &poly)
0519 {
0520     drawConvexPolygon(poly.constData(), int(poly.size()));
0521 }
0522 
0523 inline void QPainter::drawRect(const QRectF &rect)
0524 {
0525     drawRects(&rect, 1);
0526 }
0527 
0528 inline void QPainter::drawRect(int x, int y, int w, int h)
0529 {
0530     QRect r(x, y, w, h);
0531     drawRects(&r, 1);
0532 }
0533 
0534 inline void QPainter::drawRect(const QRect &r)
0535 {
0536     drawRects(&r, 1);
0537 }
0538 
0539 inline void QPainter::drawRects(const QList<QRectF> &rects)
0540 {
0541     drawRects(rects.constData(), int(rects.size()));
0542 }
0543 
0544 inline void QPainter::drawRects(const QList<QRect> &rects)
0545 {
0546     drawRects(rects.constData(), int(rects.size()));
0547 }
0548 
0549 inline void QPainter::drawPoint(const QPointF &p)
0550 {
0551     drawPoints(&p, 1);
0552 }
0553 
0554 inline void QPainter::drawPoint(int x, int y)
0555 {
0556     QPoint p(x, y);
0557     drawPoints(&p, 1);
0558 }
0559 
0560 inline void QPainter::drawPoint(const QPoint &p)
0561 {
0562     drawPoints(&p, 1);
0563 }
0564 
0565 inline void QPainter::drawPoints(const QPolygonF &points)
0566 {
0567     drawPoints(points.constData(), int(points.size()));
0568 }
0569 
0570 inline void QPainter::drawPoints(const QPolygon &points)
0571 {
0572     drawPoints(points.constData(), int(points.size()));
0573 }
0574 
0575 inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
0576                             Qt::SizeMode mode)
0577 {
0578     drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
0579 }
0580 
0581 inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
0582                             Qt::SizeMode mode)
0583 {
0584     drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
0585 }
0586 
0587 inline void QPainter::drawEllipse(int x, int y, int w, int h)
0588 {
0589     drawEllipse(QRect(x, y, w, h));
0590 }
0591 
0592 inline void QPainter::drawEllipse(const QPointF &center, qreal rx, qreal ry)
0593 {
0594     drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
0595 }
0596 
0597 inline void QPainter::drawEllipse(const QPoint &center, int rx, int ry)
0598 {
0599     drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
0600 }
0601 
0602 inline void QPainter::drawArc(const QRect &r, int a, int alen)
0603 {
0604     drawArc(QRectF(r), a, alen);
0605 }
0606 
0607 inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen)
0608 {
0609     drawArc(QRectF(x, y, w, h), a, alen);
0610 }
0611 
0612 inline void QPainter::drawPie(const QRect &rect, int a, int alen)
0613 {
0614     drawPie(QRectF(rect), a, alen);
0615 }
0616 
0617 inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen)
0618 {
0619     drawPie(QRectF(x, y, w, h), a, alen);
0620 }
0621 
0622 inline void QPainter::drawChord(const QRect &rect, int a, int alen)
0623 {
0624     drawChord(QRectF(rect), a, alen);
0625 }
0626 
0627 inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen)
0628 {
0629     drawChord(QRectF(x, y, w, h), a, alen);
0630 }
0631 
0632 inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op)
0633 {
0634     setClipRect(QRect(x, y, w, h), op);
0635 }
0636 
0637 inline void QPainter::eraseRect(const QRect &rect)
0638 {
0639     eraseRect(QRectF(rect));
0640 }
0641 
0642 inline void QPainter::eraseRect(int x, int y, int w, int h)
0643 {
0644     eraseRect(QRectF(x, y, w, h));
0645 }
0646 
0647 inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b)
0648 {
0649     fillRect(QRect(x, y, w, h), b);
0650 }
0651 
0652 inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b)
0653 {
0654     fillRect(QRect(x, y, w, h), b);
0655 }
0656 
0657 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c)
0658 {
0659     fillRect(QRect(x, y, w, h), QColor(c));
0660 }
0661 
0662 inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
0663 {
0664     fillRect(r, QColor(c));
0665 }
0666 
0667 inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
0668 {
0669     fillRect(r, QColor(c));
0670 }
0671 
0672 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style)
0673 {
0674     fillRect(QRectF(x, y, w, h), QBrush(style));
0675 }
0676 
0677 inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
0678 {
0679     fillRect(QRectF(r), QBrush(style));
0680 }
0681 
0682 inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
0683 {
0684     fillRect(r, QBrush(style));
0685 }
0686 
0687 inline void QPainter::fillRect(int x, int y, int w, int h, QGradient::Preset p)
0688 {
0689     fillRect(QRect(x, y, w, h), QGradient(p));
0690 }
0691 
0692 inline void QPainter::fillRect(const QRect &r, QGradient::Preset p)
0693 {
0694     fillRect(r, QGradient(p));
0695 }
0696 
0697 inline void QPainter::fillRect(const QRectF &r, QGradient::Preset p)
0698 {
0699     fillRect(r, QGradient(p));
0700 }
0701 
0702 inline void QPainter::setBrushOrigin(int x, int y)
0703 {
0704     setBrushOrigin(QPoint(x, y));
0705 }
0706 
0707 inline void QPainter::setBrushOrigin(const QPoint &p)
0708 {
0709     setBrushOrigin(QPointF(p));
0710 }
0711 
0712 inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
0713 {
0714     drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
0715 }
0716 
0717 inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy)
0718 {
0719     drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy));
0720 }
0721 
0722 inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
0723 {
0724     drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
0725 }
0726 
0727 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
0728 {
0729     drawPixmap(QPointF(p), pm);
0730 }
0731 
0732 inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
0733 {
0734     drawPixmap(QRectF(r), pm, QRectF());
0735 }
0736 
0737 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
0738 {
0739     drawPixmap(QPointF(x, y), pm);
0740 }
0741 
0742 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm)
0743 {
0744     drawPixmap(QRectF(x, y, w, h), pm, QRectF());
0745 }
0746 
0747 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
0748                                  int sx, int sy, int sw, int sh)
0749 {
0750     drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh));
0751 }
0752 
0753 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
0754                                  int sx, int sy, int sw, int sh)
0755 {
0756     drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh));
0757 }
0758 
0759 inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr)
0760 {
0761     drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
0762 }
0763 
0764 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr)
0765 {
0766     drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
0767 }
0768 
0769 inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
0770 {
0771     drawTextItem(QPointF(x, y), ti);
0772 }
0773 
0774 inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
0775                                 Qt::ImageConversionFlags flags)
0776 {
0777     drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags);
0778 }
0779 
0780 inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
0781                                 Qt::ImageConversionFlags flags)
0782 {
0783     drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags);
0784 }
0785 
0786 inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr,
0787                                 Qt::ImageConversionFlags flags)
0788 {
0789     drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags);
0790 }
0791 
0792 
0793 inline void QPainter::drawImage(const QRectF &r, const QImage &image)
0794 {
0795     drawImage(r, image, QRect(0, 0, image.width(), image.height()));
0796 }
0797 
0798 inline void QPainter::drawImage(const QRect &r, const QImage &image)
0799 {
0800     drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
0801 }
0802 
0803 inline void QPainter::drawImage(const QPoint &p, const QImage &image)
0804 {
0805     drawImage(QPointF(p), image);
0806 }
0807 
0808 inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh,
0809                                 Qt::ImageConversionFlags flags)
0810 {
0811     if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor)
0812         drawImage(QPointF(x, y), image);
0813     else
0814         drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags);
0815 }
0816 
0817 inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText)
0818 {
0819     drawStaticText(QPointF(p), staticText);
0820 }
0821 
0822 inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText)
0823 {
0824     drawStaticText(QPointF(x, y), staticText);
0825 }
0826 
0827 inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
0828 {
0829     drawTextItem(QPointF(p), ti);
0830 }
0831 
0832 inline void QPainter::drawText(const QPoint &p, const QString &s)
0833 {
0834     drawText(QPointF(p), s);
0835 }
0836 
0837 inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br)
0838 {
0839     drawText(QRect(x, y, w, h), flags, str, br);
0840 }
0841 
0842 inline void QPainter::drawText(int x, int y, const QString &s)
0843 {
0844     drawText(QPointF(x, y), s);
0845 }
0846 
0847 inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text)
0848 {
0849     return boundingRect(QRect(x, y, w, h), flags, text);
0850 }
0851 
0852 inline void QPainter::translate(qreal dx, qreal dy)
0853 {
0854     translate(QPointF(dx, dy));
0855 }
0856 
0857 inline void QPainter::translate(const QPoint &offset)
0858 {
0859     translate(offset.x(), offset.y());
0860 }
0861 
0862 inline void QPainter::setViewport(int x, int y, int w, int h)
0863 {
0864     setViewport(QRect(x, y, w, h));
0865 }
0866 
0867 inline void QPainter::setWindow(int x, int y, int w, int h)
0868 {
0869     setWindow(QRect(x, y, w, h));
0870 }
0871 
0872 #ifndef QT_NO_PICTURE
0873 inline void QPainter::drawPicture(int x, int y, const QPicture &p)
0874 {
0875     drawPicture(QPoint(x, y), p);
0876 }
0877 
0878 inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
0879 {
0880     drawPicture(QPointF(pt), p);
0881 }
0882 #endif
0883 
0884 QT_END_NAMESPACE
0885 
0886 #endif // QPAINTER_H