StripBinningDevice class abstract

PdfDevice base that bins solid fills, strokes, and embedded-outline text into sparse strips (StripGenerator) and routes everything else - and every flush-point decision - through abstract hooks.

Strip-routed ops feed generator; at every flush point (a delegated paint, a clip, a restore that pops a clip, group/soft-mask boundaries, and the final flushPending) the generator's accumulated strips are snapshotted into a StripBatchData and handed to emitBatch together with the flush point's ordinal. Empty flush points still count an ordinal (and call emitBatch with null data) so ordinals line up across isolates.

With binningEnabled false the generator is never fed or flushed - routing and flush ordinals are still tracked identically, which is how the precomputed-plan device consumes worker-binned batches without paying any flatten/bin cost.

The per-primitive delegate predicates (delegateAll/delegateFills/ delegateStrokes/delegateText) are instance state, captured at construction from whatever debug switches the subclass exposes - they are part of the routing decision, so any of them being set on one side but not the other desyncs flush ordinals. Worker plans must not be used while a debug-delegate flag is set (the worker isolate has its own statics and would bin the full routing).

Implemented types
Implementers

Constructors

StripBinningDevice({required PdfMatrix pageToDevice, required int deviceWidth, required int deviceHeight, required double pixelRatio, bool binningEnabled = true, bool delegateAll = false, bool delegateFills = false, bool delegateStrokes = false, bool delegateText = false})

Properties

binningEnabled bool
Whether strip-routed ops actually feed generator. False in precomputed-plan mode: routing and flush ordinals still advance, but no flatten/stroke-expansion/coverage work runs.
final
delegateAll bool
Debug routing predicates (see the class doc).
final
delegatedPaintCount int
Delegated paint ops routed through the fallback so far.
getter/setter pair
delegateFills bool
final
delegateStrokes bool
final
delegateText bool
final
deviceHeight int
final
deviceWidth int
final
flushPointCount int
Flush points seen so far (every flush point counts, empty or not).
no setter
generator StripGenerator
final
hashCode int
The hash code for this object.
no setterinherited
pageToDevice PdfMatrix
Page space (PDF user space, y-up) -> device pixels (y-down), including /Rotate and pixelRatio.
final
pixelRatio double
The ratio baked into pageToDevice; binned strips are only valid at this ratio.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stripsActive bool
Whether paint ops may take the strip path right now: normal blend and not directly inside a knockout group (knockout elements composite with BlendMode.src, which batched srcOver quads can't express).
no setter

Methods

beginGroup(double alpha, {bool knockout = false}) → void
Brackets a transparency-group form (§11.6.6) whose composite result paints at alpha. Inside the group, alpha starts over at 1.0; the group then blends as one object. Non-compositing devices can treat the pair as a no-op - the group's content still arrives through the normal callbacks in between.
override
beginSoftMasked() → void
Starts capturing painted content that an ExtGState /SMask will mask. Visual devices open an offscreen layer; others can ignore the pair.
override
clipPath(PdfPath path, PdfFillRule rule) → void
Intersects the current clip with path.
override
delegateBeginGroup(double alpha, {required bool knockout}) → void
delegateBeginSoftMaskComposite({required bool luminosity, required PdfRect backdrop, required double backdropLuminance, required double transferScale, required double transferOffset}) → void
The two halves of the soft-mask composite. The base runs the mask group's drawMask() between them - through THIS device, so mask-group strips bin (and flush) identically on every subclass.
delegateBeginSoftMasked() → void
delegateClipPath(PdfPath path, PdfFillRule rule) → void
delegateDrawImage(PdfImageRequest request) → void
delegateDrawText(PdfTextRun run) → void
delegateEndGroup() → void
delegateFillMesh(PdfMesh mesh, double alpha) → void
delegateFillPath(PdfPath path, PdfColor color, PdfFillRule rule, double alpha) → void
Delegated paint ops (the base flushes before each).
delegateFillPathGradient(PdfPath path, PdfFillRule rule, PdfGradient gradient, double alpha) → void
delegateFinishSoftMaskComposite() → void
delegateRestore() → void
delegateSave() → void
Delegated state ops (no pixels; not flush points except clipPath and the group boundaries, which the base flushes before forwarding).
delegateSetBlendMode(PdfBlendMode mode) → void
delegateSetOverprint({required bool fill, required bool stroke, required int mode}) → void
delegateStrokePath(PdfPath path, PdfColor color, PdfStroke stroke, double alpha) → void
drawImage(PdfImageRequest request) → void
override
drawText(PdfTextRun run) → void
override
emitBatch(int ordinal, StripBatchData? data) → void
Called at every flush point with the strips binned since the previous one (data null when nothing was binned, or when binningEnabled is off). ordinal is the flush point's 0-based index.
endGroup() → void
Composites the group opened by beginGroup.
override
endSoftMasked({required bool luminosity, required PdfRect backdrop, required void drawMask(), double backdropLuminance = 0, double transferScale = 1, double transferOffset = 0}) → void
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.
override
fillMesh(PdfMesh mesh, double alpha) → void
Paints a Gouraud triangle mesh (mesh shadings, types 4–7). Vertices arrive in page space. Non-painting devices can ignore it; simple devices may fall back to PdfMesh.averageColor.
override
fillPath(PdfPath path, PdfColor color, PdfFillRule rule, double alpha) → void
override
fillPathGradient(PdfPath path, PdfFillRule rule, PdfGradient gradient, double alpha) → void
Fills with a gradient (axial/radial shading patterns and sh). Non-painting devices can ignore it; simple devices may fall back to fillPath with PdfGradient.averageColor.
override
flushPending() → void
Runs one flush point: snapshots the generator's strips (when binning) and hands them to emitBatch with this point's ordinal. Call once more from the subclass's finish step so trailing strips land.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
restore() → void
Mirrors Q.
override
save() → void
Mirrors q. Saved state must include the clip.
override
setBlendMode(PdfBlendMode mode) → void
Sets the blend mode for subsequent painting (gs /BM). Non-compositing devices can ignore it.
override
setOverprint({required bool fill, required bool stroke, required int mode}) → void
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).
override
strokePath(PdfPath path, PdfColor color, PdfStroke stroke, double alpha) → void
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited