strips library

Sparse-strip shader rendering: StripPdfDevice batches solid fills, strokes, and outline text into drawVertices + FragmentShader draws; everything else delegates to the canvas device in painter's order. Not exported from the main dart_pdf_editor barrel - the device wins on GPU backends (Impeller) but loses on software Skia; PdfPageView's zoom router uses it automatically behind a runtime Impeller gate (ui.ImageFilter.isShaderFilterSupported), so hosts only import this for direct/off-label use.

Classes

SlugBatch
SlugBatchBuilder
Accumulates one painter-order Slug window without any dart:ui objects.
SlugBatchData
One painter-order Slug batch in worker-transferable form.
SlugChunkData
One drawVertices-sized slice of a Slug batch.
SlugGlyphData
Per-outline relocatable curve stream, memoized by outline identity.
StripBatch
A flush batch: everything needed to draw its strips with one shader paint - chunks drawVertices calls sharing one atlas.
StripBatchData
A flush batch in portable form: everything needed to draw its strips with one shader paint - chunks draw calls sharing one alpha atlas - tagged with the flushOrdinal of the flush point that emitted it.
StripChunkData
One drawVertices-sized slice of a StripBatchData: raw vertex arrays for up to stripMaxQuadsPerDraw strip quads.
StripPdfDevice
PdfDevice that batches strip-rasterized paint into shader draws and routes everything else through an internal CanvasPdfDevice fallback.
StripPlan
The strip batches of one full binning walk, tagged with the geometry they were binned for. Only valid for a device with the exact same pageToDevice matrix, viewport, and tolerance; the consuming device verifies totalFlushPoints and full batch consumption at finish and falls back to local binning on any mismatch.
StripPlanBinner
Headless subclass of the binning core: collects the StripBatchData emitted at each flush point (delegated ops are no-ops) into a StripPlan. Feed it the page's command list with bin - which honors a PdfCancellationToken cooperatively - then take finish's plan.
StripReplayProfile
Cheap, geometry-free estimate of how a command transcript fragments when replayed through the sparse-strip device.

Constants

slugAtlasWidth → const int
Curve atlas width in texels.
stripAtlasWidth → const int
Alpha atlas width in texels (4 bytes each -> 4 KB rows).
stripFlattenTolerance → const double
Curve-flattening tolerance (device px) for strip-routed paths. The raster core's 0.25 default (the GPU experiment's) leaves curve edges up to 0.25 px off the true curve - against Skia's much finer flattening that showed up as 50/255 coverage diffs on glyph-sized cubics. 0.02 px keeps curve-edge parity within a few counts for ~3.5x the segment count on curves (Wang's n grows with 1/sqrt(tolerance)); lines are unaffected.
stripMaxAlphaColumnsPerDraw → const int
Maximum alpha-texel span (u texcoord range) of one draw's strips.
stripMaxQuadsPerDraw → const int
ui.Vertices indices are Uint16, so one draw holds at most 65535 / 4 quads; batches chunk at this many strips per draw.

Functions

decodeStripPlan(Uint8List bytes) StripPlan
Decodes a buffer produced by encodeStripPlan. Throws on a version or structure mismatch (producer and consumer ship together; a mismatch is a programming error, and callers treat any throw as "no plan").
encodeStripPlan(StripPlan plan) Uint8List
Serializes plan into one compact buffer (see the layout above).

Exceptions / Errors

StripPlanMismatchError
Thrown when a StripPlan does not match the device consuming it (stale geometry, or a flush-ordinal/batch-count desync). Callers catch it, discard the picture, and re-run with local binning.