vello_cpu/dispatch/
mod.rs1#[cfg(feature = "multithreading")]
5pub(crate) mod multi_threaded;
6pub(crate) mod single_threaded;
7
8use crate::RenderMode;
9use crate::kurbo::{Affine, BezPath, Stroke};
10use crate::peniko::{BlendMode, Fill};
11use alloc::vec::Vec;
12use core::fmt::Debug;
13use vello_common::coarse::Wide;
14use vello_common::encode::EncodedPaint;
15use vello_common::mask::Mask;
16use vello_common::paint::Paint;
17
18pub(crate) trait Dispatcher: Debug + Send + Sync {
19 fn wide(&self) -> &Wide;
20 fn wide_mut(&mut self) -> &mut Wide;
21 fn fill_path(
22 &mut self,
23 path: &BezPath,
24 fill_rule: Fill,
25 transform: Affine,
26 paint: Paint,
27 anti_alias: bool,
28 );
29 fn stroke_path(
30 &mut self,
31 path: &BezPath,
32 stroke: &Stroke,
33 transform: Affine,
34 paint: Paint,
35 anti_alias: bool,
36 );
37 fn push_layer(
38 &mut self,
39 clip_path: Option<&BezPath>,
40 fill_rule: Fill,
41 clip_transform: Affine,
42 blend_mode: BlendMode,
43 opacity: f32,
44 anti_alias: bool,
45 mask: Option<Mask>,
46 );
47 fn pop_layer(&mut self);
48 fn reset(&mut self);
49 fn flush(&mut self);
50 fn rasterize(
51 &self,
52 buffer: &mut [u8],
53 render_mode: RenderMode,
54 width: u16,
55 height: u16,
56 encoded_paints: &[EncodedPaint],
57 );
58 fn alpha_buf(&self) -> &[u8];
59 fn extend_alpha_buf(&mut self, alphas: &[u8]);
60 fn replace_alpha_buf(&mut self, alphas: Vec<u8>) -> Vec<u8>;
61 fn set_alpha_buf(&mut self, alphas: Vec<u8>);
62}