colormap.builtin¶
Summary¶
colormap.builtin returns the process-wide singleton for a named built-in lookup table. Repeated calls with the same name return the same immutable Colormap, which supports CPU sampling and GPU binding.
Syntax¶
WasmGPU.colormap.builtin(name: BuiltinColormapName): Colormap
const result = wgpu.colormap.builtin(name);
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
name |
BuiltinColormapName |
Yes | One of the six supported built-in palette names. |
Returns¶
Colormap - Immutable process-wide singleton for the requested built-in table.
Type Details¶
BuiltinColormapName¶
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const name = "viridis";
const result = wgpu.colormap.builtin(name);
console.log(result.sampleCPU(0.5));