Click or drag to resize
Pdftools logo

ContentGeneratorPaintImageMask Method

Paint an image (stencil) mask.

An image mask is a monochrome image, in which each sample is specified by a single bit. However, instead of being painted in opaque black and white, the image mask is treated as a stencil mask that is partly opaque and partly transparent. Sample values in the image do not represent black and white pixels; rather, they designate places on the content that should either be marked with the given paint or masked out (not marked at all). Areas that are masked out retain their former content.

The effect is like applying paint in the current color through a cut-out stencil, which allows the paint to reach the page in some places and masks it out in others.


Namespace: PdfTools.Toolbox.Pdf.Content
Assembly: PdfTools.Toolbox (in PdfTools.Toolbox.dll) Version: 1.0.0+fdabb036503e9f99735634a6d4f5be875399e9f5
Syntax
C#
public void PaintImageMask(
	ImageMask imageMask,
	Rectangle targetRect,
	Paint paint
)

Parameters

imageMask  ImageMask
the image (stencil) mask
targetRect  Rectangle
the target rectangle in the current coordinate system. If targetRect is , the unit rectangle [0, 0, 1, 1] is used.
paint  Paint
the paint for filling marked pixels
Exceptions
ExceptionCondition
InvalidOperationExceptionif the document associated with the content has already been closed
InvalidOperationExceptionif the page/group associated with the content has already been closed
InvalidOperationExceptionif the content object has already been closed
InvalidOperationExceptionif the object has already been closed
ArgumentExceptionif the document associated with imageMask has already been closed
ArgumentExceptionif the imageMask object is not an image mask
ArgumentExceptionif the imageMask is associated with a different document
ArgumentExceptionif the document associated with paint has already been closed
ArgumentExceptionif the paint is associated with a different document
ArgumentNullExceptionif imageMask is .
ArgumentNullExceptionif paint is .
See Also