Matrix
data class Matrix(val a: Double, val b: Double, val c: Double, val d: Double, val e: Double, val f: Double)
2D affine transformation matrix as PDF uses it (ISO 32000-1 §8.3.4).
PDF carries matrices as a flat 6-element row vector [a b c d e f] meaning
┌ a b 0 ┐
│ c d 0 │
└ e f 1 ┘Content copied to clipboard
Applied to a point (x, y, 1) to give (x·a + y·c + e, x·b + y·d + f, 1).
The cm content-stream operator multiplies "new = operand × current", so the new origin lands at the operand's translation rather than the current one — see concat.
Immutable: every operation returns a fresh Matrix. The page renderer keeps a single state per gsave level and re-assigns rather than mutating.