Table of Contents

Class ColorLayersPaint

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

Paints drawn one over another, in order.

public sealed record ColorLayersPaint : ColorPaint, IEquatable<ColorPaint>, IEquatable<ColorLayersPaint>
Inheritance
ColorLayersPaint
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

ColorLayersPaint(IReadOnlyList<ColorPaint>)

Paints drawn one over another, in order.

public ColorLayersPaint(IReadOnlyList<ColorPaint> Layers)

Parameters

Layers IReadOnlyList<ColorPaint>

The layers, bottom first.

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

Layers

The layers, bottom first.

public IReadOnlyList<ColorPaint> Layers { get; init; }

Property Value

IReadOnlyList<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.

Equals(ColorLayersPaint?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ColorLayersPaint? other)

Parameters

other ColorLayersPaint

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.