@pdfking/math

Types

types

CMYKColor

type CMYKColor = {
  alpha: ColorComponent
  cyan: ColorComponent
  black: ColorComponent
  magenta: ColorComponent
  yellow: ColorComponent
}

Color

type Color = CMYKColor | RGBColor

RGBColor

type RGBColor = {
  alpha: ColorComponent
  blue: ColorComponent
  green: ColorComponent
  red: ColorComponent
}

Axis

type Axis = "x" | "y" | "z"

Box

type Box<T> = [T, T, T, T]

Margins

type Margins<T> = {
  top: T
  right: T
  bottom: T
  left: T
}

A per-edge amount around a box. Signed: positive grows the box outward, negative pulls each edge in.

Point

type Point<T> = {
  x: T
  y: T
}

Rectangle

type Rectangle<T> = {
  width: T
  height: T
}

RectangularCuboid

type RectangularCuboid<T> = Readonly<
  {
    depth: T
  } & Rectangle<T>
>

SpatialRectangle

type SpatialRectangle<T> = Point<T> & Rectangle<T>

Distance

type Distance = Float<"Distance">

Size in user unit

Pixel

type Pixel = Float<"Pixel">

Measure

type Measure = Distance | Pixel

Percentage

type Percentage = Float<"Percentage">

Degree

type Degree = Float<"Degree">

Radian

type Radian = Float<"Radian">

ColorComponent

type ColorComponent = Float<"ColorComponent">