pub trait PaintSink {
// Required methods
fn push_transform(&mut self, transform: Matrix<f32>);
fn pop_transform(&mut self);
fn push_clip_glyph(&mut self, glyph: GlyphId);
fn push_clip_box(&mut self, clip_box: BoundingBox<f32>);
fn pop_clip(&mut self);
fn fill(&mut self, brush: Brush<'_>);
fn push_layer(&mut self, composite_mode: CompositeMode);
// Provided methods
fn fill_glyph(
&mut self,
glyph: GlyphId,
brush_transform: Option<Matrix<f32>>,
brush: Brush<'_>,
) { ... }
fn paint_cached_color_glyph(
&mut self,
_glyph: GlyphId,
) -> Result<PaintCachedColorGlyph, Error> { ... }
fn pop_layer(&mut self) { ... }
fn pop_layer_with_mode(&mut self, _composite_mode: CompositeMode) { ... }
}Expand description
Receives the operations that paint a color glyph.
Each callback is one canvas operation. ColorGlyph::paint calls them
with values in font units. A sink that draws at a specific size scales
them by size / upem.
Required Methods§
Sourcefn push_transform(&mut self, transform: Matrix<f32>)
fn push_transform(&mut self, transform: Matrix<f32>)
Concatenates transform to the current transformation matrix.
Sourcefn pop_transform(&mut self)
fn pop_transform(&mut self)
Restores the transformation matrix from before the last
push_transform.
Sourcefn push_clip_glyph(&mut self, glyph: GlyphId)
fn push_clip_glyph(&mut self, glyph: GlyphId)
Clips to the outline of glyph.
Sourcefn push_clip_box(&mut self, clip_box: BoundingBox<f32>)
fn push_clip_box(&mut self, clip_box: BoundingBox<f32>)
Clips to clip_box.
Sourcefn pop_clip(&mut self)
fn pop_clip(&mut self)
Restores the clip from before the last push_clip_glyph or
push_clip_box.
Sourcefn push_layer(&mut self, composite_mode: CompositeMode)
fn push_layer(&mut self, composite_mode: CompositeMode)
Pushes a new layer that pop_layer composites
onto the layer below with composite_mode.
Provided Methods§
Sourcefn fill_glyph(
&mut self,
glyph: GlyphId,
brush_transform: Option<Matrix<f32>>,
brush: Brush<'_>,
)
fn fill_glyph( &mut self, glyph: GlyphId, brush_transform: Option<Matrix<f32>>, brush: Brush<'_>, )
Clips to the outline of glyph and fills it with brush, with
brush_transform applied to the brush alone.
The default implementation uses the other callbacks. Override it if the graphics library can fill a path in one call.
Sourcefn paint_cached_color_glyph(
&mut self,
_glyph: GlyphId,
) -> Result<PaintCachedColorGlyph, Error>
fn paint_cached_color_glyph( &mut self, _glyph: GlyphId, ) -> Result<PaintCachedColorGlyph, Error>
Paints a nested color glyph from the sink’s cache, if it has one.
The glyph is painted unscaled under the current transformation matrix. The default implementation has no cache, so the paint graph of the glyph is traversed.
Sourcefn pop_layer(&mut self)
fn pop_layer(&mut self)
Composites the last layer onto the layer below, using the mode passed
to the matching push_layer.
Sourcefn pop_layer_with_mode(&mut self, _composite_mode: CompositeMode)
fn pop_layer_with_mode(&mut self, _composite_mode: CompositeMode)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".