Skip to main content

GlyphRenderer

Trait GlyphRenderer 

Source
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§

Source

type SavedState

The type of state used by the renderer.

Required Methods§

Source

fn save_state(&mut self) -> Self::SavedState

Save the current state.

Source

fn restore_state(&mut self, state: Self::SavedState)

Restore the current state.

Source

fn stroke_path(&mut self, path: &BezPath)

Stroke a path with the current paint and stroke settings.

Source

fn set_paint_image(&mut self, image: Image)

Set the current paint to an image.

Source

fn set_tint(&mut self, tint: Option<Tint>)

Set the tint for subsequent image draws.

Source

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.

Source

fn current_paint(&self) -> &PaintType

Get the currently active paint.

Source

fn atlas_image_source(&self, atlas_slot: &AtlasSlot) -> ImageSource

Construct the ImageSource for sampling a cached glyph from the atlas.

Source

fn atlas_paint_transform(&self, atlas_slot: &AtlasSlot) -> Affine

Compute the paint transform for sampling a cached glyph from the atlas.

Implementors§