NoopCanvas

Backend that ignores everything — handy for benchmarks and content-stream sanity tests.

Functions

Link copied to clipboard
open fun applySoftMask(kind: SoftMask.Kind, maskBBox: Rectangle, maskCtm: Matrix, render: () -> Unit, renderMask: (PdfCanvas) -> Unit)

Apply a soft mask to the content rendered inside render (ISO 32000-1 §11.6.5). The default implementation just calls render — backends without offscreen compositing fall back to painting through the mask.

Link copied to clipboard
open override fun beginPage(widthPt: Double, heightPt: Double, deviceCtm: Matrix)

Set up for a page render — called once before any draw call, with the page dimensions (in PDF user units, 1pt = 1/72 inch) and the desired device CTM (e.g. flip Y and scale to fit a target rectangle).

Link copied to clipboard
open fun beginTransparencyGroup(bbox: Rectangle, ctm: Matrix, isolated: Boolean = false, knockout: Boolean = false, alpha: Double = 1.0, blendMode: BlendMode = BlendMode.Normal)

Open a transparency group (ISO 32000-1 §11.4). Subsequent paints accumulate into an offscreen layer; endTransparencyGroup composites the layer back onto the parent with blendMode + alpha.

Link copied to clipboard
open fun drawImage(image: ImageXObject, ctm: Matrix, alpha: Double = 1.0)

Paint an XObject Image under ctm. PDF defines the image's bounds as the unit square (0..1, 0..1); the CTM already encodes the scale + position. Backends that can decode image paint the pixels; others draw a placeholder rather than throw.

Link copied to clipboard
open override fun drawText(bytes: ByteArray, font: PdfFont, fontSize: Double, textMatrix: Matrix, fillColor: RgbColor, alpha: Double, blendMode: BlendMode)

Draw the show-text run bytes (verbatim from a Tj / TJ operand) at the position implied by textMatrix.

Link copied to clipboard
open override fun endPage()
Link copied to clipboard
Link copied to clipboard
open override fun fillPath(path: PdfPath, ctm: Matrix, color: RgbColor, evenOdd: Boolean, alpha: Double, blendMode: BlendMode)

Fill path under ctm with color at alpha (0..1) under the given blendMode. The default alpha = 1.0 + blendMode = Normal is the plain over-paint that PDF assumes when no ExtGState modifies the state.

Link copied to clipboard
open fun fillShading(shading: PdfShading, ctm: Matrix, clipPath: PdfPath?, alpha: Double = 1.0, blendMode: BlendMode = BlendMode.Normal)

Fill clipPath (under ctm) with the gradient defined by shading. If clipPath is null the shading covers the current clip region (or the page, when no clip is active) — the spec's sh operator.

Link copied to clipboard
open override fun popClip()
Link copied to clipboard
open override fun pushClip(path: PdfPath, ctm: Matrix, evenOdd: Boolean)

Push a clip to path under ctm. Matched 1:1 by popClip.

Link copied to clipboard
open override fun strokePath(path: PdfPath, ctm: Matrix, color: RgbColor, lineWidth: Double, alpha: Double, blendMode: BlendMode, dashArray: List<Double>?, dashPhase: Double)

Stroke path under ctm with color at lineWidth user-units, alpha, blendMode.