Interface TypedColor<T>

interface TypedColor<T> {
    buf: NumericArray;
    length: number;
    mode: ColorMode;
    offset: number;
    range: [ReadonlyVec, ReadonlyVec];
    stride: number;
    xyz: [number, number, number];
    [iterator](): Iterator<number, any, undefined>;
    clamp(): this;
    copy(): T;
    copyView(): T;
    deref(): Vec;
    empty(): T;
    eqDelta(o, eps?): boolean;
    randomize(rnd?): this;
    set(src): this;
    toJSON(): number[];
}

Type Parameters

  • T

Hierarchy (view full)

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

Implemented by

Properties

buf: NumericArray

Backing array / memory

length: number
mode: ColorMode
offset: number

Start index in array

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: number

Step size between channels

xyz: [number, number, number]

Returns first 3 color components as tuple/vector. Not to be confused with XYZD50 or XYZD65 color modes.

Methods

  • Returns Iterator<number, any, undefined>

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

    Returns this

    Remarks

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

  • Returns a copy of this instance. Shallow or deep copies are implementation specific.

    Returns T

  • Returns T

  • Returns wrapped value.

    Returns Vec

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

    Returns T

  • 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

  • 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 this

  • 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