Table of Contents

Class BitmapColorGlyph

Namespace
Egami.Fonts
Assembly
Egami.Fonts.dll

An sbix or CBDT glyph: its image, the strike's size and where the image goes, in font units with y up, so it scales with the font; the drawing code decodes and resamples it.

public sealed record BitmapColorGlyph : ColorGlyph, IEquatable<ColorGlyph>, IEquatable<BitmapColorGlyph>
Inheritance
BitmapColorGlyph
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

BitmapColorGlyph(ushort, ColorGlyphFormats, ReadOnlyMemory<byte>, BitmapGlyphEncoding, int, int, int, GlyphExtents)

An sbix or CBDT glyph: its image, the strike's size and where the image goes, in font units with y up, so it scales with the font; the drawing code decodes and resamples it.

public BitmapColorGlyph(ushort Glyph, ColorGlyphFormats Format, ReadOnlyMemory<byte> Data, BitmapGlyphEncoding Encoding, int PixelWidth, int PixelHeight, int PixelsPerEm, GlyphExtents Bounds)

Parameters

Glyph ushort

The glyph.

Format ColorGlyphFormats

Sbix or Cbdt.

Data ReadOnlyMemory<byte>

The image bytes, a slice of the font's memory.

Encoding BitmapGlyphEncoding

The image's encoding.

PixelWidth int

The image's width in pixels.

PixelHeight int

The image's height in pixels.

PixelsPerEm int

The strike's size.

Bounds GlyphExtents

Where the image's edges go, in font units, y up.

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

Bounds

Where the image's edges go, in font units, y up.

public GlyphExtents Bounds { get; init; }

Property Value

GlyphExtents

Data

The image bytes, a slice of the font's memory.

public ReadOnlyMemory<byte> Data { get; init; }

Property Value

ReadOnlyMemory<byte>

Encoding

The image's encoding.

public BitmapGlyphEncoding Encoding { get; init; }

Property Value

BitmapGlyphEncoding

PixelHeight

The image's height in pixels.

public int PixelHeight { get; init; }

Property Value

int

PixelWidth

The image's width in pixels.

public int PixelWidth { get; init; }

Property Value

int

PixelsPerEm

The strike's size.

public int PixelsPerEm { get; init; }

Property Value

int