updateImgData()
function updateImgData(
value,
pixelIdx,
imgData,
colorScale,
opacity): ImageData;
Updates an ImageData object with a new pixel color derived from a numeric value and a ColorScaleProps colormap.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | number | Numeric data value to visualize. |
pixelIdx | number | Byte offset within the ImageData.data array. |
imgData | ImageData | Target ImageData object to update. |
colorScale | ColorScaleProps | Colormap definition with min, max, and colors (see ColorScaleProps). |
opacity | number | Global opacity multiplier between 0 and 1. |
Returns
The updated ImageData with modified pixel values.
Example
updateImgData(3.2, idx, imgData, { min: 0, max: 10, colors: viridis }, 0.9);