Fix some Canvas/Context2D documentation issues.

Task-number: QTBUG-23597

Change-Id: I7b3c343a822c136cecec5ce9ce705f2d99466e77
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
Mitch Curtis 2013-06-21 13:20:43 +02:00 committed by The Qt Project
parent e357f01539
commit 93a68a6ef1
2 changed files with 56 additions and 35 deletions

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -1629,11 +1629,24 @@ static v8::Handle<v8::Value> ctx2d_strokeRect(const v8::Arguments &args)
// Complex shapes (paths) API // Complex shapes (paths) API
/*! /*!
\qmlmethod object QtQuick2::Context2D::arc(real x, real y, real radius, real startAngle, real endAngle, bool anticlockwise) \qmlmethod object QtQuick2::Context2D::arc(real x, real y, real radius,
Adds an arc to the current subpath that lies on the circumference of the circle whose center is at the point (\c x,\cy) and whose radius is \c radius. real startAngle, real endAngle, bool anticlockwise)
\image qml-item-canvas-arcTo2.png
\sa arcTo, Adds an arc to the current subpath that lies on the circumference of the
{http://www.w3.org/TR/2dcontext/#dom-context-2d-arc}{W3C 2d context standard for arc} circle whose center is at the point (\a x, \a y) and whose radius is
\a radius.
Both \c startAngle and \c endAngle are measured from the x-axis in radians.
\image qml-item-canvas-arc.png
\image qml-item-canvas-startAngle.png
The \a anticlockwise parameter is \c true for each arc in the figure above
because they are all drawn in the anticlockwise direction.
\sa arcTo, {http://www.w3.org/TR/2dcontext/#dom-context-2d-arc}{W3C's 2D
Context Standard for arc()}
*/ */
static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args) static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args)
{ {
@ -1663,24 +1676,27 @@ static v8::Handle<v8::Value> ctx2d_arc(const v8::Arguments &args)
} }
/*! /*!
\qmlmethod object QtQuick2::Context2D::arcTo(real x1, real y1, real x2, real y2, real radius) \qmlmethod object QtQuick2::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:
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 your followed to create a line:
\list \list
\li Call the context.beginPath() method to set a new path. \li Call the beginPath() method to set a new path.
\li Call the context.moveTo(\c x, \c y) method to set your starting position on the canvas at the point (\c x,\c y). \li Call the moveTo(\c x, \c y) method to set your starting position on the
\li To draw an arc or circle, call the context.arcTo(\c x1, \c y1, \c x2, \c y2,\c radius) method. canvas at the point (\c x, \c y).
This adds an arc with starting point (\c x1,\c y1), ending point (\c x2, \c y2), and radius \c radius to the current subpath and connects \li To draw an arc or circle, call the arcTo(\a x1, \a y1, \a x2, \a y2,
it to the previous subpath by a straight line. \a radius) method. This adds an arc with starting point (\a x1, \a y1),
ending point (\a x2, \a y2), and \a radius to the current subpath and
connects it to the previous subpath by a straight line.
\endlist \endlist
\image qml-item-canvas-arcTo.png
Both startAngle and endAngle are measured from the x axis in units of radians.
\image qml-item-canvas-startAngle.png \image qml-item-canvas-arcTo.png
The anticlockwise has the value TRUE for each arc in the figure above because they are all drawn in the counterclockwise direction.
\sa arc, {http://www.w3.org/TR/2dcontext/#dom-context-2d-arcto}{W3C 2d \sa arc, {http://www.w3.org/TR/2dcontext/#dom-context-2d-arcto}{W3C's 2D
context standard for arcTo} Context Standard for arcTo()}
*/ */
static v8::Handle<v8::Value> ctx2d_arcTo(const v8::Arguments &args) static v8::Handle<v8::Value> ctx2d_arcTo(const v8::Arguments &args)
{ {
@ -2317,7 +2333,7 @@ static v8::Handle<v8::Value> ctx2d_measureText(const v8::Arguments &args)
\sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage}{W3C 2d context standard for drawImage} \sa {http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage}{W3C 2d context standard for drawImage}
*/ */
/*! /*!
\qmlmethod QtQuick2::Context2D::drawImage(variant image, real sx, real sy, real sw, sh, real dx, real dy, real dw, dh) \qmlmethod QtQuick2::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. This is an overloaded function.
Draws the given item as \a image from source point (\a sx, \a sy) and source width \a sw, source height \a sh Draws the given item as \a image from source point (\a sx, \a sy) and source width \a sw, source height \a sh
onto the canvas at point (\a dx, \a dy) and with width \a dw, height \a dh. onto the canvas at point (\a dx, \a dy) and with width \a dw, height \a dh.
@ -2577,19 +2593,24 @@ v8::Handle<v8::Value> ctx2d_pixelArray_indexed_set(uint32_t index, v8::Local<v8:
} }
/*! /*!
\qmlmethod CanvasImageData QtQuick2::Context2D::createImageData(real sw, real sh) \qmlmethod CanvasImageData QtQuick2::Context2D::createImageData(real sw, real sh)
Creates a CanvasImageData object with the given dimensions(\a sw, \a sh). Creates a CanvasImageData object with the given dimensions(\a sw, \a sh).
*/ */
/*! /*!
\qmlmethod CanvasImageData QtQuick2::Context2D::createImageData(CanvasImageData imageData) \qmlmethod CanvasImageData QtQuick2::Context2D::createImageData(CanvasImageData imageData)
Creates a CanvasImageData object with the same dimensions as the argument. Creates a CanvasImageData object with the same dimensions as the argument.
*/ */
/*! /*!
\qmlmethod CanvasImageData QtQuick2::Context2D::createImageData(Url imageUrl) \qmlmethod CanvasImageData QtQuick2::Context2D::createImageData(Url imageUrl)
Creates a CanvasImageData object with the given image loaded from \a imageUrl.
Note:The \a imageUrl must be already loaded before this function call, if not, an empty
CanvasImageData obect will be returned.
\sa Canvas::loadImage(), QtQuick2::Canvas::unloadImage(), QtQuick2::Canvas::isImageLoaded Creates a CanvasImageData object with the given image loaded from \a imageUrl.
\note The \a imageUrl must be already loaded before this function call,
otherwise an empty CanvasImageData obect will be returned.
\sa Canvas::loadImage(), QtQuick2::Canvas::unloadImage(),
QtQuick2::Canvas::isImageLoaded
*/ */
static v8::Handle<v8::Value> ctx2d_createImageData(const v8::Arguments &args) static v8::Handle<v8::Value> ctx2d_createImageData(const v8::Arguments &args)
{ {