endSoftMasked method

  1. @override
void endSoftMasked({
  1. required bool luminosity,
  2. required PdfRect backdrop,
  3. required void drawMask(),
  4. double backdropLuminance = 0,
  5. double transferScale = 1,
  6. double transferOffset = 0,
})
override

Ends the capture opened by beginSoftMasked. drawMask paints the mask group's content through this same device; for luminosity masks the device converts the result's luminance to alpha over the backdrop box, then composites it into the captured content (dstIn). Areas the mask group doesn't paint take backdropLuminance (the luminance of the /BC backdrop colour, default black). The mask value is remapped through the /TR transfer function, linearised here as value * transferScale + transferOffset (identity by default). Devices that collect content from drawMask (e.g. image collectors) should invoke it even if they do no compositing.

Implementation

@override
void endSoftMasked({
  required bool luminosity,
  required PdfRect backdrop,
  required void Function() drawMask,
  double backdropLuminance = 0,
  double transferScale = 1,
  double transferOffset = 0,
}) {
  flushPending(); // masked content strips land inside the content layer
  if (_groupKnockout.isNotEmpty) _groupKnockout.removeLast();
  delegateBeginSoftMaskComposite(
      luminosity: luminosity,
      backdrop: backdrop,
      backdropLuminance: backdropLuminance,
      transferScale: transferScale,
      transferOffset: transferOffset);
  // The mask group's draws happen NOW and route through this device, so
  // they bin/flush between the composite halves on every subclass.
  drawMask();
  flushPending();
  delegateFinishSoftMaskComposite();
}