source: trunk/src/gui/painting/qpainter.h@ 203

Last change on this file since 203 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

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