use crate::font::GlyphRun;
use crate::x_object::soft_mask::SoftMask;
use crate::{BlendMode, ClipPath, FillRule, Image};
use crate::{DrawMode, DrawProps, ImageDrawProps};
use kurbo::{BezPath, Rect, Shape};
pub trait Device<'a> {
fn draw_path(&mut self, path: &BezPath, props: DrawProps<'a>, draw_mode: &DrawMode);
fn push_clip_path(&mut self, clip_path: &ClipPath);
fn push_clip_rect(&mut self, rect: &Rect) {
self.push_clip_path(&ClipPath {
path: rect.to_path(0.1),
fill: FillRule::NonZero,
});
}
fn push_transparency_group(
&mut self,
opacity: f32,
mask: Option<SoftMask<'a>>,
blend_mode: BlendMode,
);
fn draw_glyph_run(
&mut self,
glyph_run: &GlyphRun<'_, 'a>,
props: DrawProps<'a>,
draw_mode: &DrawMode,
);
fn draw_image(&mut self, image: Image<'a, '_>, props: ImageDrawProps<'a>);
fn pop_clip(&mut self);
fn pop_transparency_group(&mut self);
fn draw_rect(&mut self, rect: &Rect, props: DrawProps<'a>, draw_mode: &DrawMode) {
self.draw_path(&rect.to_path(0.1), props, 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 draw_path(&mut self, _: &BezPath, _: DrawProps<'_>, _: &DrawMode) {}
fn push_clip_path(&mut self, _: &ClipPath) {}
fn push_transparency_group(&mut self, _: f32, _: Option<SoftMask<'_>>, _: BlendMode) {}
fn draw_glyph_run(&mut self, _: &GlyphRun<'_, '_>, _: DrawProps<'_>, _: &DrawMode) {}
fn draw_image(&mut self, _: Image<'_, '_>, _: ImageDrawProps<'_>) {}
fn pop_clip(&mut self) {}
fn pop_transparency_group(&mut self) {}
}