use kurbo::{Insets, Vec2};
mod css_box;
mod non_uniform_radii;
pub use css_box::CssBox;
pub use non_uniform_radii::NonUniformRoundedRectRadii;
#[derive(Debug, Clone, Copy)]
pub enum Edge {
Top,
Right,
Bottom,
Left,
}
#[derive(Debug, Clone, Copy)]
pub(crate) enum Corner {
TopLeft,
TopRight,
BottomLeft,
BottomRight,
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(clippy::enum_variant_names, reason = "Use CSS standard terminology")]
pub(crate) enum CssBoxKind {
OutlineBox,
BorderBox,
PaddingBox,
ContentBox,
}
#[derive(Debug, Clone, Copy)]
pub(crate) enum Direction {
Clockwise,
Anticlockwise,
}
fn add_insets(a: Insets, b: Insets) -> Insets {
Insets {
x0: a.x0 + b.x0,
y0: a.y0 + b.y0,
x1: a.x1 + b.x1,
y1: a.y1 + b.y1,
}
}
#[inline(always)]
fn get_corner_insets(insets: Insets, corner: Corner) -> Vec2 {
match corner {
Corner::TopLeft => Vec2 {
x: insets.x0,
y: insets.y0,
},
Corner::TopRight => Vec2 {
x: insets.x1,
y: insets.y0,
},
Corner::BottomLeft => Vec2 {
x: insets.x0,
y: insets.y1,
},
Corner::BottomRight => Vec2 {
x: insets.x1,
y: insets.y1,
},
}
}