@@ -240,19 +240,23 @@ <h2><a id="drawing">Functions for Drawing</a></h2>
240
240
* ADVANCED DRAWING-RELATED FUNCTIONS
241
241
*/
242
242
243
+ // return the current canvas context 2D
244
+ ctx(): CanvasRenderingContext2D
245
+
243
246
// save the canvas context
244
247
push(): void
245
248
246
249
// restore the canvas context
247
250
pop(): void
248
251
249
- // create a clipping region using a path
250
- // example: clip((ctx) => ctx.arc(100, 100, 50, 0, PI * 2))
251
- // note: Clip paths cannot be reverted directly. You must save your
252
- // canvas state using push() before calling clip(), and restore it
253
- // once you have finished drawing in the clipped area using pop().
254
- // see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
255
- clip(callback: function): void
252
+ // create a rectangular clipping region
253
+ cliprect(x, y, width, height): void
254
+
255
+ // create a circular clipping region
256
+ clipcirc(x, y, width, height): void
257
+
258
+ // note: before call cliprect or clipcirc you must save the context using push()
259
+ // and later, you restore the context using pop()
256
260
257
261
// Adds a translation transformation to the current matrix
258
262
translate(x = 0, y = 0): void
@@ -264,11 +268,11 @@ <h2><a id="drawing">Functions for Drawing</a></h2>
264
268
rotate(radians = 0): void
265
269
266
270
// update the transformation matrix
267
- // when `reset = true` uses `context.setTransform()`
268
- // wwhen `reset = false` uses `context.transform()`
271
+ // when `resetFirst = true` uses `context.setTransform()`
272
+ // wwhen `resetFirst = false` uses `context.transform()`
269
273
// see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform
270
274
// see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/transform
271
- transform(a, b, c, d, e, f, reset = true): void
275
+ transform(a, b, c, d, e, f, resetFirst = true): void
272
276
273
277
// update the alpha (transparency)
274
278
// see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalAlpha
0 commit comments