Enum SoftMaskKind
Which value of a soft mask's drawing becomes the mask, as PDF's soft mask subtypes.
public enum SoftMaskKind
Fields
Alpha = 0The drawing's alpha.
Luminosity = 1The drawing's luminosity over the backdrop color: Rec. 709 weights on the encoded values, as PDF uses.
Examples
using (RasterCanvas<Rgba8> canvas = raster.CreateCanvas())
{
// A luminosity mask, as a PDF soft mask: white shows the photo, black hides it, a gradient fades it out to the right.
RectF area = new(0, 0, photo.Width, photo.Height);
SoftMask fade = new(mask => mask.FillRect(area, new LinearGradient(new Vector2(area.Width * 0.6f, 0), new Vector2(area.Width, 0), new RgbaF32(1, 1, 1, 1), new RgbaF32(0, 0, 0, 1))));
canvas.SaveLayer(new LayerOptions { Mask = fade });
canvas.DrawImage(photo, Vector2.Zero);
canvas.Restore();
}