Struct skrifa::color::ColorGlyph
source · pub struct ColorGlyph<'a> { /* private fields */ }
Expand description
A representation of a color glyph that can be painted through a sequence of ColorPainter
callbacks.
Implementations§
source§impl<'a> ColorGlyph<'a>
impl<'a> ColorGlyph<'a>
sourcepub fn format(&self) -> ColorGlyphFormat
pub fn format(&self) -> ColorGlyphFormat
Returns the version of the color table from which this outline was selected.
sourcepub fn bounding_box(
&self,
location: impl Into<LocationRef<'a>>,
size: Size,
) -> Option<BoundingBox<f32>>
pub fn bounding_box( &self, location: impl Into<LocationRef<'a>>, size: Size, ) -> Option<BoundingBox<f32>>
Returns the bounding box. For COLRv1 glyphs, this is clipbox of the
specified COLRv1 glyph, or None
if there is
none for the particular glyph. The size
argument can optionally be used
to scale the bounding box to a particular font size. location
allows
specifycing a variation instance.
sourcepub fn paint(
&self,
location: impl Into<LocationRef<'a>>,
painter: &mut impl ColorPainter,
) -> Result<(), PaintError>
pub fn paint( &self, location: impl Into<LocationRef<'a>>, painter: &mut impl ColorPainter, ) -> Result<(), PaintError>
Evaluates the paint graph at the specified location in variation space and emits the results to the given painter.
For a COLRv1 glyph, traverses the COLRv1 paint graph and invokes drawing callbacks on a
specified ColorPainter
trait object. The traversal operates in font
units and will call ColorPainter
methods with font unit values. This
means, if you want to draw a COLRv1 glyph at a particular font size, the
canvas needs to have a transformation matrix applied so that it scales down
the drawing operations to font_size / upem
.
§Arguments
glyph_id
theGlyphId
to be drawn.location
coordinates for specifying a variation instance. This can be empty.painter
a client-providedColorPainter
implementation receiving drawing callbacks.
Trait Implementations§
source§impl<'a> Clone for ColorGlyph<'a>
impl<'a> Clone for ColorGlyph<'a>
source§fn clone(&self) -> ColorGlyph<'a>
fn clone(&self) -> ColorGlyph<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'a> Freeze for ColorGlyph<'a>
impl<'a> RefUnwindSafe for ColorGlyph<'a>
impl<'a> Send for ColorGlyph<'a>
impl<'a> Sync for ColorGlyph<'a>
impl<'a> Unpin for ColorGlyph<'a>
impl<'a> UnwindSafe for ColorGlyph<'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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)