canvas: Add strokeRect binding.

This commit is contained in:
David Thompson 2024-12-13 14:58:04 -05:00
parent f6c7d000c0
commit 5e4d6cce1c
2 changed files with 4 additions and 0 deletions

View file

@ -71,6 +71,7 @@ window.addEventListener("load", async () => {
setTextAlign: (ctx, align) => ctx.textAlign = align, setTextAlign: (ctx, align) => ctx.textAlign = align,
clearRect: (ctx, x, y, w, h) => ctx.clearRect(x, y, w, h), clearRect: (ctx, x, y, w, h) => ctx.clearRect(x, y, w, h),
fillRect: (ctx, x, y, w, h) => ctx.fillRect(x, y, w, h), fillRect: (ctx, x, y, w, h) => ctx.fillRect(x, y, w, h),
strokeRect: (ctx, x, y, w, h) => ctx.strokeRect(x, y, w, h),
fillText: (ctx, text, x, y) => ctx.fillText(text, x, y), fillText: (ctx, text, x, y) => ctx.fillText(text, x, y),
drawImage: (ctx, image, sx, sy, sw, sh, dx, dy, dw, dh) => ctx.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh), drawImage: (ctx, image, sx, sy, sw, sh, dx, dy, dw, dh) => ctx.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh),
restore: (ctx) => ctx.restore(), restore: (ctx) => ctx.restore(),

View file

@ -63,6 +63,9 @@
(define-foreign fill-rect (define-foreign fill-rect
"canvas" "fillRect" "canvas" "fillRect"
(ref extern) f64 f64 f64 f64 -> none) (ref extern) f64 f64 f64 f64 -> none)
(define-foreign stroke-rect
"canvas" "strokeRect"
(ref extern) f64 f64 f64 f64 -> none)
(define-foreign fill-text (define-foreign fill-text
"canvas" "fillText" "canvas" "fillText"
(ref extern) (ref string) f64 f64 -> none) (ref extern) (ref string) f64 f64 -> none)