-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Hello, I am was trying to create a function that could generate a triangle in the canvas:
fn triangle(ctx: *capy.DrawContext, x: i32, y: i32, size: i16) void {
ctx.line(x, y, x + size, y);
ctx.line(x + size, y, x + size, y + size);
ctx.line(x + size, y + size, x, y);
ctx.fill();
}
It draws triangles but only as strokes resulting in a hollow shape. I do not know if it's supposed to be that way but maybe removing c.cairo_stroke(self.cr); from
pub fn line(self: *DrawContext, x1: i32, y1: i32, x2: i32, y2: i32) void {
c.cairo_move_to(self.cr, @as(f64, @floatFromInt(x1)), @as(f64, @floatFromInt(y1)));
c.cairo_line_to(self.cr, @as(f64, @floatFromInt(x2)), @as(f64, @floatFromInt(y2)));
c.cairo_stroke(self.cr);
}
in src/backends/gtk/Canvas.zig could help ? If this a not a solution is there any other way to draw custom shapes in the canvas ? Thanks for creating this awesome library btw :)
Metadata
Metadata
Assignees
Labels
No labels