Skip to content
GitHub repository
Class

GradientAtlas

All gradient ramps live in one RGBA16F texture (one ramp per row), shared by every SilkGraphics. Half floats keep ~11 bits per channel so dark and low-alpha ramps don’t get quantised before the shader dithers them to the 8-bit framebuffer.

Constructors#

Constructor#

new GradientAtlas(): GradientAtlas;

Returns#

GradientAtlas

Properties#

PropertyModifierTypeDescriptionDefined in
sourcereadonlyBufferImageSourceThe half-float texture that holds the ramps.atlas.ts:27

Accessors#

shared#

Get Signature#

get static shared(): GradientAtlas;

The atlas every SilkGraphics uses.

Returns

GradientAtlas

Methods#

acquire()#

acquire(gradient: Gradient): number;

Returns the atlas row for a gradient ramp, baking it on first use.

Parameters#

ParameterType
gradientGradient

Returns#

number


release()#

release(key: string): void;

Drops one reference to a ramp. When the atlas is full, rows nobody uses are reused.

Parameters#

ParameterType
keystring

Returns#

void