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 ┘

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.

Constructors

Link copied to clipboard
constructor(a: Double, b: Double, c: Double, d: Double, e: Double, f: Double)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val a: Double
Link copied to clipboard
val b: Double
Link copied to clipboard
val c: Double
Link copied to clipboard
val d: Double
Link copied to clipboard
val e: Double
Link copied to clipboard
val f: Double

Functions

Link copied to clipboard
fun concat(other: Matrix): Matrix

PDF cm semantics: returns other × this.

Link copied to clipboard
fun scale(sx: Double, sy: Double): Matrix
Link copied to clipboard
fun scaleX(): Double

X-component of the unit vector after this transform — useful for scaled font sizes.

Link copied to clipboard
fun scaleY(): Double
Link copied to clipboard
fun transformPoint(x: Double, y: Double): <Error class: unknown class><Double, Double>
Link copied to clipboard
fun translate(tx: Double, ty: Double): Matrix