Skip to content

BrushStroke<TPixel>

Namespace Nfty.Core.Editing in assembly Nfty.Core.

public sealed class BrushStroke<TPixel> : RegionEditCommand<TPixel>

Paints the brush's pixel as a filled disc stamped along a path.

Type parameters

  • TPixel - The pixel the target surface stores.

Constructors

BrushStroke(Brush<TPixel>, IReadOnlyList<(int, int)>, OpacityLock)

public BrushStroke(Brush<TPixel> brush, IReadOnlyList<(int, int)> path, OpacityLock opacity = OpacityLock.Locked);

Paints a stroke.

Parameters

  • brush (Brush<TPixel>) - Size and payload of the brush.
  • path (IReadOnlyList<(int, int)>) - The gesture's pixel path.
  • opacity (OpacityLock) - Whether partial alpha is admitted; locked by default.

Methods

ComputePixels(IEditSurface<TPixel>)

protected override IReadOnlyList<(int, int, TPixel)> ComputePixels(IEditSurface<TPixel> surface);

Target pixels and their new values. Only in-bounds pixels, each coordinate at most once; computed before any mutation.

Parameters

  • surface (IEditSurface<TPixel>) - The surface being edited, for reading the pixels the edit depends on.

Returns. The pixels to write, before the opacity lock is applied to them.