Skip to content

DepthStep

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

public sealed class DepthStep : RegionEditCommand<DepthPixel>

Raises or lowers one side of the depth of every solid pixel a gesture touches, by exactly one.

Remarks

A pixel crossed several times by a stroke steps once: the footprint is deduplicated, so the result does not depend on pointer sample rate. Only pixels whose value actually changes are emitted, so a gesture over transparent pixels or against a floor/ceiling is not an undo entry.

Constructors

DepthStep(IReadOnlyCollection<(int, int)>, DepthSide, int)

public DepthStep(IReadOnlyCollection<(int, int)> pixels, DepthSide side, int delta);

Creates the step.

Parameters

  • pixels (IReadOnlyCollection<(int, int)>) - The gesture's footprint; copied.
  • side (DepthSide) - Which side of the paper to move.
  • delta (int) - +1 to raise, -1 to lower.

Exceptions

  • ArgumentOutOfRangeException - delta is not 1 or -1, or side is undefined.

Methods

ComputePixels(IEditSurface<DepthPixel>)

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

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

Parameters

  • surface (IEditSurface<DepthPixel>) - 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.