@pixerate/editor 0.274.0 → 0.275.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +60 -60
- package/dist/animation-editor/index.js +4 -4
- package/dist/brushes/index.cjs +102 -74
- package/dist/brushes/index.js +34 -6
- package/dist/brushes/patch.d.cts +1 -1
- package/dist/brushes/patch.d.ts +1 -1
- package/dist/brushes/preview.d.cts +3 -0
- package/dist/brushes/preview.d.ts +3 -0
- package/dist/brushes/profiles.d.cts +2 -0
- package/dist/brushes/profiles.d.ts +2 -0
- package/dist/brushes/schema.d.cts +4 -0
- package/dist/brushes/schema.d.ts +4 -0
- package/dist/brushes/types.d.cts +47 -0
- package/dist/brushes/types.d.ts +47 -0
- package/dist/{brushstrokeRender-5YBCLFDQ.cjs → brushstrokeRender-2RQL46WB.cjs} +15 -15
- package/dist/{brushstrokeRender-DZGFU3J4.js → brushstrokeRender-WGY4DZHF.js} +3 -3
- package/dist/canvas/index.cjs +13 -13
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-2XDNF73E.js → chunk-43XJC3PP.js} +1 -1
- package/dist/{chunk-GHGBIAWQ.cjs → chunk-6QNDGMK7.cjs} +263 -45
- package/dist/{chunk-2F3YDXCN.js → chunk-75SYKUOT.js} +1 -1
- package/dist/{chunk-M3RZOF3G.cjs → chunk-C6VB7CPY.cjs} +1 -1
- package/dist/{chunk-N5IMDAHM.cjs → chunk-DHC4E2DU.cjs} +89 -37
- package/dist/{chunk-NAHJV3O6.js → chunk-G5TCMKX5.js} +28 -11
- package/dist/{chunk-DZVRH63Y.js → chunk-IEEY5RJV.js} +1 -1
- package/dist/{chunk-7W2EQQBP.cjs → chunk-JDXWLCXF.cjs} +6 -6
- package/dist/{chunk-N3SKPQEH.js → chunk-LMG57L5A.js} +62 -10
- package/dist/{chunk-5HP2VSAS.js → chunk-MSWLJI4G.js} +1 -1
- package/dist/{chunk-SNAFFCAX.cjs → chunk-OLZXXAER.cjs} +221 -196
- package/dist/{chunk-YJANF2BL.cjs → chunk-RAPNRK4R.cjs} +86 -86
- package/dist/{chunk-CLB2I2FU.js → chunk-RJGW3RQS.js} +2 -2
- package/dist/{chunk-FXVCB6YG.cjs → chunk-T6KNJVBP.cjs} +35 -35
- package/dist/{chunk-ZEI7ZEA4.js → chunk-Y2ISSVPH.js} +34 -9
- package/dist/{chunk-3JKCREEU.cjs → chunk-Y354ETAE.cjs} +76 -59
- package/dist/{chunk-TNLKFW7D.cjs → chunk-YYZC2EQO.cjs} +23 -23
- package/dist/{chunk-UXYCY3HP.js → chunk-ZM7IKQ4X.js} +239 -21
- package/dist/image-editor/index.cjs +789 -789
- package/dist/image-editor/index.js +5 -5
- package/dist/paint/index.cjs +2 -2
- package/dist/paint/index.js +1 -1
- package/dist/paint/wet/world.d.cts +15 -2
- package/dist/paint/wet/world.d.ts +15 -2
- package/dist/paint-editor/brush-controls.d.cts +7 -0
- package/dist/paint-editor/brush-controls.d.ts +7 -0
- package/dist/paint-editor/brush-model.d.cts +59 -1
- package/dist/paint-editor/brush-model.d.ts +59 -1
- package/dist/paint-editor/controller.d.cts +168 -1
- package/dist/paint-editor/controller.d.ts +168 -1
- package/dist/paint-editor/dab-stroke.d.cts +3 -0
- package/dist/paint-editor/dab-stroke.d.ts +3 -0
- package/dist/paint-editor/document.d.cts +13 -3
- package/dist/paint-editor/document.d.ts +13 -3
- package/dist/paint-editor/engine.d.cts +3 -0
- package/dist/paint-editor/engine.d.ts +3 -0
- package/dist/paint-editor/heat.d.cts +156 -0
- package/dist/paint-editor/heat.d.ts +156 -0
- package/dist/paint-editor/index.cjs +3386 -855
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +2731 -200
- package/dist/paint-editor/mutation-tools.d.cts +13 -0
- package/dist/paint-editor/mutation-tools.d.ts +13 -0
- package/dist/paint-editor/mutation.d.cts +67 -0
- package/dist/paint-editor/mutation.d.ts +67 -0
- package/dist/paint-editor/presence.d.cts +7 -1
- package/dist/paint-editor/presence.d.ts +7 -1
- package/dist/paint-editor/procedural.d.cts +3 -0
- package/dist/paint-editor/procedural.d.ts +3 -0
- package/dist/paint-editor/stroke.d.cts +32 -2
- package/dist/paint-editor/stroke.d.ts +32 -2
- package/dist/paint-editor/thick.d.cts +48 -7
- package/dist/paint-editor/thick.d.ts +48 -7
- package/dist/paint-editor/ui.d.cts +34 -1
- package/dist/paint-editor/ui.d.ts +34 -1
- package/dist/paint-editor/wet.d.cts +8 -1
- package/dist/paint-editor/wet.d.ts +8 -1
- package/dist/vector/index.cjs +999 -999
- package/dist/vector/index.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart inks: UV-fluorescent ink (`doc.fluor[layerId]` + `uvLight`) and thermochromic ink
|
|
3
|
+
* (`doc.thermo[layerId]` + `doc.heat`).
|
|
4
|
+
*
|
|
5
|
+
* - **Fluorescent ink**: a per-layer 4-channel RGBA surface (`[R, G, B, intensity]`) in layer
|
|
6
|
+
* space, painted alongside strokes when `brush.fluorescence.amount > 0`. With
|
|
7
|
+
* `brush.fluorescence.invisible: true`, no daylight pigment is laid onto the layer's normal
|
|
8
|
+
* surface, so the mark stays invisible under normal light. When the virtual UV blacklight
|
|
9
|
+
* (`uvLight.on`) is switched on, normal layers dim to `uvLight.ambient` and fluorescent pixels
|
|
10
|
+
* emit their colour and cast a Linear Dodge spill halo (reusing `computeSpill` from `./light`).
|
|
11
|
+
* - **Thermochromic ink**: a per-layer 4-channel RGBA surface (`[hotR, hotG, hotB, thresholdByte]`)
|
|
12
|
+
* in layer space, painted when `brush.thermochromic.hotColor` is set. A document-level coarse
|
|
13
|
+
* heat field (`HEAT_SCALE = 4`, 1/4 canvas resolution) stores local temperature in `0..1`,
|
|
14
|
+
* painted by `paintHeatField` and stepped with 5-point Laplacian diffusion + Newtonian cooling
|
|
15
|
+
* by `advanceHeatField`. At render time, thermochromic pixels blend smoothly from their cold
|
|
16
|
+
* paint colour to `hotColor` around `threshold` based on bilinearly sampled temperature, and
|
|
17
|
+
* tiles heated past `HEAT_DRY_THRESHOLD` dry any wet paint on them.
|
|
18
|
+
*/
|
|
19
|
+
import { TiledSurface, type RasterRect } from '../raster/surface.cjs';
|
|
20
|
+
import { type PaintBrush } from './brushes.cjs';
|
|
21
|
+
import { type PaperSettings } from './paper.cjs';
|
|
22
|
+
/** View / document UV blacklight setting. */
|
|
23
|
+
export interface UvLightSettings {
|
|
24
|
+
/** Whether the UV blacklight is switched on (default false). */
|
|
25
|
+
on: boolean;
|
|
26
|
+
/** Emission and halo strength under UV, 0..2 (default 1). */
|
|
27
|
+
strength: number;
|
|
28
|
+
/** How much normal daylight colour remains visible when UV is on, 0 (pitch dark) .. 1 (default 0.15). */
|
|
29
|
+
ambient: number;
|
|
30
|
+
}
|
|
31
|
+
export declare const DEFAULT_UV_LIGHT: Readonly<UvLightSettings>;
|
|
32
|
+
export declare function normalizeUvLight(raw?: Partial<UvLightSettings>, base?: UvLightSettings): UvLightSettings;
|
|
33
|
+
export declare function uvLightKey(uv: UvLightSettings): string;
|
|
34
|
+
/** The paper dimmed to `uv.ambient` while the UV blacklight is on (cached by paper reference). */
|
|
35
|
+
export declare function uvPaper(paper: PaperSettings, uv: UvLightSettings): PaperSettings;
|
|
36
|
+
export declare function emptyFluor(): TiledSurface;
|
|
37
|
+
export declare function emptyThermo(): TiledSurface;
|
|
38
|
+
/**
|
|
39
|
+
* Twin brush that writes or moves the per-layer 4-channel fluorescence surface (`doc.fluor[id]`).
|
|
40
|
+
* When `brush.fluorescence.amount > 0`, it lays the stroke's colour scaled by `fluorescence.amount`;
|
|
41
|
+
* erasers, smudges and blenders act on the existing fluorescence; plain opaque paint dims it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function fluorTwinBrush(brush: PaintBrush): PaintBrush;
|
|
44
|
+
/**
|
|
45
|
+
* Twin brush that writes or moves the per-layer 4-channel thermochromic surface (`doc.thermo[id]`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function thermoTwinBrush(brush: PaintBrush): PaintBrush;
|
|
48
|
+
/**
|
|
49
|
+
* Encodes `threshold` (`0.05..0.95`) into channel 3 (`1..255`) of a thermochromic surface after a
|
|
50
|
+
* twin stroke painted `hotColor` with coverage in channel 3. Existing thermochromic pixels blend
|
|
51
|
+
* smoothly with the new `hotColor` and `threshold` by the twin's coverage.
|
|
52
|
+
*/
|
|
53
|
+
export declare function finalizeThermoStroke(twinOut: TiledSurface, before: TiledSurface, hotRgb: readonly [number, number, number], threshold: number): TiledSurface;
|
|
54
|
+
/** Scales the alpha channel of a 4-channel RGBA surface (`fluor`) by `k` (0..1). */
|
|
55
|
+
export declare function scaleFluor(surface: TiledSurface, k: number): TiledSurface;
|
|
56
|
+
/** Merges two 4-channel surfaces (`above` over `below`) when merging layers down. */
|
|
57
|
+
export declare function mergeFourChannel(below: TiledSurface | undefined, above: TiledSurface | undefined): TiledSurface | null;
|
|
58
|
+
/** Computes the UV spill halo for a layer's `fluor` surface, reusing `computeSpill` from `./light`. */
|
|
59
|
+
export declare function computeUvSpill(fluor: TiledSurface, strength: number): TiledSurface | null;
|
|
60
|
+
/**
|
|
61
|
+
* Tile cache for UV blacklight rendering on one layer: dims daylight pixels to `uvLight.ambient`
|
|
62
|
+
* and adds fluorescent emission from `doc.fluor[id]` (even where daylight alpha is 0 for invisible ink).
|
|
63
|
+
*/
|
|
64
|
+
export declare class UvCache {
|
|
65
|
+
private readonly tiles;
|
|
66
|
+
private spillCache;
|
|
67
|
+
render(color: TiledSurface, fluor: TiledSurface | undefined, uv: UvLightSettings): TiledSurface;
|
|
68
|
+
spill(fluor: TiledSurface, uv: UvLightSettings): TiledSurface | null;
|
|
69
|
+
}
|
|
70
|
+
/** Coarse grid scale: 1 heat cell per 4×4 canvas pixels. */
|
|
71
|
+
export declare const HEAT_SCALE = 4;
|
|
72
|
+
/** Explicit 2D diffusion rate per step (≤ 0.25 for stability). */
|
|
73
|
+
export declare const HEAT_DIFFUSION = 0.18;
|
|
74
|
+
/** Newtonian cooling fraction per step. */
|
|
75
|
+
export declare const HEAT_COOLING = 0.03;
|
|
76
|
+
/** Temperature above which a heated cell dries wet paint. */
|
|
77
|
+
export declare const HEAT_DRY_THRESHOLD = 0.5;
|
|
78
|
+
export interface HeatField {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
gridWidth: number;
|
|
82
|
+
gridHeight: number;
|
|
83
|
+
/** Row-major temperatures in 0..1 (`gridWidth * gridHeight`). */
|
|
84
|
+
cells: Float64Array;
|
|
85
|
+
max: number;
|
|
86
|
+
revision: number;
|
|
87
|
+
}
|
|
88
|
+
export interface HeatSample {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
temperature: number;
|
|
92
|
+
}
|
|
93
|
+
export declare function createHeatField(width: number, height: number): HeatField;
|
|
94
|
+
export declare function cloneHeatField(field: HeatField): HeatField;
|
|
95
|
+
export interface HeatStats {
|
|
96
|
+
max: number;
|
|
97
|
+
mean: number;
|
|
98
|
+
hotCells: number;
|
|
99
|
+
bounds: RasterRect | null;
|
|
100
|
+
}
|
|
101
|
+
export declare function heatStats(field: HeatField | undefined): HeatStats;
|
|
102
|
+
/** Bounding document-space rectangle of all coarse cells with temperature ≥ `threshold`, or `null`. */
|
|
103
|
+
export declare function hotCellsBounds(field: HeatField, threshold?: number): RasterRect | null;
|
|
104
|
+
/**
|
|
105
|
+
* Paints heat (or cools when `temperature` is below current cell heat) along `points` with `radius`
|
|
106
|
+
* in document pixels. Returns the affected document-space bounding box and updated field statistics.
|
|
107
|
+
*/
|
|
108
|
+
export declare function paintHeatField(field: HeatField, points: ReadonlyArray<{
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
}>, radius?: number, temperature?: number): {
|
|
112
|
+
bounds: RasterRect;
|
|
113
|
+
stats: HeatStats;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Advances the heat field by `steps` iterations of 5-point Laplacian diffusion and Newtonian cooling.
|
|
117
|
+
*/
|
|
118
|
+
export declare function advanceHeatField(field: HeatField, steps?: number): HeatStats;
|
|
119
|
+
/** Clears the heat field to 0 everywhere. */
|
|
120
|
+
export declare function clearHeatField(field: HeatField): boolean;
|
|
121
|
+
/** Bilinearly samples temperature (0..1) at document coordinates `(x, y)`. */
|
|
122
|
+
export declare function sampleHeatAt(field: HeatField, x: number, y: number): number;
|
|
123
|
+
/** Shifts and resizes a heat field when `extendCanvas` shifts the document by `(dx, dy)`. */
|
|
124
|
+
export declare function shiftHeatField(field: HeatField, dx: number, dy: number, newWidth: number, newHeight: number): HeatField;
|
|
125
|
+
/**
|
|
126
|
+
* Tile cache for thermochromic colour shifting on one layer: blends cold pixels toward `hotColor`
|
|
127
|
+
* around `threshold` where the coarse heat field is warm.
|
|
128
|
+
*/
|
|
129
|
+
export declare class ThermoCache {
|
|
130
|
+
private readonly tiles;
|
|
131
|
+
render(color: TiledSurface, thermo: TiledSurface | undefined, offset: {
|
|
132
|
+
x: number;
|
|
133
|
+
y: number;
|
|
134
|
+
}, heat: HeatField): TiledSurface;
|
|
135
|
+
}
|
|
136
|
+
export interface SavedLayerFluor {
|
|
137
|
+
rect: RasterRect;
|
|
138
|
+
/** 4-channel RGBA PNG data URL of the layer's fluorescence. */
|
|
139
|
+
fluor: string;
|
|
140
|
+
}
|
|
141
|
+
export interface SavedLayerThermo {
|
|
142
|
+
rect: RasterRect;
|
|
143
|
+
/** 4-channel RGBA PNG data URL of the layer's thermochromic `[hotR, hotG, hotB, thresholdByte]`. */
|
|
144
|
+
thermo: string;
|
|
145
|
+
}
|
|
146
|
+
export interface SavedHeatField {
|
|
147
|
+
gridWidth: number;
|
|
148
|
+
gridHeight: number;
|
|
149
|
+
cells: number[];
|
|
150
|
+
}
|
|
151
|
+
export declare function fluorToJSON(fluor: TiledSurface | undefined): SavedLayerFluor | null;
|
|
152
|
+
export declare function fluorFromJSON(raw: unknown): TiledSurface;
|
|
153
|
+
export declare function thermoToJSON(thermo: TiledSurface | undefined): SavedLayerThermo | null;
|
|
154
|
+
export declare function thermoFromJSON(raw: unknown): TiledSurface;
|
|
155
|
+
export declare function heatToJSON(field: HeatField | undefined): SavedHeatField | null;
|
|
156
|
+
export declare function heatFromJSON(raw: unknown, width: number, height: number): HeatField | null;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart inks: UV-fluorescent ink (`doc.fluor[layerId]` + `uvLight`) and thermochromic ink
|
|
3
|
+
* (`doc.thermo[layerId]` + `doc.heat`).
|
|
4
|
+
*
|
|
5
|
+
* - **Fluorescent ink**: a per-layer 4-channel RGBA surface (`[R, G, B, intensity]`) in layer
|
|
6
|
+
* space, painted alongside strokes when `brush.fluorescence.amount > 0`. With
|
|
7
|
+
* `brush.fluorescence.invisible: true`, no daylight pigment is laid onto the layer's normal
|
|
8
|
+
* surface, so the mark stays invisible under normal light. When the virtual UV blacklight
|
|
9
|
+
* (`uvLight.on`) is switched on, normal layers dim to `uvLight.ambient` and fluorescent pixels
|
|
10
|
+
* emit their colour and cast a Linear Dodge spill halo (reusing `computeSpill` from `./light`).
|
|
11
|
+
* - **Thermochromic ink**: a per-layer 4-channel RGBA surface (`[hotR, hotG, hotB, thresholdByte]`)
|
|
12
|
+
* in layer space, painted when `brush.thermochromic.hotColor` is set. A document-level coarse
|
|
13
|
+
* heat field (`HEAT_SCALE = 4`, 1/4 canvas resolution) stores local temperature in `0..1`,
|
|
14
|
+
* painted by `paintHeatField` and stepped with 5-point Laplacian diffusion + Newtonian cooling
|
|
15
|
+
* by `advanceHeatField`. At render time, thermochromic pixels blend smoothly from their cold
|
|
16
|
+
* paint colour to `hotColor` around `threshold` based on bilinearly sampled temperature, and
|
|
17
|
+
* tiles heated past `HEAT_DRY_THRESHOLD` dry any wet paint on them.
|
|
18
|
+
*/
|
|
19
|
+
import { TiledSurface, type RasterRect } from '../raster/surface.js';
|
|
20
|
+
import { type PaintBrush } from './brushes.js';
|
|
21
|
+
import { type PaperSettings } from './paper.js';
|
|
22
|
+
/** View / document UV blacklight setting. */
|
|
23
|
+
export interface UvLightSettings {
|
|
24
|
+
/** Whether the UV blacklight is switched on (default false). */
|
|
25
|
+
on: boolean;
|
|
26
|
+
/** Emission and halo strength under UV, 0..2 (default 1). */
|
|
27
|
+
strength: number;
|
|
28
|
+
/** How much normal daylight colour remains visible when UV is on, 0 (pitch dark) .. 1 (default 0.15). */
|
|
29
|
+
ambient: number;
|
|
30
|
+
}
|
|
31
|
+
export declare const DEFAULT_UV_LIGHT: Readonly<UvLightSettings>;
|
|
32
|
+
export declare function normalizeUvLight(raw?: Partial<UvLightSettings>, base?: UvLightSettings): UvLightSettings;
|
|
33
|
+
export declare function uvLightKey(uv: UvLightSettings): string;
|
|
34
|
+
/** The paper dimmed to `uv.ambient` while the UV blacklight is on (cached by paper reference). */
|
|
35
|
+
export declare function uvPaper(paper: PaperSettings, uv: UvLightSettings): PaperSettings;
|
|
36
|
+
export declare function emptyFluor(): TiledSurface;
|
|
37
|
+
export declare function emptyThermo(): TiledSurface;
|
|
38
|
+
/**
|
|
39
|
+
* Twin brush that writes or moves the per-layer 4-channel fluorescence surface (`doc.fluor[id]`).
|
|
40
|
+
* When `brush.fluorescence.amount > 0`, it lays the stroke's colour scaled by `fluorescence.amount`;
|
|
41
|
+
* erasers, smudges and blenders act on the existing fluorescence; plain opaque paint dims it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function fluorTwinBrush(brush: PaintBrush): PaintBrush;
|
|
44
|
+
/**
|
|
45
|
+
* Twin brush that writes or moves the per-layer 4-channel thermochromic surface (`doc.thermo[id]`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function thermoTwinBrush(brush: PaintBrush): PaintBrush;
|
|
48
|
+
/**
|
|
49
|
+
* Encodes `threshold` (`0.05..0.95`) into channel 3 (`1..255`) of a thermochromic surface after a
|
|
50
|
+
* twin stroke painted `hotColor` with coverage in channel 3. Existing thermochromic pixels blend
|
|
51
|
+
* smoothly with the new `hotColor` and `threshold` by the twin's coverage.
|
|
52
|
+
*/
|
|
53
|
+
export declare function finalizeThermoStroke(twinOut: TiledSurface, before: TiledSurface, hotRgb: readonly [number, number, number], threshold: number): TiledSurface;
|
|
54
|
+
/** Scales the alpha channel of a 4-channel RGBA surface (`fluor`) by `k` (0..1). */
|
|
55
|
+
export declare function scaleFluor(surface: TiledSurface, k: number): TiledSurface;
|
|
56
|
+
/** Merges two 4-channel surfaces (`above` over `below`) when merging layers down. */
|
|
57
|
+
export declare function mergeFourChannel(below: TiledSurface | undefined, above: TiledSurface | undefined): TiledSurface | null;
|
|
58
|
+
/** Computes the UV spill halo for a layer's `fluor` surface, reusing `computeSpill` from `./light`. */
|
|
59
|
+
export declare function computeUvSpill(fluor: TiledSurface, strength: number): TiledSurface | null;
|
|
60
|
+
/**
|
|
61
|
+
* Tile cache for UV blacklight rendering on one layer: dims daylight pixels to `uvLight.ambient`
|
|
62
|
+
* and adds fluorescent emission from `doc.fluor[id]` (even where daylight alpha is 0 for invisible ink).
|
|
63
|
+
*/
|
|
64
|
+
export declare class UvCache {
|
|
65
|
+
private readonly tiles;
|
|
66
|
+
private spillCache;
|
|
67
|
+
render(color: TiledSurface, fluor: TiledSurface | undefined, uv: UvLightSettings): TiledSurface;
|
|
68
|
+
spill(fluor: TiledSurface, uv: UvLightSettings): TiledSurface | null;
|
|
69
|
+
}
|
|
70
|
+
/** Coarse grid scale: 1 heat cell per 4×4 canvas pixels. */
|
|
71
|
+
export declare const HEAT_SCALE = 4;
|
|
72
|
+
/** Explicit 2D diffusion rate per step (≤ 0.25 for stability). */
|
|
73
|
+
export declare const HEAT_DIFFUSION = 0.18;
|
|
74
|
+
/** Newtonian cooling fraction per step. */
|
|
75
|
+
export declare const HEAT_COOLING = 0.03;
|
|
76
|
+
/** Temperature above which a heated cell dries wet paint. */
|
|
77
|
+
export declare const HEAT_DRY_THRESHOLD = 0.5;
|
|
78
|
+
export interface HeatField {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
gridWidth: number;
|
|
82
|
+
gridHeight: number;
|
|
83
|
+
/** Row-major temperatures in 0..1 (`gridWidth * gridHeight`). */
|
|
84
|
+
cells: Float64Array;
|
|
85
|
+
max: number;
|
|
86
|
+
revision: number;
|
|
87
|
+
}
|
|
88
|
+
export interface HeatSample {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
temperature: number;
|
|
92
|
+
}
|
|
93
|
+
export declare function createHeatField(width: number, height: number): HeatField;
|
|
94
|
+
export declare function cloneHeatField(field: HeatField): HeatField;
|
|
95
|
+
export interface HeatStats {
|
|
96
|
+
max: number;
|
|
97
|
+
mean: number;
|
|
98
|
+
hotCells: number;
|
|
99
|
+
bounds: RasterRect | null;
|
|
100
|
+
}
|
|
101
|
+
export declare function heatStats(field: HeatField | undefined): HeatStats;
|
|
102
|
+
/** Bounding document-space rectangle of all coarse cells with temperature ≥ `threshold`, or `null`. */
|
|
103
|
+
export declare function hotCellsBounds(field: HeatField, threshold?: number): RasterRect | null;
|
|
104
|
+
/**
|
|
105
|
+
* Paints heat (or cools when `temperature` is below current cell heat) along `points` with `radius`
|
|
106
|
+
* in document pixels. Returns the affected document-space bounding box and updated field statistics.
|
|
107
|
+
*/
|
|
108
|
+
export declare function paintHeatField(field: HeatField, points: ReadonlyArray<{
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
}>, radius?: number, temperature?: number): {
|
|
112
|
+
bounds: RasterRect;
|
|
113
|
+
stats: HeatStats;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Advances the heat field by `steps` iterations of 5-point Laplacian diffusion and Newtonian cooling.
|
|
117
|
+
*/
|
|
118
|
+
export declare function advanceHeatField(field: HeatField, steps?: number): HeatStats;
|
|
119
|
+
/** Clears the heat field to 0 everywhere. */
|
|
120
|
+
export declare function clearHeatField(field: HeatField): boolean;
|
|
121
|
+
/** Bilinearly samples temperature (0..1) at document coordinates `(x, y)`. */
|
|
122
|
+
export declare function sampleHeatAt(field: HeatField, x: number, y: number): number;
|
|
123
|
+
/** Shifts and resizes a heat field when `extendCanvas` shifts the document by `(dx, dy)`. */
|
|
124
|
+
export declare function shiftHeatField(field: HeatField, dx: number, dy: number, newWidth: number, newHeight: number): HeatField;
|
|
125
|
+
/**
|
|
126
|
+
* Tile cache for thermochromic colour shifting on one layer: blends cold pixels toward `hotColor`
|
|
127
|
+
* around `threshold` where the coarse heat field is warm.
|
|
128
|
+
*/
|
|
129
|
+
export declare class ThermoCache {
|
|
130
|
+
private readonly tiles;
|
|
131
|
+
render(color: TiledSurface, thermo: TiledSurface | undefined, offset: {
|
|
132
|
+
x: number;
|
|
133
|
+
y: number;
|
|
134
|
+
}, heat: HeatField): TiledSurface;
|
|
135
|
+
}
|
|
136
|
+
export interface SavedLayerFluor {
|
|
137
|
+
rect: RasterRect;
|
|
138
|
+
/** 4-channel RGBA PNG data URL of the layer's fluorescence. */
|
|
139
|
+
fluor: string;
|
|
140
|
+
}
|
|
141
|
+
export interface SavedLayerThermo {
|
|
142
|
+
rect: RasterRect;
|
|
143
|
+
/** 4-channel RGBA PNG data URL of the layer's thermochromic `[hotR, hotG, hotB, thresholdByte]`. */
|
|
144
|
+
thermo: string;
|
|
145
|
+
}
|
|
146
|
+
export interface SavedHeatField {
|
|
147
|
+
gridWidth: number;
|
|
148
|
+
gridHeight: number;
|
|
149
|
+
cells: number[];
|
|
150
|
+
}
|
|
151
|
+
export declare function fluorToJSON(fluor: TiledSurface | undefined): SavedLayerFluor | null;
|
|
152
|
+
export declare function fluorFromJSON(raw: unknown): TiledSurface;
|
|
153
|
+
export declare function thermoToJSON(thermo: TiledSurface | undefined): SavedLayerThermo | null;
|
|
154
|
+
export declare function thermoFromJSON(raw: unknown): TiledSurface;
|
|
155
|
+
export declare function heatToJSON(field: HeatField | undefined): SavedHeatField | null;
|
|
156
|
+
export declare function heatFromJSON(raw: unknown, width: number, height: number): HeatField | null;
|