Table of Contents

Class ColorGlyphReferencePaint

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

Another color glyph's paint graph drawn here, as COLR's PaintColrGlyph reuses it.

public sealed record ColorGlyphReferencePaint : ColorPaint, IEquatable<ColorPaint>, IEquatable<ColorGlyphReferencePaint>
Inheritance
ColorGlyphReferencePaint
Implements
Inherited Members

Examples

// Color glyphs draw in color by themselves: COLR (layers and gradients), sbix and CBDT (images), per glyph.
using (RasterCanvas<Rgba8> canvas = image.CreateCanvas())
{
    canvas.DrawText("Ship it", new Vector2(8, 40), new Font(text, 24), Rgba8.Black);
    canvas.DrawText("\U0001F680\U0001F389", new Vector2(100, 42), new Font(emoji, 32), Rgba8.Black);
}

// The palette is a font setting; the paint's color fills a glyph's foreground parts and its alpha the whole glyph.
var darkMode = new Font(emoji, 32) { Palette = FontPalette.Dark };
ColorGlyphFormats formats = emoji.ColorFormats;

// The paint graph is there to walk, for writers that draw color glyphs their own way.
emoji.TryGetColorGlyph(emoji.GetGlyph(0x1F680), darkMode.Palette, out ColorGlyph? rocket);

Constructors

ColorGlyphReferencePaint(ushort, ColorPaint)

Another color glyph's paint graph drawn here, as COLR's PaintColrGlyph reuses it.

public ColorGlyphReferencePaint(ushort Glyph, ColorPaint Paint)

Parameters

Glyph ushort

The color glyph reused.

Paint ColorPaint

Its paint graph.

Examples

// Color glyphs draw in color by themselves: COLR (layers and gradients), sbix and CBDT (images), per glyph.
using (RasterCanvas<Rgba8> canvas = image.CreateCanvas())
{
    canvas.DrawText("Ship it", new Vector2(8, 40), new Font(text, 24), Rgba8.Black);
    canvas.DrawText("\U0001F680\U0001F389", new Vector2(100, 42), new Font(emoji, 32), Rgba8.Black);
}

// The palette is a font setting; the paint's color fills a glyph's foreground parts and its alpha the whole glyph.
var darkMode = new Font(emoji, 32) { Palette = FontPalette.Dark };
ColorGlyphFormats formats = emoji.ColorFormats;

// The paint graph is there to walk, for writers that draw color glyphs their own way.
emoji.TryGetColorGlyph(emoji.GetGlyph(0x1F680), darkMode.Palette, out ColorGlyph? rocket);

Properties

Glyph

The color glyph reused.

public ushort Glyph { get; init; }

Property Value

ushort

Paint

Its paint graph.

public ColorPaint Paint { get; init; }

Property Value

ColorPaint

Methods

Accept(IColorPaintVisitor)

Calls the visitor's method for this kind of node.

public override void Accept(IColorPaintVisitor visitor)

Parameters

visitor IColorPaintVisitor

The visitor.