Table of Contents

Struct Mask

Namespace
Egami.Operations
Assembly
Egami.dll

A raster read as coverage, 0 (none) to full, placed on the image being edited: where an operation inside Within(Mask, Action<RasterOps>) applies and how strongly. The raster may have any size and pixel type; outside it coverage is 0, or full when Inverted. Its first frame is used for every frame. It must stay undisposed until the chain has run.

public readonly record struct Mask : IEquatable<Mask>
Implements
Inherited Members

Examples

// Edit only the sky: a gray mask, white where the edit applies fully, black where it does not, soft in between.
photo.Apply(ops => ops
    .Within(new Mask(sky), o => o.Saturation(1.3f).Contrast(1.1f))

    // Or take coverage from a logo's alpha, placed on the photo, and invert the area under it.
    .Within(new Mask(logo, new Point(20, 20), MaskChannel.Alpha), o => o.Invert()), Ct);

Constructors

Mask(Raster, Point, MaskChannel, bool)

A raster read as coverage, 0 (none) to full, placed on the image being edited: where an operation inside Within(Mask, Action<RasterOps>) applies and how strongly. The raster may have any size and pixel type; outside it coverage is 0, or full when Inverted. Its first frame is used for every frame. It must stay undisposed until the chain has run.

public Mask(Raster Source, Point Offset = default, MaskChannel Channel = MaskChannel.Auto, bool Inverted = false)

Parameters

Source Raster

The raster to read coverage from.

Offset Point

Where the raster's top-left corner sits on the image; may be negative.

Channel MaskChannel

Which values are read. Defaults to Auto.

Inverted bool

Whether coverage is flipped: none becomes full and full becomes none, outside the raster included.

Examples

// Edit only the sky: a gray mask, white where the edit applies fully, black where it does not, soft in between.
photo.Apply(ops => ops
    .Within(new Mask(sky), o => o.Saturation(1.3f).Contrast(1.1f))

    // Or take coverage from a logo's alpha, placed on the photo, and invert the area under it.
    .Within(new Mask(logo, new Point(20, 20), MaskChannel.Alpha), o => o.Invert()), Ct);

Properties

Channel

Which values are read. Defaults to Auto.

public MaskChannel Channel { get; init; }

Property Value

MaskChannel

Inverted

Whether coverage is flipped: none becomes full and full becomes none, outside the raster included.

public bool Inverted { get; init; }

Property Value

bool

Offset

Where the raster's top-left corner sits on the image; may be negative.

public Point Offset { get; init; }

Property Value

Point

Source

The raster to read coverage from.

public Raster Source { get; init; }

Property Value

Raster