strokePath method

  1. @override
void strokePath(
  1. PdfPath path,
  2. PdfColor color,
  3. PdfStroke stroke,
  4. double alpha,
)
inherited

Implementation

@override
void strokePath(
    PdfPath path, PdfColor color, PdfStroke stroke, double alpha) {
  if (!stripsActive || delegateStrokes) {
    _delegatePaint(() => delegateStrokePath(path, color, stroke, alpha));
    return;
  }
  if (!binningEnabled) return;
  // Skia renders strokes thinner than one device pixel as a 1-px hairline
  // with the alpha modulated by the width (not a true sub-pixel band);
  // match it so thin CAD/print linework is parity-identical.
  var deviceStroke = stroke;
  var a = alpha;
  final sf = pageToDevice.scaleFactor;
  final hairWidth = stroke.width * sf;
  if (hairWidth < 1 && sf > 0) {
    deviceStroke = stroke.copyWith(width: 1 / sf);
    if (hairWidth > 0) a *= hairWidth;
  }
  generator.strokePath(
      path, pageToDevice, deviceStroke, stripArgbColor(color, a),
      tolerance: stripFlattenTolerance);
}