File indexing completed on 2025-01-18 10:08:14
0001
0002
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
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
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 void setCompositionMode(CompositionMode mode);
0142 CompositionMode compositionMode() const;
0143
0144 const QFont &font() const;
0145 void setFont(const QFont &f);
0146
0147 QFontMetrics fontMetrics() const;
0148 QFontInfo fontInfo() const;
0149
0150 void setPen(const QColor &color);
0151 void setPen(const QPen &pen);
0152 void setPen(Qt::PenStyle style);
0153 const QPen &pen() const;
0154
0155 void setBrush(const QBrush &brush);
0156 void setBrush(Qt::BrushStyle style);
0157 const QBrush &brush() const;
0158
0159
0160 void setBackgroundMode(Qt::BGMode mode);
0161 Qt::BGMode backgroundMode() const;
0162
0163 QPoint brushOrigin() const;
0164 inline void setBrushOrigin(int x, int y);
0165 inline void setBrushOrigin(const QPoint &);
0166 void setBrushOrigin(const QPointF &);
0167
0168 void setBackground(const QBrush &bg);
0169 const QBrush &background() const;
0170
0171 qreal opacity() const;
0172 void setOpacity(qreal opacity);
0173
0174
0175 QRegion clipRegion() const;
0176 QPainterPath clipPath() const;
0177
0178 void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip);
0179 void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip);
0180 inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip);
0181
0182 void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip);
0183
0184 void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip);
0185
0186 void setClipping(bool enable);
0187 bool hasClipping() const;
0188
0189 QRectF clipBoundingRect() const;
0190
0191 void save();
0192 void restore();
0193
0194
0195 void setTransform(const QTransform &transform, bool combine = false);
0196 const QTransform &transform() const;
0197 const QTransform &deviceTransform() const;
0198 void resetTransform();
0199
0200 void setWorldTransform(const QTransform &matrix, bool combine = false);
0201 const QTransform &worldTransform() const;
0202
0203 QTransform combinedTransform() const;
0204
0205 void setWorldMatrixEnabled(bool enabled);
0206 bool worldMatrixEnabled() const;
0207
0208 void scale(qreal sx, qreal sy);
0209 void shear(qreal sh, qreal sv);
0210 void rotate(qreal a);
0211
0212 void translate(const QPointF &offset);
0213 inline void translate(const QPoint &offset);
0214 inline void translate(qreal dx, qreal dy);
0215
0216 QRect window() const;
0217 void setWindow(const QRect &window);
0218 inline void setWindow(int x, int y, int w, int h);
0219
0220 QRect viewport() const;
0221 void setViewport(const QRect &viewport);
0222 inline void setViewport(int x, int y, int w, int h);
0223
0224 void setViewTransformEnabled(bool enable);
0225 bool viewTransformEnabled() const;
0226
0227
0228 void strokePath(const QPainterPath &path, const QPen &pen);
0229 void fillPath(const QPainterPath &path, const QBrush &brush);
0230 void drawPath(const QPainterPath &path);
0231
0232 inline void drawPoint(const QPointF &pt);
0233 inline void drawPoint(const QPoint &p);
0234 inline void drawPoint(int x, int y);
0235
0236 void drawPoints(const QPointF *points, int pointCount);
0237 inline void drawPoints(const QPolygonF &points);
0238 void drawPoints(const QPoint *points, int pointCount);
0239 inline void drawPoints(const QPolygon &points);
0240
0241 inline void drawLine(const QLineF &line);
0242 inline void drawLine(const QLine &line);
0243 inline void drawLine(int x1, int y1, int x2, int y2);
0244 inline void drawLine(const QPoint &p1, const QPoint &p2);
0245 inline void drawLine(const QPointF &p1, const QPointF &p2);
0246
0247 void drawLines(const QLineF *lines, int lineCount);
0248 inline void drawLines(const QList<QLineF> &lines);
0249 void drawLines(const QPointF *pointPairs, int lineCount);
0250 inline void drawLines(const QList<QPointF> &pointPairs);
0251 void drawLines(const QLine *lines, int lineCount);
0252 inline void drawLines(const QList<QLine> &lines);
0253 void drawLines(const QPoint *pointPairs, int lineCount);
0254 inline void drawLines(const QList<QPoint> &pointPairs);
0255
0256 inline void drawRect(const QRectF &rect);
0257 inline void drawRect(int x1, int y1, int w, int h);
0258 inline void drawRect(const QRect &rect);
0259
0260 void drawRects(const QRectF *rects, int rectCount);
0261 inline void drawRects(const QList<QRectF> &rectangles);
0262 void drawRects(const QRect *rects, int rectCount);
0263 inline void drawRects(const QList<QRect> &rectangles);
0264
0265 void drawEllipse(const QRectF &r);
0266 void drawEllipse(const QRect &r);
0267 inline void drawEllipse(int x, int y, int w, int h);
0268
0269 inline void drawEllipse(const QPointF ¢er, qreal rx, qreal ry);
0270 inline void drawEllipse(const QPoint ¢er, int rx, int ry);
0271
0272 void drawPolyline(const QPointF *points, int pointCount);
0273 inline void drawPolyline(const QPolygonF &polyline);
0274 void drawPolyline(const QPoint *points, int pointCount);
0275 inline void drawPolyline(const QPolygon &polygon);
0276
0277 void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
0278 inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
0279 void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
0280 inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
0281
0282 void drawConvexPolygon(const QPointF *points, int pointCount);
0283 inline void drawConvexPolygon(const QPolygonF &polygon);
0284 void drawConvexPolygon(const QPoint *points, int pointCount);
0285 inline void drawConvexPolygon(const QPolygon &polygon);
0286
0287 void drawArc(const QRectF &rect, int a, int alen);
0288 inline void drawArc(const QRect &, int a, int alen);
0289 inline void drawArc(int x, int y, int w, int h, int a, int alen);
0290
0291 void drawPie(const QRectF &rect, int a, int alen);
0292 inline void drawPie(int x, int y, int w, int h, int a, int alen);
0293 inline void drawPie(const QRect &, int a, int alen);
0294
0295 void drawChord(const QRectF &rect, int a, int alen);
0296 inline void drawChord(int x, int y, int w, int h, int a, int alen);
0297 inline void drawChord(const QRect &, int a, int alen);
0298
0299 void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
0300 Qt::SizeMode mode = Qt::AbsoluteSize);
0301 inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
0302 Qt::SizeMode mode = Qt::AbsoluteSize);
0303 inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
0304 Qt::SizeMode mode = Qt::AbsoluteSize);
0305
0306 void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
0307 inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
0308 inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
0309 #ifndef QT_NO_PICTURE
0310 void drawPicture(const QPointF &p, const QPicture &picture);
0311 inline void drawPicture(int x, int y, const QPicture &picture);
0312 inline void drawPicture(const QPoint &p, const QPicture &picture);
0313 #endif
0314
0315 void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
0316 inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
0317 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
0318 int sx, int sy, int sw, int sh);
0319 inline void drawPixmap(int x, int y, const QPixmap &pm,
0320 int sx, int sy, int sw, int sh);
0321 inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
0322 inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
0323 void drawPixmap(const QPointF &p, const QPixmap &pm);
0324 inline void drawPixmap(const QPoint &p, const QPixmap &pm);
0325 inline void drawPixmap(int x, int y, const QPixmap &pm);
0326 inline void drawPixmap(const QRect &r, const QPixmap &pm);
0327 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
0328
0329 void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount,
0330 const QPixmap &pixmap, PixmapFragmentHints hints = PixmapFragmentHints());
0331
0332 void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect,
0333 Qt::ImageConversionFlags flags = Qt::AutoColor);
0334 inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
0335 Qt::ImageConversionFlags flags = Qt::AutoColor);
0336 inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
0337 Qt::ImageConversionFlags flags = Qt::AutoColor);
0338 inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr,
0339 Qt::ImageConversionFlags flags = Qt::AutoColor);
0340 inline void drawImage(const QRectF &r, const QImage &image);
0341 inline void drawImage(const QRect &r, const QImage &image);
0342 void drawImage(const QPointF &p, const QImage &image);
0343 inline void drawImage(const QPoint &p, const QImage &image);
0344 inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0,
0345 int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor);
0346
0347 void setLayoutDirection(Qt::LayoutDirection direction);
0348 Qt::LayoutDirection layoutDirection() const;
0349
0350 #if !defined(QT_NO_RAWFONT)
0351 void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun);
0352 #endif
0353
0354 void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText);
0355 inline void drawStaticText(const QPoint &topLeftPosition, const QStaticText &staticText);
0356 inline void drawStaticText(int left, int top, const QStaticText &staticText);
0357
0358 void drawText(const QPointF &p, const QString &s);
0359 inline void drawText(const QPoint &p, const QString &s);
0360 inline void drawText(int x, int y, const QString &s);
0361
0362 void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding);
0363
0364 void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = nullptr);
0365 void drawText(const QRect &r, int flags, const QString &text, QRect *br = nullptr);
0366 inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = nullptr);
0367
0368 void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption());
0369
0370 QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
0371 QRect boundingRect(const QRect &rect, int flags, const QString &text);
0372 inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
0373
0374 QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption());
0375
0376 void drawTextItem(const QPointF &p, const QTextItem &ti);
0377 inline void drawTextItem(int x, int y, const QTextItem &ti);
0378 inline void drawTextItem(const QPoint &p, const QTextItem &ti);
0379
0380 void fillRect(const QRectF &, const QBrush &);
0381 inline void fillRect(int x, int y, int w, int h, const QBrush &);
0382 void fillRect(const QRect &, const QBrush &);
0383
0384 void fillRect(const QRectF &, const QColor &color);
0385 inline void fillRect(int x, int y, int w, int h, const QColor &color);
0386 void fillRect(const QRect &, const QColor &color);
0387
0388 inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
0389 inline void fillRect(const QRect &r, Qt::GlobalColor c);
0390 inline void fillRect(const QRectF &r, Qt::GlobalColor c);
0391
0392 inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
0393 inline void fillRect(const QRect &r, Qt::BrushStyle style);
0394 inline void fillRect(const QRectF &r, Qt::BrushStyle style);
0395
0396 inline void fillRect(int x, int y, int w, int h, QGradient::Preset preset);
0397 inline void fillRect(const QRect &r, QGradient::Preset preset);
0398 inline void fillRect(const QRectF &r, QGradient::Preset preset);
0399
0400 void eraseRect(const QRectF &);
0401 inline void eraseRect(int x, int y, int w, int h);
0402 inline void eraseRect(const QRect &);
0403
0404 void setRenderHint(RenderHint hint, bool on = true);
0405 void setRenderHints(RenderHints hints, bool on = true);
0406 RenderHints renderHints() const;
0407 inline bool testRenderHint(RenderHint hint) const { return bool(renderHints() & hint); }
0408
0409 QPaintEngine *paintEngine() const;
0410
0411 void beginNativePainting();
0412 void endNativePainting();
0413
0414 private:
0415 Q_DISABLE_COPY(QPainter)
0416
0417 std::unique_ptr<QPainterPrivate> d_ptr;
0418
0419 friend class QWidget;
0420 friend class QFontEngine;
0421 friend class QFontEngineBox;
0422 friend class QFontEngineFT;
0423 friend class QFontEngineMac;
0424 friend class QFontEngineWin;
0425 friend class QPaintEngine;
0426 friend class QPaintEngineExPrivate;
0427 friend class QOpenGLPaintEngine;
0428 friend class QWin32PaintEngine;
0429 friend class QWin32PaintEnginePrivate;
0430 friend class QRasterPaintEngine;
0431 friend class QAlphaPaintEngine;
0432 friend class QPreviewPaintEngine;
0433 friend class QTextEngine;
0434 };
0435 Q_DECLARE_TYPEINFO(QPainter::PixmapFragment, Q_RELOCATABLE_TYPE);
0436
0437 Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
0438
0439
0440
0441
0442 inline void QPainter::drawLine(const QLineF &l)
0443 {
0444 drawLines(&l, 1);
0445 }
0446
0447 inline void QPainter::drawLine(const QLine &line)
0448 {
0449 drawLines(&line, 1);
0450 }
0451
0452 inline void QPainter::drawLine(int x1, int y1, int x2, int y2)
0453 {
0454 QLine l(x1, y1, x2, y2);
0455 drawLines(&l, 1);
0456 }
0457
0458 inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
0459 {
0460 QLine l(p1, p2);
0461 drawLines(&l, 1);
0462 }
0463
0464 inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
0465 {
0466 drawLine(QLineF(p1, p2));
0467 }
0468
0469 inline void QPainter::drawLines(const QList<QLineF> &lines)
0470 {
0471 drawLines(lines.constData(), int(lines.size()));
0472 }
0473
0474 inline void QPainter::drawLines(const QList<QLine> &lines)
0475 {
0476 drawLines(lines.constData(), int(lines.size()));
0477 }
0478
0479 inline void QPainter::drawLines(const QList<QPointF> &pointPairs)
0480 {
0481 drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
0482 }
0483
0484 inline void QPainter::drawLines(const QList<QPoint> &pointPairs)
0485 {
0486 drawLines(pointPairs.constData(), int(pointPairs.size() / 2));
0487 }
0488
0489 inline void QPainter::drawPolyline(const QPolygonF &polyline)
0490 {
0491 drawPolyline(polyline.constData(), int(polyline.size()));
0492 }
0493
0494 inline void QPainter::drawPolyline(const QPolygon &polyline)
0495 {
0496 drawPolyline(polyline.constData(), int(polyline.size()));
0497 }
0498
0499 inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
0500 {
0501 drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
0502 }
0503
0504 inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
0505 {
0506 drawPolygon(polygon.constData(), int(polygon.size()), fillRule);
0507 }
0508
0509 inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
0510 {
0511 drawConvexPolygon(poly.constData(), int(poly.size()));
0512 }
0513
0514 inline void QPainter::drawConvexPolygon(const QPolygon &poly)
0515 {
0516 drawConvexPolygon(poly.constData(), int(poly.size()));
0517 }
0518
0519 inline void QPainter::drawRect(const QRectF &rect)
0520 {
0521 drawRects(&rect, 1);
0522 }
0523
0524 inline void QPainter::drawRect(int x, int y, int w, int h)
0525 {
0526 QRect r(x, y, w, h);
0527 drawRects(&r, 1);
0528 }
0529
0530 inline void QPainter::drawRect(const QRect &r)
0531 {
0532 drawRects(&r, 1);
0533 }
0534
0535 inline void QPainter::drawRects(const QList<QRectF> &rects)
0536 {
0537 drawRects(rects.constData(), int(rects.size()));
0538 }
0539
0540 inline void QPainter::drawRects(const QList<QRect> &rects)
0541 {
0542 drawRects(rects.constData(), int(rects.size()));
0543 }
0544
0545 inline void QPainter::drawPoint(const QPointF &p)
0546 {
0547 drawPoints(&p, 1);
0548 }
0549
0550 inline void QPainter::drawPoint(int x, int y)
0551 {
0552 QPoint p(x, y);
0553 drawPoints(&p, 1);
0554 }
0555
0556 inline void QPainter::drawPoint(const QPoint &p)
0557 {
0558 drawPoints(&p, 1);
0559 }
0560
0561 inline void QPainter::drawPoints(const QPolygonF &points)
0562 {
0563 drawPoints(points.constData(), int(points.size()));
0564 }
0565
0566 inline void QPainter::drawPoints(const QPolygon &points)
0567 {
0568 drawPoints(points.constData(), int(points.size()));
0569 }
0570
0571 inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
0572 Qt::SizeMode mode)
0573 {
0574 drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
0575 }
0576
0577 inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
0578 Qt::SizeMode mode)
0579 {
0580 drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
0581 }
0582
0583 inline void QPainter::drawEllipse(int x, int y, int w, int h)
0584 {
0585 drawEllipse(QRect(x, y, w, h));
0586 }
0587
0588 inline void QPainter::drawEllipse(const QPointF ¢er, qreal rx, qreal ry)
0589 {
0590 drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
0591 }
0592
0593 inline void QPainter::drawEllipse(const QPoint ¢er, int rx, int ry)
0594 {
0595 drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
0596 }
0597
0598 inline void QPainter::drawArc(const QRect &r, int a, int alen)
0599 {
0600 drawArc(QRectF(r), a, alen);
0601 }
0602
0603 inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen)
0604 {
0605 drawArc(QRectF(x, y, w, h), a, alen);
0606 }
0607
0608 inline void QPainter::drawPie(const QRect &rect, int a, int alen)
0609 {
0610 drawPie(QRectF(rect), a, alen);
0611 }
0612
0613 inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen)
0614 {
0615 drawPie(QRectF(x, y, w, h), a, alen);
0616 }
0617
0618 inline void QPainter::drawChord(const QRect &rect, int a, int alen)
0619 {
0620 drawChord(QRectF(rect), a, alen);
0621 }
0622
0623 inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen)
0624 {
0625 drawChord(QRectF(x, y, w, h), a, alen);
0626 }
0627
0628 inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op)
0629 {
0630 setClipRect(QRect(x, y, w, h), op);
0631 }
0632
0633 inline void QPainter::eraseRect(const QRect &rect)
0634 {
0635 eraseRect(QRectF(rect));
0636 }
0637
0638 inline void QPainter::eraseRect(int x, int y, int w, int h)
0639 {
0640 eraseRect(QRectF(x, y, w, h));
0641 }
0642
0643 inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b)
0644 {
0645 fillRect(QRect(x, y, w, h), b);
0646 }
0647
0648 inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b)
0649 {
0650 fillRect(QRect(x, y, w, h), b);
0651 }
0652
0653 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c)
0654 {
0655 fillRect(QRect(x, y, w, h), QColor(c));
0656 }
0657
0658 inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
0659 {
0660 fillRect(r, QColor(c));
0661 }
0662
0663 inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
0664 {
0665 fillRect(r, QColor(c));
0666 }
0667
0668 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style)
0669 {
0670 fillRect(QRectF(x, y, w, h), QBrush(style));
0671 }
0672
0673 inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
0674 {
0675 fillRect(QRectF(r), QBrush(style));
0676 }
0677
0678 inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
0679 {
0680 fillRect(r, QBrush(style));
0681 }
0682
0683 inline void QPainter::fillRect(int x, int y, int w, int h, QGradient::Preset p)
0684 {
0685 fillRect(QRect(x, y, w, h), QGradient(p));
0686 }
0687
0688 inline void QPainter::fillRect(const QRect &r, QGradient::Preset p)
0689 {
0690 fillRect(r, QGradient(p));
0691 }
0692
0693 inline void QPainter::fillRect(const QRectF &r, QGradient::Preset p)
0694 {
0695 fillRect(r, QGradient(p));
0696 }
0697
0698 inline void QPainter::setBrushOrigin(int x, int y)
0699 {
0700 setBrushOrigin(QPoint(x, y));
0701 }
0702
0703 inline void QPainter::setBrushOrigin(const QPoint &p)
0704 {
0705 setBrushOrigin(QPointF(p));
0706 }
0707
0708 inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
0709 {
0710 drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
0711 }
0712
0713 inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy)
0714 {
0715 drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy));
0716 }
0717
0718 inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
0719 {
0720 drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
0721 }
0722
0723 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
0724 {
0725 drawPixmap(QPointF(p), pm);
0726 }
0727
0728 inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
0729 {
0730 drawPixmap(QRectF(r), pm, QRectF());
0731 }
0732
0733 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
0734 {
0735 drawPixmap(QPointF(x, y), pm);
0736 }
0737
0738 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm)
0739 {
0740 drawPixmap(QRectF(x, y, w, h), pm, QRectF());
0741 }
0742
0743 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
0744 int sx, int sy, int sw, int sh)
0745 {
0746 drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh));
0747 }
0748
0749 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
0750 int sx, int sy, int sw, int sh)
0751 {
0752 drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh));
0753 }
0754
0755 inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr)
0756 {
0757 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
0758 }
0759
0760 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr)
0761 {
0762 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
0763 }
0764
0765 inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
0766 {
0767 drawTextItem(QPointF(x, y), ti);
0768 }
0769
0770 inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
0771 Qt::ImageConversionFlags flags)
0772 {
0773 drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags);
0774 }
0775
0776 inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
0777 Qt::ImageConversionFlags flags)
0778 {
0779 drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags);
0780 }
0781
0782 inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr,
0783 Qt::ImageConversionFlags flags)
0784 {
0785 drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags);
0786 }
0787
0788
0789 inline void QPainter::drawImage(const QRectF &r, const QImage &image)
0790 {
0791 drawImage(r, image, QRect(0, 0, image.width(), image.height()));
0792 }
0793
0794 inline void QPainter::drawImage(const QRect &r, const QImage &image)
0795 {
0796 drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
0797 }
0798
0799 inline void QPainter::drawImage(const QPoint &p, const QImage &image)
0800 {
0801 drawImage(QPointF(p), image);
0802 }
0803
0804 inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh,
0805 Qt::ImageConversionFlags flags)
0806 {
0807 if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor)
0808 drawImage(QPointF(x, y), image);
0809 else
0810 drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags);
0811 }
0812
0813 inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText)
0814 {
0815 drawStaticText(QPointF(p), staticText);
0816 }
0817
0818 inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText)
0819 {
0820 drawStaticText(QPointF(x, y), staticText);
0821 }
0822
0823 inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
0824 {
0825 drawTextItem(QPointF(p), ti);
0826 }
0827
0828 inline void QPainter::drawText(const QPoint &p, const QString &s)
0829 {
0830 drawText(QPointF(p), s);
0831 }
0832
0833 inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br)
0834 {
0835 drawText(QRect(x, y, w, h), flags, str, br);
0836 }
0837
0838 inline void QPainter::drawText(int x, int y, const QString &s)
0839 {
0840 drawText(QPointF(x, y), s);
0841 }
0842
0843 inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text)
0844 {
0845 return boundingRect(QRect(x, y, w, h), flags, text);
0846 }
0847
0848 inline void QPainter::translate(qreal dx, qreal dy)
0849 {
0850 translate(QPointF(dx, dy));
0851 }
0852
0853 inline void QPainter::translate(const QPoint &offset)
0854 {
0855 translate(offset.x(), offset.y());
0856 }
0857
0858 inline void QPainter::setViewport(int x, int y, int w, int h)
0859 {
0860 setViewport(QRect(x, y, w, h));
0861 }
0862
0863 inline void QPainter::setWindow(int x, int y, int w, int h)
0864 {
0865 setWindow(QRect(x, y, w, h));
0866 }
0867
0868 #ifndef QT_NO_PICTURE
0869 inline void QPainter::drawPicture(int x, int y, const QPicture &p)
0870 {
0871 drawPicture(QPoint(x, y), p);
0872 }
0873
0874 inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
0875 {
0876 drawPicture(QPointF(pt), p);
0877 }
0878 #endif
0879
0880 QT_END_NAMESPACE
0881
0882 #endif