Class ColorLinearGradientPaint
A linear gradient filling the clip: the color line runs from P0 toward P1, with lines of equal color parallel to P0–P2, as COLR defines it.
public sealed record ColorLinearGradientPaint : ColorPaint, IEquatable<ColorPaint>, IEquatable<ColorLinearGradientPaint>
- Inheritance
-
ColorLinearGradientPaint
- 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
ColorLinearGradientPaint(Vector2, Vector2, Vector2, ColorLine)
A linear gradient filling the clip: the color line runs from P0 toward P1, with lines of equal color parallel to P0–P2, as COLR defines it.
public ColorLinearGradientPaint(Vector2 P0, Vector2 P1, Vector2 P2, ColorLine Line)
Parameters
P0Vector2The start point.
P1Vector2The end point.
P2Vector2The point giving the direction of the lines of equal color.
LineColorLineThe 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
Line
The color line.
public ColorLine Line { get; init; }
Property Value
P0
The start point.
public Vector2 P0 { get; init; }
Property Value
P1
The end point.
public Vector2 P1 { get; init; }
Property Value
P2
The point giving the direction of the lines of equal color.
public Vector2 P2 { get; init; }
Property Value
Methods
Accept(IColorPaintVisitor)
Calls the visitor's method for this kind of node.
public override void Accept(IColorPaintVisitor visitor)
Parameters
visitorIColorPaintVisitorThe visitor.