Skip to content

AlphaSnap<TPixel>

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

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

Snaps every partially transparent pixel at 50%: alpha at or above VoxelReady.Threshold becomes 255, below it becomes 0. Color channels are untouched. Pixels already fully opaque or fully clear are not written, so snapping clean art changes nothing and records no undo step.

Type parameters

  • TPixel - The pixel the target surface stores.

Remarks

It runs OpacityLock.Unlocked because it is the alpha edit; the one rule for "which side of 50%" is VoxelReady.Threshold, the same cutoff the opacity lock uses.

Constructors

AlphaSnap()

public AlphaSnap();

Creates the snap over the whole surface.

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.