use crate::font::Glyph;
use crate::soft_mask::SoftMask;
use crate::{BlendMode, ClipPath, Image};
use crate::{GlyphDrawMode, Paint, PathDrawMode};
use kurbo::{Affine, BezPath, Rect, Shape};
pub trait Device<'a> {
fn set_soft_mask(&mut self, mask: Option<SoftMask<'a>>);
fn set_blend_mode(&mut self, blend_mode: BlendMode);
fn draw_path(
&mut self,
path: &BezPath,
transform: Affine,
paint: &Paint<'a>,
draw_mode: &PathDrawMode,
);
fn push_clip_path(&mut self, clip_path: &ClipPath);
fn push_transparency_group(
&mut self,
opacity: f32,
mask: Option<SoftMask<'a>>,
blend_mode: BlendMode,
);
fn draw_glyph(
&mut self,
glyph: &Glyph<'a>,
transform: Affine,
glyph_transform: Affine,
paint: &Paint<'a>,
draw_mode: &GlyphDrawMode,
);
fn draw_image(&mut self, image: Image<'a, '_>, transform: Affine);
fn pop_clip_path(&mut self);
fn pop_transparency_group(&mut self);
fn draw_rect(
&mut self,
rect: &Rect,
transform: Affine,
paint: &Paint<'a>,
draw_mode: &PathDrawMode,
) {
self.draw_path(&rect.to_path(0.1), transform, paint, draw_mode);
}
fn begin_marked_content(&mut self, _tag: &[u8], _mcid: Option<i32>) {}
fn end_marked_content(&mut self) {}
}
pub struct DummyDevice;
impl Device<'_> for DummyDevice {
fn set_soft_mask(&mut self, _: Option<SoftMask<'_>>) {}
fn set_blend_mode(&mut self, _: BlendMode) {}
fn draw_path(&mut self, _: &BezPath, _: Affine, _: &Paint<'_>, _: &PathDrawMode) {}
fn push_clip_path(&mut self, _: &ClipPath) {}
fn push_transparency_group(&mut self, _: f32, _: Option<SoftMask<'_>>, _: BlendMode) {}
fn draw_glyph(
&mut self,
_: &Glyph<'_>,
_: Affine,
_: Affine,
_: &Paint<'_>,
_: &GlyphDrawMode,
) {
}
fn draw_image(&mut self, _: Image<'_, '_>, _: Affine) {}
fn pop_clip_path(&mut self) {}
fn pop_transparency_group(&mut self) {}
}