StripPdfDevice constructor

StripPdfDevice(
  1. Canvas canvas, {
  2. required PdfMatrix pageToDevice,
  3. required int deviceWidth,
  4. required int deviceHeight,
  5. required double pixelRatio,
  6. Map<Object, Image> images = const {},
  7. StripPlan? precomputed,
  8. double slugMinGlyphPx = 4,
  9. bool? enableSlugGlyphs,
})

precomputed feeds the device a worker-binned StripPlan instead of binning locally: generator feeds are skipped entirely and each flush point consumes the plan batch tagged with its ordinal. The plan must have been binned for this exact geometry - usablePlan guards that (and the debug-delegate flags, which force local binning) - and finish verifies the flush-point count and full consumption before painting anything, throwing StripPlanMismatchError on desync so the caller can transparently re-run with local binning.

Implementation

factory StripPdfDevice(
  ui.Canvas canvas, {
  required PdfMatrix pageToDevice,
  required int deviceWidth,
  required int deviceHeight,
  required double pixelRatio,
  Map<Object, ui.Image> images = const {},
  StripPlan? precomputed,
  double slugMinGlyphPx = 4,
  bool? enableSlugGlyphs,
}) {
  final slugEnabled = enableSlugGlyphs ?? slugGlyphs;
  return StripPdfDevice._(
    canvas,
    usablePlan(precomputed,
        pageToDevice: pageToDevice,
        deviceWidth: deviceWidth,
        deviceHeight: deviceHeight,
        slugEnabled: slugEnabled),
    pageToDevice: pageToDevice,
    deviceWidth: deviceWidth,
    deviceHeight: deviceHeight,
    pixelRatio: pixelRatio,
    images: images,
    slugMinGlyphPx: slugMinGlyphPx,
    slugEnabled: slugEnabled,
  );
}