5#include <CoreGraphics/CoreGraphics.h>
14#include <private/qpaintengine_raster_p.h>
23#include <qpa/qplatformpixmap.h>
25#include <private/qfont_p.h>
26#include <private/qfontengine_p.h>
27#include <private/qfontengine_coretext_p.h>
28#include <private/qnumeric_p.h>
29#include <private/qpainter_p.h>
30#include <private/qpainterpath_p.h>
31#include <private/qtextengine_p.h>
32#include <private/qcoregraphics_p.h>
44 free(
const_cast<void *
>(memoryToFree));
55 const uint nbytes = sw * sh;
61 srow = sptr + (
y * (sbpr / 4));
62 for (
int x = sx;
x < sw; ++
x)
66 return CGImageMaskCreate(sw, sh, 8, 8, nbytes / sh, provider,
nullptr,
false);
72 return CGAffineTransformMake(
t.m11(),
t.m12(),
t.m21(),
t.m22(),
t.dx(),
t.dy());
91#ifdef QT_MAC_USE_NATIVE_GRADIENTS
92static bool drawGradientNatively(
const QGradient *gradient)
104 const int n = stops.
count();
111 while (
i !=
end &&
i->first <
p)
117 }
else if (
i ==
end) {
118 c = (
end - 1)->second.rgba();
124 QRgb c1 =
s1.second.rgba();
126 int idist = 256 * (
p -
p1) / (
p2 -
p1);
127 int dist = 256 - idist;
144 static bool inReset =
false;
149 CGAffineTransform old_xform = CGContextGetCTM(
hd);
152 CGContextConcatCTM(
hd, CGAffineTransformInvert(old_xform));
159 CGContextConcatCTM(
hd, CGAffineTransformInvert(CGContextGetCTM(
hd)));
160 CGContextConcatCTM(
hd, old_xform);
165 return CGRectMake(
r.x()+off,
r.y()+off,
r.width(),
r.height());
170 CGMutablePathRef
ret = CGPathCreateMutable();
172 for (
int i=0;
i<
p.elementCount(); ++
i) {
177 &&
p.elementAt(
i - 1).x == startPt.
x()
178 &&
p.elementAt(
i - 1).y == startPt.
y())
179 CGPathCloseSubpath(
ret);
181 CGPathMoveToPoint(
ret, 0, elm.
x+off, elm.
y+off);
184 CGPathAddLineToPoint(
ret, 0, elm.
x+off, elm.
y+off);
189 CGPathAddCurveToPoint(
ret, 0,
190 elm.
x+off, elm.
y+off,
191 p.elementAt(
i+1).x+off,
p.elementAt(
i+1).y+off,
192 p.elementAt(
i+2).x+off,
p.elementAt(
i+2).y+off);
196 qFatal(
"QCoreGraphicsPaintEngine::drawPath(), unhandled type: %d", elm.
type);
201 &&
p.elementAt(
p.elementCount() - 1).x == startPt.
x()
202 &&
p.elementAt(
p.elementCount() - 1).y == startPt.
y())
203 CGPathCloseSubpath(
ret);
209# define QMACPATTERN_MASK_MULTIPLIER 32
211# define QMACPATTERN_MASK_MULTIPLIER 1
220 return CGImageGetWidth(
image);
223 return data.pixmap.width();
227 return CGImageGetHeight(
image);
230 return data.pixmap.height();
253#if (QMACPATTERN_MASK_MULTIPLIER == 1)
254 CGDataProviderRef provider = CGDataProviderCreateWithData(
nullptr, pat->
data.
bytes,
w*
h,
nullptr);
255 pat->
image = CGImageMaskCreate(
w,
h, 1, 1, 1, provider,
nullptr,
false);
256 CGDataProviderRelease(provider);
258 const int numBytes = (
w*
h)/
sizeof(
uchar);
259 uchar xor_bytes[numBytes];
260 for (
int i = 0;
i < numBytes; ++
i)
262 CGDataProviderRef provider = CGDataProviderCreateWithData(
nullptr, xor_bytes,
w*
h,
nullptr);
263 CGImageRef swatch = CGImageMaskCreate(
w,
h, 1, 1, 1, provider,
nullptr,
false);
264 CGDataProviderRelease(provider);
266 const QColor c0(0, 0, 0, 0), c1(255, 255, 255, 255);
271 CGRect
rect = CGRectMake(0, 0,
w,
h);
280 CGImageRelease(swatch);
293 w = CGImageGetWidth(pat->
image);
294 h = CGImageGetHeight(pat->
image);
298 bool needRestore =
false;
299 if (CGImageIsMask(pat->
image)) {
300 CGContextSaveGState(
c);
303 CGRect
rect = CGRectMake(0, 0,
w,
h);
306 CGContextRestoreGState(
c);
347 qWarning(
"QCoreGraphicsPaintEngine::begin: Painter already active");
353 d->complexXForm =
false;
355 d->cosmeticPenSize = 1;
356 d->current.clipEnabled =
false;
361 d->hd = CGContextRetain(
ctx);
363 d->saveGraphicsState();
364 d->orig_xform = CGContextGetCTM(
d->hd);
366 CGShadingRelease(
d->shading);
367 d->shading =
nullptr;
381 qWarning(
"QCoreGraphicsPaintEngine::begin: Does not support clipped desktop on OS X");
383 }
else if (unclipped) {
384 qWarning(
"QCoreGraphicsPaintEngine::begin: Does not support unclipped painting");
389 qWarning(
"QCoreGraphicsPaintEngine::begin: Cannot paint null pixmap");
411 CGShadingRelease(
d->shading);
416 d->restoreGraphicsState();
417 CGContextSynchronize(
d->hd);
418 CGContextRelease(
d->hd);
466 if (!
d->current.pen.isCosmetic()) {
468 }
else if (
d->current.transform.m11() <
d->current.transform.m22()-1.0 ||
469 d->current.transform.m11() >
d->current.transform.m22()+1.0) {
471 d->cosmeticPenSize =
d->adjustPenWidth(
d->current.pen.widthF());
472 if (!
d->cosmeticPenSize)
473 d->cosmeticPenSize = 1.0;
476 static const float sqrt2 = std::sqrt(2.0f);
480 d->cosmeticPenSize = std::sqrt(std::pow(
d->pixelSize.y(), 2) + std::pow(
d->pixelSize.x(), 2)) / sqrt2 *
width;
490 d->current.pen = pen;
491 d->setStrokePen(pen);
501#ifdef QT_MAC_USE_NATIVE_GRADIENTS
504 if (drawGradientNatively(gradient)) {
513 CGShadingRelease(
d->shading);
514 d->shading =
nullptr;
516 d->setFillBrush(brushOrigin);
523 CGContextSetAlpha(
d->hd, opacity);
549 d->pixelSize =
d->devicePixelSize(
d->hd);
558 if (
d->current.clipEnabled) {
559 d->current.clipEnabled =
false;
564 if (!
d->current.clipEnabled)
566 d->current.clipEnabled =
true;
567 QRegion clipRegion(
p.toFillPolygon().toPolygon(),
p.fillRule());
569 d->current.clip = clipRegion;
572 CGRect
rect = CGRectMake(0, 0, 0, 0);
573 CGContextClipToRect(
d->hd,
rect);
576 CGContextBeginPath(
d->hd);
577 CGContextAddPath(
d->hd,
path);
579 CGContextClip(
d->hd);
581 CGContextEOClip(
d->hd);
585 d->current.clip =
d->current.clip.intersected(clipRegion);
586 d->setClip(&
d->current.clip);
597 d->current.clipEnabled =
false;
601 if (!
d->current.clipEnabled)
603 d->current.clipEnabled =
true;
605 d->current.clip =
d->current.clip.intersected(clipRegion);
607 d->current.clip = clipRegion;
608 d->setClip(&
d->current.clip);
627 CGContextBeginPath(
d->hd);
628 d->drawPath(ops,
path);
641 for (
int i=0;
i<rectCount; ++
i) {
644 CGMutablePathRef
path = CGPathCreateMutable();
662 CGContextSetLineCap(
d->hd, kCGLineCapSquare);
664 CGMutablePathRef
path = CGPathCreateMutable();
665 for (
int i=0;
i < pointCount;
i++) {
667 CGPathMoveToPoint(
path,
nullptr,
x,
y);
668 CGPathAddLineToPoint(
path,
nullptr,
x+0.001,
y);
671 bool doRestore =
false;
675 d->saveGraphicsState();
676 CGContextSetLineWidth(
d->hd,
d->current.pen.widthF());
680 d->restoreGraphicsState();
683 CGContextSetLineCap(
d->hd, kCGLineCapButt);
695 CGMutablePathRef
path = CGPathCreateMutable();
696 CGAffineTransform
transform = CGAffineTransformMakeScale(
r.width() /
r.height(), 1);
697 CGPathAddArc(
path, &
transform,(
r.x() + (
r.width() / 2)) / (
r.width() /
r.height()),
698 r.y() + (
r.height() / 2),
r.height() / 2, 0, (2 *
M_PI),
false);
713 CGMutablePathRef
path = CGPathCreateMutable();
715 for (
int x = 1;
x < pointCount; ++
x)
723 d->drawPath(op,
path);
736 CGMutablePathRef
path = CGPathCreateMutable();
737 for (
int i = 0;
i < lineCount;
i++) {
740 CGPathAddLineToPoint(
path,
nullptr,
end.x(),
end.y());
757 bool differentSize = (
QRectF(0, 0, pm.
width(), pm.
height()) != sr), doRestore =
false;
758 CGRect
rect = CGRectMake(
r.x(),
r.y(),
r.width(),
r.height());
760 bool isBitmap = (pm.
depth() == 1);
763 d->saveGraphicsState();
765 const QColor &col =
d->current.pen.color();
768 }
else if (differentSize) {
777 d->restoreGraphicsState();
781 Qt::ImageConversionFlags
flags)
791 CGRect
rect = CGRectMake(
r.x(),
r.y(),
r.width(),
r.height());
793 cgimage = CGImageCreateWithImageInRect(cgimage, CGRectMake(sr.
x(), sr.
y(),
823 d->saveGraphicsState();
829 qpattern->
pdev =
d->pdev;
830 CGPatternCallbacks callbks;
835 CGAffineTransform trans = CGContextGetCTM(
d->hd);
836 CGPatternRef pat = CGPatternCreate(qpattern, CGRectMake(0, 0,
width,
height),
838 kCGPatternTilingNoDistortion,
true, &callbks);
840 CGContextSetFillColorSpace(
d->hd, cs);
842 CGContextSetFillPattern(
d->hd, pat, &
component);
843 CGSize phase = CGSizeApplyAffineTransform(CGSizeMake(-(
p.x()-
r.x()), -(
p.y()-
r.y())), trans);
844 CGContextSetPatternPhase(
d->hd, phase);
847 CGRect mac_rect = CGRectMake(
r.x(),
r.y(),
r.width(),
r.height());
848 CGContextFillRect(
d->hd, mac_rect);
851 d->restoreGraphicsState();
853 CGColorSpaceRelease(cs);
854 CGPatternRelease(pat);
861#ifndef QMAC_NATIVE_GRADIENTS
887 if (textAA != lineAA)
888 CGContextSetShouldAntialias(
d->hd, textAA);
891 if (
d->disabledSmoothFonts == smoothing)
892 CGContextSetShouldSmoothFonts(
d->hd, smoothing);
895 switch (fe->
type()) {
900 d->drawBoxTextItem(
pos, ti);
907 if (textAA != lineAA)
908 CGContextSetShouldAntialias(
d->hd, !textAA);
910 if (smoothing ==
d->disabledSmoothFonts)
911 CGContextSetShouldSmoothFonts(
d->hd, !
d->disabledSmoothFonts);
943 int cg_mode = kCGBlendModeNormal;
946 cg_mode = kCGBlendModeMultiply;
949 cg_mode = kCGBlendModeScreen;
952 cg_mode = kCGBlendModeOverlay;
955 cg_mode = kCGBlendModeDarken;
958 cg_mode = kCGBlendModeLighten;
961 cg_mode = kCGBlendModeColorDodge;
964 cg_mode = kCGBlendModeColorBurn;
967 cg_mode = kCGBlendModeHardLight;
970 cg_mode = kCGBlendModeSoftLight;
973 cg_mode = kCGBlendModeDifference;
976 cg_mode = kCGBlendModeExclusion;
979 cg_mode = kCGBlendModePlusLighter;
982 cg_mode = kCGBlendModeNormal;
985 cg_mode = kCGBlendModeDestinationOver;
988 cg_mode = kCGBlendModeClear;
991 cg_mode = kCGBlendModeCopy;
997 cg_mode = kCGBlendModeSourceIn;
1003 cg_mode = kCGBlendModeSourceOut;
1006 cg_mode = kCGBlendModeDestinationOver;
1009 cg_mode = kCGBlendModeSourceAtop;
1012 cg_mode = kCGBlendModeDestinationAtop;
1015 cg_mode = kCGBlendModeXOR;
1021 CGContextSetBlendMode(d_func()->hd, CGBlendMode(cg_mode));
1031 kCGInterpolationHigh : kCGInterpolationNone);
1033 if (!textAntialiasing ||
d->disabledSmoothFonts) {
1034 d->disabledSmoothFonts = !textAntialiasing;
1035 CGContextSetShouldSmoothFonts(
d->hd, textAntialiasing);
1056 float ret = penWidth;
1060 else if (penWidth < 3)
1072 CGLineCap cglinecap = kCGLineCapButt;
1074 cglinecap = kCGLineCapSquare;
1076 cglinecap = kCGLineCapRound;
1077 CGContextSetLineCap(
hd, cglinecap);
1081 CGLineJoin cglinejoin = kCGLineJoinMiter;
1083 cglinejoin = kCGLineJoinBevel;
1085 cglinejoin = kCGLineJoinRound;
1086 CGContextSetLineJoin(
hd, cglinejoin);
1093 for (
int i = 0;
i < customs.
size(); ++
i)
1115 for (
int i = 0;
i < linedashes.
size(); ++
i) {
1116 linedashes[
i] *= cglinewidth;
1117 if (cglinewidth < 3 && (cglinecap == kCGLineCapSquare || cglinecap == kCGLineCapRound)) {
1119 linedashes[
i] += cglinewidth/2;
1121 linedashes[
i] -= cglinewidth/2;
1135 static const uchar dense1_pat[] = { 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x44, 0x00 };
1136 static const uchar dense2_pat[] = { 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00, 0x88 };
1137 static const uchar dense3_pat[] = { 0x11, 0xaa, 0x44, 0xaa, 0x11, 0xaa, 0x44, 0xaa };
1138 static const uchar dense4_pat[] = { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 };
1139 static const uchar dense5_pat[] = { 0xee, 0x55, 0xbb, 0x55, 0xee, 0x55, 0xbb, 0x55 };
1140 static const uchar dense6_pat[] = { 0xff, 0xdd, 0xff, 0x77, 0xff, 0xdd, 0xff, 0x77 };
1141 static const uchar dense7_pat[] = { 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb, 0xff };
1142 static const uchar hor_pat[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff };
1143 static const uchar ver_pat[] = { 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef };
1144 static const uchar cross_pat[] = { 0xef, 0xef, 0xef, 0xef, 0x00, 0xef, 0xef, 0xef };
1145 static const uchar fdiag_pat[] = { 0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe };
1146 static const uchar bdiag_pat[] = { 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f };
1147 static const uchar dcross_pat[] = { 0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e };
1148 static const uchar *
const pat_tbl[] = {
1149 dense1_pat, dense2_pat, dense3_pat, dense4_pat, dense5_pat,
1150 dense6_pat, dense7_pat,
1151 hor_pat, ver_pat, cross_pat, bdiag_pat, fdiag_pat, dcross_pat };
1159#ifdef QT_MAC_USE_NATIVE_GRADIENTS
1162 if (drawGradientNatively(grad)) {
1165 static const CGFloat domain[] = { 0.0f, +1.0f };
1166 static const CGFunctionCallbacks
callbacks = { 0, qt_mac_color_gradient_function,
nullptr };
1167 CGFunctionRef fill_func = CGFunctionCreate(
reinterpret_cast<void *
>(&
current.brush),
1170 CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB)
1176 CGPointMake(stop.
x(), stop.
y()), fill_func,
true,
true);
1184 shading = CGShadingCreateRadial(colorspace, CGPointMake(focal.
x(), focal.
y()),
1185 focalRadius, CGPointMake(center.x(), center.y()), radius, fill_func,
false,
true);
1188 CGFunctionRelease(fill_func);
1193#ifndef QT_MAC_USE_NATIVE_GRADIENTS
1209 base_colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
1219 base_colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
1224 CGColorSpaceRef fill_colorspace = CGColorSpaceCreatePattern(base_colorspace);
1225 CGContextSetFillColorSpace(
hd, fill_colorspace);
1227 CGAffineTransform
xform = CGContextGetCTM(
hd);
1231 CGPatternCallbacks callbks;
1232 callbks.version = 0;
1235 CGPatternRef fill_pattern = CGPatternCreate(qpattern, CGRectMake(0, 0,
width,
height),
1237 !base_colorspace, &callbks);
1241 CGPatternRelease(fill_pattern);
1242 CGColorSpaceRelease(base_colorspace);
1243 CGColorSpaceRelease(fill_colorspace);
1272 switch (element->type) {
1273 case kCGPathElementMoveToPoint:
1274 CGPathMoveToPoint(
t->path, &
t->transform, element->points[0].x, element->points[0].y);
1276 case kCGPathElementAddLineToPoint:
1277 CGPathAddLineToPoint(
t->path, &
t->transform, element->points[0].x, element->points[0].y);
1279 case kCGPathElementAddQuadCurveToPoint:
1280 CGPathAddQuadCurveToPoint(
t->path, &
t->transform, element->points[0].x, element->points[0].y,
1281 element->points[1].x, element->points[1].y);
1283 case kCGPathElementAddCurveToPoint:
1284 CGPathAddCurveToPoint(
t->path, &
t->transform, element->points[0].x, element->points[0].y,
1285 element->points[1].x, element->points[1].y,
1286 element->points[2].x, element->points[2].y);
1288 case kCGPathElementCloseSubpath:
1289 CGPathCloseSubpath(
t->path);
1292 qDebug() <<
"Unhandled path transform type: " << element->type;
1303 CGContextBeginPath(
hd);
1304 CGContextAddPath(
hd,
path);
1309 CGContextEOClip(
hd);
1311 CGRect boundingBox = CGPathGetBoundingBox(
path);
1312 CGContextConcatCTM(
hd,
1313 CGAffineTransformMake(boundingBox.size.width, 0,
1314 0, boundingBox.size.height,
1315 boundingBox.origin.x, boundingBox.origin.y));
1330 CGContextBeginPath(
hd);
1331 CGContextAddPath(
hd,
path);
1333 CGContextEOFillPath(
hd);
1335 CGContextFillPath(
hd);
1343 if (needContextSave)
1345 CGContextBeginPath(
hd);
1355 CGContextTranslateCTM(
hd, 0,
double(
pixelSize.
y()) * 0.1);
1362 else if (
current.pen.widthF() <= 1)
1370 t.path = CGPathCreateMutable();
1374 CGContextAddPath(
hd,
t.path);
1375 CGPathRelease(
t.path);
1377 CGContextAddPath(
hd,
path);
1380 CGContextStrokePath(
hd);
1381 if (needContextSave)
The QColor class provides colors based on RGB, HSV or CMYK values.
int alpha() const noexcept
Returns the alpha color component of this color.
int red() const noexcept
Returns the red color component of this color.
int blue() const noexcept
Returns the blue color component of this color.
int green() const noexcept
Returns the green color component of this color.
void setTransform(const QTransform *matrix=nullptr)
void setFillBrush(const QPointF &origin=QPoint())
void setStrokePen(const QPen &pen)
QPointF devicePixelSize(CGContextRef context)
float adjustPenWidth(float penWidth)
struct QCoreGraphicsPaintEnginePrivate::@470 current
CGAffineTransform orig_xform
enum QCoreGraphicsPaintEnginePrivate::@471 cosmeticPen
void restoreGraphicsState()
void drawPath(uchar ops, CGMutablePathRef path=nullptr)
void setClip(const QRegion *rgn=nullptr)
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
void updateRenderHints(QPainter::RenderHints hints)
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
Type type() const
Reimplement this function to return the paint engine \l{Type}.
void drawPoints(const QPointF *p, int pointCount)
Draws the first pointCount points in the buffer points.
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount rectangles in the buffer rects.
void drawTextItem(const QPointF &pos, const QTextItem &item)
This function draws the text item textItem at position p.
void updateMatrix(const QTransform &matrix)
void updateBrush(const QBrush &brush, const QPointF &pt)
QPainter::RenderHints supportedRenderHints() const
void updateClipPath(const QPainterPath &path, Qt::ClipOperation op)
bool end()
Reimplement this function to finish painting on the current paint device.
bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void updateCompositionMode(QPainter::CompositionMode mode)
CGContextRef handle() const
void updateFont(const QFont &font)
void drawLines(const QLineF *lines, int lineCount)
The default implementation splits the list of lines in lines into lineCount separate calls to drawPat...
void updateClipRegion(const QRegion ®ion, Qt::ClipOperation op)
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
~QCoreGraphicsPaintEngine()
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void updatePen(const QPen &pen)
QCoreGraphicsPaintEngine()
void updateOpacity(qreal opacity)
void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
Spread spread() const
Returns the spread method use by this gradient.
@ Format_ARGB32_Premultiplied
constexpr QPointF p1() const
Returns the line's start point.
constexpr QPointF p2() const
Returns the line's end point.
QPointF start() const
Returns the start point of this linear gradient in logical coordinates.
QPointF finalStop() const
Returns the final stop point of this linear gradient in logical coordinates.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
const_iterator constBegin() const noexcept
qsizetype count() const noexcept
void append(parameter_type t)
struct QMacPattern::@473 data
virtual int devType() const
The QPaintEngineState class provides information about the active paint engine's current state....
QTransform transform() const
QPainterPath clipPath() const
Returns the clip path in the current paint engine state.
Qt::ClipOperation clipOperation() const
Returns the clip operation in the current paint engine state.
QPointF brushOrigin() const
Returns the brush origin in the current paint engine state.
bool isClipEnabled() const
Returns whether clipping is enabled or not in the current paint engine state.
QBrush brush() const
Returns the brush in the current paint engine state.
QRegion clipRegion() const
Returns the clip region in the current paint engine state.
QPainter::RenderHints renderHints() const
Returns the render hints in the current paint engine state.
QFont font() const
Returns the font in the current paint engine state.
QPen pen() const
Returns the pen in the current paint engine state.
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
QPainter::CompositionMode compositionMode() const
Returns the composition mode in the current paint engine state.
void setActive(bool newState)
Sets the active state of the paint engine to state.
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
QPainter * painter() const
Returns the paint engine's painter.
void setDirty(DirtyFlags df)
QPaintEngineState * state
PaintEngineFeatures gccaps
bool isActive() const
Returns true if the paint engine is actively drawing; otherwise returns false.
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr...
const QPen & pen() const
Returns the painter's current pen.
const QBrush & brush() const
Returns the painter's current brush.
QPoint brushOrigin() const
Returns the currently set brush origin.
CompositionMode
Defines the modes supported for digital image compositing.
@ CompositionMode_Destination
@ CompositionMode_Lighten
@ CompositionMode_ColorDodge
@ CompositionMode_DestinationAtop
@ CompositionMode_SourceOver
@ CompositionMode_DestinationOut
@ CompositionMode_SourceAtop
@ CompositionMode_Overlay
@ CompositionMode_Multiply
@ CompositionMode_DestinationOver
@ CompositionMode_HardLight
@ CompositionMode_Exclusion
@ CompositionMode_ColorBurn
@ CompositionMode_Difference
@ CompositionMode_SoftLight
@ CompositionMode_DestinationIn
@ CompositionMode_SourceOut
@ CompositionMode_SourceIn
qreal widthF() const
Returns the pen width with floating point precision.
QList< qreal > dashPattern() const
Returns the dash pattern of this pen.
QColor color() const
Returns the color of this pen's brush.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
qreal dashOffset() const
Returns the dash offset for the pen.
Qt::PenStyle style() const
Returns the pen style.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
int height() const
Returns the height of the pixmap.
QImage toImage() const
Converts the pixmap to a QImage.
int depth() const
Returns the depth of the pixmap.
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
int width() const
Returns the width of the pixmap.
QRect rect() const
Returns the pixmap's enclosing rectangle.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
QPointF center() const
Returns the center of this radial gradient in logical coordinates.
qreal focalRadius() const
QPointF focalPoint() const
Returns the focal point of this radial gradient in logical coordinates.
qreal radius() const
Returns the radius of this radial gradient in logical coordinates.
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
The QRegion class specifies a clip region for a painter.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Combined button and popup list for selecting options.
QPair< qreal, QColor > QGradientStop
void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
CGImageRef qt_mac_toCGImage(const QImage &inImage)
static uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b)
int qRound(qfloat16 d) noexcept
constexpr T qAbs(const T &t)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLint GLenum GLint components
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
QT_BEGIN_NAMESPACE void qt_mac_cgimage_data_free(void *, const void *memoryToFree, size_t)
static QCFType< CGColorRef > cgColorForQColor(const QColor &col)
static void qt_mac_draw_pattern(void *info, CGContextRef c)
static CGMutablePathRef qt_mac_compose_path(const QPainterPath &p, float off=0)
CGAffineTransform qt_mac_convert_transform_to_cg(const QTransform &t)
static float qt_mac_convert_color_to_cg(int c)
static CGRect qt_mac_compose_rect(const QRectF &r, float off=0)
void qt_mac_cg_transform_path_apply(void *info, const CGPathElement *element)
void CGContextSetCompositeOperation(CGContextRef, int)
CGImageRef qt_mac_create_imagemask(const QPixmap &pixmap, const QRectF &sr)
static const uchar * qt_mac_patternForBrush(int brushStyle)
#define QMACPATTERN_MASK_MULTIPLIER
static QPaintEngine::PaintEngineFeatures qt_mac_cg_features()
static void qt_mac_dispose_pattern(void *info)
@ kCGCompositeModeDestinationAtop
@ kCGCompositeModeSourceOut
@ kCGCompositeModeDestinationIn
@ kCGCompositeModeDestinationOver
@ kCGCompositeModeSourceOver
@ kCGCompositeModePlusDarker
@ kCGCompositeModeDestinationOut
@ kCGCompositeModePlusLighter
@ kCGCompositeModeSourceAtop
@ kCGCompositeModeSourceIn
struct CGContext * CGContextRef
struct CGColorSpace * CGColorSpaceRef
static qreal component(const QPointF &point, unsigned int i)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr int qRed(QRgb rgb)
constexpr int qGreen(QRgb rgb)
constexpr QRgb qRgba(int r, int g, int b, int a)
constexpr int qBlue(QRgb rgb)
constexpr int qAlpha(QRgb rgb)
PromiseCallbacks callbacks
std::uniform_real_distribution dist(1, 2.5)
[2]
QFileInfo info(fileName)
[8]
QTextStream out(stdout)
[7]
myFilter draw(painter, QPoint(0, 0), originalPixmap)