KiteFunction

sealed class KiteFunction

A PDF function (ISO 32000-1 §7.10). Functions map an n-component input to an m-component output, used by shadings, transparency groups, tint transforms and halftone calculations.

Supported types:

  • Type 0 sampled (§7.10.2): multidimensional sample table with multilinear interpolation.

  • Type 2 exponential interpolation (§7.10.3).

  • Type 3 stitching (§7.10.4).

  • Type 4 PostScript calculator (§7.10.5): a small stack interpreter.

An array of n single-output functions (as some shadings / tint transforms use) is wrapped in ArrayCombination.

Inheritors

Types

Link copied to clipboard

An array of single-output functions evaluated in parallel, producing one output component each (shadings / tint transforms sometimes use this form).

Link copied to clipboard
object Companion
Link copied to clipboard
class Type0(val domain: DoubleArray, val range: DoubleArray?, size: IntArray, bitsPerSample: Int, encode: DoubleArray, decode: DoubleArray, samples: ByteArray) : KiteFunction

Type 0 sampled function. A regular sample grid (one value per output per grid point) interpolated multilinearly. The common case is 1 input (shading colour ramps) but tint transforms use up to 4.

Link copied to clipboard
class Type2(val domain: DoubleArray, val range: DoubleArray?, val c0: DoubleArray, val c1: DoubleArray, val n: Double) : KiteFunction

Exponential interpolation: c0 + x^N * (c1 - c0) per output channel.

Link copied to clipboard
class Type3(val domain: DoubleArray, val range: DoubleArray?, val functions: List<KiteFunction>, val bounds: DoubleArray, val encode: DoubleArray) : KiteFunction

Stitching function: delegates to one of functions by x's position relative to bounds, remapping x via encode.

Link copied to clipboard
class Type4(val domain: DoubleArray, val range: DoubleArray?, program: List<Any>) : KiteFunction

Type 4 PostScript calculator function. The program is compiled once into a nested token tree; evaluateInternal runs it on a small operand stack.

Link copied to clipboard
class Unsupported(val type: Int, val domain: DoubleArray, val range: DoubleArray?, val outputCount: Int) : KiteFunction

Function type we don't model; returns zeros of the right length.

Properties

Link copied to clipboard
abstract val domain: DoubleArray

Input bounds: paired [min0, max0, min1, max1, …].

Link copied to clipboard
abstract val outputCount: Int

Number of output components.

Link copied to clipboard
abstract val range: DoubleArray?

Optional output bounds; null = unclipped.

Functions

Link copied to clipboard

Evaluate f(input) → output. The output length is outputCount.