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>

source

pub fn format(&self) -> ColorGlyphFormat

Returns the version of the color table from which this outline was selected.

source

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.

source

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 the GlyphId to be drawn.
  • location coordinates for specifying a variation instance. This can be empty.
  • painter a client-provided ColorPainter implementation receiving drawing callbacks.

Trait Implementations§

source§

impl<'a> Clone for ColorGlyph<'a>

source§

fn clone(&self) -> ColorGlyph<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.