Table of Contents

Enum Antialiasing

Namespace
Egami.Drawing
Assembly
Egami.Drawing.dll

How a canvas antialiases shapes.

public enum Antialiasing

Fields

Exact = 0

The exact area each pixel has inside the shape, in 256 levels: Egami's default.

GdiPlus = 1

As measured from GDI+'s SmoothingMode.AntiAlias and HighQuality: 8 by 4 point samples a pixel, at eighths across and quarters down from its top-left corner, so coverage comes in 32 steps. A sample on a shape's left or top edge is inside and one on its right or bottom edge is outside. Pens whose device width is 1.5 pixels or less draw as GDI+'s thin lines: one pixel thick across the line's major axis, with pointed ends and no caps.

Examples

// Shapes as System.Drawing draws them at its defaults (SmoothingMode.AntiAlias, PixelOffsetMode.None): whole coordinates on
// pixel centres, GDI+'s 8 by 4 samples a pixel, and pens up to 1.5 px drawn as its one-pixel thin lines.
// CanvasOptions.GdiPlus sets both too.
var options = new CanvasOptions { PixelOffset = PixelOffset.None, Antialiasing = Antialiasing.GdiPlus };
using (RasterCanvas<Rgb8> canvas = raster.CreateCanvas(options))
{
    canvas.FillOval(new RectF(4, 4, 20, 20), new SolidPaint(new Rgba8(0, 90, 200, 255)));
    canvas.DrawLine(new Vector2(30, 6), new Vector2(60, 26), new Stroke(0.5f), new SolidPaint(Rgba8.Black));
}