pub(crate) struct GlyphPainter<'a> {
pub(crate) font: &'a Font,
pub(crate) svg: &'a mut XmlWriter,
pub(crate) path_buf: &'a mut String,
pub(crate) gradient_index: usize,
pub(crate) clip_path_index: usize,
pub(crate) foreground_color: Color,
pub(crate) transform: Matrix<f32>,
pub(crate) outline_transform: Matrix<f32>,
pub(crate) transforms_stack: Vec<Matrix<f32>>,
pub(crate) clip_stack: Vec<Option<Rect>>,
}Fields§
§font: &'a Font§svg: &'a mut XmlWriter§path_buf: &'a mut String§gradient_index: usize§clip_path_index: usize§foreground_color: Color§transform: Matrix<f32>§outline_transform: Matrix<f32>§transforms_stack: Vec<Matrix<f32>>§clip_stack: Vec<Option<Rect>>The bounding box of every active clip, in the root coordinate space.
None means the clip is empty (or its bounds are unknown).
Implementations§
Source§impl<'a> GlyphPainter<'a>
impl<'a> GlyphPainter<'a>
fn write_gradient_stops(&mut self, stops: &[ColorStop])
fn paint_solid(&mut self, color: Color)
fn paint_linear_gradient( &mut self, p0: Point<f32>, p1: Point<f32>, color_stops: &[ColorStop], extend: Extend, )
fn paint_radial_gradient( &mut self, c0: Point<f32>, r0: f32, c1: Point<f32>, r1: f32, color_stops: &[ColorStop], extend: Extend, )
fn paint_sweep_gradient( &mut self, _c0: Point<f32>, _start_angle: f32, _end_angle: f32, _color_stops: &[ColorStop], _extend: Extend, )
Source§impl GlyphPainter<'_>
impl GlyphPainter<'_>
fn clip_with_path(&mut self, path: &str)
Sourcefn outline_glyph(&mut self, glyph_id: GlyphId) -> Option<Rect>
fn outline_glyph(&mut self, glyph_id: GlyphId) -> Option<Rect>
Outlines a glyph into path_buf at the current variation location
(an empty path on failure), records the current transform as the
outline transform and returns the outline’s conservative bounding box
in the glyph’s local coordinate space.
Sourcefn paint_brush(&mut self, brush: Brush<'_>)
fn paint_brush(&mut self, brush: Brush<'_>)
Paints path_buf (positioned by the outline transform) with the given brush.
fn palette_index_to_color(&self, palette_index: u16, alpha: f32) -> Color
Trait Implementations§
Source§impl PaintSink for GlyphPainter<'_>
impl PaintSink for GlyphPainter<'_>
Source§fn push_transform(&mut self, transform: Matrix<f32>)
fn push_transform(&mut self, transform: Matrix<f32>)
Concatenates
transform to the current transformation matrix.Source§fn pop_transform(&mut self)
fn pop_transform(&mut self)
Restores the transformation matrix from before the last
push_transform.Source§fn fill_glyph(
&mut self,
glyph_id: GlyphId,
brush_transform: Option<Matrix<f32>>,
brush: Brush<'_>,
)
fn fill_glyph( &mut self, glyph_id: 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. Read moreSource§fn push_clip_glyph(&mut self, glyph_id: GlyphId)
fn push_clip_glyph(&mut self, glyph_id: GlyphId)
Clips to the outline of
glyph.Source§fn push_clip_box(&mut self, clip_box: BoundingBox<f32>)
fn push_clip_box(&mut self, clip_box: BoundingBox<f32>)
Clips to
clip_box.Source§fn pop_clip(&mut self)
fn pop_clip(&mut self)
Restores the clip from before the last
push_clip_glyph or
push_clip_box.Source§fn 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.Source§fn 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.Source§fn 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. Read more
Source§fn pop_layer_with_mode(&mut self, _composite_mode: CompositeMode)
fn pop_layer_with_mode(&mut self, _composite_mode: CompositeMode)
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for GlyphPainter<'a>
impl<'a> !UnwindSafe for GlyphPainter<'a>
impl<'a> Freeze for GlyphPainter<'a>
impl<'a> Send for GlyphPainter<'a>
impl<'a> Sync for GlyphPainter<'a>
impl<'a> Unpin for GlyphPainter<'a>
impl<'a> UnsafeUnpin for GlyphPainter<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more