PdfSoftMask constructor

PdfSoftMask(
  1. PdfDocument document, {
  2. required PdfRect boundingBox,
  3. bool isolated = false,
  4. bool knockout = false,
  5. bool invert = false,
})

Implementation

PdfSoftMask(this.document,
    {required PdfRect boundingBox,
    bool isolated = false,
    bool knockout = false,
    bool invert = false}) {
  _mask = PdfGraphicXObject(document, '/Form');
  _mask.params['/BBox'] = PdfArray.fromNum([
    boundingBox.x,
    boundingBox.y,
    boundingBox.width,
    boundingBox.height,
  ]);
  if (isolated) {
    _mask.params['/I'] = const PdfBool(true);
  }
  if (knockout) {
    _mask.params['/K'] = const PdfBool(true);
  }
  _graphics = PdfGraphics(_mask, _mask.buf);

  if (invert) {
    _tr = PdfFunction(
      document,
      data: [255, 0],
    );
  }
}