Footprint¶
Namespace Nfty.Core.Editing in assembly Nfty.Core.
Which pixels a gesture touches, independent of what it writes there. The brush, eraser, flood fill and the depth tools all ask "where" the same way; they differ only in what each pixel becomes, so the geometry lives here once, payload-free.
Methods¶
Box(PixelRect, int, int)¶
Every pixel of a rectangle, clipped to the surface, rows then columns.
Parameters
rect(PixelRect) - The rectangle.width(int) - Surface width.height(int) - Surface height.
Returns. The covered in-bounds pixels.
Discs(int, int, IReadOnlyList<(int, int)>, int)¶
public static List<(int, int)> Discs(int width, int height, IReadOnlyList<(int, int)> path, int size);
A filled round disc of diameter size stamped along path, each in-bounds pixel at most once.
Parameters
width(int) - Surface width.height(int) - Surface height.path(IReadOnlyList<(int, int)>) - The gesture's pixel path.size(int) - Disc diameter in pixels; anything below 1 is treated as 1.
Returns. The stamped pixels in first-visit order, deduplicated and clipped to the surface.
Remarks
The path is joined, not merely visited: a disc is stamped at every pixel on the line between consecutive points, not only at the points themselves. A pointer reports samples at whatever rate the device and the UI thread manage, so a stroke drawn at any speed arrives as a handful of scattered coordinates — stamping only those turns a fast stroke into a row of dots with gaps between them, which is what the editor shipped before this. Joining here rather than in the front-end makes it a property of "a stroke" rather than of one caller's sample rate, and fixes every stroke tool at once.
Region<TPixel>(IEditSurface<TPixel>, int, int)¶
The 4-connected run of pixels exactly equal to the seed pixel, alpha included, so a region spreads across an erased area without leaking into a painted one.
Parameters
surface(IEditSurface<TPixel>) - The surface to scan.seedX(int) - Seed column.seedY(int) - Seed row.
Type parameters
TPixel- The pixel the surface stores.
Returns. The matching pixels in breadth-first order; empty when the seed is out of bounds.