Table of Contents

Class ColorRadialGradientPaint

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

A gradient between two circles filling the clip.

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

ColorRadialGradientPaint(Vector2, float, Vector2, float, ColorLine)

A gradient between two circles filling the clip.

public ColorRadialGradientPaint(Vector2 Center0, float Radius0, Vector2 Center1, float Radius1, ColorLine Line)

Parameters

Center0 Vector2

The start circle's center.

Radius0 float

The start circle's radius.

Center1 Vector2

The end circle's center.

Radius1 float

The end circle's radius.

Line ColorLine

The color line.

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

Center0

The start circle's center.

public Vector2 Center0 { get; init; }

Property Value

Vector2

Center1

The end circle's center.

public Vector2 Center1 { get; init; }

Property Value

Vector2

Line

The color line.

public ColorLine Line { get; init; }

Property Value

ColorLine

Radius0

The start circle's radius.

public float Radius0 { get; init; }

Property Value

float

Radius1

The end circle's radius.

public float Radius1 { get; init; }

Property Value

float

Methods

Accept(IColorPaintVisitor)

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

public override void Accept(IColorPaintVisitor visitor)

Parameters

visitor IColorPaintVisitor

The visitor.