PixelMask Class
A set of pixels of an image: the region to fill of ImageProcessingExtensions.Inpaint, or the regions to keep and to remove of ImageProcessingExtensions.SeamCarve.
public sealed class PixelMaskRemarks
A new mask is empty. It holds one bit per pixel, in memory owned by the mask (not charged to an image). It is not thread-safe for writes.
Constructors
| Name | Description |
|---|---|
| PixelMask(Size) | Initializes a new instance of the PixelMask class, empty. |
| PixelMask(int, int) | Initializes a new instance of the PixelMask class, empty. |
PixelMask overloads
PixelMask(Size)
PixelMask.csInitializes a new instance of the PixelMask class, empty.
public PixelMask(Size size)Parameters
sizeSize- The size. Must not be empty.
Exceptions
ArgumentOutOfRangeException- A side of
sizeis not positive, or the mask would have more thanInt32.MaxValuepixels.
PixelMask(int, int)
PixelMask.csInitializes a new instance of the PixelMask class, empty.
Parameters
Exceptions
ArgumentOutOfRangeExceptionwidthorheightis not positive, or the mask would have more thanInt32.MaxValuepixels.
Properties
| Name | Description |
|---|---|
| Count | Gets the number of pixels of the mask. |
| Height | Gets the height, in pixels. |
| Size | Gets the size. |
| Width | Gets the width, in pixels. |
Count
PixelMask.csHeight
PixelMask.csSize
PixelMask.csWidth
PixelMask.csIndexers
| Name | Description |
|---|---|
| this[int, int] | Gets or sets whether a pixel belongs to the mask. |
this[int, int]
PixelMask.csMethods
| Name | Description |
|---|---|
| Clear() | Removes every pixel from the mask. |
| Fill(Rectangle, bool) | Adds the pixels of a rectangle to the mask, or removes them; the part of the rectangle outside the mask is ignored. |
| FromFrame(ImageFrame) | Creates the mask of the light pixels of a frame: those whose Rec. 709 luma, premultiplied by their alpha, is at least half of the largest sample, such as the white strokes of a mask painted in black and white. For an PixelFormat.A8 frame, the pixels whose alpha is at least half. |
Clear()
PixelMask.csRemoves every pixel from the mask.
public void Clear()Fill(Rectangle, bool)
PixelMask.csFromFrame(ImageFrame)
PixelMask.csCreates the mask of the light pixels of a frame: those whose Rec. 709 luma, premultiplied by their alpha, is at least half of the largest sample, such as the white strokes of a mask painted in black and white. For an PixelFormat.A8 frame, the pixels whose alpha is at least half.
public static PixelMask FromFrame(ImageFrame frame)Parameters
frameImageFrame- The frame.
Returns
PixelMask A mask of the size of the frame.
Exceptions
ArgumentNullExceptionframeisnull.UnsupportedImageFeatureException- The frame has CMYK pixels.
InvalidOperationException- A pixel lease is active.
ObjectDisposedException- The frame is no longer attached to a live image.