MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / draw

Function draw

25_vector_graphics/rust/cairodraw/src/main.rs:1–17  ·  view source on GitHub ↗
(context: &cairo::Context)

Source from the content-addressed store, hash-verified

1fn draw(context: &cairo::Context) -> Result<(), Box<dyn std::error::Error>> {
2 let (x, y, x1, y1) = (0.1, 0.5, 0.4, 0.9);
3 let (x2, y2, x3, y3) = (0.6, 0.1, 0.9, 0.5);
4 context.scale(200., 200.);
5 context.set_line_width(0.04);
6 context.move_to(x, y);
7 context.curve_to(x1, y1, x2, y2, x3, y3);
8 context.stroke()?;
9 context.set_source_rgba(1., 0.2, 0.2, 0.6);
10 context.set_line_width(0.02);
11 context.move_to(x, y);
12 context.line_to(x1, y1);
13 context.move_to(x2, y2);
14 context.line_to(x3, y3);
15 context.stroke()?;
16 Ok(())
17}
18
19fn draw_box(
20 context: &cairo::Context,

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected