setOverprint method

  1. @override
void setOverprint({
  1. required bool fill,
  2. required bool stroke,
  3. required int mode,
})
inherited

Sets the overprint state for subsequent painting (gs /OP, /op, /OPM; PDF §8.6.7). fill is nonstroking overprint (/op), stroke is stroking overprint (/OP), and mode is the overprint mode (/OPM, 0 or 1).

Overprint is a subtractive (CMYK/spot colorant) operation: an overprinting colorant that is not written leaves the underlying colorant untouched instead of knocking it out. The interpreter resolves that in a CMYK/spot colorant buffer (PdfOverprintCompositor, issue #502) before the draw reaches a device: a resolved draw arrives with its composite already in the colour and this flag cleared, so devices paint it plainly.

The flag therefore only arrives set where the buffer declined - over an image, a gradient, a transparency group, or a colour space with no colorant reading. Painting devices approximate that residue with a darken (per-channel min) composite, which is a no-op over white, so it only affects ink laid over ink. mode is the parsed /OPM; the RGB approximation cannot act on its zero-component distinction, which is a colorant-space question the buffer has already answered. Non-compositing devices can ignore all three.

Implementation

@override
void setOverprint(
    {required bool fill, required bool stroke, required int mode}) {
  // Overprint (§8.6.7) composites with BlendMode.darken on the canvas device,
  // which batched srcOver strip quads can't express - so an overprinting fill
  // or stroke routes to the delegate (see fillPath/strokePath), exactly like a
  // non-Normal blend mode. Forward the state so the delegate darkens to match
  // the pure-canvas render and strip/canvas parity holds (issue #502).
  _fillOverprint = fill;
  _strokeOverprint = stroke;
  delegateSetOverprint(fill: fill, stroke: stroke, mode: mode);
}