1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.gui.painter;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.flags;
19 import qt.core.global;
20 import qt.core.line;
21 import qt.core.namespace;
22 import qt.core.objectdefs;
23 import qt.core.point;
24 import qt.core.rect;
25 import qt.core.scopedpointer;
26 import qt.core.string;
27 import qt.core.vector;
28 import qt.gui.brush;
29 import qt.gui.color;
30 import qt.gui.font;
31 import qt.gui.fontinfo;
32 import qt.gui.fontmetrics;
33 import qt.gui.image;
34 import qt.gui.matrix;
35 import qt.gui.paintdevice;
36 import qt.gui.paintengine;
37 import qt.gui.painterpath;
38 import qt.gui.pen;
39 import qt.gui.pixmap;
40 import qt.gui.polygon;
41 import qt.gui.region;
42 import qt.gui.statictext;
43 import qt.gui.textoption;
44 import qt.gui.transform;
45 import qt.helpers;
46 version(QT_NO_PICTURE){}else
47     import qt.gui.picture;
48 version(QT_NO_RAWFONT){}else
49     import qt.gui.glyphrun;
50 
51 /+ #ifndef QT_INCLUDE_COMPAT
52 #endif
53 
54 
55 
56 class QBrush;
57 class QFontInfo;
58 class QFontMetrics;
59 class QPaintDevice;
60 class QPainterPath; +/
61 extern(C++, class) struct QPainterPrivate;
62 /+ class QPen;
63 class QPolygon;
64 class QTextItem; +/
65 extern(C++, class) struct QTextEngine;
66 /+ class QTransform;
67 class QStaticText; +/
68 
69 extern(C++, class) struct QPainterPrivateDeleter;
70 
71 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPainter
72 {
73 private:
74     import qt.core.namespace;
75     /+ Q_DECLARE_PRIVATE(QPainter) +/
76     mixin(Q_GADGET);
77 
78 public:
79     enum RenderHint {
80         Antialiasing = 0x01,
81         TextAntialiasing = 0x02,
82         SmoothPixmapTransform = 0x04,
83 /+ #if QT_DEPRECATED_SINCE(5, 14) +/
84         HighQualityAntialiasing /+ Q_DECL_ENUMERATOR_DEPRECATED_X("Use Antialiasing instead") +/ = 0x08,
85         NonCosmeticDefaultPen /+ Q_DECL_ENUMERATOR_DEPRECATED_X("Default pen is non-cosmetic now") +/ = 0x10,
86 /+ #endif +/
87         Qt4CompatiblePainting = 0x20,
88         LosslessImageRendering = 0x40,
89     }
90     /+ Q_FLAG(RenderHint) +/
91 
92     /+ Q_DECLARE_FLAGS(RenderHints, RenderHint) +/
93 alias RenderHints = QFlags!(RenderHint);    /+ Q_FLAG(RenderHints) +/
94 
95     extern(C++, class) struct PixmapFragment {
96     public:
97         qreal x;
98         qreal y;
99         qreal sourceLeft;
100         qreal sourceTop;
101         qreal width;
102         qreal height;
103         qreal scaleX;
104         qreal scaleY;
105         qreal rotation;
106         qreal opacity;
107         /+ static PixmapFragment Q_GUI_EXPORT create(const QPointF &pos, const QRectF &sourceRect,
108                                             qreal scaleX = 1, qreal scaleY = 1,
109                                             qreal rotation = 0, qreal opacity = 1); +/
110     }
111 
112     enum PixmapFragmentHint {
113         OpaqueHint = 0x01
114     }
115 
116     /+ Q_DECLARE_FLAGS(PixmapFragmentHints, PixmapFragmentHint) +/
117 alias PixmapFragmentHints = QFlags!(PixmapFragmentHint);
118     @disable this();
119     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
120     ref typeof(this) rawConstructor();
121     static typeof(this) create()
122     {
123         typeof(this) r = typeof(this).init;
124         r.rawConstructor();
125         return r;
126     }
127 
128     /+ explicit +/this(QPaintDevice );
129     /+ explicit +/this(QPaintDeviceInterface dev)
130     {
131         this(cast(QPaintDevice)cast(void*)dev);
132     }
133     ~this();
134 
135     QPaintDevice device() const;
136 
137     bool begin(QPaintDevice );
138     bool end();
139     bool isActive() const;
140 
141 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
142     /+ QT_DEPRECATED_X("Use begin(QPaintDevice*) instead") +/
143         void initFrom(const(QPaintDevice) device);
144 /+ #endif +/
145 
146     enum CompositionMode {
147         CompositionMode_SourceOver,
148         CompositionMode_DestinationOver,
149         CompositionMode_Clear,
150         CompositionMode_Source,
151         CompositionMode_Destination,
152         CompositionMode_SourceIn,
153         CompositionMode_DestinationIn,
154         CompositionMode_SourceOut,
155         CompositionMode_DestinationOut,
156         CompositionMode_SourceAtop,
157         CompositionMode_DestinationAtop,
158         CompositionMode_Xor,
159 
160         //svg 1.2 blend modes
161         CompositionMode_Plus,
162         CompositionMode_Multiply,
163         CompositionMode_Screen,
164         CompositionMode_Overlay,
165         CompositionMode_Darken,
166         CompositionMode_Lighten,
167         CompositionMode_ColorDodge,
168         CompositionMode_ColorBurn,
169         CompositionMode_HardLight,
170         CompositionMode_SoftLight,
171         CompositionMode_Difference,
172         CompositionMode_Exclusion,
173 
174         // ROPs
175         RasterOp_SourceOrDestination,
176         RasterOp_SourceAndDestination,
177         RasterOp_SourceXorDestination,
178         RasterOp_NotSourceAndNotDestination,
179         RasterOp_NotSourceOrNotDestination,
180         RasterOp_NotSourceXorDestination,
181         RasterOp_NotSource,
182         RasterOp_NotSourceAndDestination,
183         RasterOp_SourceAndNotDestination,
184         RasterOp_NotSourceOrDestination,
185         RasterOp_SourceOrNotDestination,
186         RasterOp_ClearDestination,
187         RasterOp_SetDestination,
188         RasterOp_NotDestination
189     }
190     void setCompositionMode(CompositionMode mode);
191     CompositionMode compositionMode() const;
192 
193     ref const(QFont) font() const;
194     void setFont(ref const(QFont) f);
195 
196     QFontMetrics fontMetrics() const;
197     QFontInfo fontInfo() const;
198 
199     void setPen(ref const(QColor) color);
200     void setPen(ref const(QPen) pen);
201     void setPen(/+ Qt:: +/qt.core.namespace.PenStyle style);
202     ref const(QPen) pen() const;
203 
204     void setBrush(ref const(QBrush) brush);
205     void setBrush(/+ Qt:: +/qt.core.namespace.BrushStyle style);
206     ref const(QBrush) brush() const;
207 
208     // attributes/modes
209     void setBackgroundMode(/+ Qt:: +/qt.core.namespace.BGMode mode);
210     /+ Qt:: +/qt.core.namespace.BGMode backgroundMode() const;
211 
212     QPoint brushOrigin() const;
213     pragma(inline, true) void setBrushOrigin(int x, int y)
214     {
215         auto tmp = QPoint(x, y); setBrushOrigin(tmp);
216     }
217     pragma(inline, true) void setBrushOrigin(ref const(QPoint) p)
218     {
219         auto tmp = QPointF(p); setBrushOrigin(tmp);
220     }
221     void setBrushOrigin(ref const(QPointF) );
222 
223     void setBackground(ref const(QBrush) bg);
224     ref const(QBrush) background() const;
225 
226     qreal opacity() const;
227     void setOpacity(qreal opacity);
228 
229     // Clip functions
230     QRegion clipRegion() const;
231     QPainterPath clipPath() const;
232 
233     void setClipRect(ref const(QRectF) , /+ Qt:: +/qt.core.namespace.ClipOperation op = /+ Qt:: +/qt.core.namespace.ClipOperation.ReplaceClip);
234     void setClipRect(ref const(QRect) , /+ Qt:: +/qt.core.namespace.ClipOperation op = /+ Qt:: +/qt.core.namespace.ClipOperation.ReplaceClip);
235     pragma(inline, true) void setClipRect(int x, int y, int w, int h, /+ Qt:: +/qt.core.namespace.ClipOperation op = /+ Qt:: +/qt.core.namespace.ClipOperation.ReplaceClip)
236     {
237         auto tmp = QRect(x, y, w, h); setClipRect(tmp, op);
238     }
239 
240     void setClipRegion(ref const(QRegion) , /+ Qt:: +/qt.core.namespace.ClipOperation op = /+ Qt:: +/qt.core.namespace.ClipOperation.ReplaceClip);
241 
242     void setClipPath(ref const(QPainterPath) path, /+ Qt:: +/qt.core.namespace.ClipOperation op = /+ Qt:: +/qt.core.namespace.ClipOperation.ReplaceClip);
243 
244     void setClipping(bool enable);
245     bool hasClipping() const;
246 
247     QRectF clipBoundingRect() const;
248 
249     void save();
250     void restore();
251 
252     // XForm functions
253 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
254     /+ QT_DEPRECATED_X("Use setTransform() instead") +/
255         void setMatrix(ref const(QMatrix) matrix, bool combine = false);
256     /+ QT_DEPRECATED_X("Use transform() instead") +/
257         ref const(QMatrix) matrix() const;
258     /+ QT_DEPRECATED_X("Use deviceTransform() instead") +/
259         ref const(QMatrix) deviceMatrix() const;
260     /+ QT_DEPRECATED_X("Use resetTransform() instead") +/
261         void resetMatrix();
262 /+ #endif +/
263 
264     void setTransform(ref const(QTransform) transform, bool combine = false);
265     ref const(QTransform) transform() const;
266     ref const(QTransform) deviceTransform() const;
267     void resetTransform();
268 
269 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
270     /+ QT_DEPRECATED_X("Use setWorldTransform() instead") +/
271         void setWorldMatrix(ref const(QMatrix) matrix, bool combine = false);
272     /+ QT_DEPRECATED_X("Use worldTransform() instead") +/
273         ref const(QMatrix) worldMatrix() const;
274     /+ QT_DEPRECATED_X("Use combinedTransform() instead") +/
275         QMatrix combinedMatrix() const;
276     /+ QT_DEPRECATED_X("Use setWorldMatrixEnabled() instead") +/
277         void setMatrixEnabled(bool enabled);
278     /+ QT_DEPRECATED_X("Use worldMatrixEnabled() instead") +/
279         bool matrixEnabled() const;
280 /+ #endif +/
281 
282     void setWorldTransform(ref const(QTransform) matrix, bool combine = false);
283     ref const(QTransform) worldTransform() const;
284 
285     QTransform combinedTransform() const;
286 
287     void setWorldMatrixEnabled(bool enabled);
288     bool worldMatrixEnabled() const;
289 
290     void scale(qreal sx, qreal sy);
291     void shear(qreal sh, qreal sv);
292     void rotate(qreal a);
293 
294     void translate(ref const(QPointF) offset);
295     pragma(inline, true) void translate(ref const(QPoint) offset)
296     {
297         translate(offset.x(), offset.y());
298     }
299     pragma(inline, true) void translate(qreal dx, qreal dy)
300     {
301         auto tmp = QPointF(dx, dy); translate(tmp);
302     }
303 
304     QRect window() const;
305     void setWindow(ref const(QRect) window);
306     pragma(inline, true) void setWindow(int x, int y, int w, int h)
307     {
308         auto tmp = QRect(x, y, w, h); setWindow(tmp);
309     }
310 
311     QRect viewport() const;
312     void setViewport(ref const(QRect) viewport);
313     pragma(inline, true) void setViewport(int x, int y, int w, int h)
314     {
315         auto tmp = QRect(x, y, w, h); setViewport(tmp);
316     }
317 
318     void setViewTransformEnabled(bool enable);
319     bool viewTransformEnabled() const;
320 
321     // drawing functions
322     void strokePath(ref const(QPainterPath) path, ref const(QPen) pen);
323     void fillPath(ref const(QPainterPath) path, ref const(QBrush) brush);
324     void drawPath(ref const(QPainterPath) path);
325 
326     pragma(inline, true) void drawPoint(ref const(QPointF) p)
327     {
328         drawPoints(&p, 1);
329     }
330     pragma(inline, true) void drawPoint(ref const(QPoint) p)
331     {
332         drawPoints(&p, 1);
333     }
334     pragma(inline, true) void drawPoint(int x, int y)
335     {
336         auto p = QPoint(x, y);
337         drawPoints(&p, 1);
338     }
339 
340     void drawPoints(const(QPointF)* points, int pointCount);
341     pragma(inline, true) void drawPoints(ref const(QPolygonF) points)
342     {
343         drawPoints(points.constData(), points.size());
344     }
345     void drawPoints(const(QPoint)* points, int pointCount);
346     pragma(inline, true) void drawPoints(ref const(QPolygon) points)
347     {
348         drawPoints(points.constData(), points.size());
349     }
350 
351     //
352     // functions
353     //
354     pragma(inline, true) void drawLine(ref const(QLineF) l)
355     {
356         drawLines(&l, 1);
357     }
358     pragma(inline, true) void drawLine(ref const(QLine) line)
359     {
360         drawLines(&line, 1);
361     }
362     pragma(inline, true) void drawLine(int x1, int y1, int x2, int y2)
363     {
364         auto l = QLine(x1, y1, x2, y2);
365         drawLines(&l, 1);
366     }
367     pragma(inline, true) void drawLine(ref const(QPoint) p1, ref const(QPoint) p2)
368     {
369         auto l = QLine(p1, p2);
370         drawLines(&l, 1);
371     }
372     pragma(inline, true) void drawLine(ref const(QPointF) p1, ref const(QPointF) p2)
373     {
374         auto tmp = QLineF(p1, p2); drawLine(tmp);
375     }
376 
377     void drawLines(const(QLineF)* lines, int lineCount);
378     pragma(inline, true) void drawLines(ref const(QVector!(QLineF)) lines)
379     {
380         drawLines(lines.constData(), lines.size());
381     }
382     void drawLines(const(QPointF)* pointPairs, int lineCount);
383     pragma(inline, true) void drawLines(ref const(QVector!(QPointF)) pointPairs)
384     {
385         drawLines(pointPairs.constData(), pointPairs.size() / 2);
386     }
387     void drawLines(const(QLine)* lines, int lineCount);
388     pragma(inline, true) void drawLines(ref const(QVector!(QLine)) lines)
389     {
390         drawLines(lines.constData(), lines.size());
391     }
392     void drawLines(const(QPoint)* pointPairs, int lineCount);
393     pragma(inline, true) void drawLines(ref const(QVector!(QPoint)) pointPairs)
394     {
395         drawLines(pointPairs.constData(), pointPairs.size() / 2);
396     }
397 
398     pragma(inline, true) void drawRect(ref const(QRectF) rect)
399     {
400         drawRects(&rect, 1);
401     }
402     pragma(inline, true) void drawRect(int x, int y, int w, int h)
403     {
404         auto r = QRect(x, y, w, h);
405         drawRects(&r, 1);
406     }
407     pragma(inline, true) void drawRect(ref const(QRect) r)
408     {
409         drawRects(&r, 1);
410     }
411 
412     void drawRects(const(QRectF)* rects, int rectCount);
413     pragma(inline, true) void drawRects(ref const(QVector!(QRectF)) rects)
414     {
415         drawRects(rects.constData(), rects.size());
416     }
417     void drawRects(const(QRect)* rects, int rectCount);
418     pragma(inline, true) void drawRects(ref const(QVector!(QRect)) rects)
419     {
420         drawRects(rects.constData(), rects.size());
421     }
422 
423     void drawEllipse(ref const(QRectF) r);
424     void drawEllipse(ref const(QRect) r);
425     pragma(inline, true) void drawEllipse(int x, int y, int w, int h)
426     {
427         auto tmp = QRect(x, y, w, h); drawEllipse(tmp);
428     }
429 
430     pragma(inline, true) void drawEllipse(ref const(QPointF) center, qreal rx, qreal ry)
431     {
432         auto tmp = QRectF(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry); drawEllipse(tmp);
433     }
434     pragma(inline, true) void drawEllipse(ref const(QPoint) center, int rx, int ry)
435     {
436         auto tmp = QRect(center.x() - rx, center.y() - ry, 2 * rx, 2 * ry); drawEllipse(tmp);
437     }
438 
439     void drawPolyline(const(QPointF)* points, int pointCount);
440     pragma(inline, true) void drawPolyline(ref const(QPolygonF) polyline)
441     {
442         drawPolyline(polyline.constData(), polyline.size());
443     }
444     void drawPolyline(const(QPoint)* points, int pointCount);
445     pragma(inline, true) void drawPolyline(ref const(QPolygon) polyline)
446     {
447         drawPolyline(polyline.constData(), polyline.size());
448     }
449 
450     void drawPolygon(const(QPointF)* points, int pointCount, /+ Qt:: +/qt.core.namespace.FillRule fillRule = /+ Qt:: +/qt.core.namespace.FillRule.OddEvenFill);
451     pragma(inline, true) void drawPolygon(ref const(QPolygonF) polygon, /+ Qt:: +/qt.core.namespace.FillRule fillRule = /+ Qt:: +/qt.core.namespace.FillRule.OddEvenFill)
452     {
453         drawPolygon(polygon.constData(), polygon.size(), fillRule);
454     }
455     void drawPolygon(const(QPoint)* points, int pointCount, /+ Qt:: +/qt.core.namespace.FillRule fillRule = /+ Qt:: +/qt.core.namespace.FillRule.OddEvenFill);
456     pragma(inline, true) void drawPolygon(ref const(QPolygon) polygon, /+ Qt:: +/qt.core.namespace.FillRule fillRule = /+ Qt:: +/qt.core.namespace.FillRule.OddEvenFill)
457     {
458         drawPolygon(polygon.constData(), polygon.size(), fillRule);
459     }
460 
461     void drawConvexPolygon(const(QPointF)* points, int pointCount);
462     pragma(inline, true) void drawConvexPolygon(ref const(QPolygonF) poly)
463     {
464         drawConvexPolygon(poly.constData(), poly.size());
465     }
466     void drawConvexPolygon(const(QPoint)* points, int pointCount);
467     pragma(inline, true) void drawConvexPolygon(ref const(QPolygon) poly)
468     {
469         drawConvexPolygon(poly.constData(), poly.size());
470     }
471 
472     void drawArc(ref const(QRectF) rect, int a, int alen);
473     pragma(inline, true) void drawArc(ref const(QRect) r, int a, int alen)
474     {
475         auto tmp = QRectF(r); drawArc(tmp, a, alen);
476     }
477     pragma(inline, true) void drawArc(int x, int y, int w, int h, int a, int alen)
478     {
479         auto tmp = QRectF(x, y, w, h); drawArc(tmp, a, alen);
480     }
481 
482     void drawPie(ref const(QRectF) rect, int a, int alen);
483     pragma(inline, true) void drawPie(int x, int y, int w, int h, int a, int alen)
484     {
485         auto tmp = QRectF(x, y, w, h); drawPie(tmp, a, alen);
486     }
487     pragma(inline, true) void drawPie(ref const(QRect) rect, int a, int alen)
488     {
489         auto tmp = QRectF(rect); drawPie(tmp, a, alen);
490     }
491 
492     void drawChord(ref const(QRectF) rect, int a, int alen);
493     pragma(inline, true) void drawChord(int x, int y, int w, int h, int a, int alen)
494     {
495         auto tmp = QRectF(x, y, w, h); drawChord(tmp, a, alen);
496     }
497     pragma(inline, true) void drawChord(ref const(QRect) rect, int a, int alen)
498     {
499         auto tmp = QRectF(rect); drawChord(tmp, a, alen);
500     }
501 
502     void drawRoundedRect(ref const(QRectF) rect, qreal xRadius, qreal yRadius,
503                              /+ Qt:: +/qt.core.namespace.SizeMode mode = /+ Qt:: +/qt.core.namespace.SizeMode.AbsoluteSize);
504     pragma(inline, true) void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
505                                     /+ Qt:: +/qt.core.namespace.SizeMode mode = /+ Qt:: +/qt.core.namespace.SizeMode.AbsoluteSize)
506     {
507         auto tmp = QRectF(x, y, w, h); drawRoundedRect(tmp, xRadius, yRadius, mode);
508     }
509     pragma(inline, true) void drawRoundedRect(ref const(QRect) rect, qreal xRadius, qreal yRadius,
510                                     /+ Qt:: +/qt.core.namespace.SizeMode mode = /+ Qt:: +/qt.core.namespace.SizeMode.AbsoluteSize)
511     {
512         auto tmp = QRectF(rect); drawRoundedRect(tmp, xRadius, yRadius, mode);
513     }
514 
515 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
516     /+ QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead") +/
517         void drawRoundRect(ref const(QRectF) r, int xround = 25, int yround = 25);
518     /+ QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead") +/
519         void drawRoundRect(int x, int y, int w, int h, int /+ = 25 +/, int /+ = 25 +/);
520     /+ QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead") +/
521         void drawRoundRect(ref const(QRect) r, int xround = 25, int yround = 25);
522 /+ #endif +/
523 
524     void drawTiledPixmap(ref const(QRectF) rect, ref const(QPixmap) pm, ref const(QPointF) offset = globalInitVar!QPointF);
525     pragma(inline, true) void drawTiledPixmap(int x, int y, int w, int h, ref const(QPixmap) pm, int sx=0, int sy=0)
526     {
527         auto tmp = QRectF(x, y, w, h); auto tmp__1 = QPointF(sx, sy); drawTiledPixmap(tmp, pm, tmp__1);
528     }
529     pragma(inline, true) void drawTiledPixmap(ref const(QRect) rect, ref const(QPixmap) pm, ref const(QPoint) offset /+ = QPoint() +/)
530     {
531         auto tmp = QRectF(rect); auto tmp__1 = QPointF(offset); drawTiledPixmap(tmp, pm, tmp__1);
532     }
533     version(QT_NO_PICTURE){}else
534     {
535         void drawPicture(ref const(QPointF) p, ref const(QPicture) picture);
536         pragma(inline, true) void drawPicture(int x, int y, ref const(QPicture) p)
537         {
538             auto tmp = QPoint(x, y); drawPicture(tmp, p);
539         }
540         pragma(inline, true) void drawPicture(ref const(QPoint) pt, ref const(QPicture) p)
541         {
542             auto tmp = QPointF(pt); drawPicture(tmp, p);
543         }
544     }
545 
546     void drawPixmap(ref const(QRectF) targetRect, ref const(QPixmap) pixmap, ref const(QRectF) sourceRect);
547     pragma(inline, true) void drawPixmap(ref const(QRect) targetRect, ref const(QPixmap) pixmap, ref const(QRect) sourceRect)
548     {
549         auto tmp = QRectF(targetRect); auto tmp__1 = QRectF(sourceRect); drawPixmap(tmp, pixmap, tmp__1);
550     }
551     pragma(inline, true) void drawPixmap(int x, int y, int w, int h, ref const(QPixmap) pm,
552                                int sx, int sy, int sw, int sh)
553     {
554         auto tmp = QRectF(x, y, w, h); auto tmp__1 = QRectF(sx, sy, sw, sh); drawPixmap(tmp, pm, tmp__1);
555     }
556     pragma(inline, true) void drawPixmap(int x, int y, ref const(QPixmap) pm,
557                                int sx, int sy, int sw, int sh)
558     {
559         auto tmp = QRectF(x, y, -1, -1); auto tmp__1 = QRectF(sx, sy, sw, sh); drawPixmap(tmp, pm, tmp__1);
560     }
561     pragma(inline, true) void drawPixmap(ref const(QPointF) p, ref const(QPixmap) pm, ref const(QRectF) sr)
562     {
563         auto tmp = QRectF(p.x(), p.y(), -1, -1); drawPixmap(tmp, pm, sr);
564     }
565     pragma(inline, true) void drawPixmap(ref const(QPoint) p, ref const(QPixmap) pm, ref const(QRect) sr)
566     {
567         auto tmp = QRectF(p.x(), p.y(), -1, -1); auto tmp2 = QRectF(sr); drawPixmap(tmp, pm, tmp2);
568     }
569     void drawPixmap(ref const(QPointF) p, ref const(QPixmap) pm);
570     pragma(inline, true) void drawPixmap(ref const(QPoint) p, ref const(QPixmap) pm)
571     {
572         auto tmp = QPointF(p); drawPixmap(tmp, pm);
573     }
574     pragma(inline, true) void drawPixmap(int x, int y, ref const(QPixmap) pm)
575     {
576         auto tmp = QPointF(x, y); drawPixmap(tmp, pm);
577     }
578     pragma(inline, true) void drawPixmap(ref const(QRect) r, ref const(QPixmap) pm)
579     {
580         auto tmp = QRectF(r); auto tmp__1 = QRectF(); drawPixmap(tmp, pm, tmp__1);
581     }
582     pragma(inline, true) void drawPixmap(int x, int y, int w, int h, ref const(QPixmap) pm)
583     {
584         auto tmp = QRectF(x, y, w, h); auto tmp__1 = QRectF(); drawPixmap(tmp, pm, tmp__1);
585     }
586 
587     void drawPixmapFragments(const(PixmapFragment)* fragments, int fragmentCount,
588                                  ref const(QPixmap) pixmap, PixmapFragmentHints hints = PixmapFragmentHints());
589 
590     void drawImage(ref const(QRectF) targetRect, ref const(QImage) image, ref const(QRectF) sourceRect,
591                        /+ Qt:: +/qt.core.namespace.ImageConversionFlags flags = /+ Qt:: +/qt.core.namespace.ImageConversionFlag.AutoColor);
592     pragma(inline, true) void drawImage(ref const(QRect) targetRect, ref const(QImage) image, ref const(QRect) sourceRect,
593                               /+ Qt:: +/qt.core.namespace.ImageConversionFlags flags = /+ Qt:: +/qt.core.namespace.ImageConversionFlag.AutoColor)
594     {
595         auto tmp = QRectF(targetRect); auto tmp__1 = QRectF(sourceRect); drawImage(tmp, image, tmp__1, flags);
596     }
597     pragma(inline, true) void drawImage(ref const(QPointF) p, ref const(QImage) image, ref const(QRectF) sr,
598                               /+ Qt:: +/qt.core.namespace.ImageConversionFlags flags = /+ Qt:: +/qt.core.namespace.ImageConversionFlag.AutoColor)
599     {
600         auto tmp = QRectF(p.x(), p.y(), -1, -1); drawImage(tmp, image, sr, flags);
601     }
602     pragma(inline, true) void drawImage(ref const(QPoint) p, ref const(QImage) image, ref const(QRect) sr,
603                               /+ Qt:: +/qt.core.namespace.ImageConversionFlags flags = /+ Qt:: +/qt.core.namespace.ImageConversionFlag.AutoColor)
604     {
605         auto tmp = QRect(p.x(), p.y(), -1, -1); drawImage(tmp, image, sr, flags);
606     }
607     pragma(inline, true) void drawImage(ref const(QRectF) r, ref const(QImage) image)
608     {
609         auto tmp = QRectF(0, 0, image.width(), image.height()); drawImage(r, image, tmp);
610     }
611     pragma(inline, true) void drawImage(ref const(QRect) r, ref const(QImage) image)
612     {
613         auto tmp0 = QRectF(r); auto tmp = QRectF(0, 0, image.width(), image.height()); drawImage(tmp0, image, tmp);
614     }
615     void drawImage(ref const(QPointF) p, ref const(QImage) image);
616     pragma(inline, true) void drawImage(ref const(QPoint) p, ref const(QImage) image)
617     {
618         auto tmp = QPointF(p); drawImage(tmp, image);
619     }
620     pragma(inline, true) void drawImage(int x, int y, ref const(QImage) image, int sx = 0, int sy = 0,
621                               int sw = -1, int sh = -1, /+ Qt:: +/qt.core.namespace.ImageConversionFlags flags = /+ Qt:: +/qt.core.namespace.ImageConversionFlag.AutoColor)
622     {
623         if (sx == 0 && sy == 0 && sw == -1 && sh == -1 && flags == /+ Qt:: +/qt.core.namespace.ImageConversionFlags.AutoColor)
624             { auto tmp = QPointF(x, y); drawImage(tmp, image);}
625         else
626             { auto tmp__1 = QRectF(x, y, -1, -1); auto tmp__2 = QRectF(sx, sy, sw, sh); drawImage(tmp__1, image, tmp__2, flags);}
627     }
628 
629     void setLayoutDirection(/+ Qt:: +/qt.core.namespace.LayoutDirection direction);
630     /+ Qt:: +/qt.core.namespace.LayoutDirection layoutDirection() const;
631 
632     version(QT_NO_RAWFONT){}else
633     {
634         void drawGlyphRun(ref const(QPointF) position, ref const(QGlyphRun) glyphRun);
635     }
636 
637     void drawStaticText(ref const(QPointF) topLeftPosition, ref const(QStaticText) staticText);
638     pragma(inline, true) void drawStaticText(ref const(QPoint) p, ref const(QStaticText) staticText)
639     {
640         auto tmp = QPointF(p); drawStaticText(tmp, staticText);
641     }
642     pragma(inline, true) void drawStaticText(int x, int y, ref const(QStaticText) staticText)
643     {
644         auto tmp = QPointF(x, y); drawStaticText(tmp, staticText);
645     }
646 
647     void drawText(ref const(QPointF) p, ref const(QString) s);
648     pragma(inline, true) void drawText(ref const(QPoint) p, ref const(QString) s)
649     {
650         auto tmp = QPointF(p); drawText(tmp, s);
651     }
652     pragma(inline, true) void drawText(int x, int y, ref const(QString) s)
653     {
654         auto tmp = QPointF(x, y); drawText(tmp, s);
655     }
656 
657     void drawText(ref const(QPointF) p, ref const(QString) str, int tf, int justificationPadding);
658 
659     void drawText(ref const(QRectF) r, int flags, ref const(QString) text, QRectF* br = null);
660     void drawText(ref const(QRect) r, int flags, ref const(QString) text, QRect* br = null);
661     pragma(inline, true) void drawText(int x, int y, int w, int h, int flags, ref const(QString) str, QRect* br = null)
662     {
663         auto tmp = QRect(x, y, w, h); drawText(tmp, flags, str, br);
664     }
665 
666     void drawText(ref const(QRectF) r, ref const(QString) text, ref const(QTextOption) o = globalInitVar!QTextOption);
667 
668     QRectF boundingRect(ref const(QRectF) rect, int flags, ref const(QString) text);
669     QRect boundingRect(ref const(QRect) rect, int flags, ref const(QString) text);
670     pragma(inline, true) QRect boundingRect(int x, int y, int w, int h, int flags, ref const(QString) text)
671     {
672         auto tmp = QRect(x, y, w, h); return boundingRect(tmp, flags, text);
673     }
674 
675     QRectF boundingRect(ref const(QRectF) rect, ref const(QString) text, ref const(QTextOption) o = globalInitVar!QTextOption);
676 
677     void drawTextItem(ref const(QPointF) p, ref const(QTextItem) ti);
678     pragma(inline, true) void drawTextItem(int x, int y, ref const(QTextItem) ti)
679     {
680         auto tmp = QPointF(x, y); drawTextItem(tmp, ti);
681     }
682     pragma(inline, true) void drawTextItem(ref const(QPoint) p, ref const(QTextItem) ti)
683     {
684         auto tmp = QPointF(p); drawTextItem(tmp, ti);
685     }
686 
687     void fillRect(ref const(QRectF) , ref const(QBrush) );
688     pragma(inline, true) void fillRect(int x, int y, int w, int h, ref const(QBrush) b)
689     {
690         auto tmp = QRect(x, y, w, h); fillRect(tmp, b);
691     }
692     void fillRect(ref const(QRect) , ref const(QBrush) );
693 
694     void fillRect(ref const(QRectF) , ref const(QColor) color);
695     pragma(inline, true) void fillRect(int x, int y, int w, int h, ref const(QColor) b)
696     {
697         auto tmp = QRect(x, y, w, h); fillRect(tmp, b);
698     }
699     void fillRect(ref const(QRect) , ref const(QColor) color);
700 
701     pragma(inline, true) void fillRect(int x, int y, int w, int h, /+ Qt:: +/qt.core.namespace.GlobalColor c)
702     {
703         auto tmp = QRect(x, y, w, h); auto tmp__1 = QColor(c); fillRect(tmp, tmp__1);
704     }
705     pragma(inline, true) void fillRect(ref const(QRect) r, /+ Qt:: +/qt.core.namespace.GlobalColor c)
706     {
707         auto tmp = QColor(c); fillRect(r, tmp);
708     }
709     pragma(inline, true) void fillRect(ref const(QRectF) r, /+ Qt:: +/qt.core.namespace.GlobalColor c)
710     {
711         auto tmp = QColor(c); fillRect(r, tmp);
712     }
713 
714     pragma(inline, true) void fillRect(int x, int y, int w, int h, /+ Qt:: +/qt.core.namespace.BrushStyle style)
715     {
716         auto tmp = QRectF(x, y, w, h); auto tmp__1 = QBrush(style); fillRect(tmp, tmp__1);
717     }
718     pragma(inline, true) void fillRect(ref const(QRect) r, /+ Qt:: +/qt.core.namespace.BrushStyle style)
719     {
720         auto tmp = QRectF(r); auto tmp__1 = QBrush(style); fillRect(tmp, tmp__1);
721     }
722     pragma(inline, true) void fillRect(ref const(QRectF) r, /+ Qt:: +/qt.core.namespace.BrushStyle style)
723     {
724         auto tmp = QBrush(style); fillRect(r, tmp);
725     }
726 
727 /+    pragma(inline, true) void fillRect(int x, int y, int w, int h, QGradient.Preset p)
728     {
729         auto tmp = QRect(x, y, w, h); auto tmp2 = QGradient(p); fillRect(tmp, tmp2);
730     }
731     pragma(inline, true) void fillRect(ref const(QRect) r, QGradient.Preset p)
732     {
733         auto tmp = QGradient(p); fillRect(r, tmp);
734     }
735     pragma(inline, true) void fillRect(ref const(QRectF) r, QGradient.Preset p)
736     {
737         auto tmp = QGradient(p); fillRect(r, tmp);
738     }+/
739 
740     void eraseRect(ref const(QRectF) );
741     pragma(inline, true) void eraseRect(int x, int y, int w, int h)
742     {
743         auto tmp = QRectF(x, y, w, h); eraseRect(tmp);
744     }
745     pragma(inline, true) void eraseRect(ref const(QRect) rect)
746     {
747         auto tmp = QRectF(rect); eraseRect(tmp);
748     }
749 
750     void setRenderHint(RenderHint hint, bool on = true);
751     void setRenderHints(RenderHints hints, bool on = true);
752     RenderHints renderHints() const;
753     pragma(inline, true) bool testRenderHint(RenderHint hint) const { return cast(bool)(renderHints() & hint); }
754 
755     QPaintEngine paintEngine() const;
756 
757 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
758     /+ QT_DEPRECATED_X("Use QWidget::render() instead") +/
759         static void setRedirected(const(QPaintDevice) device, QPaintDevice replacement,
760                                   ref const(QPoint) offset = globalInitVar!QPoint);
761     /+ QT_DEPRECATED_X("Use QWidget::render() instead") +/
762         static QPaintDevice redirected(const(QPaintDevice) device, QPoint* offset = null);
763     /+ QT_DEPRECATED_X("Use QWidget::render() instead") +/
764         static void restoreRedirected(const(QPaintDevice) device);
765 /+ #endif +/
766 
767     void beginNativePainting();
768     void endNativePainting();
769 
770 private:
771     /+ Q_DISABLE_COPY(QPainter) +/
772 @disable this(this);
773 /+this(ref const(QPainter));+//+ref QPainter operator =(ref const(QPainter));+/
774     QScopedPointer!(QPainterPrivate) d_ptr;
775 
776     /+ friend class QWidget; +/
777     /+ friend class QFontEngine; +/
778     /+ friend class QFontEngineBox; +/
779     /+ friend class QFontEngineFT; +/
780     /+ friend class QFontEngineMac; +/
781     /+ friend class QFontEngineWin; +/
782     /+ friend class QPaintEngine; +/
783     /+ friend class QPaintEngineExPrivate; +/
784     /+ friend class QOpenGLPaintEngine; +/
785     /+ friend class QWin32PaintEngine; +/
786     /+ friend class QWin32PaintEnginePrivate; +/
787     /+ friend class QRasterPaintEngine; +/
788     /+ friend class QAlphaPaintEngine; +/
789     /+ friend class QPreviewPaintEngine; +/
790     /+ friend class QTextEngine; +/
791 }
792 /+pragma(inline, true) QFlags!(QPainter.RenderHints.enum_type) operator |(QPainter.RenderHints.enum_type f1, QPainter.RenderHints.enum_type f2)/+noexcept+/{return QFlags!(QPainter.RenderHints.enum_type)(f1)|f2;}+/
793 /+pragma(inline, true) QFlags!(QPainter.RenderHints.enum_type) operator |(QPainter.RenderHints.enum_type f1, QFlags!(QPainter.RenderHints.enum_type) f2)/+noexcept+/{return f2|f1;}+/
794 /+pragma(inline, true) QIncompatibleFlag operator |(QPainter.RenderHints.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
795 /+ Q_DECLARE_TYPEINFO(QPainter::PixmapFragment, Q_RELOCATABLE_TYPE);
796 
797 Q_DECLARE_OPERATORS_FOR_FLAGS(QPainter::RenderHints)
798 
799 #ifndef QT_NO_PICTURE
800 #endif +/
801