Expand description
Drawing color glyphs.
§Examples
§Retrieve the clip box of a COLRv1 glyph if it has one:
match font.color_glyphs()
.get_with_format(glyph_id, ColorGlyphFormat::ColrV1)
.expect("Glyph not found.")
.bounding_box(&Location::default(), size)
{
Some(bounding_box) => {
println!("Bounding box is {:?}", bounding_box);
}
None => {
println!("Glyph has no clip box.");
}
}
§Paint a COLRv1 glyph given a font, and a glyph id and a ColorPainter
implementation:
let color_glyph = font.color_glyphs()
.get_with_format(glyph_id, ColorGlyphFormat::ColrV1)
.expect("Glyph not found");
color_glyph.paint(&Location::default(), color_painter_impl)
Structs§
- A representation of a color glyph that can be painted through a sequence of
ColorPainter
callbacks. - Collection of color glyphs.
- A color stop of a gradient.
- A transformation matrix to be applied to the drawing canvas.
Enums§
- A fill type of a COLRv1 glyph (solid fill or various gradient types).
- Distinguishes available color glyph formats.
- CompositeMode enumeration
- Extend enumeration
- Signals success of request to draw a COLRv1 sub glyph from cache.
- An error during drawing a COLR glyph.
Traits§
- A group of required painting callbacks to be provided by the client.