use crate::annotators::{Color, ColorPalette};
use crate::geometry::Position;
#[derive(Debug, Clone)]
pub struct MaskAnnotator {
pub palette: ColorPalette,
pub opacity: f32,
}
impl MaskAnnotator {
pub fn new(palette: ColorPalette, opacity: f32) -> Self {
Self { palette, opacity }
}
}
impl Default for MaskAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 0.5)
}
}
#[derive(Debug, Clone)]
pub struct PolygonAnnotator {
pub palette: ColorPalette,
pub thickness: u32,
}
impl PolygonAnnotator {
pub fn new(palette: ColorPalette, thickness: u32) -> Self {
Self { palette, thickness }
}
}
impl Default for PolygonAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 2)
}
}
#[derive(Debug, Clone)]
pub struct CircleAnnotator {
pub palette: ColorPalette,
pub thickness: u32,
pub position: Position,
}
impl CircleAnnotator {
pub fn new(palette: ColorPalette, thickness: u32, position: Position) -> Self {
Self {
palette,
thickness,
position,
}
}
}
impl Default for CircleAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 2, Position::Center)
}
}
#[derive(Debug, Clone)]
pub struct DotAnnotator {
pub palette: ColorPalette,
pub radius: u32,
pub position: Position,
}
impl DotAnnotator {
pub fn new(palette: ColorPalette, radius: u32, position: Position) -> Self {
Self {
palette,
radius,
position,
}
}
}
impl Default for DotAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 4, Position::Center)
}
}
#[derive(Debug, Clone)]
pub struct EllipseAnnotator {
pub palette: ColorPalette,
pub thickness: u32,
pub height_ratio: f32,
}
impl EllipseAnnotator {
pub fn new(palette: ColorPalette, thickness: u32, height_ratio: f32) -> Self {
Self {
palette,
thickness,
height_ratio,
}
}
}
impl Default for EllipseAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 2, 0.15)
}
}
#[derive(Debug, Clone)]
pub struct LabelAnnotator {
pub palette: ColorPalette,
pub position: Position,
pub text_scale: u32,
pub padding: f32,
}
impl LabelAnnotator {
pub fn new(palette: ColorPalette, position: Position, text_scale: u32, padding: f32) -> Self {
Self {
palette,
position,
text_scale,
padding,
}
}
}
impl Default for LabelAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), Position::TopLeft, 1, 2.0)
}
}
#[derive(Debug, Clone)]
pub struct RoundBoxAnnotator {
pub palette: ColorPalette,
pub thickness: u32,
pub corner_radius: u32,
}
impl RoundBoxAnnotator {
pub fn new(palette: ColorPalette, thickness: u32, corner_radius: u32) -> Self {
Self {
palette,
thickness,
corner_radius,
}
}
}
impl Default for RoundBoxAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 2, 10)
}
}
#[derive(Debug, Clone)]
pub struct BoxCornerAnnotator {
pub palette: ColorPalette,
pub thickness: u32,
pub corner_length: u32,
}
impl BoxCornerAnnotator {
pub fn new(palette: ColorPalette, thickness: u32, corner_length: u32) -> Self {
Self {
palette,
thickness,
corner_length,
}
}
}
impl Default for BoxCornerAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 3, 15)
}
}
#[derive(Debug, Clone)]
pub struct TriangleAnnotator {
pub palette: ColorPalette,
pub base: u32,
pub height: u32,
pub position: Position,
}
impl TriangleAnnotator {
pub fn new(palette: ColorPalette, base: u32, height: u32, position: Position) -> Self {
Self {
palette,
base,
height,
position,
}
}
}
impl Default for TriangleAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 12, 14, Position::TopCenter)
}
}
#[derive(Debug, Clone)]
pub struct HaloAnnotator {
pub palette: ColorPalette,
pub opacity: f32,
pub kernel_size: u32,
}
impl HaloAnnotator {
pub fn new(palette: ColorPalette, opacity: f32, kernel_size: u32) -> Self {
Self {
palette,
opacity,
kernel_size,
}
}
}
impl Default for HaloAnnotator {
fn default() -> Self {
Self::new(ColorPalette::default(), 0.4, 12)
}
}
#[derive(Debug, Clone)]
pub struct PercentageBarAnnotator {
pub palette: ColorPalette,
pub background_color: Color,
pub bar_width: u32,
pub bar_height: u32,
pub position: Position,
}
impl PercentageBarAnnotator {
pub fn new(
palette: ColorPalette,
background_color: Color,
bar_width: u32,
bar_height: u32,
position: Position,
) -> Self {
Self {
palette,
background_color,
bar_width,
bar_height,
position,
}
}
}
impl Default for PercentageBarAnnotator {
fn default() -> Self {
Self::new(
ColorPalette::default(),
Color::new(80, 80, 80),
60,
6,
Position::TopCenter,
)
}
}
#[derive(Debug, Clone)]
pub struct IconAnnotator<Image> {
pub icon: Image,
pub position: Position,
}
impl<Image> IconAnnotator<Image> {
pub fn new(icon: Image, position: Position) -> Self {
Self { icon, position }
}
}
#[derive(Debug, Clone)]
pub struct BackgroundOverlayAnnotator {
pub color: Color,
pub opacity: f32,
}
impl BackgroundOverlayAnnotator {
pub fn new(color: Color, opacity: f32) -> Self {
Self { color, opacity }
}
}
impl Default for BackgroundOverlayAnnotator {
fn default() -> Self {
Self::new(Color::new(0, 0, 0), 0.6)
}
}