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

Function draw_box

25_vector_graphics/rust/cairodraw/src/main.rs:19–37  ·  view source on GitHub ↗
(
    context: &cairo::Context,
    x: f64,
    y: f64,
    x2: f64,
    y2: f64,
)

Source from the content-addressed store, hash-verified

17}
18
19fn draw_box(
20 context: &cairo::Context,
21 x: f64,
22 y: f64,
23 x2: f64,
24 y2: f64,
25) -> Result<(), Box<dyn std::error::Error>> {
26 context.set_source_rgb(0.258, 0.525, 0.956);
27 context.new_path();
28 context.move_to(x, y);
29 context.line_to(x2, y);
30 context.line_to(x, y2);
31 context.move_to(x2, y2);
32 context.line_to(x2, y);
33 context.line_to(x, y2);
34 context.close_path();
35 context.fill()?;
36 Ok(())
37}
38
39fn main() -> Result<(), Box<dyn std::error::Error>> {
40 let png_output_fn = "output.png";

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected