Skip to content

IEditCommand<TPixel>

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

public interface IEditCommand<TPixel>

One reversible edit over an IEditSurface<TPixel>. Apply captures enough to Undo.

Type parameters

  • TPixel - The pixel the target surface stores.

Methods

Apply(IEditSurface<TPixel>)

public abstract bool Apply(IEditSurface<TPixel> surface);

Applies the edit and returns whether it changed any pixel — a redundant edit (nothing to fill, or painting the value a pixel already holds) returns false so history can skip an empty entry. Re-applying (redo) reports the same verdict the first Apply did.

Parameters

  • surface (IEditSurface<TPixel>) - The surface to edit.

Returns. True when the edit changed anything.

Undo(IEditSurface<TPixel>)

public abstract void Undo(IEditSurface<TPixel> surface);

Restores what Apply overwrote.

Parameters

  • surface (IEditSurface<TPixel>) - The surface to restore.