1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtGui module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
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>
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>
75 class QPainterPrivate;
84 class QPainterPrivateDeleter;
86 class Q_GUI_EXPORT QPainter
88 Q_DECLARE_PRIVATE(QPainter)
90 Q_FLAGS(RenderHint RenderHints)
95 TextAntialiasing = 0x02,
96 SmoothPixmapTransform = 0x04,
97 HighQualityAntialiasing = 0x08,
98 NonCosmeticDefaultPen = 0x10
101 Q_DECLARE_FLAGS(RenderHints, RenderHint)
103 class PixmapFragment {
115 static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect,
116 qreal scaleX = 1, qreal scaleY = 1,
117 qreal rotation = 0, qreal opacity = 1);
120 enum PixmapFragmentHint {
124 Q_DECLARE_FLAGS(PixmapFragmentHints, PixmapFragmentHint)
127 explicit QPainter(QPaintDevice *);
130 QPaintDevice *device() const;
132 bool begin(QPaintDevice *);
134 bool isActive() const;
136 void initFrom(const QWidget *widget);
138 enum CompositionMode {
139 CompositionMode_SourceOver,
140 CompositionMode_DestinationOver,
141 CompositionMode_Clear,
142 CompositionMode_Source,
143 CompositionMode_Destination,
144 CompositionMode_SourceIn,
145 CompositionMode_DestinationIn,
146 CompositionMode_SourceOut,
147 CompositionMode_DestinationOut,
148 CompositionMode_SourceAtop,
149 CompositionMode_DestinationAtop,
152 //svg 1.2 blend modes
153 CompositionMode_Plus,
154 CompositionMode_Multiply,
155 CompositionMode_Screen,
156 CompositionMode_Overlay,
157 CompositionMode_Darken,
158 CompositionMode_Lighten,
159 CompositionMode_ColorDodge,
160 CompositionMode_ColorBurn,
161 CompositionMode_HardLight,
162 CompositionMode_SoftLight,
163 CompositionMode_Difference,
164 CompositionMode_Exclusion,
167 RasterOp_SourceOrDestination,
168 RasterOp_SourceAndDestination,
169 RasterOp_SourceXorDestination,
170 RasterOp_NotSourceAndNotDestination,
171 RasterOp_NotSourceOrNotDestination,
172 RasterOp_NotSourceXorDestination,
174 RasterOp_NotSourceAndDestination,
175 RasterOp_SourceAndNotDestination
177 void setCompositionMode(CompositionMode mode);
178 CompositionMode compositionMode() const;
180 const QFont &font() const;
181 void setFont(const QFont &f);
183 QFontMetrics fontMetrics() const;
184 QFontInfo fontInfo() const;
186 void setPen(const QColor &color);
187 void setPen(const QPen &pen);
188 void setPen(Qt::PenStyle style);
189 const QPen &pen() const;
191 void setBrush(const QBrush &brush);
192 void setBrush(Qt::BrushStyle style);
193 const QBrush &brush() const;
196 void setBackgroundMode(Qt::BGMode mode);
197 Qt::BGMode backgroundMode() const;
199 QPoint brushOrigin() const;
200 inline void setBrushOrigin(int x, int y);
201 inline void setBrushOrigin(const QPoint &);
202 void setBrushOrigin(const QPointF &);
204 void setBackground(const QBrush &bg);
205 const QBrush &background() const;
207 qreal opacity() const;
208 void setOpacity(qreal opacity);
211 QRegion clipRegion() const;
212 QPainterPath clipPath() const;
214 void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip);
215 void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip);
216 inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip);
218 void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip);
220 void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip);
222 void setClipping(bool enable);
223 bool hasClipping() const;
225 QRectF clipBoundingRect() const;
231 void setMatrix(const QMatrix &matrix, bool combine = false);
232 const QMatrix &matrix() const;
233 const QMatrix &deviceMatrix() const;
236 void setTransform(const QTransform &transform, bool combine = false);
237 const QTransform &transform() const;
238 const QTransform &deviceTransform() const;
239 void resetTransform();
241 void setWorldMatrix(const QMatrix &matrix, bool combine = false);
242 const QMatrix &worldMatrix() const;
244 void setWorldTransform(const QTransform &matrix, bool combine = false);
245 const QTransform &worldTransform() const;
247 QMatrix combinedMatrix() const;
248 QTransform combinedTransform() const;
250 void setMatrixEnabled(bool enabled);
251 bool matrixEnabled() const;
253 void setWorldMatrixEnabled(bool enabled);
254 bool worldMatrixEnabled() const;
256 void scale(qreal sx, qreal sy);
257 void shear(qreal sh, qreal sv);
258 void rotate(qreal a);
260 void translate(const QPointF &offset);
261 inline void translate(const QPoint &offset);
262 inline void translate(qreal dx, qreal dy);
264 QRect window() const;
265 void setWindow(const QRect &window);
266 inline void setWindow(int x, int y, int w, int h);
268 QRect viewport() const;
269 void setViewport(const QRect &viewport);
270 inline void setViewport(int x, int y, int w, int h);
272 void setViewTransformEnabled(bool enable);
273 bool viewTransformEnabled() const;
276 void strokePath(const QPainterPath &path, const QPen &pen);
277 void fillPath(const QPainterPath &path, const QBrush &brush);
278 void drawPath(const QPainterPath &path);
280 inline void drawPoint(const QPointF &pt);
281 inline void drawPoint(const QPoint &p);
282 inline void drawPoint(int x, int y);
284 void drawPoints(const QPointF *points, int pointCount);
285 inline void drawPoints(const QPolygonF &points);
286 void drawPoints(const QPoint *points, int pointCount);
287 inline void drawPoints(const QPolygon &points);
289 inline void drawLine(const QLineF &line);
290 inline void drawLine(const QLine &line);
291 inline void drawLine(int x1, int y1, int x2, int y2);
292 inline void drawLine(const QPoint &p1, const QPoint &p2);
293 inline void drawLine(const QPointF &p1, const QPointF &p2);
295 void drawLines(const QLineF *lines, int lineCount);
296 inline void drawLines(const QVector<QLineF> &lines);
297 void drawLines(const QPointF *pointPairs, int lineCount);
298 inline void drawLines(const QVector<QPointF> &pointPairs);
299 void drawLines(const QLine *lines, int lineCount);
300 inline void drawLines(const QVector<QLine> &lines);
301 void drawLines(const QPoint *pointPairs, int lineCount);
302 inline void drawLines(const QVector<QPoint> &pointPairs);
304 inline void drawRect(const QRectF &rect);
305 inline void drawRect(int x1, int y1, int w, int h);
306 inline void drawRect(const QRect &rect);
308 void drawRects(const QRectF *rects, int rectCount);
309 inline void drawRects(const QVector<QRectF> &rectangles);
310 void drawRects(const QRect *rects, int rectCount);
311 inline void drawRects(const QVector<QRect> &rectangles);
313 void drawEllipse(const QRectF &r);
314 void drawEllipse(const QRect &r);
315 inline void drawEllipse(int x, int y, int w, int h);
317 inline void drawEllipse(const QPointF ¢er, qreal rx, qreal ry);
318 inline void drawEllipse(const QPoint ¢er, int rx, int ry);
320 void drawPolyline(const QPointF *points, int pointCount);
321 inline void drawPolyline(const QPolygonF &polyline);
322 void drawPolyline(const QPoint *points, int pointCount);
323 inline void drawPolyline(const QPolygon &polygon);
325 void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
326 inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
327 void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill);
328 inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill);
330 void drawConvexPolygon(const QPointF *points, int pointCount);
331 inline void drawConvexPolygon(const QPolygonF &polygon);
332 void drawConvexPolygon(const QPoint *points, int pointCount);
333 inline void drawConvexPolygon(const QPolygon &polygon);
335 void drawArc(const QRectF &rect, int a, int alen);
336 inline void drawArc(const QRect &, int a, int alen);
337 inline void drawArc(int x, int y, int w, int h, int a, int alen);
339 void drawPie(const QRectF &rect, int a, int alen);
340 inline void drawPie(int x, int y, int w, int h, int a, int alen);
341 inline void drawPie(const QRect &, int a, int alen);
343 void drawChord(const QRectF &rect, int a, int alen);
344 inline void drawChord(int x, int y, int w, int h, int a, int alen);
345 inline void drawChord(const QRect &, int a, int alen);
347 void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
348 Qt::SizeMode mode = Qt::AbsoluteSize);
349 inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
350 Qt::SizeMode mode = Qt::AbsoluteSize);
351 inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
352 Qt::SizeMode mode = Qt::AbsoluteSize);
354 void drawRoundRect(const QRectF &r, int xround = 25, int yround = 25);
355 inline void drawRoundRect(int x, int y, int w, int h, int = 25, int = 25);
356 inline void drawRoundRect(const QRect &r, int xround = 25, int yround = 25);
358 void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
359 inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
360 inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
361 #ifndef QT_NO_PICTURE
362 void drawPicture(const QPointF &p, const QPicture &picture);
363 inline void drawPicture(int x, int y, const QPicture &picture);
364 inline void drawPicture(const QPoint &p, const QPicture &picture);
367 void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
368 inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
369 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
370 int sx, int sy, int sw, int sh);
371 inline void drawPixmap(int x, int y, const QPixmap &pm,
372 int sx, int sy, int sw, int sh);
373 inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
374 inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
375 void drawPixmap(const QPointF &p, const QPixmap &pm);
376 inline void drawPixmap(const QPoint &p, const QPixmap &pm);
377 inline void drawPixmap(int x, int y, const QPixmap &pm);
378 inline void drawPixmap(const QRect &r, const QPixmap &pm);
379 inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
381 void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount,
382 const QPixmap &pixmap, PixmapFragmentHints hints = 0);
384 void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect,
385 Qt::ImageConversionFlags flags = Qt::AutoColor);
386 inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
387 Qt::ImageConversionFlags flags = Qt::AutoColor);
388 inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
389 Qt::ImageConversionFlags flags = Qt::AutoColor);
390 inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr,
391 Qt::ImageConversionFlags flags = Qt::AutoColor);
392 inline void drawImage(const QRectF &r, const QImage &image);
393 inline void drawImage(const QRect &r, const QImage &image);
394 void drawImage(const QPointF &p, const QImage &image);
395 inline void drawImage(const QPoint &p, const QImage &image);
396 inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0,
397 int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor);
399 void setLayoutDirection(Qt::LayoutDirection direction);
400 Qt::LayoutDirection layoutDirection() const;
402 #if !defined(QT_NO_RAWFONT)
403 void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun);
406 void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText);
407 inline void drawStaticText(const QPoint &topLeftPosition, const QStaticText &staticText);
408 inline void drawStaticText(int left, int top, const QStaticText &staticText);
410 void drawText(const QPointF &p, const QString &s);
411 inline void drawText(const QPoint &p, const QString &s);
412 inline void drawText(int x, int y, const QString &s);
414 void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding);
416 void drawText(const QRectF &r, int flags, const QString &text, QRectF *br=0);
417 void drawText(const QRect &r, int flags, const QString &text, QRect *br=0);
418 inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br=0);
420 void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption());
422 QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
423 QRect boundingRect(const QRect &rect, int flags, const QString &text);
424 inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
426 QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption());
428 void drawTextItem(const QPointF &p, const QTextItem &ti);
429 inline void drawTextItem(int x, int y, const QTextItem &ti);
430 inline void drawTextItem(const QPoint &p, const QTextItem &ti);
432 void fillRect(const QRectF &, const QBrush &);
433 inline void fillRect(int x, int y, int w, int h, const QBrush &);
434 void fillRect(const QRect &, const QBrush &);
436 void fillRect(const QRectF &, const QColor &color);
437 inline void fillRect(int x, int y, int w, int h, const QColor &color);
438 void fillRect(const QRect &, const QColor &color);
440 inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
441 inline void fillRect(const QRect &r, Qt::GlobalColor c);
442 inline void fillRect(const QRectF &r, Qt::GlobalColor c);
444 inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
445 inline void fillRect(const QRect &r, Qt::BrushStyle style);
446 inline void fillRect(const QRectF &r, Qt::BrushStyle style);
448 void eraseRect(const QRectF &);
449 inline void eraseRect(int x, int y, int w, int h);
450 inline void eraseRect(const QRect &);
452 void setRenderHint(RenderHint hint, bool on = true);
453 void setRenderHints(RenderHints hints, bool on = true);
454 RenderHints renderHints() const;
455 inline bool testRenderHint(RenderHint hint) const { return renderHints() & hint; }
457 QPaintEngine *paintEngine() const;
459 static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
460 const QPoint& offset = QPoint());
461 static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = 0);
462 static void restoreRedirected(const QPaintDevice *device);
464 void beginNativePainting();
465 void endNativePainting();
469 inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); }
470 inline QT3_SUPPORT const QColor &backgroundColor() const { return background().color(); }
472 inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int pos, int len)
473 { drawText(x, y, s.mid(pos, len)); }
474 inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int pos, int len)
475 { drawText(p, s.mid(pos, len)); }
476 inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int len)
477 { drawText(x, y, s.left(len)); }
478 inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int len)
479 { drawText(p, s.left(len)); }
480 inline QT3_SUPPORT void drawText(const QRect &r, int flags, const QString &str, int len, QRect *br=0)
481 { drawText(r, flags, str.left(len), br); }
482 inline QT3_SUPPORT void drawText(int x, int y, int w, int h, int flags, const QString &text, int len, QRect *br=0)
483 { drawText(QRect(x, y, w, h), flags, text.left(len), br); }
484 inline QT3_SUPPORT QRect boundingRect(const QRect &rect, int flags, const QString &text, int len)
485 { return boundingRect(rect, flags, text.left(len)); }
486 inline QT3_SUPPORT QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, int len)
487 { return boundingRect(QRect(x, y, w, h), flags, text.left(len)); }
489 inline QT3_SUPPORT bool begin(QPaintDevice *pdev, const QWidget *init)
490 { bool ret = begin(pdev); initFrom(init); return ret; }
491 QT3_SUPPORT void drawPoints(const QPolygon &pa, int index, int npoints = -1)
492 { drawPoints(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
494 QT3_SUPPORT void drawCubicBezier(const QPolygon &pa, int index = 0);
496 QT3_SUPPORT void drawLineSegments(const QPolygon &points, int index = 0, int nlines = -1);
498 inline QT3_SUPPORT void drawPolyline(const QPolygon &pa, int index, int npoints = -1)
499 { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
501 inline QT3_SUPPORT void drawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1)
502 { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints,
503 winding ? Qt::WindingFill : Qt::OddEvenFill); }
505 inline QT3_SUPPORT void drawPolygon(const QPolygonF &polygon, bool winding, int index = 0,
507 { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints,
508 winding ? Qt::WindingFill : Qt::OddEvenFill); }
510 inline QT3_SUPPORT void drawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1)
511 { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); }
512 inline QT3_SUPPORT void drawConvexPolygon(const QPolygon &pa, int index, int npoints = -1)
513 { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
515 static inline QT3_SUPPORT void redirect(QPaintDevice *pdev, QPaintDevice *replacement)
516 { setRedirected(pdev, replacement); }
517 static inline QT3_SUPPORT QPaintDevice *redirect(QPaintDevice *pdev)
518 { return const_cast<QPaintDevice*>(redirected(pdev)); }
520 inline QT3_SUPPORT void setWorldXForm(bool enabled) { setMatrixEnabled(enabled); }
521 inline QT3_SUPPORT bool hasWorldXForm() const { return matrixEnabled(); }
522 inline QT3_SUPPORT void resetXForm() { resetTransform(); }
524 inline QT3_SUPPORT void setViewXForm(bool enabled) { setViewTransformEnabled(enabled); }
525 inline QT3_SUPPORT bool hasViewXForm() const { return viewTransformEnabled(); }
527 QT3_SUPPORT void map(int x, int y, int *rx, int *ry) const;
528 QT3_SUPPORT QPoint xForm(const QPoint &) const; // map virtual -> deviceb
529 QT3_SUPPORT QRect xForm(const QRect &) const;
530 QT3_SUPPORT QPolygon xForm(const QPolygon &) const;
531 QT3_SUPPORT QPolygon xForm(const QPolygon &, int index, int npoints) const;
532 QT3_SUPPORT QPoint xFormDev(const QPoint &) const; // map device -> virtual
533 QT3_SUPPORT QRect xFormDev(const QRect &) const;
534 QT3_SUPPORT QPolygon xFormDev(const QPolygon &) const;
535 QT3_SUPPORT QPolygon xFormDev(const QPolygon &, int index, int npoints) const;
536 QT3_SUPPORT qreal translationX() const;
537 QT3_SUPPORT qreal translationY() const;
541 Q_DISABLE_COPY(QPainter)
542 friend class Q3Painter;
544 QScopedPointer<QPainterPrivate> d_ptr;
546 friend class QFontEngine;
547 friend class QFontEngineBox;
548 friend class QFontEngineFT;
549 friend class QFontEngineMac;
550 friend class QFontEngineWin;
551 friend class QFontEngineXLFD;
552 friend class QWSManager;
553 friend class QPaintEngine;
554 friend class QPaintEngineExPrivate;
555 friend class QOpenGLPaintEngine;
556 friend class QVGPaintEngine;
557 friend class QX11PaintEngine;
558 friend class QX11PaintEnginePrivate;
559 friend class QWin32PaintEngine;
560 friend class QWin32PaintEnginePrivate;
561 friend class QRasterPaintEngine;
562 friend class QAlphaPaintEngine;
563 friend class QPreviewPaintEngine;
566 Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
571 inline void QPainter::drawLine(const QLineF &l)
576 inline void QPainter::drawLine(const QLine &line)
581 inline void QPainter::drawLine(int x1, int y1, int x2, int y2)
583 QLine l(x1, y1, x2, y2);
587 inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2)
593 inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2)
595 drawLine(QLineF(p1, p2));
598 inline void QPainter::drawLines(const QVector<QLineF> &lines)
600 drawLines(lines.constData(), lines.size());
603 inline void QPainter::drawLines(const QVector<QLine> &lines)
605 drawLines(lines.constData(), lines.size());
608 inline void QPainter::drawLines(const QVector<QPointF> &pointPairs)
610 drawLines(pointPairs.constData(), pointPairs.size() / 2);
613 inline void QPainter::drawLines(const QVector<QPoint> &pointPairs)
615 drawLines(pointPairs.constData(), pointPairs.size() / 2);
618 inline void QPainter::drawPolyline(const QPolygonF &polyline)
620 drawPolyline(polyline.constData(), polyline.size());
623 inline void QPainter::drawPolyline(const QPolygon &polyline)
625 drawPolyline(polyline.constData(), polyline.size());
628 inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule)
630 drawPolygon(polygon.constData(), polygon.size(), fillRule);
633 inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule)
635 drawPolygon(polygon.constData(), polygon.size(), fillRule);
638 inline void QPainter::drawConvexPolygon(const QPolygonF &poly)
640 drawConvexPolygon(poly.constData(), poly.size());
643 inline void QPainter::drawConvexPolygon(const QPolygon &poly)
645 drawConvexPolygon(poly.constData(), poly.size());
648 inline void QPainter::drawRect(const QRectF &rect)
653 inline void QPainter::drawRect(int x, int y, int w, int h)
659 inline void QPainter::drawRect(const QRect &r)
664 inline void QPainter::drawRects(const QVector<QRectF> &rects)
666 drawRects(rects.constData(), rects.size());
669 inline void QPainter::drawRects(const QVector<QRect> &rects)
671 drawRects(rects.constData(), rects.size());
674 inline void QPainter::drawPoint(const QPointF &p)
679 inline void QPainter::drawPoint(int x, int y)
685 inline void QPainter::drawPoint(const QPoint &p)
690 inline void QPainter::drawPoints(const QPolygonF &points)
692 drawPoints(points.constData(), points.size());
695 inline void QPainter::drawPoints(const QPolygon &points)
697 drawPoints(points.constData(), points.size());
700 inline void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
702 drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
705 inline void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
707 drawRoundRect(QRectF(rect), xRnd, yRnd);
710 inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
713 drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode);
716 inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
719 drawRoundedRect(QRectF(rect), xRadius, yRadius, mode);
722 inline void QPainter::drawEllipse(int x, int y, int w, int h)
724 drawEllipse(QRect(x, y, w, h));
727 inline void QPainter::drawEllipse(const QPointF ¢er, qreal rx, qreal ry)
729 drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
732 inline void QPainter::drawEllipse(const QPoint ¢er, int rx, int ry)
734 drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry));
737 inline void QPainter::drawArc(const QRect &r, int a, int alen)
739 drawArc(QRectF(r), a, alen);
742 inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen)
744 drawArc(QRectF(x, y, w, h), a, alen);
747 inline void QPainter::drawPie(const QRect &rect, int a, int alen)
749 drawPie(QRectF(rect), a, alen);
752 inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen)
754 drawPie(QRectF(x, y, w, h), a, alen);
757 inline void QPainter::drawChord(const QRect &rect, int a, int alen)
759 drawChord(QRectF(rect), a, alen);
762 inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen)
764 drawChord(QRectF(x, y, w, h), a, alen);
767 inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op)
769 setClipRect(QRect(x, y, w, h), op);
772 inline void QPainter::eraseRect(const QRect &rect)
774 eraseRect(QRectF(rect));
777 inline void QPainter::eraseRect(int x, int y, int w, int h)
779 eraseRect(QRectF(x, y, w, h));
782 inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b)
784 fillRect(QRect(x, y, w, h), b);
787 inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b)
789 fillRect(QRect(x, y, w, h), b);
792 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c)
794 fillRect(QRect(x, y, w, h), QColor(c));
797 inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c)
799 fillRect(r, QColor(c));
802 inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c)
804 fillRect(r, QColor(c));
807 inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style)
809 fillRect(QRectF(x, y, w, h), QBrush(style));
812 inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style)
814 fillRect(QRectF(r), QBrush(style));
817 inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style)
819 fillRect(r, QBrush(style));
823 inline void QPainter::setBrushOrigin(int x, int y)
825 setBrushOrigin(QPoint(x, y));
828 inline void QPainter::setBrushOrigin(const QPoint &p)
830 setBrushOrigin(QPointF(p));
833 inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset)
835 drawTiledPixmap(QRectF(rect), pm, QPointF(offset));
838 inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy)
840 drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy));
843 inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect)
845 drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect));
848 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm)
850 drawPixmap(QPointF(p), pm);
853 inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm)
855 drawPixmap(QRectF(r), pm, QRectF());
858 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm)
860 drawPixmap(QPointF(x, y), pm);
863 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm)
865 drawPixmap(QRectF(x, y, w, h), pm, QRectF());
868 inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm,
869 int sx, int sy, int sw, int sh)
871 drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh));
874 inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
875 int sx, int sy, int sw, int sh)
877 drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh));
880 inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr)
882 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
885 inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr)
887 drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr);
890 inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti)
892 drawTextItem(QPointF(x, y), ti);
895 inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect,
896 Qt::ImageConversionFlags flags)
898 drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags);
901 inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr,
902 Qt::ImageConversionFlags flags)
904 drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags);
907 inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr,
908 Qt::ImageConversionFlags flags)
910 drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags);
914 inline void QPainter::drawImage(const QRectF &r, const QImage &image)
916 drawImage(r, image, QRect(0, 0, image.width(), image.height()));
919 inline void QPainter::drawImage(const QRect &r, const QImage &image)
921 drawImage(r, image, QRectF(0, 0, image.width(), image.height()));
924 inline void QPainter::drawImage(const QPoint &p, const QImage &image)
926 drawImage(QPointF(p), image);
929 inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh,
930 Qt::ImageConversionFlags flags)
932 if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor)
933 drawImage(QPointF(x, y), image);
935 drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags);
938 inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText)
940 drawStaticText(QPointF(p), staticText);
943 inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText)
945 drawStaticText(QPointF(x, y), staticText);
948 inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti)
950 drawTextItem(QPointF(p), ti);
953 inline void QPainter::drawText(const QPoint &p, const QString &s)
955 drawText(QPointF(p), s);
958 inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br)
960 drawText(QRect(x, y, w, h), flags, str, br);
963 inline void QPainter::drawText(int x, int y, const QString &s)
965 drawText(QPointF(x, y), s);
968 inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text)
970 return boundingRect(QRect(x, y, w, h), flags, text);
973 inline void QPainter::translate(qreal dx, qreal dy)
975 translate(QPointF(dx, dy));
978 inline void QPainter::translate(const QPoint &offset)
980 translate(offset.x(), offset.y());
983 inline void QPainter::setViewport(int x, int y, int w, int h)
985 setViewport(QRect(x, y, w, h));
988 inline void QPainter::setWindow(int x, int y, int w, int h)
990 setWindow(QRect(x, y, w, h));
993 #ifndef QT_NO_PICTURE
994 inline void QPainter::drawPicture(int x, int y, const QPicture &p)
996 drawPicture(QPoint(x, y), p);
999 inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p)
1001 drawPicture(QPointF(pt), p);
1009 #endif // QPAINTER_H