use canvist_layout::FontSpec;
use canvist_layout::TextRun;
use kurbo::Affine;
use kurbo::BezPath;
use kurbo::Rect;
use kurbo::Stroke;
use peniko::BlendMode;
use peniko::Brush;
use peniko::Color;
use peniko::Fill;
use peniko::ImageData;
#[derive(Clone, Copy, Debug)]
pub struct Draw<'a> {
pub path: &'a BezPath,
pub transform: Affine,
pub brush: &'a Brush,
pub brush_transform: Option<Affine>,
}
#[derive(Clone, Copy, Debug)]
pub struct Layer<'a> {
pub clip: Option<&'a BezPath>,
pub transform: Affine,
pub blend: BlendMode,
pub alpha: f32,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct BoxShadow {
pub rect: Rect,
pub radius: f64,
pub transform: Affine,
pub color: Color,
pub blur: f64,
}
#[derive(Clone, Copy, Debug)]
pub struct Text<'a> {
pub run: &'a TextRun,
pub font: &'a FontSpec,
pub transform: Affine,
pub color: Color,
}
#[derive(Clone, Copy, Debug)]
pub struct Image<'a> {
pub asset: &'a str,
pub data: &'a ImageData,
pub transform: Affine,
pub alpha: f32,
}
pub trait Painter {
fn fill(&mut self, draw: &Draw<'_>, rule: Fill);
fn stroke(&mut self, draw: &Draw<'_>, style: &Stroke);
fn push_layer(&mut self, layer: &Layer<'_>);
fn pop_layer(&mut self);
fn image(&mut self, image: &Image<'_>);
fn text(&mut self, text: &Text<'_>);
fn shadow(&mut self, shadow: &BoxShadow);
}