Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ColorFactory<T>

Type parameters

Hierarchy

  • ColorFactory

Callable

  • ColorFactory(col: MaybeColor, buf?: NumericArray, idx?: number, stride?: number): T
  • ColorFactory(col?: Vec, idx?: number, stride?: number): T
  • ColorFactory(a: number, b: number, c: number, ...xs: number[]): T

Index

Properties

Methods

Properties

Readonly class

Readonly range

range: [ReadonlyVec, ReadonlyVec]

Methods

mapBuffer

  • mapBuffer(buf: NumericArray, num?: number, start?: number, cstride?: number, estride?: number): T[]
  • Returns array of memory mapped colors using given backing array and stride settings.

    remarks

    The cstride is the step size between individual color components. estride is the step size between successive colors and will default to number of channels supported by given color type/space. This arrangement allows for different storage approaches, incl. SOA, AOS, striped / interleaved etc.

    Parameters

    • buf: NumericArray

      backing array

    • Optional num: number

      num vectors (default: buf.length / numChannels)

    • Optional start: number

      start index (default: 0)

    • Optional cstride: number

      component stride (default: 1)

    • Optional estride: number

      element stride (default: numChannels)

    Returns T[]

random

  • random(rnd?: IRandom, buf?: NumericArray, index?: number, stride?: number): T
  • Returns a new random color, optionally backed by given memory. I.e. if buf is given, the returned color will wrap buf from given index (default: 0) and stride step size (default: 1).

    Parameters

    • Optional rnd: IRandom
    • Optional buf: NumericArray
    • Optional index: number
    • Optional stride: number

    Returns T

Generated using TypeDoc