| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at qt-info@nokia.com.
|
|---|
| 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 | #include <QtGui/qdrawutil.h>
|
|---|
| 53 |
|
|---|
| 54 | #ifndef QT_INCLUDE_COMPAT
|
|---|
| 55 | #include <QtGui/qpolygon.h>
|
|---|
| 56 | #include <QtGui/qpen.h>
|
|---|
| 57 | #include <QtGui/qbrush.h>
|
|---|
| 58 | #include <QtGui/qmatrix.h>
|
|---|
| 59 | #include <QtGui/qtransform.h>
|
|---|
| 60 | #include <QtGui/qfontinfo.h>
|
|---|
| 61 | #include <QtGui/qfontmetrics.h>
|
|---|
| 62 | #endif
|
|---|
| 63 |
|
|---|
| 64 | QT_BEGIN_HEADER
|
|---|
| 65 |
|
|---|
| 66 | QT_BEGIN_NAMESPACE
|
|---|
| 67 |
|
|---|
| 68 | QT_MODULE(Gui)
|
|---|
| 69 |
|
|---|
| 70 | class QBrush;
|
|---|
| 71 | class QFontInfo;
|
|---|
| 72 | class QFontMetrics;
|
|---|
| 73 | class QPaintDevice;
|
|---|
| 74 | class QPainterPath;
|
|---|
| 75 | class QPainterPrivate;
|
|---|
| 76 | class QPen;
|
|---|
| 77 | class QPolygon;
|
|---|
| 78 | class QTextItem;
|
|---|
| 79 | class QMatrix;
|
|---|
| 80 | class QTransform;
|
|---|
| 81 | class QStaticText;
|
|---|
| 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 QWidget *widget);
|
|---|
| 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 | };
|
|---|
| 176 | void setCompositionMode(CompositionMode mode);
|
|---|
| 177 | CompositionMode compositionMode() const;
|
|---|
| 178 |
|
|---|
| 179 | const QFont &font() const;
|
|---|
| 180 | void setFont(const QFont &f);
|
|---|
| 181 |
|
|---|
| 182 | QFontMetrics fontMetrics() const;
|
|---|
| 183 | QFontInfo fontInfo() const;
|
|---|
| 184 |
|
|---|
| 185 | void setPen(const QColor &color);
|
|---|
| 186 | void setPen(const QPen &pen);
|
|---|
| 187 | void setPen(Qt::PenStyle style);
|
|---|
| 188 | const QPen &pen() const;
|
|---|
| 189 |
|
|---|
| 190 | void setBrush(const QBrush &brush);
|
|---|
| 191 | void setBrush(Qt::BrushStyle style);
|
|---|
| 192 | const QBrush &brush() const;
|
|---|
| 193 |
|
|---|
| 194 | // attributes/modes
|
|---|
| 195 | void setBackgroundMode(Qt::BGMode mode);
|
|---|
| 196 | Qt::BGMode backgroundMode() const;
|
|---|
| 197 |
|
|---|
| 198 | QPoint brushOrigin() const;
|
|---|
| 199 | inline void setBrushOrigin(int x, int y);
|
|---|
| 200 | inline void setBrushOrigin(const QPoint &);
|
|---|
| 201 | void setBrushOrigin(const QPointF &);
|
|---|
| 202 |
|
|---|
| 203 | void setBackground(const QBrush &bg);
|
|---|
| 204 | const QBrush &background() const;
|
|---|
| 205 |
|
|---|
| 206 | qreal opacity() const;
|
|---|
| 207 | void setOpacity(qreal opacity);
|
|---|
| 208 |
|
|---|
| 209 | // Clip functions
|
|---|
| 210 | QRegion clipRegion() const;
|
|---|
| 211 | QPainterPath clipPath() const;
|
|---|
| 212 |
|
|---|
| 213 | void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip);
|
|---|
| 214 | void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip);
|
|---|
| 215 | inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip);
|
|---|
| 216 |
|
|---|
| 217 | void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip);
|
|---|
| 218 |
|
|---|
| 219 | void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip);
|
|---|
| 220 |
|
|---|
| 221 | void setClipping(bool enable);
|
|---|
| 222 | bool hasClipping() const;
|
|---|
| 223 |
|
|---|
| 224 | void save();
|
|---|
| 225 | void restore();
|
|---|
| 226 |
|
|---|
| 227 | // XForm functions
|
|---|
| 228 | void setMatrix(const QMatrix &matrix, bool combine = false);
|
|---|
| 229 | const QMatrix &matrix() const;
|
|---|
| 230 | const QMatrix &deviceMatrix() const;
|
|---|
| 231 | void resetMatrix();
|
|---|
| 232 |
|
|---|
| 233 | void setTransform(const QTransform &transform, bool combine = false);
|
|---|
| 234 | const QTransform &transform() const;
|
|---|
| 235 | const QTransform &deviceTransform() const;
|
|---|
| 236 | void resetTransform();
|
|---|
| 237 |
|
|---|
| 238 | void setWorldMatrix(const QMatrix &matrix, bool combine = false);
|
|---|
| 239 | const QMatrix &worldMatrix() const;
|
|---|
| 240 |
|
|---|
| 241 | void setWorldTransform(const QTransform &matrix, bool combine = false);
|
|---|
| 242 | const QTransform &worldTransform() const;
|
|---|
| 243 |
|
|---|
| 244 | QMatrix combinedMatrix() const;
|
|---|
| 245 | QTransform combinedTransform() const;
|
|---|
| 246 |
|
|---|
| 247 | void setMatrixEnabled(bool enabled);
|
|---|
| 248 | bool matrixEnabled() const;
|
|---|
| 249 |
|
|---|
| 250 | void setWorldMatrixEnabled(bool enabled);
|
|---|
| 251 | bool worldMatrixEnabled() const;
|
|---|
| 252 |
|
|---|
| 253 | void scale(qreal sx, qreal sy);
|
|---|
| 254 | void shear(qreal sh, qreal sv);
|
|---|
| 255 | void rotate(qreal a);
|
|---|
| 256 |
|
|---|
| 257 | void translate(const QPointF &offset);
|
|---|
| 258 | inline void translate(const QPoint &offset);
|
|---|
| 259 | inline void translate(qreal dx, qreal dy);
|
|---|
| 260 |
|
|---|
| 261 | QRect window() const;
|
|---|
| 262 | void setWindow(const QRect &window);
|
|---|
| 263 | inline void setWindow(int x, int y, int w, int h);
|
|---|
| 264 |
|
|---|
| 265 | QRect viewport() const;
|
|---|
| 266 | void setViewport(const QRect &viewport);
|
|---|
| 267 | inline void setViewport(int x, int y, int w, int h);
|
|---|
| 268 |
|
|---|
| 269 | void setViewTransformEnabled(bool enable);
|
|---|
| 270 | bool viewTransformEnabled() const;
|
|---|
| 271 |
|
|---|
| 272 | // drawing functions
|
|---|
| 273 | void strokePath(const QPainterPath &path, const QPen &pen);
|
|---|
| 274 | void fillPath(const QPainterPath &path, const QBrush &brush);
|
|---|
| 275 | void drawPath(const QPainterPath &path);
|
|---|
| 276 |
|
|---|
| 277 | inline void drawPoint(const QPointF &pt);
|
|---|
| 278 | inline void drawPoint(const QPoint &p);
|
|---|
| 279 | inline void drawPoint(int x, int y);
|
|---|
| 280 |
|
|---|
| 281 | void drawPoints(const QPointF *points, int pointCount);
|
|---|
| 282 | inline void drawPoints(const QPolygonF &points);
|
|---|
| 283 | void drawPoints(const QPoint *points, int pointCount);
|
|---|
| 284 | inline void drawPoints(const QPolygon &points);
|
|---|
| 285 |
|
|---|
| 286 | inline void drawLine(const QLineF &line);
|
|---|
| 287 | inline void drawLine(const QLine &line);
|
|---|
| 288 | inline void drawLine(int x1, int y1, int x2, int y2);
|
|---|
| 289 | inline void drawLine(const QPoint &p1, const QPoint &p2);
|
|---|
| 290 | inline void drawLine(const QPointF &p1, const QPointF &p2);
|
|---|
| 291 |
|
|---|
| 292 | void drawLines(const QLineF *lines, int lineCount);
|
|---|
| 293 | inline void drawLines(const QVector<QLineF> &lines);
|
|---|
| 294 | void drawLines(const QPointF *pointPairs, int lineCount);
|
|---|
| 295 | inline void drawLines(const QVector<QPointF> &pointPairs);
|
|---|
| 296 | void drawLines(const QLine *lines, int lineCount);
|
|---|
| 297 | inline void drawLines(const QVector<QLine> &lines);
|
|---|
| 298 | void drawLines(const QPoint *pointPairs, int lineCount);
|
|---|
| 299 | inline void drawLines(const QVector<QPoint> &pointPairs);
|
|---|
| 300 |
|
|---|
| 301 | inline void drawRect(const QRectF &rect);
|
|---|
| 302 | inline void drawRect(int x1, int y1, int w, int h);
|
|---|
| 303 | inline void drawRect(const QRect &rect);
|
|---|
| 304 |
|
|---|
| 305 | void drawRects(const QRectF *rects, int rectCount);
|
|---|
| 306 | inline void drawRects(const QVector<QRectF> &rectangles);
|
|---|
| 307 | void drawRects(const QRect *rects, int rectCount);
|
|---|
| 308 | inline void drawRects(const QVector<QRect> &rectangles);
|
|---|
| 309 |
|
|---|
| 310 | void drawEllipse(const QRectF &r);
|
|---|
| 311 | void drawEllipse(const QRect &r);
|
|---|
| 312 | inline void drawEllipse(int x, int y, int w, int h);
|
|---|
| 313 |
|
|---|
| 314 | inline void drawEllipse(const QPointF ¢er, qreal rx, qreal ry);
|
|---|
| 315 | inline void drawEllipse(const QPoint ¢er, int rx, int ry);
|
|---|
| 316 |
|
|---|
| 317 | void drawPolyline(const QPointF *points, int pointCount);
|
|---|
| 318 | inline void drawPolyline(const QPolygonF &polyline);
|
|---|
| 319 | void drawPolyline(const QPoint *points, int pointCount);
|
|---|
| 320 | inline void drawPolyline(const QPolygon &polygon);
|
|---|
| 321 |
|
|---|
| 322 | void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
|
|---|
| 323 | inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
|
|---|
| 324 | void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
|
|---|
| 325 | inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
|
|---|
| 326 |
|
|---|
| 327 | void drawConvexPolygon(const QPointF *points, int pointCount);
|
|---|
| 328 | inline void drawConvexPolygon(const QPolygonF &polygon);
|
|---|
| 329 | void drawConvexPolygon(const QPoint *points, int pointCount);
|
|---|
| 330 | inline void drawConvexPolygon(const QPolygon &polygon);
|
|---|
| 331 |
|
|---|
| 332 | void drawArc(const QRectF &rect, int a, int alen);
|
|---|
| 333 | inline void drawArc(const QRect &, int a, int alen);
|
|---|
| 334 | inline void drawArc(int x, int y, int w, int h, int a, int alen);
|
|---|
| 335 |
|
|---|
| 336 | void drawPie(const QRectF &rect, int a, int alen);
|
|---|
| 337 | inline void drawPie(int x, int y, int w, int h, int a, int alen);
|
|---|
| 338 | inline void drawPie(const QRect &, int a, int alen);
|
|---|
| 339 |
|
|---|
| 340 | void drawChord(const QRectF &rect, int a, int alen);
|
|---|
| 341 | inline void drawChord(int x, int y, int w, int h, int a, int alen);
|
|---|
| 342 | inline void drawChord(const QRect &, int a, int alen);
|
|---|
| 343 |
|
|---|
| 344 | void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
|
|---|
| 345 | Qt::SizeMode mode = Qt::AbsoluteSize);
|
|---|
| 346 | inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
|
|---|
| 347 | Qt::SizeMode mode = Qt::AbsoluteSize);
|
|---|
| 348 | inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
|
|---|
| 349 | Qt::SizeMode mode = Qt::AbsoluteSize);
|
|---|
| 350 |
|
|---|
| 351 | void drawRoundRect(const QRectF &r, int xround = 25, int yround = 25);
|
|---|
| 352 | inline void drawRoundRect(int x, int y, int w, int h, int = 25, int = 25);
|
|---|
| 353 | inline void drawRoundRect(const QRect &r, int xround = 25, int yround = 25);
|
|---|
| 354 |
|
|---|
| 355 | void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
|
|---|
| 356 | inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
|
|---|
| 357 | inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
|
|---|
| 358 | #ifndef QT_NO_PICTURE
|
|---|
| 359 | void drawPicture(const QPointF &p, const QPicture &picture);
|
|---|
| 360 | inline void drawPicture(int x, int y, const QPicture &picture);
|
|---|
| 361 | inline void drawPicture(const QPoint &p, const QPicture &picture);
|
|---|
| 362 | #endif
|
|---|
| 363 |
|
|---|
| 364 | void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
|
|---|
| 365 | inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
|
|---|
| 366 | inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
|
|---|
| 367 | int sx, int sy, int sw, int sh);
|
|---|
| 368 | inline void drawPixmap(int x, int y, const QPixmap &pm,
|
|---|
| 369 | int sx, int sy, int sw, int sh);
|
|---|
| 370 | inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
|
|---|
| 371 | inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
|
|---|
| 372 | void drawPixmap(const QPointF &p, const QPixmap &pm);
|
|---|
| 373 | inline void drawPixmap(const QPoint &p, const QPixmap &pm);
|
|---|
| 374 | inline void drawPixmap(int x, int y, const QPixmap &pm);
|
|---|
| 375 | inline void drawPixmap(const QRect &r, const QPixmap &pm);
|
|---|
| 376 | inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
|
|---|
| 377 |
|
|---|
| 378 | void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount,
|
|---|
| 379 | const QPixmap &pixmap, PixmapFragmentHints hints = 0);
|
|---|
| 380 |
|
|---|
| 381 | void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect,
|
|---|
| 382 | Qt::ImageConversionFlags flags = Qt::AutoColor);
|
|---|
| 383 | inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
|
|---|
| 384 | Qt::ImageConversionFlags flags = Qt::AutoColor);
|
|---|
| 385 | inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
|
|---|
| 386 | Qt::ImageConversionFlags flags = Qt::AutoColor);
|
|---|
| 387 | inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr,
|
|---|
| 388 | Qt::ImageConversionFlags flags = Qt::AutoColor);
|
|---|
| 389 | inline void drawImage(const QRectF &r, const QImage &image);
|
|---|
| 390 | inline void drawImage(const QRect &r, const QImage &image);
|
|---|
| 391 | void drawImage(const QPointF &p, const QImage &image);
|
|---|
| 392 | inline void drawImage(const QPoint &p, const QImage &image);
|
|---|
| 393 | inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0,
|
|---|
| 394 | int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor);
|
|---|
| 395 |
|
|---|
| 396 | void setLayoutDirection(Qt::LayoutDirection direction);
|
|---|
| 397 | Qt::LayoutDirection layoutDirection() const;
|
|---|
| 398 |
|
|---|
| 399 | void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText);
|
|---|
| 400 | inline void drawStaticText(const QPoint &topLeftPosition, const QStaticText &staticText);
|
|---|
| 401 | inline void drawStaticText(int left, int top, const QStaticText &staticText);
|
|---|
| 402 |
|
|---|
| 403 | void drawText(const QPointF &p, const QString &s);
|
|---|
| 404 | inline void drawText(const QPoint &p, const QString &s);
|
|---|
| 405 | inline void drawText(int x, int y, const QString &s);
|
|---|
| 406 |
|
|---|
| 407 | void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding);
|
|---|
| 408 |
|
|---|
| 409 | void drawText(const QRectF &r, int flags, const QString &text, QRectF *br=0);
|
|---|
| 410 | void drawText(const QRect &r, int flags, const QString &text, QRect *br=0);
|
|---|
| 411 | inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br=0);
|
|---|
| 412 |
|
|---|
| 413 | void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption());
|
|---|
| 414 |
|
|---|
| 415 | QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
|
|---|
| 416 | QRect boundingRect(const QRect &rect, int flags, const QString &text);
|
|---|
| 417 | inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
|
|---|
| 418 |
|
|---|
| 419 | QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption());
|
|---|
| 420 |
|
|---|
| 421 | void drawTextItem(const QPointF &p, const QTextItem &ti);
|
|---|
| 422 | inline void drawTextItem(int x, int y, const QTextItem &ti);
|
|---|
| 423 | inline void drawTextItem(const QPoint &p, const QTextItem &ti);
|
|---|
| 424 |
|
|---|
| 425 | void fillRect(const QRectF &, const QBrush &);
|
|---|
| 426 | inline void fillRect(int x, int y, int w, int h, const QBrush &);
|
|---|
| 427 | void fillRect(const QRect &, const QBrush &);
|
|---|
| 428 |
|
|---|
| 429 | void fillRect(const QRectF &, const QColor &color);
|
|---|
| 430 | inline void fillRect(int x, int y, int w, int h, const QColor &color);
|
|---|
| 431 | void fillRect(const QRect &, const QColor &color);
|
|---|
| 432 |
|
|---|
| 433 | inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
|
|---|
| 434 | inline void fillRect(const QRect &r, Qt::GlobalColor c);
|
|---|
| 435 | inline void fillRect(const QRectF &r, Qt::GlobalColor c);
|
|---|
| 436 |
|
|---|
| 437 | inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
|
|---|
| 438 | inline void fillRect(const QRect &r, Qt::BrushStyle style);
|
|---|
| 439 | inline void fillRect(const QRectF &r, Qt::BrushStyle style);
|
|---|
| 440 |
|
|---|
| 441 | void eraseRect(const QRectF &);
|
|---|
| 442 | inline void eraseRect(int x, int y, int w, int h);
|
|---|
| 443 | inline void eraseRect(const QRect &);
|
|---|
| 444 |
|
|---|
| 445 | void setRenderHint(RenderHint hint, bool on = true);
|
|---|
| 446 | void setRenderHints(RenderHints hints, bool on = true);
|
|---|
| 447 | RenderHints renderHints() const;
|
|---|
| 448 | inline bool testRenderHint(RenderHint hint) const { return renderHints() & hint; }
|
|---|
| 449 |
|
|---|
| 450 | QPaintEngine *paintEngine() const;
|
|---|
| 451 |
|
|---|
| 452 | static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
|
|---|
| 453 | const QPoint& offset = QPoint());
|
|---|
| 454 | static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0);
|
|---|
| 455 | static void restoreRedirected(const QPaintDevice *device);
|
|---|
| 456 |
|
|---|
| 457 | void beginNativePainting();
|
|---|
| 458 | void endNativePainting();
|
|---|
| 459 |
|
|---|
| 460 | #ifdef QT3_SUPPORT
|
|---|
| 461 |
|
|---|
| 462 | inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); }
|
|---|
| 463 | inline QT3_SUPPORT const QColor &backgroundColor() const { return background().color(); }
|
|---|
| 464 |
|
|---|
| 465 | inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int pos, int len)
|
|---|
| 466 | { drawText(x, y, s.mid(pos, len)); }
|
|---|
| 467 | inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int pos, int len)
|
|---|
| 468 | { drawText(p, s.mid(pos, len)); }
|
|---|
| 469 | inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int len)
|
|---|
| 470 | { drawText(x, y, s.left(len)); }
|
|---|
| 471 | inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int len)
|
|---|
| 472 | { drawText(p, s.left(len)); }
|
|---|
| 473 | inline QT3_SUPPORT void drawText(const QRect &r, int flags, const QString &str, int len, QRect *br=0)
|
|---|
| 474 | { drawText(r, flags, str.left(len), br); }
|
|---|
| 475 | inline QT3_SUPPORT void drawText(int x, int y, int w, int h, int flags, const QString &text, int len, QRect *br=0)
|
|---|
| 476 | { drawText(QRect(x, y, w, h), flags, text.left(len), br); }
|
|---|
| 477 | inline QT3_SUPPORT QRect boundingRect(const QRect &rect, int flags, const QString &text, int len)
|
|---|
| 478 | { return boundingRect(rect, flags, text.left(len)); }
|
|---|
| 479 | inline QT3_SUPPORT QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, int len)
|
|---|
| 480 | { return boundingRect(QRect(x, y, w, h), flags, text.left(len)); }
|
|---|
| 481 |
|
|---|
| 482 | inline QT3_SUPPORT bool begin(QPaintDevice *pdev, const QWidget *init)
|
|---|
| 483 | { bool ret = begin(pdev); initFrom(init); return ret; }
|
|---|
| 484 | QT3_SUPPORT void drawPoints(const QPolygon &pa, int index, int npoints = -1)
|
|---|
| 485 | { drawPoints(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
|
|---|
| 486 |
|
|---|
| 487 | QT3_SUPPORT void drawCubicBezier(const QPolygon &pa, int index = 0);
|
|---|
| 488 |
|
|---|
| 489 | QT3_SUPPORT void drawLineSegments(const QPolygon &points, int index = 0, int nlines = -1);
|
|---|
| 490 |
|
|---|
| 491 | inline QT3_SUPPORT void drawPolyline(const QPolygon &pa, int index, int npoints = -1)
|
|---|
| 492 | { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
|
|---|
| 493 |
|
|---|
| 494 | inline QT3_SUPPORT void drawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1)
|
|---|
| 495 | { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints,
|
|---|
| 496 | winding ? Qt::WindingFill : Qt::OddEvenFill); }
|
|---|
| 497 |
|
|---|
| 498 | inline QT3_SUPPORT void drawPolygon(const QPolygonF &polygon, bool winding, int index = 0,
|
|---|
| 499 | int npoints = -1)
|
|---|
| 500 | { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints,
|
|---|
| 501 | winding ? Qt::WindingFill : Qt::OddEvenFill); }
|
|---|
| 502 |
|
|---|
| 503 | inline QT3_SUPPORT void drawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1)
|
|---|
| 504 | { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); }
|
|---|
| 505 | inline QT3_SUPPORT void drawConvexPolygon(const QPolygon &pa, int index, int npoints = -1)
|
|---|
| 506 | { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
|
|---|
| 507 |
|
|---|
| 508 | static inline QT3_SUPPORT void redirect(QPaintDevice *pdev, QPaintDevice *replacement)
|
|---|
| 509 | { setRedirected(pdev, replacement); }
|
|---|
| 510 | static inline QT3_SUPPORT QPaintDevice *redirect(QPaintDevice *pdev)
|
|---|
| 511 | { return const_cast<QPaintDevice*>(redirected(pdev)); }
|
|---|
| 512 |
|
|---|
| 513 | inline QT3_SUPPORT void setWorldXForm(bool enabled) { setMatrixEnabled(enabled); }
|
|---|
| 514 | inline QT3_SUPPORT bool hasWorldXForm() const { return matrixEnabled(); }
|
|---|
| 515 | inline QT3_SUPPORT void resetXForm() { resetTransform(); }
|
|---|
| 516 |
|
|---|
| 517 | inline QT3_SUPPORT void setViewXForm(bool enabled) { setViewTransformEnabled(enabled); }
|
|---|
| 518 | inline QT3_SUPPORT bool hasViewXForm() const { return viewTransformEnabled(); }
|
|---|
| 519 |
|
|---|
| 520 | QT3_SUPPORT void map(int x, int y, int *rx, int *ry) const;
|
|---|
| 521 | QT3_SUPPORT QPoint xForm(const QPoint &) const; // map virtual -> deviceb
|
|---|
| 522 | QT3_SUPPORT QRect xForm(const QRect &) const;
|
|---|
| 523 | QT3_SUPPORT QPolygon xForm(const QPolygon &) const;
|
|---|
| 524 | QT3_SUPPORT QPolygon xForm(const QPolygon &, int index, int npoints) const;
|
|---|
| 525 | QT3_SUPPORT QPoint xFormDev(const QPoint &) const; // map device -> virtual
|
|---|
| 526 | QT3_SUPPORT QRect xFormDev(const QRect &) const;
|
|---|
| 527 | QT3_SUPPORT QPolygon xFormDev(const QPolygon &) const;
|
|---|
| 528 | QT3_SUPPORT QPolygon xFormDev(const QPolygon &, int index, int npoints) const;
|
|---|
| 529 | QT3_SUPPORT qreal translationX() const;
|
|---|
| 530 | QT3_SUPPORT qreal translationY() const;
|
|---|
| 531 | #endif
|
|---|
| 532 |
|
|---|
| 533 | private:
|
|---|
| 534 | Q_DISABLE_COPY(QPainter)
|
|---|
| 535 | friend class Q3Painter;
|
|---|
| 536 |
|
|---|
| 537 | QScopedPointer<QPainterPrivate> d_ptr;
|
|---|
| 538 |
|
|---|
| 539 | friend class QFontEngine;
|
|---|
| 540 | friend class QFontEngineBox;
|
|---|
| 541 | friend class QFontEngineFT;
|
|---|
| 542 | friend class QFontEngineMac;
|
|---|
| 543 | friend class QFontEngineWin;
|
|---|
| 544 | friend class QFontEngineXLFD;
|
|---|
| 545 | friend class QWSManager;
|
|---|
| 546 | friend class QPaintEngine;
|
|---|
| 547 | friend class QPaintEngineExPrivate;
|
|---|
| 548 | friend class QOpenGLPaintEngine;
|
|---|
| 549 | friend class QX11PaintEngine;
|
|---|
| 550 | friend class QX11PaintEnginePrivate;
|
|---|
| 551 | friend class QWin32PaintEngine;
|
|---|
| 552 | friend class QWin32PaintEnginePrivate;
|
|---|
| 553 | friend class QRasterPaintEngine;
|
|---|
| 554 | friend class QAlphaPaintEngine;
|
|---|
| 555 | friend class QPreviewPaintEngine;
|
|---|
| 556 | };
|
|---|
| 557 |
|
|---|
| 558 | Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
|
|---|
| 559 |
|
|---|
| 560 | //
|
|---|
| 561 | // functions
|
|---|
| 562 | //
|
|---|
| 563 | inline void QPainter::drawLine(const QLineF &l)
|
|---|
| 564 | {
|
|---|
| 565 | drawLines(&l, 1);
|
|---|
| 566 | }
|
|---|
| 567 |
|
|---|
| 568 | inline void QPainter::drawLine(const QLine &line)
|
|---|
| 569 | {
|
|---|
| 570 | drawLines(&line, 1);
|
|---|
| 571 | }
|
|---|
| 572 |
|
|---|
| 573 | inline void QPainter::drawLine(int x1, int y1, int x2, int y2)
|
|---|
| 574 | {
|
|---|
| 575 | QLine l(x1, y1, x2, y2);
|
|---|
| 576 | drawLines(&l, 1);
|
|---|
| 577 | }
|
|---|
| 578 |
|
|---|
| 579 | inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
|
|---|
| 580 | {
|
|---|
| 581 | QLine l(p1, p2);
|
|---|
| 582 | drawLines(&l, 1);
|
|---|
| 583 | }
|
|---|
| 584 |
|
|---|
| 585 | inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
|
|---|
| 586 | {
|
|---|
| 587 | drawLine(QLineF(p1, p2));
|
|---|
| 588 | }
|
|---|
| 589 |
|
|---|
| 590 | inline void QPainter::drawLines(const QVector<QLineF> &lines)
|
|---|
| 591 | {
|
|---|
| 592 | drawLines(lines.constData(), lines.size());
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 | inline void QPainter::drawLines(const QVector<QLine> &lines)
|
|---|
| 596 | {
|
|---|
| 597 | drawLines(lines.constData(), lines.size());
|
|---|
| 598 | }
|
|---|
| 599 |
|
|---|
| 600 | inline void QPainter::drawLines(const QVector<QPointF> &pointPairs)
|
|---|
| 601 | {
|
|---|
| 602 | drawLines(pointPairs.constData(), pointPairs.size() / 2);
|
|---|
| 603 | }
|
|---|
| 604 |
|
|---|
| 605 | inline void QPainter::drawLines(const QVector<QPoint> &pointPairs)
|
|---|
| 606 | {
|
|---|
| 607 | drawLines(pointPairs.constData(), pointPairs.size() / 2);
|
|---|
| 608 | }
|
|---|
| 609 |
|
|---|
| 610 | inline void QPainter::drawPolyline(const QPolygonF &polyline)
|
|---|
| 611 | {
|
|---|
| 612 | drawPolyline(polyline.constData(), polyline.size());
|
|---|
| 613 | }
|
|---|
| 614 |
|
|---|
| 615 | inline void QPainter::drawPolyline(const QPolygon &polyline)
|
|---|
| 616 | {
|
|---|
| 617 | drawPolyline(polyline.constData(), polyline.size());
|
|---|
| 618 | }
|
|---|
| 619 |
|
|---|
| 620 | inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
|
|---|
| 621 | {
|
|---|
| 622 | drawPolygon(polygon.constData(), polygon.size(), fillRule);
|
|---|
| 623 | }
|
|---|
| 624 |
|
|---|
| 625 | inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
|
|---|
| 626 | {
|
|---|
| 627 | drawPolygon(polygon.constData(), polygon.size(), fillRule);
|
|---|
| 628 | }
|
|---|
| 629 |
|
|---|
| 630 | inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
|
|---|
| 631 | {
|
|---|
| 632 | drawConvexPolygon(poly.constData(), poly.size());
|
|---|
| 633 | }
|
|---|
| 634 |
|
|---|
| 635 | inline void QPainter::drawConvexPolygon(const QPolygon &poly)
|
|---|
| 636 | {
|
|---|
| 637 | drawConvexPolygon(poly.constData(), poly.size());
|
|---|
| 638 | }
|
|---|
| 639 |
|
|---|
| 640 | inline void QPainter::drawRect(const QRectF &rect)
|
|---|
| 641 | {
|
|---|
| 642 | drawRects(&rect, 1);
|
|---|
| 643 | }
|
|---|
| 644 |
|
|---|
| 645 | inline void QPainter::drawRect(int x, int y, int w, int h)
|
|---|
| 646 | {
|
|---|
| 647 | QRect r(x, y, w, h);
|
|---|
| 648 | drawRects(&r, 1);
|
|---|
| 649 | }
|
|---|
| 650 |
|
|---|
| 651 | inline void QPainter::drawRect(const QRect &r)
|
|---|
| 652 | {
|
|---|
| 653 | drawRects(&r, 1);
|
|---|
| 654 | }
|
|---|
| 655 |
|
|---|
| 656 | inline void QPainter::drawRects(const QVector<QRectF> &rects)
|
|---|
| 657 | {
|
|---|
| 658 | drawRects(rects.constData(), rects.size());
|
|---|
| 659 | }
|
|---|
| 660 |
|
|---|
| 661 | inline void QPainter::drawRects(const QVector<QRect> &rects)
|
|---|
| 662 | {
|
|---|
| 663 | drawRects(rects.constData(), rects.size());
|
|---|
| 664 | }
|
|---|
| 665 |
|
|---|
| 666 | inline void QPainter::drawPoint(const QPointF &p)
|
|---|
| 667 | {
|
|---|
| 668 | drawPoints(&p, 1);
|
|---|
| 669 | }
|
|---|
| 670 |
|
|---|
| 671 | inline void QPainter::drawPoint(int x, int y)
|
|---|
| 672 | {
|
|---|
| 673 | QPoint p(x, y);
|
|---|
| 674 | drawPoints(&p, 1);
|
|---|
| 675 | }
|
|---|
| 676 |
|
|---|
| 677 | inline void QPainter::drawPoint(const QPoint &p)
|
|---|
| 678 | {
|
|---|
| 679 | drawPoints(&p, 1);
|
|---|
| 680 | }
|
|---|
| 681 |
|
|---|
| 682 | inline void QPainter::drawPoints(const QPolygonF &points)
|
|---|
| 683 | {
|
|---|
| 684 | drawPoints(points.constData(), points.size());
|
|---|
| 685 | }
|
|---|
| 686 |
|
|---|
| 687 | inline void QPainter::drawPoints(const QPolygon &points)
|
|---|
| 688 | {
|
|---|
| 689 | drawPoints(points.constData(), points.size());
|
|---|
| 690 | }
|
|---|
| 691 |
|
|---|
| 692 | inline void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
|
|---|
| 693 | {
|
|---|
| 694 | drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
|
|---|
| 695 | }
|
|---|
| 696 |
|
|---|
| 697 | inline void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
|
|---|
| 698 | {
|
|---|
| 699 | drawRoundRect(QRectF(rect), xRnd, yRnd);
|
|---|
| 700 | }
|
|---|
| 701 |
|
|---|
| 702 | inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
|
|---|
| 703 | Qt::SizeMode mode)
|
|---|
| 704 | {
|
|---|
| 705 | drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
|
|---|
| 706 | }
|
|---|
| 707 |
|
|---|
| 708 | inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
|
|---|
| 709 | Qt::SizeMode mode)
|
|---|
| 710 | {
|
|---|
| 711 | drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
|
|---|
| 712 | }
|
|---|
| 713 |
|
|---|
| 714 | inline void QPainter::drawEllipse(int x, int y, int w, int h)
|
|---|
| 715 | {
|
|---|
| 716 | drawEllipse(QRect(x, y, w, h));
|
|---|
| 717 | }
|
|---|
| 718 |
|
|---|
| 719 | inline void QPainter::drawEllipse(const QPointF ¢er, qreal rx, qreal ry)
|
|---|
| 720 | {
|
|---|
| 721 | drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
|
|---|
| 722 | }
|
|---|
| 723 |
|
|---|
| 724 | inline void QPainter::drawEllipse(const QPoint ¢er, int rx, int ry)
|
|---|
| 725 | {
|
|---|
| 726 | drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
|
|---|
| 727 | }
|
|---|
| 728 |
|
|---|
| 729 | inline void QPainter::drawArc(const QRect &r, int a, int alen)
|
|---|
| 730 | {
|
|---|
| 731 | drawArc(QRectF(r), a, alen);
|
|---|
| 732 | }
|
|---|
| 733 |
|
|---|
| 734 | inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen)
|
|---|
| 735 | {
|
|---|
| 736 | drawArc(QRectF(x, y, w, h), a, alen);
|
|---|
| 737 | }
|
|---|
| 738 |
|
|---|
| 739 | inline void QPainter::drawPie(const QRect &rect, int a, int alen)
|
|---|
| 740 | {
|
|---|
| 741 | drawPie(QRectF(rect), a, alen);
|
|---|
| 742 | }
|
|---|
| 743 |
|
|---|
| 744 | inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen)
|
|---|
| 745 | {
|
|---|
| 746 | drawPie(QRectF(x, y, w, h), a, alen);
|
|---|
| 747 | }
|
|---|
| 748 |
|
|---|
| 749 | inline void QPainter::drawChord(const QRect &rect, int a, int alen)
|
|---|
| 750 | {
|
|---|
| 751 | drawChord(QRectF(rect), a, alen);
|
|---|
| 752 | }
|
|---|
| 753 |
|
|---|
| 754 | inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen)
|
|---|
| 755 | {
|
|---|
| 756 | drawChord(QRectF(x, y, w, h), a, alen);
|
|---|
| 757 | }
|
|---|
| 758 |
|
|---|
| 759 | inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op)
|
|---|
| 760 | {
|
|---|
| 761 | setClipRect(QRect(x, y, w, h), op);
|
|---|
| 762 | }
|
|---|
| 763 |
|
|---|
| 764 | inline void QPainter::eraseRect(const QRect &rect)
|
|---|
| 765 | {
|
|---|
| 766 | eraseRect(QRectF(rect));
|
|---|
| 767 | }
|
|---|
| 768 |
|
|---|
| 769 | inline void QPainter::eraseRect(int x, int y, int w, int h)
|
|---|
| 770 | {
|
|---|
| 771 | eraseRect(QRectF(x, y, w, h));
|
|---|
| 772 | }
|
|---|
| 773 |
|
|---|
| 774 | inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b)
|
|---|
| 775 | {
|
|---|
| 776 | fillRect(QRect(x, y, w, h), b);
|
|---|
| 777 | }
|
|---|
| 778 |
|
|---|
| 779 | inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b)
|
|---|
| 780 | {
|
|---|
| 781 | fillRect(QRect(x, y, w, h), b);
|
|---|
| 782 | }
|
|---|
| 783 |
|
|---|
| 784 | inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c)
|
|---|
| 785 | {
|
|---|
| 786 | fillRect(QRect(x, y, w, h), QColor(c));
|
|---|
| 787 | }
|
|---|
| 788 |
|
|---|
| 789 | inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
|
|---|
| 790 | {
|
|---|
| 791 | fillRect(r, QColor(c));
|
|---|
| 792 | }
|
|---|
| 793 |
|
|---|
| 794 | inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
|
|---|
| 795 | {
|
|---|
| 796 | fillRect(r, QColor(c));
|
|---|
| 797 | }
|
|---|
| 798 |
|
|---|
| 799 | inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style)
|
|---|
| 800 | {
|
|---|
| 801 | fillRect(QRectF(x, y, w, h), QBrush(style));
|
|---|
| 802 | }
|
|---|
| 803 |
|
|---|
| 804 | inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
|
|---|
| 805 | {
|
|---|
| 806 | fillRect(QRectF(r), QBrush(style));
|
|---|
| 807 | }
|
|---|
| 808 |
|
|---|
| 809 | inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
|
|---|
| 810 | {
|
|---|
| 811 | fillRect(r, QBrush(style));
|
|---|
| 812 | }
|
|---|
| 813 |
|
|---|
| 814 |
|
|---|
| 815 | inline void QPainter::setBrushOrigin(int x, int y)
|
|---|
| 816 | {
|
|---|
| 817 | setBrushOrigin(QPoint(x, y));
|
|---|
| 818 | }
|
|---|
| 819 |
|
|---|
| 820 | inline void QPainter::setBrushOrigin(const QPoint &p)
|
|---|
| 821 | {
|
|---|
| 822 | setBrushOrigin(QPointF(p));
|
|---|
| 823 | }
|
|---|
| 824 |
|
|---|
| 825 | inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
|
|---|
| 826 | {
|
|---|
| 827 | drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
|
|---|
| 828 | }
|
|---|
| 829 |
|
|---|
| 830 | inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy)
|
|---|
| 831 | {
|
|---|
| 832 | drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy));
|
|---|
| 833 | }
|
|---|
| 834 |
|
|---|
| 835 | inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
|
|---|
| 836 | {
|
|---|
| 837 | drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
|
|---|
| 838 | }
|
|---|
| 839 |
|
|---|
| 840 | inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
|
|---|
| 841 | {
|
|---|
| 842 | drawPixmap(QPointF(p), pm);
|
|---|
| 843 | }
|
|---|
| 844 |
|
|---|
| 845 | inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
|
|---|
| 846 | {
|
|---|
| 847 | drawPixmap(QRectF(r), pm, QRectF());
|
|---|
| 848 | }
|
|---|
| 849 |
|
|---|
| 850 | inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
|
|---|
| 851 | {
|
|---|
| 852 | drawPixmap(QPointF(x, y), pm);
|
|---|
| 853 | }
|
|---|
| 854 |
|
|---|
| 855 | inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm)
|
|---|
| 856 | {
|
|---|
| 857 | drawPixmap(QRectF(x, y, w, h), pm, QRectF());
|
|---|
| 858 | }
|
|---|
| 859 |
|
|---|
| 860 | inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
|
|---|
| 861 | int sx, int sy, int sw, int sh)
|
|---|
| 862 | {
|
|---|
| 863 | drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh));
|
|---|
| 864 | }
|
|---|
| 865 |
|
|---|
| 866 | inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
|
|---|
| 867 | int sx, int sy, int sw, int sh)
|
|---|
| 868 | {
|
|---|
| 869 | drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh));
|
|---|
| 870 | }
|
|---|
| 871 |
|
|---|
| 872 | inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr)
|
|---|
| 873 | {
|
|---|
| 874 | drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
|
|---|
| 875 | }
|
|---|
| 876 |
|
|---|
| 877 | inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr)
|
|---|
| 878 | {
|
|---|
| 879 | drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
|
|---|
| 880 | }
|
|---|
| 881 |
|
|---|
| 882 | inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
|
|---|
| 883 | {
|
|---|
| 884 | drawTextItem(QPointF(x, y), ti);
|
|---|
| 885 | }
|
|---|
| 886 |
|
|---|
| 887 | inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
|
|---|
| 888 | Qt::ImageConversionFlags flags)
|
|---|
| 889 | {
|
|---|
| 890 | drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags);
|
|---|
| 891 | }
|
|---|
| 892 |
|
|---|
| 893 | inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
|
|---|
| 894 | Qt::ImageConversionFlags flags)
|
|---|
| 895 | {
|
|---|
| 896 | drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags);
|
|---|
| 897 | }
|
|---|
| 898 |
|
|---|
| 899 | inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr,
|
|---|
| 900 | Qt::ImageConversionFlags flags)
|
|---|
| 901 | {
|
|---|
| 902 | drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags);
|
|---|
| 903 | }
|
|---|
| 904 |
|
|---|
| 905 |
|
|---|
| 906 | inline void QPainter::drawImage(const QRectF &r, const QImage &image)
|
|---|
| 907 | {
|
|---|
| 908 | drawImage(r, image, QRect(0, 0, image.width(), image.height()));
|
|---|
| 909 | }
|
|---|
| 910 |
|
|---|
| 911 | inline void QPainter::drawImage(const QRect &r, const QImage &image)
|
|---|
| 912 | {
|
|---|
| 913 | drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
|
|---|
| 914 | }
|
|---|
| 915 |
|
|---|
| 916 | inline void QPainter::drawImage(const QPoint &p, const QImage &image)
|
|---|
| 917 | {
|
|---|
| 918 | drawImage(QPointF(p), image);
|
|---|
| 919 | }
|
|---|
| 920 |
|
|---|
| 921 | inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh,
|
|---|
| 922 | Qt::ImageConversionFlags flags)
|
|---|
| 923 | {
|
|---|
| 924 | if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor)
|
|---|
| 925 | drawImage(QPointF(x, y), image);
|
|---|
| 926 | else
|
|---|
| 927 | drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags);
|
|---|
| 928 | }
|
|---|
| 929 |
|
|---|
| 930 | inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText)
|
|---|
| 931 | {
|
|---|
| 932 | drawStaticText(QPointF(p), staticText);
|
|---|
| 933 | }
|
|---|
| 934 |
|
|---|
| 935 | inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText)
|
|---|
| 936 | {
|
|---|
| 937 | drawStaticText(QPointF(x, y), staticText);
|
|---|
| 938 | }
|
|---|
| 939 |
|
|---|
| 940 | inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
|
|---|
| 941 | {
|
|---|
| 942 | drawTextItem(QPointF(p), ti);
|
|---|
| 943 | }
|
|---|
| 944 |
|
|---|
| 945 | inline void QPainter::drawText(const QPoint &p, const QString &s)
|
|---|
| 946 | {
|
|---|
| 947 | drawText(QPointF(p), s);
|
|---|
| 948 | }
|
|---|
| 949 |
|
|---|
| 950 | inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br)
|
|---|
| 951 | {
|
|---|
| 952 | drawText(QRect(x, y, w, h), flags, str, br);
|
|---|
| 953 | }
|
|---|
| 954 |
|
|---|
| 955 | inline void QPainter::drawText(int x, int y, const QString &s)
|
|---|
| 956 | {
|
|---|
| 957 | drawText(QPointF(x, y), s);
|
|---|
| 958 | }
|
|---|
| 959 |
|
|---|
| 960 | inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text)
|
|---|
| 961 | {
|
|---|
| 962 | return boundingRect(QRect(x, y, w, h), flags, text);
|
|---|
| 963 | }
|
|---|
| 964 |
|
|---|
| 965 | inline void QPainter::translate(qreal dx, qreal dy)
|
|---|
| 966 | {
|
|---|
| 967 | translate(QPointF(dx, dy));
|
|---|
| 968 | }
|
|---|
| 969 |
|
|---|
| 970 | inline void QPainter::translate(const QPoint &offset)
|
|---|
| 971 | {
|
|---|
| 972 | translate(offset.x(), offset.y());
|
|---|
| 973 | }
|
|---|
| 974 |
|
|---|
| 975 | inline void QPainter::setViewport(int x, int y, int w, int h)
|
|---|
| 976 | {
|
|---|
| 977 | setViewport(QRect(x, y, w, h));
|
|---|
| 978 | }
|
|---|
| 979 |
|
|---|
| 980 | inline void QPainter::setWindow(int x, int y, int w, int h)
|
|---|
| 981 | {
|
|---|
| 982 | setWindow(QRect(x, y, w, h));
|
|---|
| 983 | }
|
|---|
| 984 |
|
|---|
| 985 | #ifndef QT_NO_PICTURE
|
|---|
| 986 | inline void QPainter::drawPicture(int x, int y, const QPicture &p)
|
|---|
| 987 | {
|
|---|
| 988 | drawPicture(QPoint(x, y), p);
|
|---|
| 989 | }
|
|---|
| 990 |
|
|---|
| 991 | inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
|
|---|
| 992 | {
|
|---|
| 993 | drawPicture(QPointF(pt), p);
|
|---|
| 994 | }
|
|---|
| 995 | #endif
|
|---|
| 996 |
|
|---|
| 997 | QT_END_NAMESPACE
|
|---|
| 998 |
|
|---|
| 999 | QT_END_HEADER
|
|---|
| 1000 |
|
|---|
| 1001 | #endif // QPAINTER_H
|
|---|