1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use graphicility::{Color, Config,};
fn main() {
let conf = Config::builder().with_title("Geometry").build();
graphicility::run_with(conf, |ctx| {
let g= ctx.graphics();
g.clear(Color::rgb(30, 30, 45)); // Dark navy background
// 1. Lines: Drawing a simple grid or crosshair
g.line((320, 0), (320, 400), Color::rgba(255, 255, 255, 0.2));
g.line((0, 200), (640, 200), Color::rgba(255, 255, 255, 0.2));
// 2. Rectangles: Outline vs standard blocks
// Bottom left square
g.rect((135, 260), (50, 50), Color::CYAN);
// 3. Circles: Centered primitives
// Drawing a target pattern
let center = (160, 100);
g.circle(center, 40, Color::RED);
g.circle(center, 30, Color::WHITE);
g.circle(center, 20, Color::RED);
g.circle(center, 10, Color::WHITE);
// 4. Triangles: Custom coordinates
g.triangle(
(475, 50), // Top
(525, 120), // Bottom Right
(425, 120), // Bottom Left
Color::YELLOW
);
g.triangle(
(425, 250), // Top
(525, 310), // Bottom Right
(425, 310), // Bottom Left
Color::GREEN
);
// 6. Text Labels
g.text((220, 10), "Graphicility Shapes Demo", Color::WHITE);
});
}