/usr/include/QtGui/qpainter.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (C) 2016 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | |
4 | | #ifndef QPAINTER_H |
5 | | #define QPAINTER_H |
6 | | |
7 | | #include <QtGui/qtguiglobal.h> |
8 | | #include <QtCore/qnamespace.h> |
9 | | #include <QtCore/qrect.h> |
10 | | #include <QtCore/qpoint.h> |
11 | | #include <QtCore/qscopedpointer.h> |
12 | | #include <QtGui/qpixmap.h> |
13 | | #include <QtGui/qimage.h> |
14 | | #include <QtGui/qtextoption.h> |
15 | | #include <memory> |
16 | | |
17 | | #ifndef QT_INCLUDE_COMPAT |
18 | | #include <QtGui/qpolygon.h> |
19 | | #include <QtGui/qpen.h> |
20 | | #include <QtGui/qbrush.h> |
21 | | #include <QtGui/qtransform.h> |
22 | | #include <QtGui/qfontinfo.h> |
23 | | #include <QtGui/qfontmetrics.h> |
24 | | #endif |
25 | | |
26 | | QT_BEGIN_NAMESPACE |
27 | | |
28 | | |
29 | | class QBrush; |
30 | | class QFontInfo; |
31 | | class QFontMetrics; |
32 | | class QPaintDevice; |
33 | | class QPainterPath; |
34 | | class QPainterPrivate; |
35 | | class QPen; |
36 | | class QPolygon; |
37 | | class QTextItem; |
38 | | class QTextEngine; |
39 | | class QTransform; |
40 | | class QStaticText; |
41 | | class QGlyphRun; |
42 | | |
43 | | class QPainterPrivateDeleter; |
44 | | |
45 | | class Q_GUI_EXPORT QPainter |
46 | | { |
47 | | Q_DECLARE_PRIVATE(QPainter) |
48 | | Q_GADGET |
49 | | |
50 | | public: |
51 | | enum RenderHint { |
52 | | Antialiasing = 0x01, |
53 | | TextAntialiasing = 0x02, |
54 | | SmoothPixmapTransform = 0x04, |
55 | | VerticalSubpixelPositioning = 0x08, |
56 | | LosslessImageRendering = 0x40, |
57 | | NonCosmeticBrushPatterns = 0x80 |
58 | | }; |
59 | | Q_ENUM(RenderHint) |
60 | | |
61 | | Q_DECLARE_FLAGS(RenderHints, RenderHint) |
62 | | Q_FLAG(RenderHints) |
63 | | |
64 | | class PixmapFragment { |
65 | | public: |
66 | | qreal x; |
67 | | qreal y; |
68 | | qreal sourceLeft; |
69 | | qreal sourceTop; |
70 | | qreal width; |
71 | | qreal height; |
72 | | qreal scaleX; |
73 | | qreal scaleY; |
74 | | qreal rotation; |
75 | | qreal opacity; |
76 | | static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect, |
77 | | qreal scaleX = 1, qreal scaleY = 1, |
78 | | qreal rotation = 0, qreal opacity = 1); |
79 | | }; |
80 | | |
81 | | enum PixmapFragmentHint { |
82 | | OpaqueHint = 0x01 |
83 | | }; |
84 | | |
85 | | Q_DECLARE_FLAGS(PixmapFragmentHints, PixmapFragmentHint) |
86 | | |
87 | | QPainter(); |
88 | | explicit QPainter(QPaintDevice *); |
89 | | ~QPainter(); |
90 | | |
91 | | QPaintDevice *device() const; |
92 | | |
93 | | bool begin(QPaintDevice *); |
94 | | bool end(); |
95 | | bool isActive() const; |
96 | | |
97 | | enum CompositionMode { |
98 | | CompositionMode_SourceOver, |
99 | | CompositionMode_DestinationOver, |
100 | | CompositionMode_Clear, |
101 | | CompositionMode_Source, |
102 | | CompositionMode_Destination, |
103 | | CompositionMode_SourceIn, |
104 | | CompositionMode_DestinationIn, |
105 | | CompositionMode_SourceOut, |
106 | | CompositionMode_DestinationOut, |
107 | | CompositionMode_SourceAtop, |
108 | | CompositionMode_DestinationAtop, |
109 | | CompositionMode_Xor, |
110 | | |
111 | | //svg 1.2 blend modes |
112 | | CompositionMode_Plus, |
113 | | CompositionMode_Multiply, |
114 | | CompositionMode_Screen, |
115 | | CompositionMode_Overlay, |
116 | | CompositionMode_Darken, |
117 | | CompositionMode_Lighten, |
118 | | CompositionMode_ColorDodge, |
119 | | CompositionMode_ColorBurn, |
120 | | CompositionMode_HardLight, |
121 | | CompositionMode_SoftLight, |
122 | | CompositionMode_Difference, |
123 | | CompositionMode_Exclusion, |
124 | | |
125 | | // ROPs |
126 | | RasterOp_SourceOrDestination, |
127 | | RasterOp_SourceAndDestination, |
128 | | RasterOp_SourceXorDestination, |
129 | | RasterOp_NotSourceAndNotDestination, |
130 | | RasterOp_NotSourceOrNotDestination, |
131 | | RasterOp_NotSourceXorDestination, |
132 | | RasterOp_NotSource, |
133 | | RasterOp_NotSourceAndDestination, |
134 | | RasterOp_SourceAndNotDestination, |
135 | | RasterOp_NotSourceOrDestination, |
136 | | RasterOp_SourceOrNotDestination, |
137 | | RasterOp_ClearDestination, |
138 | | RasterOp_SetDestination, |
139 | | RasterOp_NotDestination, |
140 | | |
141 | | NCompositionModes |
142 | | }; |
143 | | void setCompositionMode(CompositionMode mode); |
144 | | CompositionMode compositionMode() const; |
145 | | |
146 | | const QFont &font() const; |
147 | | void setFont(const QFont &f); |
148 | | |
149 | | QFontMetrics fontMetrics() const; |
150 | | QFontInfo fontInfo() const; |
151 | | |
152 | | void setPen(const QColor &color); |
153 | | QT_GUI_INLINE_SINCE(6, 11) |
154 | | void setPen(const QPen &pen); |
155 | 0 | void setPen(QPen &&pen) { doSetPen(pen, &pen); } |
156 | | void setPen(Qt::PenStyle style); |
157 | | const QPen &pen() const; |
158 | | |
159 | | QT_GUI_INLINE_SINCE(6, 11) |
160 | | void setBrush(const QBrush &brush); |
161 | 0 | void setBrush(QBrush &&brush) { doSetBrush(brush, &brush); } |
162 | | void setBrush(Qt::BrushStyle style); |
163 | | void setBrush(QColor color); |
164 | 0 | void setBrush(Qt::GlobalColor color) { setBrush(QColor(color)); } |
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 | | QPointF brushOriginF() const; |
173 | | inline void setBrushOrigin(int x, int y); |
174 | | inline void setBrushOrigin(const QPoint &); |
175 | | void setBrushOrigin(const QPointF &); |
176 | | |
177 | | void setBackground(const QBrush &bg); |
178 | | const QBrush &background() const; |
179 | | |
180 | | qreal opacity() const; |
181 | | void setOpacity(qreal opacity); |
182 | | |
183 | | // Clip functions |
184 | | QRegion clipRegion() const; |
185 | | QPainterPath clipPath() const; |
186 | | |
187 | | void setClipRect(const QRectF &, Qt::ClipOperation op = Qt::ReplaceClip); |
188 | | void setClipRect(const QRect &, Qt::ClipOperation op = Qt::ReplaceClip); |
189 | | inline void setClipRect(int x, int y, int w, int h, Qt::ClipOperation op = Qt::ReplaceClip); |
190 | | |
191 | | void setClipRegion(const QRegion &, Qt::ClipOperation op = Qt::ReplaceClip); |
192 | | |
193 | | void setClipPath(const QPainterPath &path, Qt::ClipOperation op = Qt::ReplaceClip); |
194 | | |
195 | | void setClipping(bool enable); |
196 | | bool hasClipping() const; |
197 | | |
198 | | QRectF clipBoundingRect() const; |
199 | | |
200 | | void save(); |
201 | | void restore(); |
202 | | |
203 | | // XForm functions |
204 | | void setTransform(const QTransform &transform, bool combine = false); |
205 | | const QTransform &transform() const; |
206 | | const QTransform &deviceTransform() const; |
207 | | void resetTransform(); |
208 | | |
209 | | void setWorldTransform(const QTransform &matrix, bool combine = false); |
210 | | const QTransform &worldTransform() const; |
211 | | |
212 | | QTransform combinedTransform() const; |
213 | | |
214 | | void setWorldMatrixEnabled(bool enabled); |
215 | | bool worldMatrixEnabled() const; |
216 | | |
217 | | void scale(qreal sx, qreal sy); |
218 | | void shear(qreal sh, qreal sv); |
219 | | void rotate(qreal a); |
220 | | |
221 | | void translate(const QPointF &offset); |
222 | | inline void translate(const QPoint &offset); |
223 | | inline void translate(qreal dx, qreal dy); |
224 | | |
225 | | QRect window() const; |
226 | | void setWindow(const QRect &window); |
227 | | inline void setWindow(int x, int y, int w, int h); |
228 | | |
229 | | QRect viewport() const; |
230 | | void setViewport(const QRect &viewport); |
231 | | inline void setViewport(int x, int y, int w, int h); |
232 | | |
233 | | void setViewTransformEnabled(bool enable); |
234 | | bool viewTransformEnabled() const; |
235 | | |
236 | | // drawing functions |
237 | | void strokePath(const QPainterPath &path, const QPen &pen); |
238 | | void fillPath(const QPainterPath &path, const QBrush &brush); |
239 | | void drawPath(const QPainterPath &path); |
240 | | |
241 | | inline void drawPoint(const QPointF &pt); |
242 | | inline void drawPoint(const QPoint &p); |
243 | | inline void drawPoint(int x, int y); |
244 | | |
245 | | void drawPoints(const QPointF *points, int pointCount); |
246 | | inline void drawPoints(const QPolygonF &points); |
247 | | void drawPoints(const QPoint *points, int pointCount); |
248 | | inline void drawPoints(const QPolygon &points); |
249 | | |
250 | | inline void drawLine(const QLineF &line); |
251 | | inline void drawLine(const QLine &line); |
252 | | inline void drawLine(int x1, int y1, int x2, int y2); |
253 | | inline void drawLine(const QPoint &p1, const QPoint &p2); |
254 | | inline void drawLine(const QPointF &p1, const QPointF &p2); |
255 | | |
256 | | void drawLines(const QLineF *lines, int lineCount); |
257 | | inline void drawLines(const QList<QLineF> &lines); |
258 | | void drawLines(const QPointF *pointPairs, int lineCount); |
259 | | inline void drawLines(const QList<QPointF> &pointPairs); |
260 | | void drawLines(const QLine *lines, int lineCount); |
261 | | inline void drawLines(const QList<QLine> &lines); |
262 | | void drawLines(const QPoint *pointPairs, int lineCount); |
263 | | inline void drawLines(const QList<QPoint> &pointPairs); |
264 | | |
265 | | inline void drawRect(const QRectF &rect); |
266 | | inline void drawRect(int x1, int y1, int w, int h); |
267 | | inline void drawRect(const QRect &rect); |
268 | | |
269 | | void drawRects(const QRectF *rects, int rectCount); |
270 | | inline void drawRects(const QList<QRectF> &rectangles); |
271 | | void drawRects(const QRect *rects, int rectCount); |
272 | | inline void drawRects(const QList<QRect> &rectangles); |
273 | | |
274 | | void drawEllipse(const QRectF &r); |
275 | | void drawEllipse(const QRect &r); |
276 | | inline void drawEllipse(int x, int y, int w, int h); |
277 | | |
278 | | inline void drawEllipse(const QPointF ¢er, qreal rx, qreal ry); |
279 | | inline void drawEllipse(const QPoint ¢er, int rx, int ry); |
280 | | |
281 | | void drawPolyline(const QPointF *points, int pointCount); |
282 | | inline void drawPolyline(const QPolygonF &polyline); |
283 | | void drawPolyline(const QPoint *points, int pointCount); |
284 | | inline void drawPolyline(const QPolygon &polygon); |
285 | | |
286 | | void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill); |
287 | | inline void drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule = Qt::OddEvenFill); |
288 | | void drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule = Qt::OddEvenFill); |
289 | | inline void drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule = Qt::OddEvenFill); |
290 | | |
291 | | void drawConvexPolygon(const QPointF *points, int pointCount); |
292 | | inline void drawConvexPolygon(const QPolygonF &polygon); |
293 | | void drawConvexPolygon(const QPoint *points, int pointCount); |
294 | | inline void drawConvexPolygon(const QPolygon &polygon); |
295 | | |
296 | | void drawArc(const QRectF &rect, int a, int alen); |
297 | | inline void drawArc(const QRect &, int a, int alen); |
298 | | inline void drawArc(int x, int y, int w, int h, int a, int alen); |
299 | | |
300 | | void drawPie(const QRectF &rect, int a, int alen); |
301 | | inline void drawPie(int x, int y, int w, int h, int a, int alen); |
302 | | inline void drawPie(const QRect &, int a, int alen); |
303 | | |
304 | | void drawChord(const QRectF &rect, int a, int alen); |
305 | | inline void drawChord(int x, int y, int w, int h, int a, int alen); |
306 | | inline void drawChord(const QRect &, int a, int alen); |
307 | | |
308 | | void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, |
309 | | Qt::SizeMode mode = Qt::AbsoluteSize); |
310 | | inline void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, |
311 | | Qt::SizeMode mode = Qt::AbsoluteSize); |
312 | | inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, |
313 | | Qt::SizeMode mode = Qt::AbsoluteSize); |
314 | | |
315 | | void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF()); |
316 | | inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0); |
317 | | inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint()); |
318 | | #ifndef QT_NO_PICTURE |
319 | | void drawPicture(const QPointF &p, const QPicture &picture); |
320 | | inline void drawPicture(int x, int y, const QPicture &picture); |
321 | | inline void drawPicture(const QPoint &p, const QPicture &picture); |
322 | | #endif |
323 | | |
324 | | void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect); |
325 | | inline void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect); |
326 | | inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm, |
327 | | int sx, int sy, int sw, int sh); |
328 | | inline void drawPixmap(int x, int y, const QPixmap &pm, |
329 | | int sx, int sy, int sw, int sh); |
330 | | inline void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr); |
331 | | inline void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr); |
332 | | void drawPixmap(const QPointF &p, const QPixmap &pm); |
333 | | inline void drawPixmap(const QPoint &p, const QPixmap &pm); |
334 | | inline void drawPixmap(int x, int y, const QPixmap &pm); |
335 | | inline void drawPixmap(const QRect &r, const QPixmap &pm); |
336 | | inline void drawPixmap(int x, int y, int w, int h, const QPixmap &pm); |
337 | | |
338 | | void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, |
339 | | const QPixmap &pixmap, PixmapFragmentHints hints = PixmapFragmentHints()); |
340 | | |
341 | | void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, |
342 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
343 | | inline void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, |
344 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
345 | | inline void drawImage(const QPointF &p, const QImage &image, const QRectF &sr, |
346 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
347 | | inline void drawImage(const QPoint &p, const QImage &image, const QRect &sr, |
348 | | Qt::ImageConversionFlags flags = Qt::AutoColor); |
349 | | inline void drawImage(const QRectF &r, const QImage &image); |
350 | | inline void drawImage(const QRect &r, const QImage &image); |
351 | | void drawImage(const QPointF &p, const QImage &image); |
352 | | inline void drawImage(const QPoint &p, const QImage &image); |
353 | | inline void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0, |
354 | | int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor); |
355 | | |
356 | | void setLayoutDirection(Qt::LayoutDirection direction); |
357 | | Qt::LayoutDirection layoutDirection() const; |
358 | | |
359 | | #if !defined(QT_NO_RAWFONT) |
360 | | void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun); |
361 | | #endif |
362 | | |
363 | | void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText); |
364 | | inline void drawStaticText(const QPoint &topLeftPosition, const QStaticText &staticText); |
365 | | inline void drawStaticText(int left, int top, const QStaticText &staticText); |
366 | | |
367 | | void drawText(const QPointF &p, const QString &s); |
368 | | inline void drawText(const QPoint &p, const QString &s); |
369 | | inline void drawText(int x, int y, const QString &s); |
370 | | |
371 | | void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding); |
372 | | |
373 | | void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = nullptr); |
374 | | void drawText(const QRect &r, int flags, const QString &text, QRect *br = nullptr); |
375 | | inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = nullptr); |
376 | | |
377 | | void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption()); |
378 | | |
379 | | QRectF boundingRect(const QRectF &rect, int flags, const QString &text); |
380 | | QRect boundingRect(const QRect &rect, int flags, const QString &text); |
381 | | inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text); |
382 | | |
383 | | QRectF boundingRect(const QRectF &rect, const QString &text, const QTextOption &o = QTextOption()); |
384 | | |
385 | | void drawTextItem(const QPointF &p, const QTextItem &ti); |
386 | | inline void drawTextItem(int x, int y, const QTextItem &ti); |
387 | | inline void drawTextItem(const QPoint &p, const QTextItem &ti); |
388 | | |
389 | | void fillRect(const QRectF &, const QBrush &); |
390 | | inline void fillRect(int x, int y, int w, int h, const QBrush &); |
391 | | void fillRect(const QRect &, const QBrush &); |
392 | | |
393 | | void fillRect(const QRectF &, const QColor &color); |
394 | | inline void fillRect(int x, int y, int w, int h, const QColor &color); |
395 | | void fillRect(const QRect &, const QColor &color); |
396 | | |
397 | | inline void fillRect(int x, int y, int w, int h, Qt::GlobalColor c); |
398 | | inline void fillRect(const QRect &r, Qt::GlobalColor c); |
399 | | inline void fillRect(const QRectF &r, Qt::GlobalColor c); |
400 | | |
401 | | inline void fillRect(int x, int y, int w, int h, Qt::BrushStyle style); |
402 | | inline void fillRect(const QRect &r, Qt::BrushStyle style); |
403 | | inline void fillRect(const QRectF &r, Qt::BrushStyle style); |
404 | | |
405 | | inline void fillRect(int x, int y, int w, int h, QGradient::Preset preset); |
406 | | inline void fillRect(const QRect &r, QGradient::Preset preset); |
407 | | inline void fillRect(const QRectF &r, QGradient::Preset preset); |
408 | | |
409 | | void eraseRect(const QRectF &); |
410 | | inline void eraseRect(int x, int y, int w, int h); |
411 | | inline void eraseRect(const QRect &); |
412 | | |
413 | | void setRenderHint(RenderHint hint, bool on = true); |
414 | | void setRenderHints(RenderHints hints, bool on = true); |
415 | | RenderHints renderHints() const; |
416 | 0 | inline bool testRenderHint(RenderHint hint) const { return bool(renderHints() & hint); } |
417 | | |
418 | | QPaintEngine *paintEngine() const; |
419 | | |
420 | | void beginNativePainting(); |
421 | | void endNativePainting(); |
422 | | |
423 | | private: |
424 | | Q_DISABLE_COPY(QPainter) |
425 | | |
426 | | void doSetPen(const QPen &lvalue, QPen *rvalue); |
427 | | void doSetBrush(const QBrush &lvalue, QBrush *rvalue); |
428 | | |
429 | | std::unique_ptr<QPainterPrivate> d_ptr; |
430 | | |
431 | | friend class QWidget; |
432 | | friend class QFontEngine; |
433 | | friend class QFontEngineBox; |
434 | | friend class QFontEngineFT; |
435 | | friend class QFontEngineMac; |
436 | | friend class QFontEngineWin; |
437 | | friend class QPaintEngine; |
438 | | friend class QPaintEngineExPrivate; |
439 | | friend class QOpenGLPaintEngine; |
440 | | friend class QWin32PaintEngine; |
441 | | friend class QWin32PaintEnginePrivate; |
442 | | friend class QRasterPaintEngine; |
443 | | friend class QAlphaPaintEngine; |
444 | | friend class QPreviewPaintEngine; |
445 | | friend class QTextEngine; |
446 | | }; |
447 | | Q_DECLARE_TYPEINFO(QPainter::PixmapFragment, Q_RELOCATABLE_TYPE); |
448 | | |
449 | | Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints) |
450 | | |
451 | | // |
452 | | // functions |
453 | | // |
454 | | inline void QPainter::drawLine(const QLineF &l) |
455 | 0 | { |
456 | 0 | drawLines(&l, 1); |
457 | 0 | } |
458 | | |
459 | | inline void QPainter::drawLine(const QLine &line) |
460 | 0 | { |
461 | 0 | drawLines(&line, 1); |
462 | 0 | } |
463 | | |
464 | | inline void QPainter::drawLine(int x1, int y1, int x2, int y2) |
465 | 0 | { |
466 | 0 | QLine l(x1, y1, x2, y2); |
467 | 0 | drawLines(&l, 1); |
468 | 0 | } |
469 | | |
470 | | inline void QPainter::drawLine(const QPoint &p1, const QPoint &p2) |
471 | 0 | { |
472 | 0 | QLine l(p1, p2); |
473 | 0 | drawLines(&l, 1); |
474 | 0 | } |
475 | | |
476 | | inline void QPainter::drawLine(const QPointF &p1, const QPointF &p2) |
477 | 0 | { |
478 | 0 | drawLine(QLineF(p1, p2)); |
479 | 0 | } |
480 | | |
481 | | inline void QPainter::drawLines(const QList<QLineF> &lines) |
482 | 0 | { |
483 | 0 | drawLines(lines.constData(), int(lines.size())); |
484 | 0 | } |
485 | | |
486 | | inline void QPainter::drawLines(const QList<QLine> &lines) |
487 | 0 | { |
488 | 0 | drawLines(lines.constData(), int(lines.size())); |
489 | 0 | } |
490 | | |
491 | | inline void QPainter::drawLines(const QList<QPointF> &pointPairs) |
492 | 0 | { |
493 | 0 | drawLines(pointPairs.constData(), int(pointPairs.size() / 2)); |
494 | 0 | } |
495 | | |
496 | | inline void QPainter::drawLines(const QList<QPoint> &pointPairs) |
497 | 0 | { |
498 | 0 | drawLines(pointPairs.constData(), int(pointPairs.size() / 2)); |
499 | 0 | } |
500 | | |
501 | | inline void QPainter::drawPolyline(const QPolygonF &polyline) |
502 | 0 | { |
503 | 0 | drawPolyline(polyline.constData(), int(polyline.size())); |
504 | 0 | } |
505 | | |
506 | | inline void QPainter::drawPolyline(const QPolygon &polyline) |
507 | 0 | { |
508 | 0 | drawPolyline(polyline.constData(), int(polyline.size())); |
509 | 0 | } |
510 | | |
511 | | inline void QPainter::drawPolygon(const QPolygonF &polygon, Qt::FillRule fillRule) |
512 | 0 | { |
513 | 0 | drawPolygon(polygon.constData(), int(polygon.size()), fillRule); |
514 | 0 | } |
515 | | |
516 | | inline void QPainter::drawPolygon(const QPolygon &polygon, Qt::FillRule fillRule) |
517 | 0 | { |
518 | 0 | drawPolygon(polygon.constData(), int(polygon.size()), fillRule); |
519 | 0 | } |
520 | | |
521 | | inline void QPainter::drawConvexPolygon(const QPolygonF &poly) |
522 | 0 | { |
523 | 0 | drawConvexPolygon(poly.constData(), int(poly.size())); |
524 | 0 | } |
525 | | |
526 | | inline void QPainter::drawConvexPolygon(const QPolygon &poly) |
527 | 0 | { |
528 | 0 | drawConvexPolygon(poly.constData(), int(poly.size())); |
529 | 0 | } |
530 | | |
531 | | inline void QPainter::drawRect(const QRectF &rect) |
532 | 0 | { |
533 | 0 | drawRects(&rect, 1); |
534 | 0 | } |
535 | | |
536 | | inline void QPainter::drawRect(int x, int y, int w, int h) |
537 | 0 | { |
538 | 0 | QRect r(x, y, w, h); |
539 | 0 | drawRects(&r, 1); |
540 | 0 | } |
541 | | |
542 | | inline void QPainter::drawRect(const QRect &r) |
543 | 0 | { |
544 | 0 | drawRects(&r, 1); |
545 | 0 | } |
546 | | |
547 | | inline void QPainter::drawRects(const QList<QRectF> &rects) |
548 | 0 | { |
549 | 0 | drawRects(rects.constData(), int(rects.size())); |
550 | 0 | } |
551 | | |
552 | | inline void QPainter::drawRects(const QList<QRect> &rects) |
553 | 0 | { |
554 | 0 | drawRects(rects.constData(), int(rects.size())); |
555 | 0 | } |
556 | | |
557 | | inline void QPainter::drawPoint(const QPointF &p) |
558 | 0 | { |
559 | 0 | drawPoints(&p, 1); |
560 | 0 | } |
561 | | |
562 | | inline void QPainter::drawPoint(int x, int y) |
563 | 0 | { |
564 | 0 | QPoint p(x, y); |
565 | 0 | drawPoints(&p, 1); |
566 | 0 | } |
567 | | |
568 | | inline void QPainter::drawPoint(const QPoint &p) |
569 | 0 | { |
570 | 0 | drawPoints(&p, 1); |
571 | 0 | } |
572 | | |
573 | | inline void QPainter::drawPoints(const QPolygonF &points) |
574 | 0 | { |
575 | 0 | drawPoints(points.constData(), int(points.size())); |
576 | 0 | } |
577 | | |
578 | | inline void QPainter::drawPoints(const QPolygon &points) |
579 | 0 | { |
580 | 0 | drawPoints(points.constData(), int(points.size())); |
581 | 0 | } |
582 | | |
583 | | inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, |
584 | | Qt::SizeMode mode) |
585 | 0 | { |
586 | 0 | drawRoundedRect(QRectF(x, y, w, h), xRadius, yRadius, mode); |
587 | 0 | } |
588 | | |
589 | | inline void QPainter::drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, |
590 | | Qt::SizeMode mode) |
591 | 0 | { |
592 | 0 | drawRoundedRect(QRectF(rect), xRadius, yRadius, mode); |
593 | 0 | } |
594 | | |
595 | | inline void QPainter::drawEllipse(int x, int y, int w, int h) |
596 | 0 | { |
597 | 0 | drawEllipse(QRect(x, y, w, h)); |
598 | 0 | } |
599 | | |
600 | | inline void QPainter::drawEllipse(const QPointF ¢er, qreal rx, qreal ry) |
601 | 0 | { |
602 | 0 | drawEllipse(QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry)); |
603 | 0 | } |
604 | | |
605 | | inline void QPainter::drawEllipse(const QPoint ¢er, int rx, int ry) |
606 | 0 | { |
607 | 0 | drawEllipse(QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry)); |
608 | 0 | } |
609 | | |
610 | | inline void QPainter::drawArc(const QRect &r, int a, int alen) |
611 | 0 | { |
612 | 0 | drawArc(QRectF(r), a, alen); |
613 | 0 | } |
614 | | |
615 | | inline void QPainter::drawArc(int x, int y, int w, int h, int a, int alen) |
616 | 0 | { |
617 | 0 | drawArc(QRectF(x, y, w, h), a, alen); |
618 | 0 | } |
619 | | |
620 | | inline void QPainter::drawPie(const QRect &rect, int a, int alen) |
621 | 0 | { |
622 | 0 | drawPie(QRectF(rect), a, alen); |
623 | 0 | } |
624 | | |
625 | | inline void QPainter::drawPie(int x, int y, int w, int h, int a, int alen) |
626 | 0 | { |
627 | 0 | drawPie(QRectF(x, y, w, h), a, alen); |
628 | 0 | } |
629 | | |
630 | | inline void QPainter::drawChord(const QRect &rect, int a, int alen) |
631 | 0 | { |
632 | 0 | drawChord(QRectF(rect), a, alen); |
633 | 0 | } |
634 | | |
635 | | inline void QPainter::drawChord(int x, int y, int w, int h, int a, int alen) |
636 | 0 | { |
637 | 0 | drawChord(QRectF(x, y, w, h), a, alen); |
638 | 0 | } |
639 | | |
640 | | inline void QPainter::setClipRect(int x, int y, int w, int h, Qt::ClipOperation op) |
641 | 0 | { |
642 | 0 | setClipRect(QRect(x, y, w, h), op); |
643 | 0 | } |
644 | | |
645 | | inline void QPainter::eraseRect(const QRect &rect) |
646 | 0 | { |
647 | 0 | eraseRect(QRectF(rect)); |
648 | 0 | } |
649 | | |
650 | | inline void QPainter::eraseRect(int x, int y, int w, int h) |
651 | 0 | { |
652 | 0 | eraseRect(QRectF(x, y, w, h)); |
653 | 0 | } |
654 | | |
655 | | inline void QPainter::fillRect(int x, int y, int w, int h, const QBrush &b) |
656 | 0 | { |
657 | 0 | fillRect(QRect(x, y, w, h), b); |
658 | 0 | } |
659 | | |
660 | | inline void QPainter::fillRect(int x, int y, int w, int h, const QColor &b) |
661 | 0 | { |
662 | 0 | fillRect(QRect(x, y, w, h), b); |
663 | 0 | } |
664 | | |
665 | | inline void QPainter::fillRect(int x, int y, int w, int h, Qt::GlobalColor c) |
666 | 0 | { |
667 | 0 | fillRect(QRect(x, y, w, h), QColor(c)); |
668 | 0 | } |
669 | | |
670 | | inline void QPainter::fillRect(const QRect &r, Qt::GlobalColor c) |
671 | 0 | { |
672 | 0 | fillRect(r, QColor(c)); |
673 | 0 | } |
674 | | |
675 | | inline void QPainter::fillRect(const QRectF &r, Qt::GlobalColor c) |
676 | 0 | { |
677 | 0 | fillRect(r, QColor(c)); |
678 | 0 | } |
679 | | |
680 | | inline void QPainter::fillRect(int x, int y, int w, int h, Qt::BrushStyle style) |
681 | 0 | { |
682 | 0 | fillRect(QRectF(x, y, w, h), QBrush(style)); |
683 | 0 | } |
684 | | |
685 | | inline void QPainter::fillRect(const QRect &r, Qt::BrushStyle style) |
686 | 0 | { |
687 | 0 | fillRect(QRectF(r), QBrush(style)); |
688 | 0 | } |
689 | | |
690 | | inline void QPainter::fillRect(const QRectF &r, Qt::BrushStyle style) |
691 | 0 | { |
692 | 0 | fillRect(r, QBrush(style)); |
693 | 0 | } |
694 | | |
695 | | inline void QPainter::fillRect(int x, int y, int w, int h, QGradient::Preset p) |
696 | 0 | { |
697 | 0 | fillRect(QRect(x, y, w, h), QGradient(p)); |
698 | 0 | } |
699 | | |
700 | | inline void QPainter::fillRect(const QRect &r, QGradient::Preset p) |
701 | 0 | { |
702 | 0 | fillRect(r, QGradient(p)); |
703 | 0 | } |
704 | | |
705 | | inline void QPainter::fillRect(const QRectF &r, QGradient::Preset p) |
706 | 0 | { |
707 | 0 | fillRect(r, QGradient(p)); |
708 | 0 | } |
709 | | |
710 | | #if QT_GUI_INLINE_IMPL_SINCE(6, 11) |
711 | | |
712 | | void QPainter::setPen(const QPen &p) |
713 | | { |
714 | | doSetPen(p, nullptr); |
715 | | } |
716 | | |
717 | | void QPainter::setBrush(const QBrush &b) |
718 | | { |
719 | | doSetBrush(b, nullptr); |
720 | | } |
721 | | |
722 | | #endif // QT_GUI_INLINE_IMPL_SINCE(6, 11) |
723 | | |
724 | | |
725 | | inline void QPainter::setBrushOrigin(int x, int y) |
726 | 0 | { |
727 | 0 | setBrushOrigin(QPoint(x, y)); |
728 | 0 | } |
729 | | |
730 | | inline void QPainter::setBrushOrigin(const QPoint &p) |
731 | 0 | { |
732 | 0 | setBrushOrigin(QPointF(p)); |
733 | 0 | } |
734 | | |
735 | | inline void QPainter::drawTiledPixmap(const QRect &rect, const QPixmap &pm, const QPoint &offset) |
736 | 0 | { |
737 | 0 | drawTiledPixmap(QRectF(rect), pm, QPointF(offset)); |
738 | 0 | } |
739 | | |
740 | | inline void QPainter::drawTiledPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy) |
741 | 0 | { |
742 | 0 | drawTiledPixmap(QRectF(x, y, w, h), pm, QPointF(sx, sy)); |
743 | 0 | } |
744 | | |
745 | | inline void QPainter::drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect) |
746 | 0 | { |
747 | 0 | drawPixmap(QRectF(targetRect), pixmap, QRectF(sourceRect)); |
748 | 0 | } |
749 | | |
750 | | inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm) |
751 | 0 | { |
752 | 0 | drawPixmap(QPointF(p), pm); |
753 | 0 | } |
754 | | |
755 | | inline void QPainter::drawPixmap(const QRect &r, const QPixmap &pm) |
756 | 0 | { |
757 | 0 | drawPixmap(QRectF(r), pm, QRectF()); |
758 | 0 | } |
759 | | |
760 | | inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm) |
761 | 0 | { |
762 | 0 | drawPixmap(QPointF(x, y), pm); |
763 | 0 | } |
764 | | |
765 | | inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm) |
766 | 0 | { |
767 | 0 | drawPixmap(QRectF(x, y, w, h), pm, QRectF()); |
768 | 0 | } |
769 | | |
770 | | inline void QPainter::drawPixmap(int x, int y, int w, int h, const QPixmap &pm, |
771 | | int sx, int sy, int sw, int sh) |
772 | 0 | { |
773 | 0 | drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh)); |
774 | 0 | } |
775 | | |
776 | | inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm, |
777 | | int sx, int sy, int sw, int sh) |
778 | 0 | { |
779 | 0 | drawPixmap(QRectF(x, y, -1, -1), pm, QRectF(sx, sy, sw, sh)); |
780 | 0 | } |
781 | | |
782 | | inline void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr) |
783 | 0 | { |
784 | 0 | drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr); |
785 | 0 | } |
786 | | |
787 | | inline void QPainter::drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr) |
788 | 0 | { |
789 | 0 | drawPixmap(QRectF(p.x(), p.y(), -1, -1), pm, sr); |
790 | 0 | } |
791 | | |
792 | | inline void QPainter::drawTextItem(int x, int y, const QTextItem &ti) |
793 | 0 | { |
794 | 0 | drawTextItem(QPointF(x, y), ti); |
795 | 0 | } |
796 | | |
797 | | inline void QPainter::drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, |
798 | | Qt::ImageConversionFlags flags) |
799 | 0 | { |
800 | 0 | drawImage(QRectF(targetRect), image, QRectF(sourceRect), flags); |
801 | 0 | } |
802 | | |
803 | | inline void QPainter::drawImage(const QPointF &p, const QImage &image, const QRectF &sr, |
804 | | Qt::ImageConversionFlags flags) |
805 | 0 | { |
806 | 0 | drawImage(QRectF(p.x(), p.y(), -1, -1), image, sr, flags); |
807 | 0 | } |
808 | | |
809 | | inline void QPainter::drawImage(const QPoint &p, const QImage &image, const QRect &sr, |
810 | | Qt::ImageConversionFlags flags) |
811 | 0 | { |
812 | 0 | drawImage(QRect(p.x(), p.y(), -1, -1), image, sr, flags); |
813 | 0 | } |
814 | | |
815 | | |
816 | | inline void QPainter::drawImage(const QRectF &r, const QImage &image) |
817 | 0 | { |
818 | 0 | drawImage(r, image, QRect(0, 0, image.width(), image.height())); |
819 | 0 | } |
820 | | |
821 | | inline void QPainter::drawImage(const QRect &r, const QImage &image) |
822 | 0 | { |
823 | 0 | drawImage(r, image, QRectF(0, 0, image.width(), image.height())); |
824 | 0 | } |
825 | | |
826 | | inline void QPainter::drawImage(const QPoint &p, const QImage &image) |
827 | 379 | { |
828 | 379 | drawImage(QPointF(p), image); |
829 | 379 | } |
830 | | |
831 | | inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int sy, int sw, int sh, |
832 | | Qt::ImageConversionFlags flags) |
833 | 4.27M | { |
834 | 4.27M | if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == Qt::AutoColor) |
835 | 4.27M | drawImage(QPointF(x, y), image); |
836 | 0 | else |
837 | 0 | drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags); |
838 | 4.27M | } |
839 | | |
840 | | inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText) |
841 | 0 | { |
842 | 0 | drawStaticText(QPointF(p), staticText); |
843 | 0 | } |
844 | | |
845 | | inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText) |
846 | 0 | { |
847 | 0 | drawStaticText(QPointF(x, y), staticText); |
848 | 0 | } |
849 | | |
850 | | inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti) |
851 | 0 | { |
852 | 0 | drawTextItem(QPointF(p), ti); |
853 | 0 | } |
854 | | |
855 | | inline void QPainter::drawText(const QPoint &p, const QString &s) |
856 | 0 | { |
857 | 0 | drawText(QPointF(p), s); |
858 | 0 | } |
859 | | |
860 | | inline void QPainter::drawText(int x, int y, int w, int h, int flags, const QString &str, QRect *br) |
861 | 0 | { |
862 | 0 | drawText(QRect(x, y, w, h), flags, str, br); |
863 | 0 | } |
864 | | |
865 | | inline void QPainter::drawText(int x, int y, const QString &s) |
866 | 0 | { |
867 | 0 | drawText(QPointF(x, y), s); |
868 | 0 | } |
869 | | |
870 | | inline QRect QPainter::boundingRect(int x, int y, int w, int h, int flags, const QString &text) |
871 | 0 | { |
872 | 0 | return boundingRect(QRect(x, y, w, h), flags, text); |
873 | 0 | } |
874 | | |
875 | | inline void QPainter::translate(qreal dx, qreal dy) |
876 | 0 | { |
877 | 0 | translate(QPointF(dx, dy)); |
878 | 0 | } |
879 | | |
880 | | inline void QPainter::translate(const QPoint &offset) |
881 | 0 | { |
882 | 0 | translate(offset.x(), offset.y()); |
883 | 0 | } |
884 | | |
885 | | inline void QPainter::setViewport(int x, int y, int w, int h) |
886 | 0 | { |
887 | 0 | setViewport(QRect(x, y, w, h)); |
888 | 0 | } |
889 | | |
890 | | inline void QPainter::setWindow(int x, int y, int w, int h) |
891 | 0 | { |
892 | 0 | setWindow(QRect(x, y, w, h)); |
893 | 0 | } |
894 | | |
895 | | #ifndef QT_NO_PICTURE |
896 | | inline void QPainter::drawPicture(int x, int y, const QPicture &p) |
897 | 0 | { |
898 | 0 | drawPicture(QPoint(x, y), p); |
899 | 0 | } |
900 | | |
901 | | inline void QPainter::drawPicture(const QPoint &pt, const QPicture &p) |
902 | 0 | { |
903 | 0 | drawPicture(QPointF(pt), p); |
904 | 0 | } |
905 | | #endif |
906 | | |
907 | | QT_END_NAMESPACE |
908 | | |
909 | | #endif // QPAINTER_H |