Constructor ImageRedactionArea
ImageRedactionArea(int, IBounds)
Initializes a redaction area from a page index and a bounding box: the whole rectangle is covered with an opaque fill (Rectangle, Fill).
public ImageRedactionArea(int pageIndex, IBounds bounds)
Parameters
pageIndexintZero-based page index.
boundsIBoundsThe region to redact, in top-left origin image pixels. Any IBounds is accepted, including a Rectangle, a layout TextElement, or a search match's bounds. The edges are normalized, so reversed edges are handled.
Exceptions
- ArgumentOutOfRangeException
Thrown when
pageIndexis negative.- ArgumentNullException
Thrown when
boundsisnull.- ArgumentException
Thrown when
boundshas a non-positive width or height.
ImageRedactionArea(int, IBounds, ImageRedactionShape, ImageRedactionCover)
Initializes a redaction area from a page index, a bounding box, the shape covered inside it and what it is covered with.
public ImageRedactionArea(int pageIndex, IBounds bounds, ImageRedactionShape shape, ImageRedactionCover cover)
Parameters
pageIndexintZero-based page index.
boundsIBoundsThe bounds of the region to redact, in top-left origin image pixels. Any IBounds is accepted. The edges are normalized, so reversed edges are handled.
shapeImageRedactionShapeWhich pixels of
boundsare covered: the whole rectangle, or the ellipse inscribed in it.coverImageRedactionCoverWhat the covered pixels are painted with: the options' fill color, or a pixelation or blur computed from a coarse grid so the content cannot be recovered.
Examples
using LMKit.Media.Image;
using LMKit.Graphics.Geometry;
var request = new ImageRedactionRequest();
request.Areas.Add(new ImageRedactionArea(
0, Rectangle.FromSize(120, 40, 80, 100), ImageRedactionShape.Ellipse, ImageRedactionCover.Pixelate));
ImageRedactionResult result = ImageRedactor.RedactToBytes(File.ReadAllBytes("photo.jpg"), request);
Exceptions
- ArgumentOutOfRangeException
Thrown when
pageIndexis negative, or whenshapeorcoveris not a defined value.- ArgumentNullException
Thrown when
boundsisnull.- ArgumentException
Thrown when
boundshas a non-positive width or height.