7#include <private/qtquickglobal_p.h>
8#include <private/qquickcontext2dtexture_p.h>
9#include <private/qquickitem_p.h>
10#if QT_CONFIG(quick_shadereffect)
11#include <QtQuick/private/qquickshadereffectsource_p.h>
15#include <QtQuick/private/qsgcontext_p.h>
16#include <private/qquicksvgparser_p.h>
17#if QT_CONFIG(quick_path)
18#include <private/qquickpath_p.h>
20#include <private/qquickimage_p_p.h>
25#include <private/qv4domerrors_p.h>
26#include <private/qv4engine_p.h>
27#include <private/qv4object_p.h>
28#include <private/qv4qobjectwrapper_p.h>
29#include <private/qquickwindow_p.h>
31#include <private/qv4value_p.h>
32#include <private/qv4functionobject_p.h>
33#include <private/qv4objectproto_p.h>
34#include <private/qv4scopedvalue_p.h>
35#include <private/qlocale_tools_p.h>
37#include <QtCore/qmath.h>
38#include <QtCore/qvector.h>
39#include <QtCore/private/qnumeric_p.h>
40#include <QtCore/QRunnable>
41#include <QtGui/qguiapplication.h>
42#include <private/qguiapplication_p.h>
43#include <qpa/qplatformintegration.h>
45#include <private/qsgdefaultrendercontext_p.h>
47#include <QtCore/qpointer.h>
50#if defined(Q_OS_QNX) || defined(Q_OS_ANDROID)
94#define CHECK_CONTEXT(r) if (!r || !r->d()->context() || !r->d()->context()->bufferValid()) \
95 THROW_GENERIC_ERROR("Not a Context2D object");
97#define CHECK_CONTEXT_SETTER(r) if (!r || !r->d()->context() || !r->d()->context()->bufferValid()) \
98 THROW_GENERIC_ERROR("Not a Context2D object");
99#define qClamp(val, min, max) qMin(qMax(val, min), max)
100#define CHECK_RGBA(c) (c == '-' || c == '.' || (c >=0 && c <= 9))
108 if (!
p ||
len > 255 ||
len <= 7)
111 bool isRgb(
false), isHsl(
false),
hasAlpha(
false);
114 while (isspace(*
p))
p++;
115 if (strncmp(
p,
"rgb", 3) == 0)
117 else if (strncmp(
p,
"hsl", 3) == 0)
129 int rh, gs, bl,
alpha = 255;
132 while (isspace(*
p))
p++;
133 rh = strtol(
p, &
p, 10);
135 rh =
qRound(rh/100.0 * 255);
138 if (*
p++ !=
',')
return QColor();
141 while (isspace(*
p))
p++;
142 gs = strtol(
p, &
p, 10);
144 gs =
qRound(gs/100.0 * 255);
147 if (*
p++ !=
',')
return QColor();
150 while (isspace(*
p))
p++;
151 bl = strtol(
p, &
p, 10);
153 bl =
qRound(bl/100.0 * 255);
158 if (*
p++!=
',')
return QColor();
159 while (isspace(*
p))
p++;
164 if (*
p !=
')')
return QColor();
166 return QColor::fromRgba(
qRgba(
qClamp(rh, 0, 255),
qClamp(gs, 0, 255),
qClamp(bl, 0, 255),
qClamp(
alpha, 0, 255)));
168 return QColor::fromHsl(
qClamp(rh, 0, 359),
qClamp(gs, 0, 255),
qClamp(bl, 0, 255),
qClamp(
alpha, 0, 255));
176 float size = fontSizeToken.trimmed().toFloat(&
ok);
180 qWarning().nospace() <<
"Context2D: A font size of " << fontSizeToken <<
" is invalid.";
209 qWarning().nospace() <<
"Context2D: Invalid font size unit in font string.";
226 if (
ch == u
'"' ||
ch == u
'\'') {
227 if (quoteIndex == -1) {
230 if (
ch == fontFamiliesString.at(quoteIndex)) {
232 const QString family = fontFamiliesString.
mid(quoteIndex + 1,
index - quoteIndex - 1).toString();
234 currentFamily.clear();
237 qWarning().nospace() <<
"Context2D: Mismatched quote in font string.";
241 }
else if (
ch == u
' ' && quoteIndex == -1) {
243 if (!currentFamily.isEmpty()) {
245 extractedFamilies.push_back(currentFamily);
246 currentFamily.clear();
249 currentFamily.push_back(
ch);
252 if (!currentFamily.isEmpty()) {
253 if (quoteIndex == -1) {
255 extractedFamilies.push_back(currentFamily);
257 qWarning().nospace() <<
"Context2D: Unclosed quote in font string.";
261 if (extractedFamilies.isEmpty()) {
262 qWarning().nospace() <<
"Context2D: Missing or misplaced font family in font string"
263 <<
" (it must come after the font size).";
265 return extractedFamilies;
279 for (
const QString &fontFamilyToken : fontFamilyTokens) {
289 }
else if (fontFamilyToken.compare(
QLatin1String(
"sans-serif")) == 0) {
291 }
else if (fontFamilyToken.compare(
QLatin1String(
"cursive")) == 0) {
293 }
else if (fontFamilyToken.compare(
QLatin1String(
"monospace")) == 0) {
295 }
else if (fontFamilyToken.compare(
QLatin1String(
"fantasy")) == 0) {
298 if (styleHint != -1) {
306 qWarning(
"Context2D: The font families specified are invalid: %s",
qPrintable(fontFamilyTokens.join(
QString()).trimmed()));
318#define Q_TRY_SET_TOKEN(token, value, setStatement) \
319if (!(usedTokens & token)) { \
320 usedTokens |= token; \
323 qWarning().nospace() << "Context2D: Duplicate token " << QLatin1String(value) << " found in font string."; \
324 return currentFont; \
333 if (fontString.isEmpty()) {
334 qWarning().nospace() <<
"Context2D: Font string is empty.";
341 if (fontSizeEnd == -1)
343 if (fontSizeEnd == -1) {
344 qWarning().nospace() <<
"Context2D: Invalid font size unit in font string.";
348 int fontSizeStart = fontString.lastIndexOf(u
' ', fontSizeEnd);
349 if (fontSizeStart == -1) {
366 QString remainingFontString = fontString;
367 remainingFontString.
remove(fontSizeStart, fontSizeEnd - fontSizeStart);
368 QStringView remainingFontStringRef(remainingFontString);
371 const QStringView fontFamiliesString = remainingFontStringRef.
mid(fontSizeStart);
372 remainingFontStringRef.truncate(fontSizeStart);
374 if (fontFamilies.isEmpty()) {
382 if (trimmedTokensStr.isEmpty()) {
405 qWarning().nospace() <<
"Context2D: Duplicate token \"normal\" found in font string.";
417 bool conversionOk =
false;
424 qWarning().nospace() <<
"Context2D: Invalid or misplaced token " <<
token
425 <<
" found in font string.";
468 m_context =
new QPointer<QQuickContext2D>(
context);
472 QPointer<QQuickContext2D>* m_context;
476 void init() { Object::init(); }
511 Object::markObjects(that, markStack);
557#if QT_CONFIG(quick_path)
699 int filterDim = 2 * delta + 1;
704 int h =
src.height();
707 int srcStride =
src.bytesPerLine() / 4;
710 int dstStride =
dst.bytesPerLine() / 4;
712 for (
int y = 0;
y <
h; ++
y) {
713 for (
int x = 0;
x <
w; ++
x) {
727 for (
int cy = 0; cy < filterDim; ++cy) {
728 int scy = sy + cy - delta;
730 if (scy < 0 || scy >=
h)
733 const QRgb *sry = sr + scy * srcStride;
735 for (
int cx = 0; cx < filterDim; ++cx) {
736 int scx = sx + cx - delta;
738 if (scx < 0 || scx >=
w)
741 const QRgb col = sry[scx];
751 redF +=
qRed(col) * wt;
752 greenF +=
qGreen(col) * wt;
753 blueF +=
qBlue(col) * wt;
754 alphaF +=
qAlpha(col) * wt;
773 int passes = quality? 3: 1;
774 int filterSize = 2 * radius + 1;
775 for (
int i = 0;
i < passes; ++
i)
783 }
else if (compositeOperator ==
QLatin1String(
"source-out")) {
785 }
else if (compositeOperator ==
QLatin1String(
"source-in")) {
787 }
else if (compositeOperator ==
QLatin1String(
"source-atop")) {
789 }
else if (compositeOperator ==
QLatin1String(
"destination-atop")) {
791 }
else if (compositeOperator ==
QLatin1String(
"destination-in")) {
793 }
else if (compositeOperator ==
QLatin1String(
"destination-out")) {
795 }
else if (compositeOperator ==
QLatin1String(
"destination-over")) {
805 }
else if (compositeOperator ==
QLatin1String(
"qt-destination")) {
807 }
else if (compositeOperator ==
QLatin1String(
"qt-multiply")) {
809 }
else if (compositeOperator ==
QLatin1String(
"qt-screen")) {
811 }
else if (compositeOperator ==
QLatin1String(
"qt-overlay")) {
813 }
else if (compositeOperator ==
QLatin1String(
"qt-darken")) {
815 }
else if (compositeOperator ==
QLatin1String(
"qt-lighten")) {
817 }
else if (compositeOperator ==
QLatin1String(
"qt-color-dodge")) {
819 }
else if (compositeOperator ==
QLatin1String(
"qt-color-burn")) {
821 }
else if (compositeOperator ==
QLatin1String(
"qt-hard-light")) {
823 }
else if (compositeOperator ==
QLatin1String(
"qt-soft-light")) {
825 }
else if (compositeOperator ==
QLatin1String(
"qt-difference")) {
827 }
else if (compositeOperator ==
QLatin1String(
"qt-exclusion")) {
907 o->setArrayType(QV4::Heap::ArrayData::Custom);
943 pixelData->setPrototypeOf(
p);
945 if (
image.isNull()) {
947 pixelData->d()->image->fill(0x00000000);
988 r->d()->context()->popState();
1002 r->d()->context()->reset();
1043 r->d()->context()->pushState();
1073 r->d()->context()->rotate(argv[0].
toNumber());
1151 r->d()->context()->setTransform( argv[0].
toNumber()
1183 r->d()->context()->transform( argv[0].
toNumber()
1230 r->d()->context()->setTransform(1, 0, 0, 1, 0, 0);
1285 if (globalAlpha >= 0.0 && globalAlpha <= 1.0 && r->
d()->
context()->
state.globalAlpha != globalAlpha) {
1286 r->d()->context()->state.globalAlpha = globalAlpha;
1287 r->d()->context()->buffer()->setGlobalAlpha(
r->d()->context()->state.globalAlpha);
1393 if (cm !=
r->d()->context()->state.globalCompositeOperation) {
1394 r->d()->context()->state.globalCompositeOperation = cm;
1395 r->d()->context()->buffer()->setGlobalCompositeOperation(cm);
1431 if (
color.isValid()) {
1432 if (
color.alpha() == 255)
1436 alphaString.chop(1);
1455 if (
color.isValid()) {
1456 r->d()->context()->state.fillStyle =
color;
1457 r->d()->context()->buffer()->setFillStyle(
color);
1458 r->d()->context()->m_fillStyle.set(scope.
engine,
value);
1461 if (style && *style->d()->brush !=
r->d()->context()->state.fillStyle) {
1462 r->d()->context()->state.fillStyle = *style->d()->brush;
1463 r->d()->context()->buffer()->setFillStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
1464 r->d()->context()->m_fillStyle.set(scope.
engine,
value);
1465 r->d()->context()->state.fillPatternRepeatX = style->d()->patternRepeatX;
1466 r->d()->context()->state.fillPatternRepeatY = style->d()->patternRepeatY;
1469 }
else if (
value->isString()) {
1473 r->d()->context()->buffer()->setFillStyle(
r->d()->context()->state.fillStyle);
1474 r->d()->context()->m_fillStyle.set(scope.
engine,
value);
1518 r->d()->context()->m_path.setFillRule(
r->d()->context()->state.fillRule);
1541 if (
color.isValid()) {
1542 if (
color.alpha() == 255)
1546 alphaString.chop(1);
1565 if (
color.isValid()) {
1566 r->d()->context()->state.strokeStyle =
color;
1567 r->d()->context()->buffer()->setStrokeStyle(
color);
1568 r->d()->context()->m_strokeStyle.set(scope.
engine,
value);
1571 if (style && *style->d()->brush !=
r->d()->context()->state.strokeStyle) {
1572 r->d()->context()->state.strokeStyle = *style->d()->brush;
1573 r->d()->context()->buffer()->setStrokeStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
1574 r->d()->context()->m_strokeStyle.set(scope.
engine,
value);
1575 r->d()->context()->state.strokePatternRepeatX = style->d()->patternRepeatX;
1576 r->d()->context()->state.strokePatternRepeatY = style->d()->patternRepeatY;
1577 }
else if (!style &&
r->d()->context()->state.strokeStyle !=
QBrush(
QColor())) {
1581 r->d()->context()->buffer()->setStrokeStyle(
r->d()->context()->state.strokeStyle);
1582 r->d()->context()->m_strokeStyle.set(scope.
engine,
value);
1585 }
else if (
value->isString()) {
1589 r->d()->context()->buffer()->setStrokeStyle(
r->d()->context()->state.strokeStyle);
1590 r->d()->context()->m_strokeStyle.set(scope.
engine,
value);
1635 gradient->setPrototypeOf(
p);
1683 if (r0 < 0 ||
r1 < 0)
1690 gradient->setPrototypeOf(
p);
1736 gradient->setPrototypeOf(
p);
1798 argv[0], QMetaType::fromType<QColor>()).value<
QColor>();
1799 if (
color.isValid()) {
1800 int patternMode = argv[1].
toInt32();
1813 patternTexture = *pixelData->d()->image;
1819 if (!patternTexture.isNull()) {
1820 pattern->d()->brush->setTextureImage(patternTexture);
1824 pattern->d()->patternRepeatX =
true;
1825 pattern->d()->patternRepeatY =
true;
1827 pattern->d()->patternRepeatX =
true;
1828 pattern->d()->patternRepeatY =
false;
1830 pattern->d()->patternRepeatX =
false;
1831 pattern->d()->patternRepeatY =
true;
1833 pattern->d()->patternRepeatX =
false;
1834 pattern->d()->patternRepeatY =
false;
1873 switch (
r->d()->context()->state.lineCap) {
1905 if (
cap !=
r->d()->context()->state.lineCap) {
1906 r->d()->context()->state.lineCap =
cap;
1907 r->d()->context()->buffer()->setLineCap(
cap);
1934 switch (
r->d()->context()->state.lineJoin) {
1966 if (join !=
r->d()->context()->state.lineJoin) {
1967 r->d()->context()->state.lineJoin = join;
1968 r->d()->context()->buffer()->setLineJoin(join);
1995 r->d()->context()->state.lineWidth =
w;
1996 r->d()->context()->buffer()->setLineWidth(
w);
2023 if (ml > 0 &&
qt_is_finite(ml) && ml !=
r->d()->context()->state.miterLimit) {
2024 r->d()->context()->state.miterLimit = ml;
2025 r->d()->context()->buffer()->setMiterLimit(ml);
2043 const QVector<qreal>
pattern =
r->d()->context()->state.lineDash;
2093 QVector<qreal> dashes;
2097 const double number =
v->toNumber();
2102 dashes.append(
v->toNumber());
2104 if (dashes.size() % 2 != 0) {
2108 r->d()->context()->state.lineDash = dashes;
2109 r->d()->context()->buffer()->setLineDash(dashes);
2141 r->d()->context()->state.lineDashOffset =
offset;
2142 r->d()->context()->buffer()->setLineDashOffset(
offset);
2170 if (blur > 0 &&
qt_is_finite(blur) && blur !=
r->d()->context()->state.shadowBlur) {
2171 r->d()->context()->state.shadowBlur = blur;
2172 r->d()->context()->buffer()->setShadowBlur(blur);
2200 if (
color.isValid() &&
color !=
r->d()->context()->state.shadowColor) {
2201 r->d()->context()->state.shadowColor =
color;
2202 r->d()->context()->buffer()->setShadowColor(
color);
2230 if (
qt_is_finite(offsetX) && offsetX !=
r->d()->context()->state.shadowOffsetX) {
2231 r->d()->context()->state.shadowOffsetX = offsetX;
2232 r->d()->context()->buffer()->setShadowOffsetX(offsetX);
2258 if (
qt_is_finite(offsetY) && offsetY !=
r->d()->context()->state.shadowOffsetY) {
2259 r->d()->context()->state.shadowOffsetY = offsetY;
2260 r->d()->context()->buffer()->setShadowOffsetY(offsetY);
2265#if QT_CONFIG(quick_path)
2282 r->d()->context()->beginPath();
2284 if (!!qobjectWrapper) {
2285 if (
QQuickPath *
path = qobject_cast<QQuickPath*>(qobjectWrapper->object()))
2286 r->d()->context()->m_path =
path->path();
2291 r->d()->context()->m_v4path.set(scope.engine,
value);
2311 r->d()->context()->clearRect(argv[0].
toNumber(),
2387 bool antiClockwise =
false;
2397 r->d()->context()->arc(argv[0].
toNumber(),
2444 r->d()->context()->arcTo(argv[0].
toNumber(),
2466 r->d()->context()->beginPath();
2511 r->d()->context()->bezierCurveTo(cp1x, cp1y, cp2x, cp2y,
x,
y);
2546 r->d()->context()->clip();
2563 r->d()->context()->closePath();
2582 r->d()->context()->fill();
2604 r->d()->context()->lineTo(
x,
y);
2627 r->d()->context()->moveTo(
x,
y);
2656 r->d()->context()->quadraticCurveTo(cpx, cpy,
x,
y);
2694 r->d()->context()->roundedRect(argv[0].
toNumber()
2767 r->d()->context()->stroke();
2785 bool pointInPath =
false;
2787 pointInPath =
r->d()->context()->isPointInPath(argv[0].
toNumber(), argv[1].
toNumber());
2851 if (
font !=
r->d()->context()->state.font) {
2852 r->d()->context()->state.font =
font;
2878 switch (
r->d()->context()->state.textAlign) {
2903 QString textAlign =
s->toQString();
2919 if (ta !=
r->d()->context()->state.textAlign)
2920 r->d()->context()->state.textAlign = ta;
2945 switch (
r->d()->context()->state.textBaseline) {
2969 QString textBaseline =
s->toQString();
2985 if (tb !=
r->d()->context()->state.textBaseline)
2986 r->d()->context()->state.textBaseline = tb;
3013 r->d()->context()->buffer()->fill(textPath);
3129 qreal sx, sy, sw, sh, dx, dy, dw, dh;
3135 if (!
r->d()->context()->state.invertibleCTM)
3138 QQmlRefPointer<QQuickCanvasPixmap>
pixmap;
3141 if (
arg->isString()) {
3146 pixmap =
r->d()->context()->createPixmap(
url);
3147 }
else if (
arg->isObject()) {
3149 if (!!qobjectWrapper) {
3150 if (
QQuickImage *imageItem = qobject_cast<QQuickImage*>(qobjectWrapper->object())) {
3151 pixmap =
r->d()->context()->createPixmap(imageItem->source());
3152 }
else if (
QQuickCanvasItem *canvas = qobject_cast<QQuickCanvasItem*>(qobjectWrapper->object())) {
3171 pixmap =
r->d()->context()->createPixmap(
url);
3192 }
else if (argc >= 5) {
3201 }
else if (argc >= 3) {
3228 || sx + sw >
pixmap->width()
3229 || sy + sh >
pixmap->height()
3230 || sx + sw < 0 || sy + sh < 0) {
3234 r->d()->context()->buffer()->drawPixmap(
pixmap,
QRectF(sx, sy, sw, sh),
QRectF(dx, dy, dw, dh));
3270 int width =
r ?
r->d()->image->width() : 0;
3285 int height =
r ?
r->d()->image->height() : 0;
3324 if (!
r ||
r->d()->image->isNull())
3332 if (!
id.isArrayIndex())
3341 if (
index <
static_cast<quint32>(
r->d()->image->width() *
r->d()->image->height() * 4)) {
3344 const quint32 w =
r->d()->image->width();
3347 const QRgb* pixel =
reinterpret_cast<const QRgb*
>(
r->d()->image->constScanLine(
row));
3349 switch (
index % 4) {
3368 if (!
id.isArrayIndex())
3380 const int v =
value.toInt32();
3381 if (
r &&
index <
static_cast<quint32>(
r->d()->image->width() *
r->d()->image->height() * 4) &&
v >= 0 &&
v <= 255) {
3382 const quint32 w =
r->d()->image->width();
3386 QRgb* pixel =
reinterpret_cast<QRgb*
>(
r->d()->image->scanLine(
row));
3388 switch (
index % 4) {
3440 qreal w = pa->d()->image->width();
3441 qreal h = pa->d()->image->height();
3444 }
else if (arg0->isString()) {
3445 QImage image =
r->d()->context()->createPixmap(
QUrl(arg0->toQStringNoThrow()))->image();
3448 }
else if (argc == 2) {
3483 if (
w <= 0 ||
h <= 0)
3510 if (!arg0->isObject())
3515 qreal w,
h, dirtyX, dirtyY, dirtyWidth, dirtyHeight;
3526 w = pixelArray->d()->image->width();
3527 h = pixelArray->d()->image->height();
3539 if (dirtyWidth < 0) {
3540 dirtyX = dirtyX+dirtyWidth;
3541 dirtyWidth = -dirtyWidth;
3544 if (dirtyHeight < 0) {
3545 dirtyY = dirtyY+dirtyHeight;
3546 dirtyHeight = -dirtyHeight;
3550 dirtyWidth = dirtyWidth+dirtyX;
3555 dirtyHeight = dirtyHeight+dirtyY;
3559 if (dirtyX+dirtyWidth >
w) {
3560 dirtyWidth =
w - dirtyX;
3563 if (dirtyY+dirtyHeight >
h) {
3564 dirtyHeight =
h - dirtyY;
3567 if (dirtyWidth <=0 || dirtyHeight <= 0)
3576 QImage image = pixelArray->d()->image->copy(dirtyX, dirtyY, dirtyWidth, dirtyHeight);
3577 r->d()->context()->buffer()->drawImage(
image,
QRectF(dirtyX, dirtyY, dirtyWidth, dirtyHeight),
QRectF(dx, dy, dirtyWidth, dirtyHeight));
3614 if (!style->d()->brush->gradient())
3615 THROW_GENERIC_ERROR(
"Not a valid CanvasGradient object, can't get the gradient information");
3616 QGradient gradient = *(style->d()->brush->gradient());
3620 if (argv[1].as<Object>()) {
3622 argv[1], QMetaType::fromType<QColor>()).value<
QColor>();
3630 if (
color.isValid()) {
3635 *style->d()->brush = gradient;
3643 if (!
state.invertibleCTM)
3652 if (!newTransform.isInvertible()) {
3653 state.invertibleCTM =
false;
3657 state.matrix = newTransform;
3664 if (!
state.invertibleCTM)
3673 if (!newTransform.isInvertible()) {
3674 state.invertibleCTM =
false;
3678 state.matrix = newTransform;
3685 if (!
state.invertibleCTM)
3694 if (!newTransform.isInvertible()) {
3695 state.invertibleCTM =
false;
3699 state.matrix = newTransform;
3706 if (!
state.invertibleCTM)
3715 if (!newTransform.isInvertible()) {
3716 state.invertibleCTM =
false;
3720 state.matrix = newTransform;
3727 if (!
state.invertibleCTM)
3736 if (!newTransform.isInvertible()) {
3737 state.invertibleCTM =
false;
3740 state.matrix = newTransform;
3751 if (!ctm.isInvertible())
3755 m_path = ctm.
map(m_path);
3756 state.invertibleCTM =
true;
3762 if (!
state.invertibleCTM)
3765 if (!m_path.elementCount())
3768 m_path.setFillRule(
state.fillRule);
3774 if (!
state.invertibleCTM)
3783 state.clipPath = clipPath;
3790 if (!
state.invertibleCTM)
3793 if (!m_path.elementCount())
3796 buffer()->stroke(m_path);
3801 if (!
state.invertibleCTM)
3812 if (!
state.invertibleCTM)
3823 if (!
state.invertibleCTM)
3834 if (!
state.invertibleCTM)
3842 buffer()->fill(textPath);
3844 buffer()->stroke(textPath);
3850 if (!m_path.elementCount())
3857 if (!m_path.elementCount())
3860 QRectF boundRect = m_path.boundingRect();
3861 if (boundRect.width() || boundRect.height())
3862 m_path.closeSubpath();
3869 if (!
state.invertibleCTM)
3878 if (!
state.invertibleCTM)
3883 if (!m_path.elementCount())
3885 else if (m_path.currentPosition() != pt)
3892 if (!
state.invertibleCTM)
3895 if (!m_path.elementCount())
3896 m_path.moveTo(
QPointF(cpx, cpy));
3899 if (m_path.currentPosition() != pt)
3900 m_path.quadTo(
QPointF(cpx, cpy), pt);
3907 if (!
state.invertibleCTM)
3910 if (!m_path.elementCount())
3911 m_path.moveTo(
QPointF(cp1x, cp1y));
3914 if (m_path.currentPosition() != pt)
3920 QPointF p0(m_path.currentPosition());
3922 QPointF p1p0((p0.x() -
p1.x()), (p0.y() -
p1.y()));
3924 qreal p1p0_length = std::hypot(p1p0.x(), p1p0.y());
3925 qreal p1p2_length = std::hypot(p1p2.x(), p1p2.y());
3937 qreal tangent = radius / std::tan(std::acos(cos_phi) / 2);
3938 qreal factor_p1p0 = tangent / p1p0_length;
3939 QPointF t_p1p0((
p1.x() + factor_p1p0 * p1p0.x()), (
p1.y() + factor_p1p0 * p1p0.y()));
3941 QPointF orth_p1p0(p1p0.y(), -p1p0.x());
3942 qreal orth_p1p0_length = std::hypot(orth_p1p0.x(), orth_p1p0.y());
3943 qreal factor_ra = radius / orth_p1p0_length;
3947 if (cos_alpha < 0.f)
3948 orth_p1p0 =
QPointF(-orth_p1p0.x(), -orth_p1p0.y());
3950 QPointF p((t_p1p0.x() + factor_ra * orth_p1p0.x()), (t_p1p0.y() + factor_ra * orth_p1p0.y()));
3953 orth_p1p0 =
QPointF(-orth_p1p0.x(), -orth_p1p0.y());
3954 qreal sa = std::atan2(orth_p1p0.y(), orth_p1p0.x());
3957 bool anticlockwise =
false;
3959 qreal factor_p1p2 = tangent / p1p2_length;
3960 QPointF t_p1p2((
p1.x() + factor_p1p2 * p1p2.x()), (
p1.y() + factor_p1p2 * p1p2.y()));
3961 QPointF orth_p1p2((t_p1p2.x() -
p.x()), (t_p1p2.y() -
p.y()));
3962 qreal ea = std::atan2(orth_p1p2.y(), orth_p1p2.x());
3963 if ((sa > ea) && ((sa - ea) <
M_PI))
3964 anticlockwise =
true;
3965 if ((sa < ea) && ((ea - sa) >
M_PI))
3966 anticlockwise =
true;
3968 arc(
p.x(),
p.y(), radius, sa, ea, anticlockwise);
3975 if (!
state.invertibleCTM)
3984 if (!m_path.elementCount())
3986 else if (st == m_path.currentPosition() || st ==
end || !radius)
3989 addArcTo(st,
end, radius);
3994 if (!
state.invertibleCTM)
4000 m_path.moveTo(
x,
y);
4003 m_path.addRect(
x,
y,
w,
h);
4010 if (!
state.invertibleCTM)
4017 m_path.moveTo(
x,
y);
4026 if (!
state.invertibleCTM)
4033 m_path.moveTo(
x,
y);
4037 m_path.addEllipse(
x,
y,
w,
h);
4042 if (!
state.invertibleCTM)
4047 m_path.addPath(
path);
4052 if (!
state.invertibleCTM)
4069 antiClockWise = !antiClockWise;
4077 double xs = xc - radius;
4078 double ys = yc - radius;
4079 double width = radius*2;
4080 double height = radius*2;
4081 if ((!antiClockWise && (ea - sa >= 360)) || (antiClockWise && (sa - ea >= 360)))
4087 if (!antiClockWise && (ea < sa)) {
4089 }
else if (antiClockWise && (sa < ea)) {
4101 if (!m_path.elementCount())
4104 m_path.lineTo(xc, yc);
4154 m_grabbedImage = grab;
4160 return m_canvas->loadedPixmap(
url, sourceSize);
4184 return (
p >=
a &&
p <=
b) || (
p >=
b &&
p <=
a);
4189 if (!
state.invertibleCTM)
4192 if (!m_path.elementCount())
4200 QPointF p = ctm.inverted().map(point);
4215 for (
int i = 1;
i <
border.size(); ++
i) {
4342 qWarning() <<
"Pixel readback is not supported in Cooperative mode, please try Threaded or Immediate mode";
4376#if QT_CONFIG(quick_path)
4492 wrapper->d()->setContext(
this);
4499#include "moc_qquickcontext2d_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
QColor toRgb() const noexcept
Create and returns an RGB QColor based on this color.
static QColor fromRgba(QRgb rgba) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgba.
static QColor fromString(QAnyStringView name) noexcept
static QColor fromHsl(int h, int s, int l, int a=255)
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
Type
This enum type defines the valid event types in Qt.
static bool hasFamily(const QString &family)
\reentrant \inmodule QtGui
StyleHint
Style hints are used by the \l{QFont}{font matching} algorithm to find an appropriate default family ...
void setPointSize(int)
Sets the point size to pointSize.
void setFamily(const QString &)
Sets the family name of the font.
QString defaultFamily() const
Returns the family name that corresponds to the current style hint.
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
void setStyleHint(StyleHint, StyleStrategy=PreferDefault)
Sets the style hint and strategy to hint and strategy, respectively.
Weight
Qt uses a weighting scale from 1 to 1000 compatible with OpenType.
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
static QPlatformIntegration * platformIntegration()
Qt::LayoutDirection layoutDirection
the default layout direction for this application
constexpr bool isEmpty() const noexcept
bool isEmpty() const noexcept
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QThread * thread() const
Returns the thread in which the object lives.
bool moveToThread(QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
Changes the thread affinity for this object and its children and returns true on success.
void deleteLater()
\threadsafe
QPainterPath intersected(const QPainterPath &r) const
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
void addText(const QPointF &point, const QFont &f, const QString &text)
Adds the given text to this path as a set of closed subpaths created from the font supplied.
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
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
\inmodule QtCore\reentrant
static constexpr qreal dotProduct(const QPointF &p1, const QPointF &p2)
The QPolygonF class provides a list of points using floating point precision.
RenderTarget renderTarget
void setShadowBlur(qreal b)
void updateMatrix(const QTransform &matrix)
void setGlobalCompositeOperation(QPainter::CompositionMode cm)
void setStrokeStyle(const QBrush &style, bool repeatX=false, bool repeatY=false)
void setShadowOffsetX(qreal x)
void setFillStyle(const QBrush &style, bool repeatX=false, bool repeatY=false)
void setLineCap(Qt::PenCapStyle cap)
void setLineDash(const QVector< qreal > &pattern)
void setMiterLimit(qreal limit)
void setLineWidth(qreal w)
void clip(bool enabled, const QPainterPath &path)
void setShadowOffsetY(qreal y)
void setShadowColor(const QColor &color)
void clearRect(const QRectF &r)
void setGlobalAlpha(qreal alpha)
void setLineJoin(Qt::PenJoinStyle join)
QV4::PersistentValue gradientProto
~QQuickContext2DEngineData()
QQuickContext2DEngineData(QV4::ExecutionEngine *engine)
QV4::PersistentValue contextPrototype
QV4::PersistentValue pixelArrayProto
static QQuickContext2DRenderThread * instance(QQmlEngine *engine)
void setItem(QQuickCanvasItem *item)
void setOnCustomThread(bool is)
bool setCanvasWindow(const QRect &canvasWindow)
void canvasChanged(const QSize &canvasSize, const QSize &tileSize, const QRect &canvasWindow, const QRect &dirtyRect, bool smooth, bool antialiasing)
virtual void grabImage(const QRectF ®ion=QRectF())=0
void paint(QQuickContext2DCommandBuffer *ccb)
bool setCanvasSize(const QSize &size)
bool setTileSize(const QSize &size)
void setSmooth(bool smooth)
void setAntialiasing(bool antialiasing)
QPainterPath createTextGlyphs(qreal x, qreal y, const QString &text)
bool isPointInPath(qreal x, qreal y) const
void arcTo(qreal x1, qreal y1, qreal x2, qreal y2, qreal radius)
void translate(qreal x, qreal y)
QQuickContext2DTexture * texture() const
QV4::ExecutionEngine * v4Engine() const override
void strokeRect(qreal x, qreal y, qreal w, qreal h)
void text(const QString &str, qreal x, qreal y)
void ellipse(qreal x, qreal y, qreal w, qreal h)
QV4::ExecutionEngine * m_v4engine
QV4::ReturnedValue v4value() const override
void setTransform(qreal a, qreal b, qreal c, qreal d, qreal e, qreal f)
QImage toImage(const QRectF &bounds) override
void arc(qreal x, qreal y, qreal radius, qreal startAngle, qreal endAngle, bool anticlockwise)
QStringList contextNames() const override
void setGrabbedImage(const QImage &grab)
void lineTo(qreal x, qreal y)
QQuickContext2D(QObject *parent=nullptr)
void init(QQuickCanvasItem *canvasItem, const QVariantMap &args) override
QQuickContext2DCommandBuffer * buffer() const
void scale(qreal x, qreal y)
void bezierCurveTo(qreal cp1x, qreal cp1y, qreal cp2x, qreal cp2y, qreal x, qreal y)
void prepare(const QSize &canvasSize, const QSize &tileSize, const QRect &canvasWindow, const QRect &dirtyRect, bool smooth, bool antialiasing) override
QQuickContext2DTexture * m_texture
QQuickCanvasItem * m_canvas
void quadraticCurveTo(qreal cpx, qreal cpy, qreal x, qreal y)
QQuickCanvasItem::RenderStrategy m_renderStrategy
void drawText(const QString &text, qreal x, qreal y, bool fill)
void roundedRect(qreal x, qreal y, qreal w, qreal h, qreal xr, qreal yr)
QQuickCanvasItem::RenderTarget m_renderTarget
QQmlRefPointer< QQuickCanvasPixmap > createPixmap(const QUrl &url, QSizeF sourceSize=QSizeF())
void setV4Engine(QV4::ExecutionEngine *eng) override
void shear(qreal h, qreal v)
QQuickContext2DCommandBuffer * m_buffer
void clearRect(qreal x, qreal y, qreal w, qreal h)
void addArcTo(const QPointF &p1, const QPointF &p2, qreal radius)
void transform(qreal a, qreal b, qreal c, qreal d, qreal e, qreal f)
QV4::PersistentValue m_v4value
void rect(qreal x, qreal y, qreal w, qreal h)
void moveTo(qreal x, qreal y)
void fillRect(qreal x, qreal y, qreal w, qreal h)
QStack< QQuickContext2D::State > m_stateStack
qreal width
This property holds the width of this item.
qreal height
This property holds the height of this item.
\inmodule QtCore\reentrant
constexpr void moveTo(qreal x, qreal y) noexcept
Moves the rectangle, leaving the top-left corner at the given position (x, y).
\inmodule QtCore\reentrant
T pop()
Removes the top item from the stack and returns it.
void push(const T &t)
Adds element t to the top of the stack.
constexpr QStringView left(qsizetype n) const noexcept
Q_CORE_EXPORT QList< QStringView > split(QStringView sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the view into substring views wherever sep occurs, and returns the list of those string views.
constexpr QStringView right(qsizetype n) const noexcept
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
Returns the substring of length length starting at position start in this object.
QStringView trimmed() const noexcept
Strips leading and trailing whitespace and returns the result.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString mid(qsizetype position, qsizetype n=-1) const &
qsizetype size() const noexcept
Returns the number of characters in this string.
void push_back(QChar c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QChar * data()
Returns a pointer to the data stored in the QString.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
QByteArray toUtf8() const &
static QThread * currentThread()
bool isValid() const
Returns true if the URL is non-empty and valid; otherwise returns false.
ObjectType::Data * allocate(Args &&... args)
ReturnedValue value() const
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
bool parsePathDataFast(const QString &dataStr, QPainterPath &path)
Combined button and popup list for selecting options.
Scoped< String > ScopedString
@ BlockingQueuedConnection
static int arrayLength(const QString &rawType)
QList< QString > QStringList
Constructs a string list that contains the given string, str.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
qfloat16 qSqrt(qfloat16 f)
int qRound(qfloat16 d) noexcept
constexpr float qRadiansToDegrees(float radians)
static QT_BEGIN_NAMESPACE const int tileSize
constexpr T qAbs(const T &t)
constexpr static Q_DECL_CONST_FUNCTION double qt_qnan() noexcept
static Q_DECL_CONST_FUNCTION bool qt_is_finite(double d)
#define Q_ARG(Type, data)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLuint const GLfloat * weights
GLuint GLfloat GLfloat GLfloat x1
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLuint GLuint GLfloat weight
GLint GLint GLint yoffset
GLenum GLuint GLintptr offset
GLuint GLfloat GLfloat y0
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLfixed GLfixed GLfixed y2
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void GLsizei void void * span
GLfloat GLfloat GLfloat alpha
static bool hasAlpha(const QImage &image)
QQmlEngine * qmlEngine(const QObject *obj)
static bool withinRange(qreal p, qreal a, qreal b)
#define qClamp(val, min, max)
static QPainter::CompositionMode qt_composite_mode_from_string(const QString &compositeOperator)
static QFont qt_font_from_string(const QString &fontString, const QFont ¤tFont)
QImage qt_image_convolute_filter(const QImage &src, const QVector< qreal > &weights, int radius=0)
static int textAlignOffset(QQuickContext2D::TextAlignType value, const QFontMetrics &metrics, const QString &text)
#define CHECK_CONTEXT(r)
\qmltype Context2D \instantiates QQuickContext2D \inqmlmodule QtQuick
#define Q_TRY_SET_TOKEN(token, value, setStatement)
int baseLineOffset(QQuickContext2D::TextBaseLineType value, const QFontMetrics &metrics)
static bool qSetFontFamilyFromTokens(QFont &font, const QStringList &fontFamilyTokens)
static bool areCollinear(const QPointF &a, const QPointF &b, const QPointF &c)
Q_QUICK_EXPORT QColor qt_color_from_string(const QV4::Value &name)
#define CHECK_CONTEXT_SETTER(r)
static bool qSetFontSizeFromToken(QFont &font, QStringView fontSizeToken)
static int qParseFontSizeFromToken(QStringView fontSizeToken, bool &ok)
static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV4::ExecutionEngine *v4, QImage &&image)
void qt_image_boxblur(QImage &image, int radius, bool quality)
static QString qt_composite_mode_to_string(QPainter::CompositionMode op)
static QStringList qExtractFontFamiliesFromString(QStringView fontFamiliesString)
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)
#define qPrintable(string)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
#define DOMEXCEPTION_NOT_SUPPORTED_ERR
#define DOMEXCEPTION_SYNTAX_ERR
#define DOMEXCEPTION_INDEX_SIZE_ERR
#define THROW_DOM(error, string)
#define DOMEXCEPTION_TYPE_MISMATCH_ERR
#define V4_DEFINE_EXTENSION(dataclass, datafunction)
#define THROW_TYPE_ERROR()
#define RETURN_UNDEFINED()
#define THROW_GENERIC_ERROR(str)
#define DEFINE_OBJECT_VTABLE(classname)
#define V4_OBJECT2(DataClass, superClass)
QUrl url("example.com")
[constructor-url-reference]
\inmodule QtCore \reentrant
static V4_NEEDS_DESTROY QV4::ReturnedValue gradient_proto_addColorStop(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmltype CanvasGradient \inqmlmodule QtQuick
Qt::PenJoinStyle lineJoin
QPainter::CompositionMode globalCompositeOperation
QVector< qreal > lineDash
static QV4::ReturnedValue method_get_data(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty object QtQuick::CanvasImageData::data Holds the one-dimensional array containing the dat...
static QV4::ReturnedValue method_get_height(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty int QtQuick::CanvasImageData::height Holds the actual height dimension of the data in th...
static QV4::ReturnedValue method_get_width(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmltype CanvasImageData \inqmlmodule QtQuick
static QV4::ReturnedValue proto_get_length(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmltype CanvasPixelArray \inqmlmodule QtQuick
static QV4::ReturnedValue method_isPointInPath(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::isPointInPath(real x, real y)
static QV4::ReturnedValue method_measureText(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::measureText(text)
static QV4::ReturnedValue method_moveTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::moveTo(real x, real y)
static QV4::ReturnedValue method_bezierCurveTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::bezierCurveTo(real cp1x, real cp1y, real cp2x,...
static QV4::ReturnedValue method_getImageData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod CanvasImageData QtQuick::Context2D::getImageData(real x, real y, real w,...
static QV4::ReturnedValue method_setLineDash(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod QtQuick::Context2D::setLineDash(array pattern)
static QV4::ReturnedValue method_quadraticCurveTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::quadraticCurveTo(real cpx, real cpy, real x,...
static QV4::ReturnedValue method_drawImage(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod QtQuick::Context2D::drawImage(variant image, real dx, real dy) Draws the given image on th...
static QV4::ReturnedValue method_scale(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::scale(real x, real y)
static QV4::ReturnedValue method_stroke(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::stroke()
static QV4::ReturnedValue method_closePath(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::closePath() Closes the current subpath by drawing a line to the...
static QV4::ReturnedValue method_strokeRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::strokeRect(real x, real y, real w, real h)
static QV4::ReturnedValue method_transform(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::transform(real a, real b, real c, real d, real e,...
static QV4::ReturnedValue method_translate(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::translate(real x, real y)
static QV4::ReturnedValue method_ellipse(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::ellipse(real x, real y, real w, real h)
static QV4::ReturnedValue method_resetTransform(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::resetTransform()
static QV4::ReturnedValue method_createRadialGradient(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::createRadialGradient(real x0, real y0, real r0,...
static QV4::ReturnedValue method_get_canvas(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty QtQuick::Canvas QtQuick::Context2D::canvas Holds the canvas item that the context paints...
static QV4::ReturnedValue method_clip(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::clip()
static QV4::ReturnedValue method_createLinearGradient(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::createLinearGradient(real x0, real y0, real x1,...
static QV4::ReturnedValue method_reset(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::reset() Resets the context state and properties to the default ...
static QV4::ReturnedValue method_fillText(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::fillText(text, x, y)
static QV4::ReturnedValue method_arc(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::arc(real x, real y, real radius, real startAngle,...
static QV4::ReturnedValue method_save(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::save() Pushes the current state onto the state stack.
static QV4::ReturnedValue method_drawFocusRing(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_shear(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::shear(real sh, real sv)
static QV4::ReturnedValue method_lineTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::lineTo(real x, real y)
static QV4::Heap::QQuickJSContext2DPrototype * create(QV4::ExecutionEngine *engine)
static QV4::ReturnedValue method_setTransform(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::setTransform(real a, real b, real c, real d,...
static QV4::ReturnedValue method_createConicalGradient(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::createConicalGradient(real x, real y, real angle)
static QV4::ReturnedValue method_strokeText(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::strokeText(text, x, y)
static QV4::ReturnedValue method_restore(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::restore() Pops the top state on the stack, restoring the contex...
static QV4::ReturnedValue method_rect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::rect(real x, real y, real w, real h)
static QV4::ReturnedValue method_beginPath(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::beginPath()
static QV4::ReturnedValue method_rotate(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::rotate(real angle) Rotate the canvas around the current origin ...
static QV4::ReturnedValue method_fillRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::fillRect(real x, real y, real w, real h)
static QV4::ReturnedValue method_getLineDash(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod array QtQuick::Context2D::getLineDash()
static QV4::ReturnedValue method_arcTo(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::arcTo(real x1, real y1, real x2, real y2,...
static QV4::ReturnedValue method_fill(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::fill()
static QV4::ReturnedValue method_setCaretSelectionRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_createImageData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod CanvasImageData QtQuick::Context2D::createImageData(real sw, real sh)
static QV4::ReturnedValue method_createPattern(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod variant QtQuick::Context2D::createPattern(color color, enumeration patternMode) This is an...
static QV4::ReturnedValue method_roundedRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::roundedRect(real x, real y, real w, real h, real xRadius,...
static QV4::ReturnedValue method_caretBlinkRate(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_putImageData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::putImageData(CanvasImageData imageData, real dx,...
static QV4::ReturnedValue method_text(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::text(string text, real x, real y)
static QV4::ReturnedValue method_clearRect(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlmethod object QtQuick::Context2D::clearRect(real x, real y, real w, real h)
static QV4::ReturnedValue method_set_miterLimit(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_fillRule(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_lineCap(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_textAlign(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_lineJoin(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty string QtQuick::Context2D::lineJoin Holds the current line join style.
static QV4::ReturnedValue method_get_globalCompositeOperation(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty string QtQuick::Context2D::globalCompositeOperation Holds the current the current compos...
static QV4::ReturnedValue method_set_shadowOffsetX(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_fillRule(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty enumeration QtQuick::Context2D::fillRule Holds the current fill rule used for filling sh...
static QV4::ReturnedValue method_set_strokeStyle(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_lineCap(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty string QtQuick::Context2D::lineCap Holds the current line cap style.
static QV4::ReturnedValue method_set_font(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_lineDashOffset(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty real QtQuick::Context2D::lineDashOffset
static QV4::ReturnedValue method_get_textAlign(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty string QtQuick::Context2D::textAlign
static QV4::ReturnedValue method_set_globalAlpha(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_textBaseline(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_lineWidth(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty real QtQuick::Context2D::lineWidth Holds the current line width.
static QV4::ReturnedValue method_set_fillStyle(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_shadowOffsetY(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_font(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty string QtQuick::Context2D::font Holds the current font settings.
static QV4::ReturnedValue method_get_fillStyle(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty variant QtQuick::Context2D::fillStyle Holds the current style used for filling shapes.
static QV4::ReturnedValue method_get_shadowBlur(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty real QtQuick::Context2D::shadowBlur Holds the current level of blur applied to shadows
static QV4::ReturnedValue method_get_shadowOffsetY(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty qreal QtQuick::Context2D::shadowOffsetY Holds the current shadow offset in the positive ...
static QV4::ReturnedValue method_get_miterLimit(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty real QtQuick::Context2D::miterLimit Holds the current miter limit ratio.
static QV4::ReturnedValue method_set_globalCompositeOperation(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_lineDashOffset(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static V4_NEEDS_DESTROY QV4::ReturnedValue method_get_globalAlpha(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty real QtQuick::Context2D::globalAlpha
static QV4::ReturnedValue method_get_shadowColor(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty string QtQuick::Context2D::shadowColor Holds the current shadow color.
static QV4::ReturnedValue method_set_lineWidth(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_shadowColor(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_set_lineJoin(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_strokeStyle(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty variant QtQuick::Context2D::strokeStyle Holds the current color or style to use for the ...
static QV4::ReturnedValue method_set_shadowBlur(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static QV4::ReturnedValue method_get_textBaseline(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty string QtQuick::Context2D::textBaseline
static QV4::ReturnedValue method_get_shadowOffsetX(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
\qmlproperty qreal QtQuick::Context2D::shadowOffsetX Holds the current shadow offset in the positive ...
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
MemoryManager * memoryManager
String * id_length() const
QV4::ReturnedValue fromVariant(const QVariant &)
Heap::Object * newObject()
Heap::String * newString(char16_t c)
Heap::String * newIdentifier(const QString &text)
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, bool createJSValueForObjectsAndSymbols=true)
Heap::ArrayObject * newArrayObject(int count=0)
static void markObjects(QV4::Heap::Base *that, QV4::MarkStack *markStack)
QQuickContext2D * context()
void setContext(QQuickContext2D *context)
Heap::InternalClass * internalClass() const
ExecutionEngine * engine() const
void defineDefaultProperty(StringOrSymbol *name, const Value &value, PropertyAttributes attributes=Attr_Data|Attr_NotEnumerable)
void defineAccessorProperty(const QString &name, VTable::Call getter, VTable::Call setter)
bool hasProperty(PropertyKey id) const
bool put(StringOrSymbol *name, const Value &v, Value *receiver=nullptr)
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
bool hasException() const
QML_NEARLY_ALWAYS_INLINE ReturnedValue asReturnedValue() const
constexpr ReturnedValue asReturnedValue() const
QV4_NEARLY_ALWAYS_INLINE constexpr quint32 value() const
static constexpr VTable::Get virtualGet
static constexpr VTable::Put virtualPut
void mark(MarkStack *markStack)
static constexpr Value fromBoolean(bool b)
static constexpr Value undefinedValue()
static Value fromDouble(double d)
QString toQString() const
QString toQStringNoThrow() const