Class GradientPostProcessor
- Namespace
- KernSmith.Rasterizer
- Assembly
- KernSmith.dll
Applies a two-color linear gradient across each glyph at a configurable angle. Converts grayscale glyphs to RGBA.
public sealed class GradientPostProcessor : IGlyphPostProcessor
- Inheritance
-
GradientPostProcessor
- Implements
- Inherited Members
Constructors
GradientPostProcessor(byte, byte, byte, byte, byte, byte, float, float)
Creates a gradient effect with the given colors, angle, and midpoint.
public GradientPostProcessor(byte startR, byte startG, byte startB, byte endR, byte endG, byte endB, float angleDegrees = 90, float midpoint = 0.5)
Parameters
startRbyteStart color red.
startGbyteStart color green.
startBbyteStart color blue.
endRbyteEnd color red.
endGbyteEnd color green.
endBbyteEnd color blue.
angleDegreesfloatAngle in degrees. Default 90 = top-to-bottom.
midpointfloatBlend midpoint, 0.0 to 1.0. Default 0.5.
Properties
AngleDegrees
Angle of the gradient in degrees. 0 = left-to-right, 90 = top-to-bottom, 180 = right-to-left, 270 = bottom-to-top.
public float AngleDegrees { get; }
Property Value
EndB
End color blue (0-255).
public byte EndB { get; }
Property Value
EndG
End color green (0-255).
public byte EndG { get; }
Property Value
EndR
End color red (0-255).
public byte EndR { get; }
Property Value
Midpoint
Position of the 50% blend point along the gradient, from 0.0 to 1.0. Default 0.5. Lower values shift the blend toward the start color; higher values toward the end color.
public float Midpoint { get; }
Property Value
StartB
Start color blue (0-255).
public byte StartB { get; }
Property Value
StartG
Start color green (0-255).
public byte StartG { get; }
Property Value
StartR
Start color red (0-255).
public byte StartR { get; }
Property Value
Methods
Create((byte R, byte G, byte B), (byte R, byte G, byte B), float, float)
Creates a gradient post-processor from two RGB color tuples.
public static GradientPostProcessor Create((byte R, byte G, byte B) startColor, (byte R, byte G, byte B) endColor, float angleDegrees = 90, float midpoint = 0.5)
Parameters
startColor(byte R, byte G, byte B)Start color as (R, G, B).
endColor(byte R, byte G, byte B)End color as (R, G, B).
angleDegreesfloatAngle in degrees. Default 90 = top-to-bottom.
midpointfloatBlend midpoint, 0.0 to 1.0. Default 0.5.
Returns
Process(RasterizedGlyph)
Takes a rendered glyph and returns a new one with the effect applied.
public RasterizedGlyph Process(RasterizedGlyph glyph)
Parameters
glyphRasterizedGlyphThe glyph to modify.