ori_graphics/
quad.rs

1use crate::{Color, Rect};
2
3#[derive(Clone, Copy, Debug, PartialEq)]
4pub struct Quad {
5    pub rect: Rect,
6    pub background: Color,
7    pub border_radius: [f32; 4],
8    pub border_width: f32,
9    pub border_color: Color,
10}
11
12impl Default for Quad {
13    fn default() -> Self {
14        Self {
15            rect: Rect::default(),
16            background: Color::WHITE,
17            border_radius: [0.0; 4],
18            border_width: 0.0,
19            border_color: Color::BLACK,
20        }
21    }
22}
23
24impl Quad {
25    pub fn rounded(self) -> Self {
26        Self {
27            rect: self.rect.round(),
28            ..self
29        }
30    }
31}