Table of Contents

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

startR byte

Start color red.

startG byte

Start color green.

startB byte

Start color blue.

endR byte

End color red.

endG byte

End color green.

endB byte

End color blue.

angleDegrees float

Angle in degrees. Default 90 = top-to-bottom.

midpoint float

Blend 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

float

EndB

End color blue (0-255).

public byte EndB { get; }

Property Value

byte

EndG

End color green (0-255).

public byte EndG { get; }

Property Value

byte

EndR

End color red (0-255).

public byte EndR { get; }

Property Value

byte

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

float

StartB

Start color blue (0-255).

public byte StartB { get; }

Property Value

byte

StartG

Start color green (0-255).

public byte StartG { get; }

Property Value

byte

StartR

Start color red (0-255).

public byte StartR { get; }

Property Value

byte

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

angleDegrees float

Angle in degrees. Default 90 = top-to-bottom.

midpoint float

Blend midpoint, 0.0 to 1.0. Default 0.5.

Returns

GradientPostProcessor

Process(RasterizedGlyph)

Takes a rendered glyph and returns a new one with the effect applied.

public RasterizedGlyph Process(RasterizedGlyph glyph)

Parameters

glyph RasterizedGlyph

The glyph to modify.

Returns

RasterizedGlyph