Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TypedColor<T>

Type parameters

  • T

Hierarchy

  • IColor
  • IDeref<Color>
  • IEqualsDelta<T>
  • IVector<T>
  • Iterable<number>
    • TypedColor

Implemented by

Index

Properties

buf

buf: NumericArray

Backing array / memory

Readonly length

length: number

Readonly mode

mode: ColorMode

offset

offset: number

Start index in array

Readonly range

range: [ReadonlyVec, ReadonlyVec]

A tuple of [min, max] where both are vectors specifying the min/max channel ranges for this color type.

remarks

Even though there're several color spaces which do not impose limits on at least some of their axes, the limits returned by this function indicate RGB "safe" colors and were determined by projecting all RGB colors into the color space used by this type.

stride

stride: number

Step size between channels

Methods

[iterator]

  • [iterator](): Iterator<number, any, undefined>
  • Returns Iterator<number, any, undefined>

clamp

  • Clamps all color channels so that colors is inside RGB gamut.

    remarks

    Note: This is not a 100% guarantee, due to each channel being clamped individually based on pre-determined limits.

    Returns TypedColor<T>

copy

  • copy(): T
  • Returns a copy of this instance. Shallow or deep copies are implementation specific.

    Returns T

copyView

  • copyView(): T
  • Returns T

deref

  • deref(): Vec
  • Returns wrapped value.

    Returns Vec

empty

  • empty(): T
  • Returns an empty/blank instance of same type (with possibly same config, if any).

    Returns T

eqDelta

  • eqDelta(o: T, eps?: number): boolean
  • Returns true if this value equals o with optional allowance for given tolerance eps.

    Parameters

    • o: T

      2nd value to test

    • Optional eps: number

      tolerance (usually defaults to DEFAULT_EPS)

    Returns boolean

randomize

  • Randomizes all color channels based on channel ranges defined for this color type (usually [0..1] interval). Alpha channel will remain untouched.

    Parameters

    • Optional rnd: IRandom

    Returns TypedColor<T>

set

toJSON

  • toJSON(): number[]
  • For memory mapped colors, this ensures only the elements used by this color are being serialized (as array) by JSON.stringify().

    Returns number[]

Generated using TypeDoc