@@ -77,12 +77,18 @@ class CanvasRenderingContext2D extends js.Object {
7777 /** Restores the drawing style state to the last element on the 'state stack' saved by save(). */
7878 def restore (): Unit = js.native
7979
80+ /** Resets the current transform to the identity matrix, and then invokes the transform() method with the same
81+ * arguments.
82+ */
8083 def setTransform (m11 : Double , m12 : Double , m21 : Double , m22 : Double , dx : Double , dy : Double ): Unit = js.native
8184
8285 /** Saves the current drawing style state using a stack so you can revert any change you make to it using restore().
8386 */
8487 def save (): Unit = js.native
8588
89+ /** Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at
90+ * endAngle going in the given direction by anticlockwise (defaulting to clockwise).
91+ */
8692 def arc (x : Double , y : Double , radius : Double , startAngle : Double , endAngle : Double ,
8793 anticlockwise : Boolean ): Unit = js.native
8894
@@ -91,27 +97,39 @@ class CanvasRenderingContext2D extends js.Object {
9197 */
9298 def arc (x : Double , y : Double , radius : Double , startAngle : Double , endAngle : Double ): Unit = js.native
9399
100+ /** Returns a TextMetrics object. */
94101 def measureText (text : String ): TextMetrics = js.native
95102
103+ /** Reports whether or not the specified point is contained in the current path. */
96104 def isPointInPath (x : Double , y : Double , fillRule : String ): Boolean = js.native
97105
98106 /** Reports whether or not the specified point is contained in the current path. */
99107 def isPointInPath (x : Double , y : Double ): Boolean = js.native
100108
109+ /** Adds a quadratic Bézier curve to the current path. */
101110 def quadraticCurveTo (cpx : Double , cpy : Double , x : Double , y : Double ): Unit = js.native
102111
112+ /** Paints data from the given ImageData object onto the bitmap. If a dirty rectangle is provided, only the pixels
113+ * from that rectangle are painted.
114+ */
103115 def putImageData (imagedata : ImageData , dx : Double , dy : Double , dirtyX : Double = js.native, dirtyY : Double = js.native,
104116 dirtyWidth : Double = js.native, dirtyHeight : Double = js.native): Unit = js.native
105117
118+ /** Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is
119+ * expressed in radians.
120+ */
106121 def rotate (angle : Double ): Unit = js.native
107122
123+ /** Draws (fills) a given text at the given (x, y) position. */
108124 def fillText (text : String , x : Double , y : Double , maxWidth : Double = js.native): Unit = js.native
109125
110126 /** Moves the origin point of the context to (x, y). */
111127 def translate (x : Double , y : Double ): Unit = js.native
112128
129+ /** Adds a scaling transformation to the canvas units by x horizontally and by y vertically. */
113130 def scale (x : Double , y : Double ): Unit = js.native
114131
132+ /** Creates a radial gradient given by the coordinates of the two circles represented by the parameters. */
115133 def createRadialGradient (x0 : Double , y0 : Double , r0 : Double , x1 : Double , y1 : Double ,
116134 r1 : Double ): CanvasGradient = js.native
117135
@@ -135,13 +153,17 @@ class CanvasRenderingContext2D extends js.Object {
135153 */
136154 def createImageData (imageDataOrSw : js.Any , sh : Double = js.native): ImageData = js.native
137155
156+ /** Creates a pattern using the specified image. It repeats the source in the directions specified by the repetition
157+ * argument. This method returns a CanvasPattern.
158+ */
138159 def createPattern (image : HTMLElement , repetition : String ): CanvasPattern = js.native
139160
140161 /** Tries to draw a straight line from the current point to the start. If the shape has already been closed or has
141162 * only one point, this function does nothing.
142163 */
143164 def closePath (): Unit = js.native
144165
166+ /** Creates a path for a rectangle at position (x, y) with a size that is determined by width and height. */
145167 def rect (x : Double , y : Double , w : Double , h : Double ): Unit = js.native
146168
147169 /** Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the
@@ -164,6 +186,7 @@ class CanvasRenderingContext2D extends js.Object {
164186 /** Draws a filled rectangle at (x, y) position whose size is determined by width and height. */
165187 def fillRect (x : Double , y : Double , w : Double , h : Double ): Unit = js.native
166188
189+ /** Adds a cubic Bézier curve to the current path. */
167190 def bezierCurveTo (cp1x : Double , cp1y : Double , cp2x : Double , cp2y : Double , x : Double , y : Double ): Unit = js.native
168191
169192 /** Draws the specified image. This method is available in multiple formats, providing a great deal of flexibility in
@@ -173,6 +196,7 @@ class CanvasRenderingContext2D extends js.Object {
173196 height : Double = js.native, canvasOffsetX : Double = js.native, canvasOffsetY : Double = js.native,
174197 canvasImageWidth : Double = js.native, canvasImageHeight : Double = js.native): Unit = js.native
175198
199+ /** Multiplies the current transformation matrix with the matrix described by its arguments. */
176200 def transform (m11 : Double , m12 : Double , m21 : Double , m22 : Double , dx : Double , dy : Double ): Unit = js.native
177201
178202 /** Strokes the subpaths with the current stroke style. */
@@ -185,8 +209,10 @@ class CanvasRenderingContext2D extends js.Object {
185209 */
186210 def strokeRect (x : Double , y : Double , w : Double , h : Double ): Unit = js.native
187211
212+ /** Sets the current line dash pattern. */
188213 def setLineDash (segments : js.Array [Double ]): Unit = js.native
189214
215+ /** Draws (strokes) a given text at the given (x, y) position. */
190216 def strokeText (text : String , x : Double , y : Double , maxWidth : Double = js.native): Unit = js.native
191217
192218 /** Starts a new path by resetting the list of sub-paths. Call this method when you want to create a new path. */
@@ -195,6 +221,7 @@ class CanvasRenderingContext2D extends js.Object {
195221 /** Adds an arc with the given control points and radius, connected to the previous point by a straight line. */
196222 def arcTo (x1 : Double , y1 : Double , x2 : Double , y2 : Double , radius : Double ): Unit = js.native
197223
224+ /** Creates a linear gradient along the line given by the coordinates represented by the parameters. */
198225 def createLinearGradient (x0 : Double , y0 : Double , x1 : Double , y1 : Double ): CanvasGradient = js.native
199226
200227 /** The ellipse() method creates an elliptical arc centered at (x, y) with the radii radiusX and radiusY. The path
0 commit comments