font: web canvas sprite trapezoid

This commit is contained in:
Mitchell Hashimoto
2022-12-13 22:22:00 -08:00
parent c391d0f3de
commit 05a5cfddb5

View File

@ -152,8 +152,15 @@ const WebCanvasImpl = struct {
} }
pub fn trapezoid(self: *WebCanvasImpl, t: Trapezoid) void { pub fn trapezoid(self: *WebCanvasImpl, t: Trapezoid) void {
_ = self; const ctx = self.context(.on) catch return;
_ = t; defer ctx.deinit();
ctx.call(void, "beginPath", .{}) catch return;
ctx.call(void, "moveTo", .{ t.left.p1.x, t.left.p1.y }) catch return;
ctx.call(void, "lineTo", .{ t.right.p1.x, t.right.p1.y }) catch return;
ctx.call(void, "lineTo", .{ t.right.p2.x, t.right.p2.y }) catch return;
ctx.call(void, "lineTo", .{ t.left.p2.x, t.left.p2.y }) catch return;
ctx.call(void, "fill", .{}) catch return;
} }
pub fn triangle(self: *WebCanvasImpl, t: Triangle, color: Color) void { pub fn triangle(self: *WebCanvasImpl, t: Triangle, color: Color) void {