Enum PixelOffset
Where a canvas puts its pixel centres, for paths and unhinted text: GDI+'s PixelOffsetMode.
public enum PixelOffset
Fields
Half = 0Whole coordinates fall on pixel edges and pixel centres at half coordinates: Egami's default, GDI+'s
Half.None = 1Whole coordinates fall on pixel centres, as GDI+ draws by default (
PixelOffsetMode.None,DefaultandHighSpeed): paths, their paints and unhinted text move half a pixel right and down. Hinted text does not move, and images sit on GDI+'s grid, with source pixel centres on destination pixel centres: an image scaled by s moves (1 − s) / 2 pixels, one drawn 1:1 not at all.
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));
}