zhangjian
2023-06-05 0976d2d0f90cff460cedfdc8bd74e98c2c31a58c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
declare type ColorFunc = (grad: number, fastMode: boolean, output: number[]) => void;
declare type ColorState = 'inRange' | 'outOfRange';
declare class HeatmapLayer {
    canvas: HTMLCanvasElement;
    blurSize: number;
    pointSize: number;
    maxOpacity: number;
    minOpacity: number;
    private _brushCanvas;
    private _gradientPixels;
    constructor();
    /**
     * Renders Heatmap and returns the rendered canvas
     * @param data array of data, each has x, y, value
     * @param width canvas width
     * @param height canvas height
     */
    update(data: number[][], width: number, height: number, normalize: (value: number) => number, colorFunc: Record<ColorState, ColorFunc>, isInRange?: (grad?: number) => boolean): HTMLCanvasElement;
    /**
     * get canvas of a black circle brush used for canvas to draw later
     */
    _getBrush(): HTMLCanvasElement;
    /**
     * get gradient color map
     * @private
     */
    _getGradient(colorFunc: Record<ColorState, ColorFunc>, state: ColorState): Uint8ClampedArray;
}
export default HeatmapLayer;