@@ -77,12 +77,18 @@ class CanvasRenderingContext2D extends js.Object {
77
77
/** Restores the drawing style state to the last element on the 'state stack' saved by save(). */
78
78
def restore (): Unit = js.native
79
79
80
+ /** Resets the current transform to the identity matrix, and then invokes the transform() method with the same
81
+ * arguments.
82
+ */
80
83
def setTransform (m11 : Double , m12 : Double , m21 : Double , m22 : Double , dx : Double , dy : Double ): Unit = js.native
81
84
82
85
/** Saves the current drawing style state using a stack so you can revert any change you make to it using restore().
83
86
*/
84
87
def save (): Unit = js.native
85
88
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
+ */
86
92
def arc (x : Double , y : Double , radius : Double , startAngle : Double , endAngle : Double ,
87
93
anticlockwise : Boolean ): Unit = js.native
88
94
@@ -91,27 +97,39 @@ class CanvasRenderingContext2D extends js.Object {
91
97
*/
92
98
def arc (x : Double , y : Double , radius : Double , startAngle : Double , endAngle : Double ): Unit = js.native
93
99
100
+ /** Returns a TextMetrics object. */
94
101
def measureText (text : String ): TextMetrics = js.native
95
102
103
+ /** Reports whether or not the specified point is contained in the current path. */
96
104
def isPointInPath (x : Double , y : Double , fillRule : String ): Boolean = js.native
97
105
98
106
/** Reports whether or not the specified point is contained in the current path. */
99
107
def isPointInPath (x : Double , y : Double ): Boolean = js.native
100
108
109
+ /** Adds a quadratic Bézier curve to the current path. */
101
110
def quadraticCurveTo (cpx : Double , cpy : Double , x : Double , y : Double ): Unit = js.native
102
111
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
+ */
103
115
def putImageData (imagedata : ImageData , dx : Double , dy : Double , dirtyX : Double = js.native, dirtyY : Double = js.native,
104
116
dirtyWidth : Double = js.native, dirtyHeight : Double = js.native): Unit = js.native
105
117
118
+ /** Adds a rotation to the transformation matrix. The angle argument represents a clockwise rotation angle and is
119
+ * expressed in radians.
120
+ */
106
121
def rotate (angle : Double ): Unit = js.native
107
122
123
+ /** Draws (fills) a given text at the given (x, y) position. */
108
124
def fillText (text : String , x : Double , y : Double , maxWidth : Double = js.native): Unit = js.native
109
125
110
126
/** Moves the origin point of the context to (x, y). */
111
127
def translate (x : Double , y : Double ): Unit = js.native
112
128
129
+ /** Adds a scaling transformation to the canvas units by x horizontally and by y vertically. */
113
130
def scale (x : Double , y : Double ): Unit = js.native
114
131
132
+ /** Creates a radial gradient given by the coordinates of the two circles represented by the parameters. */
115
133
def createRadialGradient (x0 : Double , y0 : Double , r0 : Double , x1 : Double , y1 : Double ,
116
134
r1 : Double ): CanvasGradient = js.native
117
135
@@ -135,13 +153,17 @@ class CanvasRenderingContext2D extends js.Object {
135
153
*/
136
154
def createImageData (imageDataOrSw : js.Any , sh : Double = js.native): ImageData = js.native
137
155
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
+ */
138
159
def createPattern (image : HTMLElement , repetition : String ): CanvasPattern = js.native
139
160
140
161
/** Tries to draw a straight line from the current point to the start. If the shape has already been closed or has
141
162
* only one point, this function does nothing.
142
163
*/
143
164
def closePath (): Unit = js.native
144
165
166
+ /** Creates a path for a rectangle at position (x, y) with a size that is determined by width and height. */
145
167
def rect (x : Double , y : Double , w : Double , h : Double ): Unit = js.native
146
168
147
169
/** 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 {
164
186
/** Draws a filled rectangle at (x, y) position whose size is determined by width and height. */
165
187
def fillRect (x : Double , y : Double , w : Double , h : Double ): Unit = js.native
166
188
189
+ /** Adds a cubic Bézier curve to the current path. */
167
190
def bezierCurveTo (cp1x : Double , cp1y : Double , cp2x : Double , cp2y : Double , x : Double , y : Double ): Unit = js.native
168
191
169
192
/** 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 {
173
196
height : Double = js.native, canvasOffsetX : Double = js.native, canvasOffsetY : Double = js.native,
174
197
canvasImageWidth : Double = js.native, canvasImageHeight : Double = js.native): Unit = js.native
175
198
199
+ /** Multiplies the current transformation matrix with the matrix described by its arguments. */
176
200
def transform (m11 : Double , m12 : Double , m21 : Double , m22 : Double , dx : Double , dy : Double ): Unit = js.native
177
201
178
202
/** Strokes the subpaths with the current stroke style. */
@@ -185,8 +209,10 @@ class CanvasRenderingContext2D extends js.Object {
185
209
*/
186
210
def strokeRect (x : Double , y : Double , w : Double , h : Double ): Unit = js.native
187
211
212
+ /** Sets the current line dash pattern. */
188
213
def setLineDash (segments : js.Array [Double ]): Unit = js.native
189
214
215
+ /** Draws (strokes) a given text at the given (x, y) position. */
190
216
def strokeText (text : String , x : Double , y : Double , maxWidth : Double = js.native): Unit = js.native
191
217
192
218
/** 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 {
195
221
/** Adds an arc with the given control points and radius, connected to the previous point by a straight line. */
196
222
def arcTo (x1 : Double , y1 : Double , x2 : Double , y2 : Double , radius : Double ): Unit = js.native
197
223
224
+ /** Creates a linear gradient along the line given by the coordinates represented by the parameters. */
198
225
def createLinearGradient (x0 : Double , y0 : Double , x1 : Double , y1 : Double ): CanvasGradient = js.native
199
226
200
227
/** The ellipse() method creates an elliptical arc centered at (x, y) with the radii radiusX and radiusY. The path
0 commit comments