![]() |
Qt 6.x
The Qt SDK
|
Static Public Member Functions | |
static QV4::Heap::QQuickJSContext2DPrototype * | create (QV4::ExecutionEngine *engine) |
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 on. | |
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 context to that state. | |
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 values. | |
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_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 by angle in radians and clockwise direction. | |
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_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_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, real e, real f) | |
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, real f) | |
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_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_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, real y1) Returns a CanvasGradient object that represents a linear gradient that transitions the color along a line between the start point (x0, y0) and the end point (x1, y1). | |
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, real x1, real y1, real r1) | |
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_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 overloaded function. | |
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_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_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_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, real endAngle, bool anticlockwise) | |
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, real radius) | |
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_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, real cp2y, real x, real y) | |
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_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 beginning of the subpath, automatically starting a new path. | |
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_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::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_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, real y) | |
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_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, real yRadius) | |
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_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_stroke (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) |
\qmlmethod object QtQuick::Context2D::stroke() | |
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_drawFocusRing (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) |
static QV4::ReturnedValue | method_setCaretSelectionRect (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) |
static QV4::ReturnedValue | method_caretBlinkRate (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) |
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_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_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_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 the canvas at position (dx, dy). | |
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_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, real h) | |
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, real dy, real dirtyX, real dirtyY, real dirtyWidth, real dirtyHeight) | |
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_getLineDash (const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) |
\qmlmethod array QtQuick::Context2D::getLineDash() | |
![]() | |
static ReturnedValue | getValue (const Value *thisObject, const Value &v, PropertyAttributes attrs) |
static ReturnedValue | getValueAccessor (const Value *thisObject, const Value &v, PropertyAttributes attrs) |
static ReturnedValue | checkedInstanceOf (ExecutionEngine *engine, const FunctionObject *typeObject, const Value &var) |
![]() | |
static constexpr Value | fromStaticValue (StaticValue staticValue) |
static Value | fromHeapObject (HeapBasePtr m) |
static bool | toBooleanImpl (Value val) |
static double | toNumberImpl (Value v) |
static Heap::String * | toString (ExecutionEngine *e, Value val) |
static Heap::Object * | toObject (ExecutionEngine *e, Value val) |
static constexpr Value | fromReturnedValue (ReturnedValue val) |
static double | toInteger (double d) |
static int | toInt32 (double d) |
static unsigned int | toUInt32 (double d) |
static constexpr Value | emptyValue () |
static constexpr Value | fromBoolean (bool b) |
static constexpr Value | fromInt32 (int i) |
static constexpr Value | undefinedValue () |
static constexpr Value | nullValue () |
static Value | fromDouble (double d) |
static Value | fromUInt32 (uint i) |
![]() | |
static int | valueOffset () |
static int | tagOffset () |
static constexpr quint64 | tagValue (quint32 tag, quint32 value) |
static constexpr quint64 | tagBitMask (TagBit bit) |
static bool | integerCompatible (StaticValue a, StaticValue b) |
static bool | bothDouble (StaticValue a, StaticValue b) |
static QV4_NEARLY_ALWAYS_INLINE bool | isInt32 (double d) |
static constexpr StaticValue | fromReturnedValue (ReturnedValue val) |
static constexpr StaticValue | emptyValue () |
static constexpr StaticValue | fromBoolean (bool b) |
static constexpr StaticValue | fromInt32 (int i) |
static constexpr StaticValue | undefinedValue () |
static constexpr StaticValue | nullValue () |
static StaticValue | fromDouble (double d) |
static StaticValue | fromUInt32 (uint i) |
static double | toInteger (double d) |
static int | toInt32 (double d) |
static unsigned int | toUInt32 (double d) |
Definition at line 570 of file qquickcontext2d.cpp.
|
inlinestatic |
Definition at line 574 of file qquickcontext2d.cpp.
References QV4::MemoryManager::allocate(), QV4::Managed::engine(), QV4::EngineBase::memoryManager, method_arc(), method_arcTo(), method_beginPath(), method_bezierCurveTo(), method_caretBlinkRate(), method_clearRect(), method_clip(), method_closePath(), method_createConicalGradient(), method_createImageData(), method_createLinearGradient(), method_createPattern(), method_createRadialGradient(), method_drawFocusRing(), method_drawImage(), method_ellipse(), method_fill(), method_fillRect(), method_fillText(), method_get_canvas(), method_getImageData(), method_getLineDash(), method_isPointInPath(), method_lineTo(), method_measureText(), method_moveTo(), method_putImageData(), method_quadraticCurveTo(), method_rect(), method_reset(), method_resetTransform(), method_restore(), method_rotate(), method_roundedRect(), method_save(), method_scale(), method_setCaretSelectionRect(), method_setLineDash(), method_setTransform(), method_shear(), method_stroke(), method_strokeRect(), method_strokeText(), method_text(), method_transform(), method_translate(), o, and QStringLiteral.
Referenced by QQuickContext2DEngineData::QQuickContext2DEngineData().
|
static |
\qmlmethod object QtQuick::Context2D::arc(real x, real y, real radius, real startAngle, real endAngle, bool anticlockwise)
Adds an arc to the current subpath that lies on the circumference of the circle whose center is at the point (x, y) and whose radius is radius.
Both startAngle and endAngle are measured from the x-axis in radians.
The anticlockwise parameter is false
for each arc in the figure above because they are all drawn in the clockwise direction.
Definition at line 2378 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, DOMEXCEPTION_INDEX_SIZE_ERR, qt_is_finite(), RETURN_RESULT, THROW_DOM, QV4::Value::toBoolean(), and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::arcTo(real x1, real y1, real x2, real y2, real radius)
Adds an arc with the given control points and radius to the current subpath, connected to the previous point by a straight line. To draw an arc, you begin with the same steps you followed to create a line:
\list
x
, y
) method to set your starting position on the canvas at the point (x
, y
). Definition at line 2430 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, DOMEXCEPTION_INDEX_SIZE_ERR, qt_is_finite(), RETURN_RESULT, THROW_DOM, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::beginPath()
Resets the current path to a new path.
Definition at line 2458 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::bezierCurveTo(real cp1x, real cp1y, real cp2x, real cp2y, real x, real y)
Adds a cubic bezier curve between the current position and the given endPoint using the control points specified by ({cp1x}, {cp1y}), and ({cp2x}, {cp2y}). After the curve is added, the current position is updated to be at the end point ({x}, {y}) of the curve. The following code produces the path shown below:
Definition at line 2492 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, and QV4::Value::toNumber().
Referenced by create().
|
static |
Definition at line 2801 of file qquickcontext2d.cpp.
References DOMEXCEPTION_NOT_SUPPORTED_ERR, and THROW_DOM.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::clearRect(real x, real y, real w, real h)
Clears all pixels on the canvas in the rectangle specified by (x, y, w, h) to transparent black.
Definition at line 2301 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::clip()
Creates the clipping region from the current path. Any parts of the shape outside the clipping path are not displayed. To create a complex shape using the clip()
method:
\list 1
{context.beginPath()} method to set the clipping path.
{lineTo},
{arcTo},
{arc},
{moveTo}, etc and
{closePath} methods.
{context.clip()} method. \endlistThe new shape displays. The following shows how a clipping path can modify how an image displays:
Definition at line 2538 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::closePath() Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting a new path.
The current point of the new path is the previous subpath's first point.
Definition at line 2555 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::createConicalGradient(real x, real y, real angle)
Returns a CanvasGradient object that represents a conical gradient that interpolates colors counter-clockwise around a center point (x, y) with a start angle angle in units of radians.
Definition at line 1712 of file qquickcontext2d.cpp.
References QV4::MemoryManager::allocate(), QV4::Value::as(), CHECK_CONTEXT, DOMEXCEPTION_INDEX_SIZE_ERR, DOMEXCEPTION_NOT_SUPPORTED_ERR, QV4::Scope::engine, QQuickContext2DEngineData::gradientProto, QV4::EngineBase::memoryManager, qRadiansToDegrees(), qt_is_finite(), RETURN_RESULT, THROW_DOM, QV4::Value::toNumber(), and QV4::PersistentValue::value().
Referenced by create().
|
static |
\qmlmethod CanvasImageData QtQuick::Context2D::createImageData(real sw, real sh)
Creates a CanvasImageData object with the given dimensions(sw, sh).
\qmlmethod CanvasImageData QtQuick::Context2D::createImageData(CanvasImageData imageData)
Creates a CanvasImageData object with the same dimensions as the argument.
\qmlmethod CanvasImageData QtQuick::Context2D::createImageData(Url imageUrl)
Creates a CanvasImageData object with the given image loaded from imageUrl.
Definition at line 3426 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, DOMEXCEPTION_INDEX_SIZE_ERR, DOMEXCEPTION_NOT_SUPPORTED_ERR, QV4::Scope::engine, QV4::Value::isString(), qt_create_image_data(), qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, THROW_DOM, QV4::Value::toNumber(), and QV4::Value::toQStringNoThrow().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::createLinearGradient(real x0, real y0, real x1, real y1) Returns a CanvasGradient object that represents a linear gradient that transitions the color along a line between the start point (x0, y0) and the end point (x1, y1).
A gradient is a smooth transition between colors. There are two types of gradients: linear and radial. Gradients must have two or more color stops, representing color shifts positioned from 0 to 1 between to the gradient's starting and end points or circles.
Definition at line 1611 of file qquickcontext2d.cpp.
References QV4::MemoryManager::allocate(), QV4::Value::as(), CHECK_CONTEXT, DOMEXCEPTION_NOT_SUPPORTED_ERR, QV4::Scope::engine, QQuickContext2DEngineData::gradientProto, QV4::EngineBase::memoryManager, qt_is_finite(), RETURN_RESULT, THROW_DOM, QV4::Value::toNumber(), and QV4::PersistentValue::value().
Referenced by create().
|
static |
\qmlmethod variant QtQuick::Context2D::createPattern(color color, enumeration patternMode) This is an overloaded function.
Returns a CanvasPattern object that uses the given color and patternMode. The valid pattern modes are:
\value Qt.SolidPattern Qt::SolidPattern \value Qt.Dense1Pattern Qt::Dense1Pattern \value Qt.Dense2Pattern Qt::Dense2Pattern \value Qt.Dense3Pattern Qt::Dense3Pattern \value Qt.Dense4Pattern Qt::Dense4Pattern \value Qt.Dense5Pattern Qt::Dense5Pattern \value Qt.Dense6Pattern Qt::Dense6Pattern \value Qt.Dense7Pattern Qt::Dense7Pattern \value Qt.HorPattern Qt::HorPattern \value Qt.VerPattern Qt::VerPattern \value Qt.CrossPattern Qt::CrossPattern \value Qt.BDiagPattern Qt::BDiagPattern \value Qt.FDiagPattern Qt::FDiagPattern \value Qt.DiagCrossPattern Qt::DiagCrossPattern
\qmlmethod variant QtQuick::Context2D::createPattern(Image image, string repetition) Returns a CanvasPattern object that uses the given image and repeats in the direction(s) given by the repetition argument.
The image parameter must be a valid Image item, a valid CanvasImageData object or loaded image url. If there is no image data, thus function throws an INVALID_STATE_ERR exception.
The allowed values for repetition are:
\value "repeat" both directions \value "repeat-x horizontal only \value "repeat-y" vertical only \value "no-repeat" neither If the repetition argument is empty or null, the value "repeat" is used.
Definition at line 1786 of file qquickcontext2d.cpp.
References QV4::MemoryManager::allocate(), CHECK_CONTEXT, QArrayDataPointer< T >::d, QV4::Scope::engine, QString::isEmpty(), QImage::isNull(), Qt::LinearGradientPattern, QV4::EngineBase::memoryManager, QV4::ExecutionEngine::newString(), o, QStringLiteral, RETURN_RESULT, RETURN_UNDEFINED, Qt::SolidPattern, QV4::Value::toInt32(), QV4::Value::toQStringNoThrow(), QV4::ExecutionEngine::toVariant(), and QVariant::value().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::createRadialGradient(real x0, real y0, real r0, real x1, real y1, real r1)
Returns a CanvasGradient object that represents a radial gradient that paints along the cone given by the start circle with origin (x0, y0) and radius r0, and the end circle with origin (x1, y1) and radius r1.
Definition at line 1658 of file qquickcontext2d.cpp.
References QV4::MemoryManager::allocate(), QV4::Value::as(), CHECK_CONTEXT, DOMEXCEPTION_INDEX_SIZE_ERR, DOMEXCEPTION_NOT_SUPPORTED_ERR, QV4::Scope::engine, QQuickContext2DEngineData::gradientProto, QV4::EngineBase::memoryManager, qt_is_finite(), r1, RETURN_RESULT, THROW_DOM, QV4::Value::toNumber(), and QV4::PersistentValue::value().
Referenced by create().
|
static |
Definition at line 2789 of file qquickcontext2d.cpp.
References DOMEXCEPTION_NOT_SUPPORTED_ERR, and THROW_DOM.
Referenced by create().
|
static |
\qmlmethod QtQuick::Context2D::drawImage(variant image, real dx, real dy) Draws the given image on the canvas at position (dx, dy).
Note: The image type can be an Image item, an image url or a CanvasImageData object. When given as Image item, if the image isn't fully loaded, this method draws nothing. When given as url string, the image should be loaded by calling Canvas item's Canvas::loadImage() method first. This image been drawing is subject to the current context clip path, even the given image
is a CanvasImageData object.
\qmlmethod QtQuick::Context2D::drawImage(variant image, real dx, real dy, real dw, real dh) This is an overloaded function. Draws the given item as image onto the canvas at point (dx, dy) and with width dw, height dh.
Note: The image type can be an Image item, an image url or a CanvasImageData object. When given as Image item, if the image isn't fully loaded, this method draws nothing. When given as url string, the image should be loaded by calling Canvas item's Canvas::loadImage() method first. This image been drawing is subject to the current context clip path, even the given image
is a CanvasImageData object.
\qmlmethod QtQuick::Context2D::drawImage(variant image, real sx, real sy, real sw, real sh, real dx, real dy, real dw, real dh) This is an overloaded function. Draws the given item as image from source point (sx, sy) and source width sw, source height sh onto the canvas at point (dx, dy) and with width dw, height dh.
Note: The image type can be an Image or Canvas item, an image url or a CanvasImageData object. When given as Image item, if the image isn't fully loaded, this method draws nothing. When given as url string, the image should be loaded by calling Canvas item's Canvas::loadImage() method first. This image been drawing is subject to the current context clip path, even the given image
is a CanvasImageData object.
Definition at line 3121 of file qquickcontext2d.cpp.
References arg, CHECK_CONTEXT, DOMEXCEPTION_INDEX_SIZE_ERR, DOMEXCEPTION_TYPE_MISMATCH_ERR, imageData, QPixmap::isNull(), QUrl::isValid(), pix, pixmap, qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, THROW_DOM, QV4::Value::toNumber(), and url.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::ellipse(real x, real y, real w, real h)
Creates an ellipse within the bounding rectangle defined by its top-left corner at (x, y), width w and height h, and adds it to the path as a closed subpath.
The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).
Definition at line 2712 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::fill()
Fills the subpaths with the current fill style.
Definition at line 2575 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::fillRect(real x, real y, real w, real h)
Paints a rectangular area specified by (x, y, w, h) using fillStyle.
Definition at line 2324 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::fillText(text, x, y)
Fills the specified text at the given position (x, y).
Definition at line 2999 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, QV4::Value::toNumber(), and QV4::Value::toQStringNoThrow().
Referenced by create().
|
static |
\qmlproperty QtQuick::Canvas QtQuick::Context2D::canvas Holds the canvas item that the context paints on.
This property is read only.
Definition at line 965 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, QV4::Scope::engine, RETURN_RESULT, and QV4::QObjectWrapper::wrap().
Referenced by create().
|
static |
\qmlmethod CanvasImageData QtQuick::Context2D::getImageData(real x, real y, real w, real h)
Returns an CanvasImageData object containing the image data for the canvas rectangle specified by (x, y, w, h).
Definition at line 3467 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, DOMEXCEPTION_INDEX_SIZE_ERR, DOMEXCEPTION_NOT_SUPPORTED_ERR, QV4::Scope::engine, QV4::Encode::null(), qt_create_image_data(), qt_is_finite(), RETURN_RESULT, THROW_DOM, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod array QtQuick::Context2D::getLineDash()
Definition at line 2035 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, QV4::Scope::engine, QV4::Value::fromDouble(), i, QV4::ExecutionEngine::newArrayObject(), and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::isPointInPath(real x, real y)
Returns true
if the point (x, y) is in the current path.
Definition at line 2777 of file qquickcontext2d.cpp.
References QV4::StaticValue::asReturnedValue(), CHECK_CONTEXT, QV4::Value::fromBoolean(), RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::lineTo(real x, real y)
Draws a line from the current position to the point at (x, y).
Definition at line 2589 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::measureText(text)
Returns an object with a width
property, whose value is equivalent to calling QFontMetrics::horizontalAdvance() with the given text in the current font.
Definition at line 3045 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, QV4::Scope::engine, QV4::Value::fromDouble(), QFontMetrics::horizontalAdvance(), QV4::ExecutionEngine::newIdentifier(), QV4::ExecutionEngine::newObject(), QStringLiteral, RETURN_RESULT, RETURN_UNDEFINED, and QV4::Value::toQStringNoThrow().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::moveTo(real x, real y)
Creates a new subpath with a point at (x, y).
Definition at line 2613 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::putImageData(CanvasImageData imageData, real dx, real dy, real dirtyX, real dirtyY, real dirtyWidth, real dirtyHeight)
Paints the data from the given imageData object onto the canvas at (dx, dy).
If a dirty rectangle (dirtyX, dirtyY, dirtyWidth, dirtyHeight) is provided, only the pixels from that rectangle are painted.
Definition at line 3499 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, DOMEXCEPTION_NOT_SUPPORTED_ERR, DOMEXCEPTION_TYPE_MISMATCH_ERR, imageData, QV4::Value::isObject(), qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, THROW_DOM, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::quadraticCurveTo(real cpx, real cpy, real x, real y)
Adds a quadratic bezier curve between the current point and the endpoint (x, y) with the control point specified by (cpx, cpy).
Definition at line 2639 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::rect(real x, real y, real w, real h)
Adds a rectangle at position (x, y), with the given width w and height h, as a closed subpath.
Definition at line 2666 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::reset() Resets the context state and properties to the default values.
Definition at line 994 of file qquickcontext2d.cpp.
References QV4::Value::as(), QV4::StaticValue::asReturnedValue(), CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::resetTransform()
Reset the transformation matrix to the default value (equivalent to calling setTransform(1
, 0
, 0
, 1
, 0
, 0
)).
Definition at line 1222 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::restore() Pops the top state on the stack, restoring the context to that state.
Definition at line 980 of file qquickcontext2d.cpp.
References QV4::Value::as(), QV4::StaticValue::asReturnedValue(), CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::rotate(real angle) Rotate the canvas around the current origin by angle in radians and clockwise direction.
The rotation transformation matrix is as follows:
where the angle of rotation is in radians.
Definition at line 1064 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::roundedRect(real x, real y, real w, real h, real xRadius, real yRadius)
Adds a rounded-corner rectangle, specified by (x, y, w, h), to the path. The xRadius and yRadius arguments specify the radius of the ellipses defining the corners of the rounded rectangle.
Definition at line 2685 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::save() Pushes the current state onto the state stack.
Before changing any state attributes, you should save the current state for future reference. The context maintains a stack of drawing states. Each state consists of the current transformation matrix, clipping region, and values of the following attributes: \list
The current path is NOT part of the drawing state. The path can be reset by invoking the beginPath() method.
Definition at line 1035 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::scale(real x, real y)
Increases or decreases the size of each unit in the canvas grid by multiplying the scale factors to the current tranform matrix. x is the scale factor in the horizontal direction and y is the scale factor in the vertical direction.
The following code doubles the horizontal size of an object drawn on the canvas and halves its vertical size:
Definition at line 1092 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
Definition at line 2795 of file qquickcontext2d.cpp.
References DOMEXCEPTION_NOT_SUPPORTED_ERR, and THROW_DOM.
Referenced by create().
|
static |
\qmlmethod QtQuick::Context2D::setLineDash(array pattern)
pattern a list of numbers that specifies distances to alternately draw a line and a gap.
If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25].
\table 100% \row
Definition at line 2076 of file qquickcontext2d.cpp.
References QList< T >::append(), arrayLength(), CHECK_CONTEXT_SETTER, i, number, qt_is_finite(), QList< T >::reserve(), RETURN_UNDEFINED, and QList< T >::size().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::setTransform(real a, real b, real c, real d, real e, real f)
Changes the transformation matrix to the matrix given by the arguments as described below.
Modifying the transformation matrix directly enables you to perform scaling, rotating, and translating transformations in a single step.
Each point on the canvas is multiplied by the matrix before anything is drawn. The \l{http://www.w3.org/TR/2dcontext/#transformations}{HTML Canvas 2D Context specification} defines the transformation matrix as:
where: \list
The scale factors and skew factors are multiples; {e} and {f} are coordinate space units, just like the units in the translate(x,y) method.
Definition at line 1141 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::shear(real sh, real sv)
Shears the transformation matrix by sh in the horizontal direction and sv in the vertical direction.
Definition at line 1241 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::stroke()
Strokes the subpaths with the current stroke style.
Definition at line 2759 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, and RETURN_RESULT.
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::strokeRect(real x, real y, real w, real h)
Strokes the path of the rectangle specified by (x, y, w, h) using strokeStyle, lineWidth, lineJoin, and (if appropriate) miterLimit attributes.
Definition at line 2344 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::strokeText(text, x, y)
Strokes the given text at a position specified by (x, y).
Definition at line 3026 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, RETURN_RESULT, QV4::Value::toNumber(), and QV4::Value::toQStringNoThrow().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::text(string text, real x, real y)
Adds the given text to the path as a set of closed subpaths created from the current context font supplied.
The subpaths are positioned so that the left end of the text's baseline lies at the point specified by (x, y).
Definition at line 2734 of file qquickcontext2d.cpp.
References CHECK_CONTEXT, qt_is_finite(), RETURN_RESULT, RETURN_UNDEFINED, QV4::Value::toNumber(), and QV4::Value::toQStringNoThrow().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::transform(real a, real b, real c, real d, real e, real f)
This method is very similar to setTransform(), but instead of replacing the old transform matrix, this method applies the given tranform matrix to the current matrix by multiplying to it.
The setTransform(a, b, c, d, e, f) method actually resets the current transform to the identity matrix, and then invokes the transform(a, b, c, d, e, f) method with the same arguments.
Definition at line 1174 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().
|
static |
\qmlmethod object QtQuick::Context2D::translate(real x, real y)
Translates the origin of the canvas by a horizontal distance of x, and a vertical distance of y, in coordinate space units.
Translating the origin enables you to draw patterns of different objects on the canvas without having to measure the coordinates manually for each shape.
Definition at line 1201 of file qquickcontext2d.cpp.
References QV4::Value::as(), CHECK_CONTEXT, RETURN_RESULT, and QV4::Value::toNumber().
Referenced by create().