Skip to content

DrawShape<TPixel>

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

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

Fills a rectangle, inscribed ellipse, or upright triangle with one pixel.

Type parameters

  • TPixel - The pixel the target surface stores.

Constructors

DrawShape(ShapeKind, PixelRect, TPixel, OpacityLock)

public DrawShape(ShapeKind kind, PixelRect bounds, TPixel pixel, OpacityLock opacity = OpacityLock.Locked);

Draws a filled shape.

Parameters

  • kind (ShapeKind) - Which shape.
  • bounds (PixelRect) - Its bounding box.
  • pixel (TPixel) - The pixel to write.
  • 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.