pub trait GlyphRenderer: DrawSink {
type SavedState;
// Required methods
fn save_state(&mut self) -> Self::SavedState;
fn restore_state(&mut self, state: Self::SavedState);
fn stroke_path(&mut self, path: &BezPath);
fn set_paint_image(&mut self, image: Image);
fn set_tint(&mut self, tint: Option<Tint>);
fn get_context_color(&self) -> AlphaColor<Srgb>;
fn current_paint(&self) -> &PaintType;
fn atlas_image_source(&self, atlas_slot: &AtlasSlot) -> ImageSource;
fn atlas_paint_transform(&self, atlas_slot: &AtlasSlot) -> Affine;
}Expand description
A stateful renderer that can draw sequences of cached and uncached glyphs.
Required Associated Types§
Sourcetype SavedState
type SavedState
The type of state used by the renderer.
Required Methods§
Sourcefn save_state(&mut self) -> Self::SavedState
fn save_state(&mut self) -> Self::SavedState
Save the current state.
Sourcefn restore_state(&mut self, state: Self::SavedState)
fn restore_state(&mut self, state: Self::SavedState)
Restore the current state.
Sourcefn stroke_path(&mut self, path: &BezPath)
fn stroke_path(&mut self, path: &BezPath)
Stroke a path with the current paint and stroke settings.
Sourcefn set_paint_image(&mut self, image: Image)
fn set_paint_image(&mut self, image: Image)
Set the current paint to an image.
Sourcefn get_context_color(&self) -> AlphaColor<Srgb>
fn get_context_color(&self) -> AlphaColor<Srgb>
Get the context color from the renderer’s current paint, used for resolving the context-dependent colors of COLR glyphs.
Sourcefn current_paint(&self) -> &PaintType
fn current_paint(&self) -> &PaintType
Get the currently active paint.
Sourcefn atlas_image_source(&self, atlas_slot: &AtlasSlot) -> ImageSource
fn atlas_image_source(&self, atlas_slot: &AtlasSlot) -> ImageSource
Construct the ImageSource for sampling a cached glyph from the atlas.
Sourcefn atlas_paint_transform(&self, atlas_slot: &AtlasSlot) -> Affine
fn atlas_paint_transform(&self, atlas_slot: &AtlasSlot) -> Affine
Compute the paint transform for sampling a cached glyph from the atlas.