Function draw_pie

Source
pub fn draw_pie(x: i32, y: i32, width: i32, height: i32, a: f64, b: f64)
Expand description

Draws a filled pie

Examples found in repository?
examples/custom_dial.rs (line 25)
13    pub fn new(x: i32, y: i32, w: i32, h: i32, label: &str) -> Self {
14        let value = Rc::from(RefCell::from(0));
15        let mut main_wid = group::Group::new(x, y, w, h, None)
16            .with_label(label)
17            .with_align(Align::Top);
18        let mut value_frame =
19            frame::Frame::new(main_wid.x(), main_wid.y() + 80, main_wid.w(), 40, "0");
20        value_frame.set_label_size(26);
21        main_wid.end();
22        let value_c = value.clone();
23        main_wid.draw(move |w| {
24            draw::set_draw_rgb_color(230, 230, 230);
25            draw::draw_pie(w.x(), w.y(), w.w(), w.h(), 0., 180.);
26            draw::set_draw_hex_color(0xb0bf1a);
27            draw::draw_pie(
28                w.x(),
29                w.y(),
30                w.w(),
31                w.h(),
32                (100 - *value_c.borrow()) as f64 * 1.8,
33                180.,
34            );
35            draw::set_draw_color(Color::White);
36            draw::draw_pie(
37                w.x() - 50 + w.w() / 2,
38                w.y() - 50 + w.h() / 2,
39                100,
40                100,
41                0.,
42                360.,
43            );
44            w.draw_children();
45        });
46        Self {
47            main_wid,
48            value,
49            value_frame,
50        }
51    }