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 {Color, Dimensions, Scalar};
use super::oval::{Full, Oval};
use super::Style as Style;
use widget;
#[derive(Copy, Clone, Debug)]
pub struct Circle;
fn rad_to_dim(radius: Scalar) -> Dimensions {
let side = radius * 2.0;
[side, side]
}
impl Circle {
pub fn styled(radius: Scalar, style: Style) -> Oval<Full> {
Oval::styled(rad_to_dim(radius), style)
}
pub fn fill(radius: Scalar) -> Oval<Full> {
Oval::fill(rad_to_dim(radius))
}
pub fn fill_with(radius: Scalar, color: Color) -> Oval<Full> {
Oval::fill_with(rad_to_dim(radius), color)
}
pub fn outline(radius: Scalar) -> Oval<Full> {
Oval::outline(rad_to_dim(radius))
}
pub fn outline_styled(radius: Scalar, line_style: widget::line::Style) -> Oval<Full> {
Oval::outline_styled(rad_to_dim(radius), line_style)
}
}