Table of Contents

Enum LcdSampling

Namespace
Egami.Drawing
Assembly
Egami.Drawing.dll

How LCD text samples a glyph before filtering.

public enum LcdSampling

Fields

Gdi = 1

As measured from GDI+ ClearType: six on-or-off samples per pixel across the stripes, two per subpixel, on each pixel's centre line, so edges along the stripes are not smoothed and a channel of the Gdi filter is a whole number of sixths. With a TextGamma other than 1, text then blends through GDI+'s 8-bit gamma tables in those sixths. Hinted TrueType glyphs keep the font's dropout control, as GDI+ does: a stroke along the stripes that falls between two rows' centre lines still turns on a row.

Smooth = 0

Exact coverage of each subpixel's area, antialiased along both axes: Egami's sampling since 2.7.2.

Examples

// GDI+ ClearType's look: its filter (an even spread over three subpixels), no smoothing along the stripes, and the text
// gamma that then matched GDI+'s weight for a white Trebuchet MS label at 16 pixels.
var gdiPlus = new CanvasOptions
{
    PixelGeometry = PixelGeometry.RgbHorizontal,
    LcdFilter = LcdFilter.Gdi,
    LcdSampling = LcdSampling.Gdi,
    TextGamma = 1.25f,
};
var label = new Font(face, 16) { Hinting = FontHinting.Light, Edging = FontEdging.Lcd, Subpixel = false };
using (RasterCanvas<Rgb8> canvas = button.CreateCanvas(gdiPlus))
{
    canvas.DrawText("Start the course", new Vector2(40, 26), label, Rgba8.White);
}

// Softer fringes: a balanced filter and half the colour of full ClearType.
var soft = new CanvasOptions { PixelGeometry = PixelGeometry.RgbHorizontal, LcdFilter = LcdFilter.Balanced, ClearTypeLevel = 0.5f };

// Or weights of your own, normalised to add up to 256.
var custom = new CanvasOptions { PixelGeometry = PixelGeometry.RgbHorizontal, LcdFilter = LcdFilter.Custom(1, 3, 4, 3, 1) };