Function
draw_box
(
context: &cairo::Context,
x: f64,
y: f64,
x2: f64,
y2: f64,
)
Source from the content-addressed store, hash-verified
| 17 | } |
| 18 | |
| 19 | fn 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 | |
| 39 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 40 | let png_output_fn = "output.png"; |
Tested by
no test coverage detected