GradientAtlas
import { GradientAtlas } from 'pixi-silk';
All gradient ramps live in one RGBA16F texture, 256 samples by 256 rows, shared by every SilkGraphics. Half floats keep about 11 bits per channel, so dark and low-alpha ramps are not quantised before the shader dithers them to the 8-bit framebuffer. You rarely need it directly.
Constructors#
Constructor#
new GradientAtlas(): GradientAtlas;
Returns#
GradientAtlas
Properties#
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
source | readonly | BufferImageSource | The half-float texture that holds the ramps. | atlas.ts:27 |
Accessors#
shared#
Get Signature#
get static shared(): GradientAtlas;
The atlas every SilkGraphics uses, created on first access.
Returns
GradientAtlas
Methods#
acquire()#
acquire(gradient: Gradient): number;
Returns the atlas row for a gradient and adds a reference to it. Gradients with the same
key share a row, baked and uploaded on first use. Pair every call with GradientAtlas.release.
Parameters#
| Parameter | Type |
|---|---|
gradient | Gradient |
Returns#
number
release()#
release(key: string): void;
Drops one reference to a ramp by its gradient key. The row stays baked, so it is free to reuse only once all 256 rows have been handed out. With every row in use, row 0 is shared and a warning is logged.
Parameters#
| Parameter | Type |
|---|---|
key | string |
Returns#
void