RecordingPdfDevice class

A PdfDevice that records every interpreter callback into a flat, replayable commands list instead of painting.

It performs no rendering and touches no dart:ui, so it can run anywhere the interpreter does - including a background isolate, where the heavy content-stream parse and walk happen - and its output (commands) is fed back through replayCommands into a real painting device on the side that owns the canvas. The recorded arguments are the interpreter's own value types (PdfPath, PdfColor, PdfTextRun, …), all immutable, so the list is a faithful, side-effect-free transcript of the page.

Image requests are recorded verbatim (PdfDrawImageCommand keeps the PdfImageRequest, including its CosStream); the side that replays decodes them as it does today. imageRequests exposes them in encounter order for callers that want to drive decoding off the recording rather than a separate scan pass.

Implemented types

Constructors

RecordingPdfDevice()

Properties

commands → List<PdfRenderCommand>
The recorded top-level command sequence.
final
hashCode → int
The hash code for this object.
no setterinherited
imageRequests → List<PdfImageRequest>
Every image the page referenced, in the order the interpreter drew them (including those inside soft-mask groups). The same list the device's drawImage calls produced - useful for decoding ahead of replay.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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
beginTransparencyGroup(double alpha, {required bool knockout, required bool isolated, PdfRect? bounds, PdfColor? backdropColor}) → void
override
clipPath(PdfPath path, PdfFillRule rule) → void
Intersects the current clip with path.
override
drawImage(PdfImageRequest request) → void
override
drawText(PdfTextRun run) → void
override
drawTiledCell(PdfDrawTiledCellCommand command) → void
override
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
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