1use omage::colors::*;
2use omage::{Components, Config, Image, Rgba};
3
4const HEIGHT: u32 = 600;
5const WIDTH: u32 = 800;
6
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let config = Config::new(
9 WIDTH,
10 HEIGHT,
11 BLACK,
12 Some(GREEN),
13 "output.png",
14 Some("./fonts/Roboto-Medium.ttf"),
15 );
16
17 let mut image = Image::new();
18
19 let line1 = Components::Line(0, 0, WIDTH, HEIGHT, GREEN);
20 let line2 = Components::Line(WIDTH, 0, 0, HEIGHT, GREEN);
21 let circle = Components::Circle(WIDTH / 2, HEIGHT / 2, 100, Rgba([0, 255, 0, 150]));
22 let text = Components::Text(
23 WIDTH / 2 - 210,
24 HEIGHT / 2 - 250,
25 40,
26 "Xiaolin Wu's Line Algorithm",
27 BLACK,
28 Some((GREEN, 3)),
29 );
30
31 image
32 .config(config)
33 .init()?
34 .add_components(vec![&line1, &line2, &circle, &text])
35 .draw()?;
36 Ok(())
37}