@pixerate/editor 0.112.0 → 0.114.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.
Files changed (129) hide show
  1. package/THIRD_PARTY_NOTICES.md +11 -0
  2. package/dist/animation-editor/index.cjs +60 -54
  3. package/dist/animation-editor/index.cjs.map +1 -1
  4. package/dist/animation-editor/index.d.cts +3 -3
  5. package/dist/animation-editor/index.d.ts +3 -3
  6. package/dist/animation-editor/index.js +14 -8
  7. package/dist/animation-editor/index.js.map +1 -1
  8. package/dist/builtin-CY97ppKM.d.cts +354 -0
  9. package/dist/builtin-CY97ppKM.d.ts +354 -0
  10. package/dist/canvas/index.cjs +3 -3
  11. package/dist/canvas/index.cjs.map +1 -1
  12. package/dist/canvas/index.js +9 -9
  13. package/dist/chunk-26PGXHY7.cjs +753 -0
  14. package/dist/chunk-26PGXHY7.cjs.map +1 -0
  15. package/dist/chunk-2OJACTPR.cjs +929 -0
  16. package/dist/chunk-2OJACTPR.cjs.map +1 -0
  17. package/dist/chunk-3UFGNHSP.js +929 -0
  18. package/dist/chunk-3UFGNHSP.js.map +1 -0
  19. package/dist/{chunk-YGIMK4NX.cjs → chunk-5OVJHMZQ.cjs} +757 -825
  20. package/dist/chunk-5OVJHMZQ.cjs.map +1 -0
  21. package/dist/chunk-643B2HKC.cjs +534 -0
  22. package/dist/chunk-643B2HKC.cjs.map +1 -0
  23. package/dist/chunk-6FCKOS2B.js +534 -0
  24. package/dist/chunk-6FCKOS2B.js.map +1 -0
  25. package/dist/chunk-BRLYOPLT.js +2574 -0
  26. package/dist/chunk-BRLYOPLT.js.map +1 -0
  27. package/dist/{chunk-LQEEDHOP.js → chunk-C6C5PDKU.js} +759 -761
  28. package/dist/chunk-C6C5PDKU.js.map +1 -0
  29. package/dist/chunk-DFQEX3AM.cjs +781 -0
  30. package/dist/chunk-DFQEX3AM.cjs.map +1 -0
  31. package/dist/{chunk-CZOXTEMN.js → chunk-EUVSQ25B.js} +336 -404
  32. package/dist/chunk-EUVSQ25B.js.map +1 -0
  33. package/dist/chunk-G5NMLUVF.cjs +2574 -0
  34. package/dist/chunk-G5NMLUVF.cjs.map +1 -0
  35. package/dist/chunk-LKCYANMW.js +781 -0
  36. package/dist/chunk-LKCYANMW.js.map +1 -0
  37. package/dist/{chunk-W3GXSUSQ.cjs → chunk-LPLCWZTM.cjs} +5087 -1283
  38. package/dist/chunk-LPLCWZTM.cjs.map +1 -0
  39. package/dist/chunk-MMVHBKMM.js +753 -0
  40. package/dist/chunk-MMVHBKMM.js.map +1 -0
  41. package/dist/{chunk-POGBUYWE.cjs → chunk-ST7E3NEE.cjs} +857 -859
  42. package/dist/chunk-ST7E3NEE.cjs.map +1 -0
  43. package/dist/{chunk-7VOHOPLW.cjs → chunk-TCKIXI46.cjs} +59 -59
  44. package/dist/{chunk-7VOHOPLW.cjs.map → chunk-TCKIXI46.cjs.map} +1 -1
  45. package/dist/{chunk-XIOMMGPD.cjs → chunk-TFOPHZ3U.cjs} +1 -1
  46. package/dist/chunk-TFOPHZ3U.cjs.map +1 -0
  47. package/dist/{chunk-Z4BC6M74.js → chunk-UBIXVXPR.js} +2 -2
  48. package/dist/{chunk-BLWCAQCW.js → chunk-VXR7XWMF.js} +4574 -770
  49. package/dist/chunk-VXR7XWMF.js.map +1 -0
  50. package/dist/{chunk-HNS7UHCM.js → chunk-XK5LZKBD.js} +1 -1
  51. package/dist/chunk-XK5LZKBD.js.map +1 -0
  52. package/dist/cms/index.cjs +146 -0
  53. package/dist/cms/index.cjs.map +1 -0
  54. package/dist/cms/index.d.cts +51 -0
  55. package/dist/cms/index.d.ts +51 -0
  56. package/dist/cms/index.js +146 -0
  57. package/dist/{export-DNu_Jr8p.d.ts → export-_1dUKwpF.d.ts} +326 -195
  58. package/dist/{export-DBba-buV.d.cts → export-b6NjCZ5-.d.cts} +326 -195
  59. package/dist/image-editor/index.cjs +2377 -1291
  60. package/dist/image-editor/index.cjs.map +1 -1
  61. package/dist/image-editor/index.d.cts +149 -97
  62. package/dist/image-editor/index.d.ts +149 -97
  63. package/dist/image-editor/index.js +1343 -257
  64. package/dist/image-editor/index.js.map +1 -1
  65. package/dist/opentype-BZEOSOX3.d.ts +188 -0
  66. package/dist/opentype-Dpe75vL5.d.cts +188 -0
  67. package/dist/paint/index.cjs +63 -4
  68. package/dist/paint/index.cjs.map +1 -1
  69. package/dist/paint/index.d.cts +30 -3
  70. package/dist/paint/index.d.ts +30 -3
  71. package/dist/paint/index.js +62 -3
  72. package/dist/paint-editor/index.cjs +146 -145
  73. package/dist/paint-editor/index.cjs.map +1 -1
  74. package/dist/paint-editor/index.d.cts +9 -8
  75. package/dist/paint-editor/index.d.ts +9 -8
  76. package/dist/paint-editor/index.js +6 -5
  77. package/dist/paint-editor/index.js.map +1 -1
  78. package/dist/raster/index.cjs +53 -3
  79. package/dist/raster/index.cjs.map +1 -1
  80. package/dist/raster/index.d.cts +62 -91
  81. package/dist/raster/index.d.ts +62 -91
  82. package/dist/raster/index.js +59 -9
  83. package/dist/{render-BEriFuqK.d.cts → render-B1K_OoLy.d.cts} +87 -2
  84. package/dist/{render-tjzKaik-.d.ts → render-CrmHOgpo.d.ts} +87 -2
  85. package/dist/{blending-aOE6Y3UE.d.cts → retouch-Bxkuc0KH.d.cts} +219 -2
  86. package/dist/{blending-DXl06NSx.d.ts → retouch-Do6tBs2H.d.ts} +219 -2
  87. package/dist/{surface-C8RRg_Bh.d.ts → surface-Cn30xIV6.d.cts} +6 -1
  88. package/dist/{surface-C8RRg_Bh.d.cts → surface-Cn30xIV6.d.ts} +6 -1
  89. package/dist/{svg-D_cfkhlB.d.cts → svg-BnRj0q8i.d.cts} +16 -4
  90. package/dist/{svg-wIaKLrU0.d.ts → svg-CmmBFfGT.d.ts} +16 -4
  91. package/dist/{types-DtL_qLFz.d.ts → types-1SUQKDAw.d.ts} +273 -4
  92. package/dist/{types-DyQq-WPY.d.cts → types-yINF17Ta.d.cts} +273 -4
  93. package/dist/vector/index.cjs +12170 -7343
  94. package/dist/vector/index.cjs.map +1 -1
  95. package/dist/vector/index.d.cts +1579 -16
  96. package/dist/vector/index.d.ts +1579 -16
  97. package/dist/vector/index.js +6303 -1476
  98. package/dist/vector/index.js.map +1 -1
  99. package/dist/warp-B39VsOtd.d.cts +348 -0
  100. package/dist/warp-DMN30aY6.d.ts +348 -0
  101. package/dist/zlib-dxQdgHyN.d.cts +95 -0
  102. package/dist/zlib-dxQdgHyN.d.ts +95 -0
  103. package/package.json +6 -1
  104. package/skills/pixerate-image-editor/SKILL.md +34 -34
  105. package/skills/pixerate-image-editor/references/color-management.md +37 -0
  106. package/skills/pixerate-image-editor/references/photoshop-files.md +39 -0
  107. package/skills/pixerate-image-editor/references/retouching.md +36 -0
  108. package/skills/pixerate-vector/SKILL.md +154 -5
  109. package/dist/chunk-BLWCAQCW.js.map +0 -1
  110. package/dist/chunk-CZOXTEMN.js.map +0 -1
  111. package/dist/chunk-FTBZPI77.cjs +0 -1
  112. package/dist/chunk-FTBZPI77.cjs.map +0 -1
  113. package/dist/chunk-HNS7UHCM.js.map +0 -1
  114. package/dist/chunk-JLYX4V57.cjs +0 -2001
  115. package/dist/chunk-JLYX4V57.cjs.map +0 -1
  116. package/dist/chunk-KB2YBCVS.js +0 -2001
  117. package/dist/chunk-KB2YBCVS.js.map +0 -1
  118. package/dist/chunk-LQEEDHOP.js.map +0 -1
  119. package/dist/chunk-POGBUYWE.cjs.map +0 -1
  120. package/dist/chunk-VKK5VS2T.js +0 -1
  121. package/dist/chunk-W3GXSUSQ.cjs.map +0 -1
  122. package/dist/chunk-XIOMMGPD.cjs.map +0 -1
  123. package/dist/chunk-YGIMK4NX.cjs.map +0 -1
  124. package/dist/homography-CZ-tFjay.d.cts +0 -50
  125. package/dist/homography-Ctfjoc1b.d.ts +0 -50
  126. package/dist/warp-CWHZzE3x.d.ts +0 -118
  127. package/dist/warp-D5jz_tN7.d.cts +0 -118
  128. /package/dist/{chunk-Z4BC6M74.js.map → chunk-UBIXVXPR.js.map} +0 -0
  129. /package/dist/{chunk-VKK5VS2T.js.map → cms/index.js.map} +0 -0
@@ -1,7 +1,9 @@
1
1
  import {
2
+ BIT_DEPTHS,
2
3
  CURVE_LUT_SIZE,
3
4
  DEFAULT_GLOBAL_LIGHT,
4
5
  DIRECT_GAUSSIAN_MAX_SIGMA,
6
+ DeepCompositor,
5
7
  INTERPOLATIONS,
6
8
  LAYER_EFFECT_KINDS,
7
9
  LayerEffectError,
@@ -12,9 +14,7 @@ import {
12
14
  RasterCompositor,
13
15
  STROKE_CHAMFER_MAX,
14
16
  TransformTooLargeError,
15
- ZlibError,
16
17
  activeEffectItems,
17
- adler32,
18
18
  base64ToBytes,
19
19
  blendTile,
20
20
  buildEffectMaps,
@@ -25,12 +25,14 @@ import {
25
25
  compositeLayerEffects,
26
26
  compositeSurfaceOver,
27
27
  contourLut,
28
+ convertSurfaceDepth,
28
29
  curveLut,
29
30
  decodePng,
31
+ deepBytes,
32
+ deepTile,
30
33
  defaultEffectGradient,
31
34
  defaultLayerEffect,
32
- deflate,
33
- deflateRaw,
35
+ depthOf,
34
36
  effectColorHex,
35
37
  effectFillColors,
36
38
  effectReach,
@@ -45,9 +47,8 @@ import {
45
47
  gradientT,
46
48
  hasActiveEffects,
47
49
  hashNoise,
48
- inflate,
49
- inflateRaw,
50
50
  insertLayer,
51
+ isBitDepth,
51
52
  isInterpolation,
52
53
  isLayerEffectKind,
53
54
  isLayerLocked,
@@ -63,16 +64,33 @@ import {
63
64
  parseEffectColor,
64
65
  patchEffectMaps,
65
66
  pngDataUrl,
67
+ proxyOf,
68
+ readDeepRegion,
66
69
  reduceSurface,
67
70
  renderLayerEffects,
68
71
  scaleLayerEffect,
72
+ srgbDecode,
73
+ srgbEncode,
74
+ surfaceDepth,
75
+ surfaceFromDeepPixels,
76
+ tileSamples,
77
+ tileSamples16,
78
+ tileSamples32,
79
+ to16From32,
80
+ to16From8,
81
+ to32From16,
82
+ to32From8,
83
+ to8From16,
84
+ to8From32,
69
85
  transformSurface,
70
86
  transformedBounds,
71
87
  validateEffectGradient,
72
88
  validateLayerEffect,
73
89
  validateLayerEffects,
74
- warpSurface
75
- } from "../chunk-LQEEDHOP.js";
90
+ warpSurface,
91
+ workingToSamples,
92
+ writeDeepRegion
93
+ } from "../chunk-C6C5PDKU.js";
76
94
  import "../chunk-GX332W2C.js";
77
95
  import {
78
96
  BLEND_MODES,
@@ -116,12 +134,22 @@ import {
116
134
  translateSurface,
117
135
  uniformTile,
118
136
  writeRegion
119
- } from "../chunk-HNS7UHCM.js";
137
+ } from "../chunk-XK5LZKBD.js";
138
+ import {
139
+ ZlibError,
140
+ adler32,
141
+ deflate,
142
+ deflateRaw,
143
+ inflate,
144
+ inflateRaw
145
+ } from "../chunk-6FCKOS2B.js";
120
146
  export {
147
+ BIT_DEPTHS,
121
148
  BLEND_MODES,
122
149
  CURVE_LUT_SIZE,
123
150
  DEFAULT_GLOBAL_LIGHT,
124
151
  DIRECT_GAUSSIAN_MAX_SIGMA,
152
+ DeepCompositor,
125
153
  INTERPOLATIONS,
126
154
  LAYER_EFFECT_KINDS,
127
155
  LayerEffectError,
@@ -159,12 +187,16 @@ export {
159
187
  compositeSurfaceOver,
160
188
  contentBounds,
161
189
  contourLut,
190
+ convertSurfaceDepth,
162
191
  curveLut,
163
192
  decodePng,
193
+ deepBytes,
194
+ deepTile,
164
195
  defaultEffectGradient,
165
196
  defaultLayerEffect,
166
197
  deflate,
167
198
  deflateRaw,
199
+ depthOf,
168
200
  effectColorHex,
169
201
  effectFillColors,
170
202
  effectReach,
@@ -185,6 +217,7 @@ export {
185
217
  inflate,
186
218
  inflateRaw,
187
219
  insertLayer,
220
+ isBitDepth,
188
221
  isBlendMode,
189
222
  isInterpolation,
190
223
  isLayerEffectKind,
@@ -208,6 +241,8 @@ export {
208
241
  patchEffectMaps,
209
242
  pigment8,
210
243
  pngDataUrl,
244
+ proxyOf,
245
+ readDeepRegion,
211
246
  readPixel,
212
247
  readRegion,
213
248
  reduceSurface,
@@ -215,14 +250,27 @@ export {
215
250
  scaleLayerEffect,
216
251
  setLum,
217
252
  solidSurface,
253
+ srgbDecode,
254
+ srgbEncode,
218
255
  standardBlendMode,
219
256
  surfaceBytes,
257
+ surfaceDepth,
258
+ surfaceFromDeepPixels,
220
259
  surfaceFromPixels,
221
260
  surfacesEqual,
222
261
  tileCoord,
223
262
  tileKey,
224
263
  tileRect,
264
+ tileSamples,
265
+ tileSamples16,
266
+ tileSamples32,
225
267
  tilesInRect,
268
+ to16From32,
269
+ to16From8,
270
+ to32From16,
271
+ to32From8,
272
+ to8From16,
273
+ to8From32,
226
274
  transformSurface,
227
275
  transformedBounds,
228
276
  translateSurface,
@@ -231,6 +279,8 @@ export {
231
279
  validateLayerEffect,
232
280
  validateLayerEffects,
233
281
  warpSurface,
282
+ workingToSamples,
283
+ writeDeepRegion,
234
284
  writeRegion
235
285
  };
236
286
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { B as BlendMode, R as RasterRect, a as TiledSurface, M as MaskSurface, b as PixelSurface, T as TileKey } from './surface-C8RRg_Bh.cjs';
1
+ import { a as BlendMode, R as RasterRect, j as TiledSurface, M as MaskSurface, c as PixelSurface, i as TileKey, h as Tile } from './surface-Cn30xIV6.cjs';
2
2
  import { H as Homography, V as Vec2 } from './types-CwMPoRMU.cjs';
3
3
 
4
4
  /**
@@ -832,6 +832,91 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
832
832
  /** Tiles that differ between two surfaces (by tile identity), as tile keys. */
833
833
  declare function changedTiles(a: TiledSurface, b: TiledSurface): TileKey[];
834
834
 
835
+ /**
836
+ * High bit depth tiles: 16-bit and 32-bit float samples alongside the 8-bit tile data.
837
+ *
838
+ * A tile may carry `deep` samples next to its `data`:
839
+ *
840
+ * - `Uint16Array`: 16 bits per channel, 0..65535, the same sRGB encoding and straight alpha as
841
+ * the 8-bit data (`data = round(deep / 257)`).
842
+ * - `Float32Array`: 32-bit float per channel in **linear light** (sRGB primaries), straight
843
+ * alpha, as Photoshop's 32-bit mode; colour may exceed 1 (`data` is the clamped sRGB encoding).
844
+ *
845
+ * `data` is always the 8-bit rendering of `deep`, so every 8-bit consumer (the compositor, the
846
+ * viewport, brushes, filters, the paint editor) keeps working unchanged and at full speed: it
847
+ * simply sees the 8-bit picture. A tile without `deep` holds 8-bit pixels; read at a higher depth
848
+ * (`tileSamples16` / `tileSamples32`) they are converted exactly as a bit-depth conversion would.
849
+ * Writers that only produce 8-bit data drop `deep` for the tiles they rewrite (those tiles become
850
+ * 8-bit precise), and writers that understand depth build tiles with `deepTile`.
851
+ *
852
+ * Masks (one channel) are coverage, not colour: their float samples are never linearised.
853
+ */
854
+
855
+ /** Bits per channel: 8, 16 or 32 (float). */
856
+ type BitDepth = 8 | 16 | 32;
857
+ declare const BIT_DEPTHS: readonly BitDepth[];
858
+ declare const isBitDepth: (v: unknown) => v is BitDepth;
859
+ /** Deep samples of a tile: 16-bit encoded, or 32-bit linear float. */
860
+ type DeepSamples = Uint16Array | Float32Array;
861
+ /** sRGB-encoded 0..1 to linear light. */
862
+ declare function srgbDecode(v: number): number;
863
+ /** Linear light to sRGB-encoded (values above 1 extend the curve; below 0 clamp to 0). */
864
+ declare function srgbEncode(v: number): number;
865
+ /** 8-bit samples to 16-bit (`v × 257`, exact both ways). */
866
+ declare function to16From8(data: ArrayLike<number>, out?: Uint16Array<ArrayBuffer>): Uint16Array;
867
+ /** 8-bit samples to 32-bit float (colour linearised; alpha and masks as is). */
868
+ declare function to32From8(data: ArrayLike<number>, channels: 1 | 4, out?: Float32Array<ArrayBuffer>): Float32Array;
869
+ /** 16-bit samples to 32-bit float. */
870
+ declare function to32From16(data: ArrayLike<number>, channels: 1 | 4, out?: Float32Array<ArrayBuffer>): Float32Array;
871
+ /** 32-bit float samples to 16-bit (colour encoded and clamped to 0..1). */
872
+ declare function to16From32(data: ArrayLike<number>, channels: 1 | 4, out?: Uint16Array<ArrayBuffer>): Uint16Array;
873
+ /** 16-bit samples to 8-bit (rounded). */
874
+ declare function to8From16(data: ArrayLike<number>, out?: Uint8ClampedArray<ArrayBuffer>): Uint8ClampedArray;
875
+ /** 32-bit float samples to 8-bit (colour encoded and clamped). */
876
+ declare function to8From32(data: ArrayLike<number>, channels: 1 | 4, out?: Uint8ClampedArray<ArrayBuffer>): Uint8ClampedArray;
877
+ /** The 8-bit rendering of deep samples. */
878
+ declare function proxyOf(deep: DeepSamples, channels: 1 | 4, out?: Uint8ClampedArray<ArrayBuffer>): Uint8ClampedArray;
879
+ /** The bit depth deep samples hold. */
880
+ declare const depthOf: (deep: DeepSamples) => 16 | 32;
881
+ /**
882
+ * A stored tile from deep samples (`TILE × TILE × channels`): `null` when it renders as the
883
+ * surface default and holds nothing finer, an 8-bit tile when 8 bits hold it exactly (16-bit
884
+ * samples that are multiples of 257), else a tile with `deep` and its 8-bit rendering.
885
+ */
886
+ declare function deepTile(deep: DeepSamples, channels: 1 | 4, defaultValue?: number): Tile | null;
887
+ /** 16-bit samples of a tile (`undefined`: the default tile), converting 8-bit or float data. */
888
+ declare function tileSamples16(tile: Tile | undefined, channels: 1 | 4, defaultValue?: number): Uint16Array;
889
+ /** 32-bit float samples of a tile (`undefined`: the default tile), converting 8- or 16-bit data. */
890
+ declare function tileSamples32(tile: Tile | undefined, channels: 1 | 4, defaultValue?: number): Float32Array;
891
+ /** Deep samples of a tile at `depth` (16 or 32). */
892
+ declare function tileSamples(tile: Tile | undefined, channels: 1 | 4, depth: 16 | 32, defaultValue?: number): DeepSamples;
893
+ /** The deepest samples any tile of a surface holds: 8, 16 or 32. */
894
+ declare function surfaceDepth(surface: TiledSurface): BitDepth;
895
+ /** Copies `rect` of a surface at `depth` into a new buffer (`rect.width × rect.height × channels`). */
896
+ declare function readDeepRegion(surface: TiledSurface, rect: RasterRect, depth: 16): Uint16Array;
897
+ declare function readDeepRegion(surface: TiledSurface, rect: RasterRect, depth: 32): Float32Array;
898
+ declare function readDeepRegion(surface: TiledSurface, rect: RasterRect, depth: 16 | 32): DeepSamples;
899
+ /**
900
+ * Writes `rect.width × rect.height` interleaved deep samples at `rect` and returns the new
901
+ * surface. Partly covered tiles keep their other pixels, converted to the samples' depth.
902
+ */
903
+ declare function writeDeepRegion(surface: TiledSurface, rect: RasterRect, samples: DeepSamples): TiledSurface;
904
+ /** A surface holding `width × height` deep samples placed at (`x`, `y`). */
905
+ declare function surfaceFromDeepPixels(pixels: {
906
+ width: number;
907
+ height: number;
908
+ data: DeepSamples;
909
+ }, channels?: 1 | 4, x?: number, y?: number, defaultValue?: number): TiledSurface;
910
+ /**
911
+ * The surface converted to `depth`: 8 drops every tile's deep samples (keeping their 8-bit
912
+ * rendering); 16 or 32 converts the deep samples tiles already hold. Tiles without deep samples
913
+ * are left alone (they read at any depth by conversion), so going up from 8 bits costs nothing.
914
+ * Returns the same surface when nothing changes.
915
+ */
916
+ declare function convertSurfaceDepth(surface: TiledSurface, depth: BitDepth): TiledSurface;
917
+ /** Bytes held by deep samples (in addition to `surfaceBytes`). */
918
+ declare function deepBytes(surface: TiledSurface): number;
919
+
835
920
  /**
836
921
  * CPU renderer for layer effects.
837
922
  *
@@ -966,4 +1051,4 @@ declare function renderLayerEffects(effects: LayerEffects, layer: {
966
1051
  fillOpacity?: number;
967
1052
  }, backdrop: Uint8ClampedArray, canvas: EffectRect, ctx: EffectContext): void;
968
1053
 
969
- export { type StrokeEffect as $, type EffectRect as A, type BevelContour as B, type CompositorLayer as C, DEFAULT_GLOBAL_LIGHT as D, type EffectFill as E, type GlowTechnique as F, type GroupBlendMode as G, type GradientColorStop as H, type Interpolation as I, type GradientOpacityStop as J, type GradientOverlayEffect as K, type LayerLocks as L, type GradientStyle as M, INTERPOLATIONS as N, type InnerGlowEffect as O, type InnerShadowEffect as P, LAYER_EFFECT_KINDS as Q, type RasterLayer as R, LayerEffectError as S, MAX_EFFECT_REACH as T, MAX_TRANSFORM_PIXELS as U, type OuterGlowEffect as V, type PatternOverlayEffect as W, PatternPlacement as X, PatternTile as Y, type ResampleOptions as Z, type SatinEffect as _, type RasterGroupLayer as a, type StrokePosition as a0, TransformTooLargeError as a1, blendTile as a2, builtinPattern as a3, builtinPatternIds as a4, changedTiles as a5, compositeSurfaceOver as a6, defaultEffectGradient as a7, defaultLayerEffect as a8, effectColorHex as a9, validateLayerEffect as aA, validateLayerEffects as aB, warpSurface as aC, type CompositorProfile as aD, type EffectCompositeInput as aE, type EffectMaps as aF, type GroupIn as aG, type PixelFilterSpec as aH, type RasterNode as aI, STROKE_CHAMFER_MAX as aJ, activeEffectItems as aK, buildEffectMaps as aL, compositeLayerEffects as aM, contourLut as aN, effectFillColors as aO, effectsAreLocal as aP, gradientT as aQ, patchEffectMaps as aR, effectReach as aa, effectsFingerprint as ab, effectsMargin as ac, effectsScale as ad, findLayer as ae, flattenLayers as af, hasActiveEffects as ag, hashNoise as ah, insertLayer as ai, isInterpolation as aj, isLayerEffectKind as ak, isLayerLocked as al, keysWeight as am, layerEffectFields as an, layerEffectLabel as ao, mapLayer as ap, mergeLayerEffect as aq, newEffectId as ar, normalizeLayerEffects as as, parseEffectColor as at, reduceSurface as au, renderLayerEffects as av, scaleLayerEffect as aw, transformSurface as ax, transformedBounds as ay, validateEffectGradient as az, type RasterPixelLayer as b, RasterCompositor as c, type RasterSources as d, type RasterLayerBase as e, type RasterMask as f, type GlobalLight as g, type EffectPattern as h, type LayerLocation as i, type LayerEffect as j, type LayerEffects as k, type CompositorOptions as l, type LayerEffectKind as m, type EffectContext as n, type BevelEmbossEffect as o, type BevelStyle as p, type BevelTechnique as q, type BevelTexture as r, type ColorOverlayEffect as s, type CompositeCallOptions as t, type CompositeStats as u, type ContourPoint as v, type DropShadowEffect as w, type EffectContour as x, type EffectGradient as y, type EffectPatternRef as z };
1054
+ export { type PixelFilterSpec as $, type GradientOverlayEffect as A, BIT_DEPTHS as B, type CompositorLayer as C, DEFAULT_GLOBAL_LIGHT as D, type EffectCompositeInput as E, type GradientStyle as F, type GlobalLight as G, type GroupBlendMode as H, type GroupIn as I, INTERPOLATIONS as J, type InnerGlowEffect as K, type InnerShadowEffect as L, type Interpolation as M, LAYER_EFFECT_KINDS as N, type LayerEffect as O, LayerEffectError as P, type LayerEffectKind as Q, type RasterSources as R, type LayerEffects as S, type LayerLocation as T, type LayerLocks as U, MAX_EFFECT_REACH as V, MAX_TRANSFORM_PIXELS as W, type OuterGlowEffect as X, type PatternOverlayEffect as Y, PatternPlacement as Z, PatternTile as _, RasterCompositor as a, tileSamples16 as a$, type RasterGroupLayer as a0, type RasterLayer as a1, type RasterLayerBase as a2, type RasterMask as a3, type RasterNode as a4, type RasterPixelLayer as a5, type ResampleOptions as a6, STROKE_CHAMFER_MAX as a7, type SatinEffect as a8, type StrokeEffect as a9, gradientT as aA, hasActiveEffects as aB, hashNoise as aC, insertLayer as aD, isBitDepth as aE, isInterpolation as aF, isLayerEffectKind as aG, isLayerLocked as aH, keysWeight as aI, layerEffectFields as aJ, layerEffectLabel as aK, mapLayer as aL, mergeLayerEffect as aM, newEffectId as aN, normalizeLayerEffects as aO, parseEffectColor as aP, patchEffectMaps as aQ, proxyOf as aR, readDeepRegion as aS, reduceSurface as aT, renderLayerEffects as aU, scaleLayerEffect as aV, srgbDecode as aW, srgbEncode as aX, surfaceDepth as aY, surfaceFromDeepPixels as aZ, tileSamples as a_, type StrokePosition as aa, TransformTooLargeError as ab, activeEffectItems as ac, blendTile as ad, buildEffectMaps as ae, builtinPattern as af, builtinPatternIds as ag, changedTiles as ah, compositeLayerEffects as ai, compositeSurfaceOver as aj, contourLut as ak, convertSurfaceDepth as al, deepBytes as am, deepTile as an, defaultEffectGradient as ao, defaultLayerEffect as ap, depthOf as aq, effectColorHex as ar, effectFillColors as as, effectReach as at, effectsAreLocal as au, effectsFingerprint as av, effectsMargin as aw, effectsScale as ax, findLayer as ay, flattenLayers as az, type CompositorProfile as b, tileSamples32 as b0, to16From32 as b1, to16From8 as b2, to32From16 as b3, to32From8 as b4, to8From16 as b5, to8From32 as b6, transformSurface as b7, transformedBounds as b8, validateEffectGradient as b9, validateLayerEffect as ba, validateLayerEffects as bb, warpSurface as bc, writeDeepRegion as bd, type BevelContour as c, type BevelEmbossEffect as d, type BevelStyle as e, type BevelTechnique as f, type BevelTexture as g, type BitDepth as h, type ColorOverlayEffect as i, type CompositeCallOptions as j, type CompositeStats as k, type CompositorOptions as l, type ContourPoint as m, type DeepSamples as n, type DropShadowEffect as o, type EffectContext as p, type EffectContour as q, type EffectFill as r, type EffectGradient as s, type EffectMaps as t, type EffectPattern as u, type EffectPatternRef as v, type EffectRect as w, type GlowTechnique as x, type GradientColorStop as y, type GradientOpacityStop as z };
@@ -1,4 +1,4 @@
1
- import { B as BlendMode, R as RasterRect, a as TiledSurface, M as MaskSurface, b as PixelSurface, T as TileKey } from './surface-C8RRg_Bh.js';
1
+ import { a as BlendMode, R as RasterRect, j as TiledSurface, M as MaskSurface, c as PixelSurface, i as TileKey, h as Tile } from './surface-Cn30xIV6.js';
2
2
  import { H as Homography, V as Vec2 } from './types-CwMPoRMU.js';
3
3
 
4
4
  /**
@@ -832,6 +832,91 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
832
832
  /** Tiles that differ between two surfaces (by tile identity), as tile keys. */
833
833
  declare function changedTiles(a: TiledSurface, b: TiledSurface): TileKey[];
834
834
 
835
+ /**
836
+ * High bit depth tiles: 16-bit and 32-bit float samples alongside the 8-bit tile data.
837
+ *
838
+ * A tile may carry `deep` samples next to its `data`:
839
+ *
840
+ * - `Uint16Array`: 16 bits per channel, 0..65535, the same sRGB encoding and straight alpha as
841
+ * the 8-bit data (`data = round(deep / 257)`).
842
+ * - `Float32Array`: 32-bit float per channel in **linear light** (sRGB primaries), straight
843
+ * alpha, as Photoshop's 32-bit mode; colour may exceed 1 (`data` is the clamped sRGB encoding).
844
+ *
845
+ * `data` is always the 8-bit rendering of `deep`, so every 8-bit consumer (the compositor, the
846
+ * viewport, brushes, filters, the paint editor) keeps working unchanged and at full speed: it
847
+ * simply sees the 8-bit picture. A tile without `deep` holds 8-bit pixels; read at a higher depth
848
+ * (`tileSamples16` / `tileSamples32`) they are converted exactly as a bit-depth conversion would.
849
+ * Writers that only produce 8-bit data drop `deep` for the tiles they rewrite (those tiles become
850
+ * 8-bit precise), and writers that understand depth build tiles with `deepTile`.
851
+ *
852
+ * Masks (one channel) are coverage, not colour: their float samples are never linearised.
853
+ */
854
+
855
+ /** Bits per channel: 8, 16 or 32 (float). */
856
+ type BitDepth = 8 | 16 | 32;
857
+ declare const BIT_DEPTHS: readonly BitDepth[];
858
+ declare const isBitDepth: (v: unknown) => v is BitDepth;
859
+ /** Deep samples of a tile: 16-bit encoded, or 32-bit linear float. */
860
+ type DeepSamples = Uint16Array | Float32Array;
861
+ /** sRGB-encoded 0..1 to linear light. */
862
+ declare function srgbDecode(v: number): number;
863
+ /** Linear light to sRGB-encoded (values above 1 extend the curve; below 0 clamp to 0). */
864
+ declare function srgbEncode(v: number): number;
865
+ /** 8-bit samples to 16-bit (`v × 257`, exact both ways). */
866
+ declare function to16From8(data: ArrayLike<number>, out?: Uint16Array<ArrayBuffer>): Uint16Array;
867
+ /** 8-bit samples to 32-bit float (colour linearised; alpha and masks as is). */
868
+ declare function to32From8(data: ArrayLike<number>, channels: 1 | 4, out?: Float32Array<ArrayBuffer>): Float32Array;
869
+ /** 16-bit samples to 32-bit float. */
870
+ declare function to32From16(data: ArrayLike<number>, channels: 1 | 4, out?: Float32Array<ArrayBuffer>): Float32Array;
871
+ /** 32-bit float samples to 16-bit (colour encoded and clamped to 0..1). */
872
+ declare function to16From32(data: ArrayLike<number>, channels: 1 | 4, out?: Uint16Array<ArrayBuffer>): Uint16Array;
873
+ /** 16-bit samples to 8-bit (rounded). */
874
+ declare function to8From16(data: ArrayLike<number>, out?: Uint8ClampedArray<ArrayBuffer>): Uint8ClampedArray;
875
+ /** 32-bit float samples to 8-bit (colour encoded and clamped). */
876
+ declare function to8From32(data: ArrayLike<number>, channels: 1 | 4, out?: Uint8ClampedArray<ArrayBuffer>): Uint8ClampedArray;
877
+ /** The 8-bit rendering of deep samples. */
878
+ declare function proxyOf(deep: DeepSamples, channels: 1 | 4, out?: Uint8ClampedArray<ArrayBuffer>): Uint8ClampedArray;
879
+ /** The bit depth deep samples hold. */
880
+ declare const depthOf: (deep: DeepSamples) => 16 | 32;
881
+ /**
882
+ * A stored tile from deep samples (`TILE × TILE × channels`): `null` when it renders as the
883
+ * surface default and holds nothing finer, an 8-bit tile when 8 bits hold it exactly (16-bit
884
+ * samples that are multiples of 257), else a tile with `deep` and its 8-bit rendering.
885
+ */
886
+ declare function deepTile(deep: DeepSamples, channels: 1 | 4, defaultValue?: number): Tile | null;
887
+ /** 16-bit samples of a tile (`undefined`: the default tile), converting 8-bit or float data. */
888
+ declare function tileSamples16(tile: Tile | undefined, channels: 1 | 4, defaultValue?: number): Uint16Array;
889
+ /** 32-bit float samples of a tile (`undefined`: the default tile), converting 8- or 16-bit data. */
890
+ declare function tileSamples32(tile: Tile | undefined, channels: 1 | 4, defaultValue?: number): Float32Array;
891
+ /** Deep samples of a tile at `depth` (16 or 32). */
892
+ declare function tileSamples(tile: Tile | undefined, channels: 1 | 4, depth: 16 | 32, defaultValue?: number): DeepSamples;
893
+ /** The deepest samples any tile of a surface holds: 8, 16 or 32. */
894
+ declare function surfaceDepth(surface: TiledSurface): BitDepth;
895
+ /** Copies `rect` of a surface at `depth` into a new buffer (`rect.width × rect.height × channels`). */
896
+ declare function readDeepRegion(surface: TiledSurface, rect: RasterRect, depth: 16): Uint16Array;
897
+ declare function readDeepRegion(surface: TiledSurface, rect: RasterRect, depth: 32): Float32Array;
898
+ declare function readDeepRegion(surface: TiledSurface, rect: RasterRect, depth: 16 | 32): DeepSamples;
899
+ /**
900
+ * Writes `rect.width × rect.height` interleaved deep samples at `rect` and returns the new
901
+ * surface. Partly covered tiles keep their other pixels, converted to the samples' depth.
902
+ */
903
+ declare function writeDeepRegion(surface: TiledSurface, rect: RasterRect, samples: DeepSamples): TiledSurface;
904
+ /** A surface holding `width × height` deep samples placed at (`x`, `y`). */
905
+ declare function surfaceFromDeepPixels(pixels: {
906
+ width: number;
907
+ height: number;
908
+ data: DeepSamples;
909
+ }, channels?: 1 | 4, x?: number, y?: number, defaultValue?: number): TiledSurface;
910
+ /**
911
+ * The surface converted to `depth`: 8 drops every tile's deep samples (keeping their 8-bit
912
+ * rendering); 16 or 32 converts the deep samples tiles already hold. Tiles without deep samples
913
+ * are left alone (they read at any depth by conversion), so going up from 8 bits costs nothing.
914
+ * Returns the same surface when nothing changes.
915
+ */
916
+ declare function convertSurfaceDepth(surface: TiledSurface, depth: BitDepth): TiledSurface;
917
+ /** Bytes held by deep samples (in addition to `surfaceBytes`). */
918
+ declare function deepBytes(surface: TiledSurface): number;
919
+
835
920
  /**
836
921
  * CPU renderer for layer effects.
837
922
  *
@@ -966,4 +1051,4 @@ declare function renderLayerEffects(effects: LayerEffects, layer: {
966
1051
  fillOpacity?: number;
967
1052
  }, backdrop: Uint8ClampedArray, canvas: EffectRect, ctx: EffectContext): void;
968
1053
 
969
- export { type StrokeEffect as $, type EffectRect as A, type BevelContour as B, type CompositorLayer as C, DEFAULT_GLOBAL_LIGHT as D, type EffectFill as E, type GlowTechnique as F, type GroupBlendMode as G, type GradientColorStop as H, type Interpolation as I, type GradientOpacityStop as J, type GradientOverlayEffect as K, type LayerLocks as L, type GradientStyle as M, INTERPOLATIONS as N, type InnerGlowEffect as O, type InnerShadowEffect as P, LAYER_EFFECT_KINDS as Q, type RasterLayer as R, LayerEffectError as S, MAX_EFFECT_REACH as T, MAX_TRANSFORM_PIXELS as U, type OuterGlowEffect as V, type PatternOverlayEffect as W, PatternPlacement as X, PatternTile as Y, type ResampleOptions as Z, type SatinEffect as _, type RasterGroupLayer as a, type StrokePosition as a0, TransformTooLargeError as a1, blendTile as a2, builtinPattern as a3, builtinPatternIds as a4, changedTiles as a5, compositeSurfaceOver as a6, defaultEffectGradient as a7, defaultLayerEffect as a8, effectColorHex as a9, validateLayerEffect as aA, validateLayerEffects as aB, warpSurface as aC, type CompositorProfile as aD, type EffectCompositeInput as aE, type EffectMaps as aF, type GroupIn as aG, type PixelFilterSpec as aH, type RasterNode as aI, STROKE_CHAMFER_MAX as aJ, activeEffectItems as aK, buildEffectMaps as aL, compositeLayerEffects as aM, contourLut as aN, effectFillColors as aO, effectsAreLocal as aP, gradientT as aQ, patchEffectMaps as aR, effectReach as aa, effectsFingerprint as ab, effectsMargin as ac, effectsScale as ad, findLayer as ae, flattenLayers as af, hasActiveEffects as ag, hashNoise as ah, insertLayer as ai, isInterpolation as aj, isLayerEffectKind as ak, isLayerLocked as al, keysWeight as am, layerEffectFields as an, layerEffectLabel as ao, mapLayer as ap, mergeLayerEffect as aq, newEffectId as ar, normalizeLayerEffects as as, parseEffectColor as at, reduceSurface as au, renderLayerEffects as av, scaleLayerEffect as aw, transformSurface as ax, transformedBounds as ay, validateEffectGradient as az, type RasterPixelLayer as b, RasterCompositor as c, type RasterSources as d, type RasterLayerBase as e, type RasterMask as f, type GlobalLight as g, type EffectPattern as h, type LayerLocation as i, type LayerEffect as j, type LayerEffects as k, type CompositorOptions as l, type LayerEffectKind as m, type EffectContext as n, type BevelEmbossEffect as o, type BevelStyle as p, type BevelTechnique as q, type BevelTexture as r, type ColorOverlayEffect as s, type CompositeCallOptions as t, type CompositeStats as u, type ContourPoint as v, type DropShadowEffect as w, type EffectContour as x, type EffectGradient as y, type EffectPatternRef as z };
1054
+ export { type PixelFilterSpec as $, type GradientOverlayEffect as A, BIT_DEPTHS as B, type CompositorLayer as C, DEFAULT_GLOBAL_LIGHT as D, type EffectCompositeInput as E, type GradientStyle as F, type GlobalLight as G, type GroupBlendMode as H, type GroupIn as I, INTERPOLATIONS as J, type InnerGlowEffect as K, type InnerShadowEffect as L, type Interpolation as M, LAYER_EFFECT_KINDS as N, type LayerEffect as O, LayerEffectError as P, type LayerEffectKind as Q, type RasterSources as R, type LayerEffects as S, type LayerLocation as T, type LayerLocks as U, MAX_EFFECT_REACH as V, MAX_TRANSFORM_PIXELS as W, type OuterGlowEffect as X, type PatternOverlayEffect as Y, PatternPlacement as Z, PatternTile as _, RasterCompositor as a, tileSamples16 as a$, type RasterGroupLayer as a0, type RasterLayer as a1, type RasterLayerBase as a2, type RasterMask as a3, type RasterNode as a4, type RasterPixelLayer as a5, type ResampleOptions as a6, STROKE_CHAMFER_MAX as a7, type SatinEffect as a8, type StrokeEffect as a9, gradientT as aA, hasActiveEffects as aB, hashNoise as aC, insertLayer as aD, isBitDepth as aE, isInterpolation as aF, isLayerEffectKind as aG, isLayerLocked as aH, keysWeight as aI, layerEffectFields as aJ, layerEffectLabel as aK, mapLayer as aL, mergeLayerEffect as aM, newEffectId as aN, normalizeLayerEffects as aO, parseEffectColor as aP, patchEffectMaps as aQ, proxyOf as aR, readDeepRegion as aS, reduceSurface as aT, renderLayerEffects as aU, scaleLayerEffect as aV, srgbDecode as aW, srgbEncode as aX, surfaceDepth as aY, surfaceFromDeepPixels as aZ, tileSamples as a_, type StrokePosition as aa, TransformTooLargeError as ab, activeEffectItems as ac, blendTile as ad, buildEffectMaps as ae, builtinPattern as af, builtinPatternIds as ag, changedTiles as ah, compositeLayerEffects as ai, compositeSurfaceOver as aj, contourLut as ak, convertSurfaceDepth as al, deepBytes as am, deepTile as an, defaultEffectGradient as ao, defaultLayerEffect as ap, depthOf as aq, effectColorHex as ar, effectFillColors as as, effectReach as at, effectsAreLocal as au, effectsFingerprint as av, effectsMargin as aw, effectsScale as ax, findLayer as ay, flattenLayers as az, type CompositorProfile as b, tileSamples32 as b0, to16From32 as b1, to16From8 as b2, to32From16 as b3, to32From8 as b4, to8From16 as b5, to8From32 as b6, transformSurface as b7, transformedBounds as b8, validateEffectGradient as b9, validateLayerEffect as ba, validateLayerEffects as bb, warpSurface as bc, writeDeepRegion as bd, type BevelContour as c, type BevelEmbossEffect as d, type BevelStyle as e, type BevelTechnique as f, type BevelTexture as g, type BitDepth as h, type ColorOverlayEffect as i, type CompositeCallOptions as j, type CompositeStats as k, type CompositorOptions as l, type ContourPoint as m, type DeepSamples as n, type DropShadowEffect as o, type EffectContext as p, type EffectContour as q, type EffectFill as r, type EffectGradient as s, type EffectMaps as t, type EffectPattern as u, type EffectPatternRef as v, type EffectRect as w, type GlowTechnique as x, type GradientColorStop as y, type GradientOpacityStop as z };
@@ -1,4 +1,4 @@
1
- import { B as BlendMode, R as RasterRect, T as TileKey, P as Pigment } from './surface-C8RRg_Bh.cjs';
1
+ import { a as BlendMode, R as RasterRect, i as TileKey, Y as Pigment } from './surface-Cn30xIV6.cjs';
2
2
 
3
3
  /**
4
4
  * The brush engine (a subset of photocraft's `crates/paint`): a computed round tip with size,
@@ -483,4 +483,221 @@ declare class SmudgeTip {
483
483
  dab(medium: TileMedium, d: SmudgeDab, rect: RasterRect, cov: ArrayLike<number>): void;
484
484
  }
485
485
 
486
- export { tipShape as $, blendRadius as A, type BrushSettings as B, CoverageMap as C, type Dab as D, EMPTY_MIXER_LOAD as E, blenderDab as F, cleanMixer as G, coverageTileCoord as H, createBlenderScratch as I, dabCoverage as J, dabRect as K, exchangeRates as L, type MixerSettings as M, loadMixer as N, mixerRates as O, type PaintTileTarget as P, normalizeBlender as Q, type RgbTriple as R, type SmudgeSettings as S, TileMedium as T, normalizeBrush as U, normalizeMixer as V, normalizeSmudge as W, rasterizeDab as X, smoothPoints as Y, tipFalloff as Z, tipReach as _, type MixingModel as a, walkDabs as a0, type BlenderSettings as b, type StrokePoint as c, type MixerLoad as d, MAX_BRUSH_SIZE as e, StrokeCoverage as f, type MixerTarget as g, MixerStroke as h, type StrokeApply as i, type BlenderScratch as j, DEFAULT_BLENDER as k, DEFAULT_BRUSH as l, DEFAULT_MIXER as m, DEFAULT_SMUDGE as n, DabWalker as o, type ExchangeRates as p, MIXER_DRAIN as q, MIXER_PICKUP_RATE as r, MIXING_MODELS as s, PaintExchange as t, type PaintMedium as u, type PaintSample as v, type SmudgeDab as w, SmudgeTip as x, type TileMediumOptions as y, applyStrokeToTile as z };
486
+ /**
487
+ * The retouching tools on the shared brush engine: Clone Stamp, Healing Brush, Spot Healing
488
+ * Brush, Smudge, Dodge, Burn and Sponge. Two stroke shapes cover them all:
489
+ *
490
+ * - **Accumulate, then composite** (Clone Stamp, Dodge, Burn; the Healing tools' result): the
491
+ * stroke's dabs build up one `CoverageMap` (flow builds towards the dab's opacity ceiling), and
492
+ * per-pixel paint taken from the pre-stroke state (a cloned source, a toned copy of the pixel,
493
+ * a healed patch) is composited through it with `applyRetouchToTile`. Pixels painted earlier in
494
+ * the stroke are never sampled again, and overlapping dabs never exceed the stroke's opacity.
495
+ * - **Sequential dabs** (Smudge, Sponge): `RetouchDabStroke` runs each dab in order over live
496
+ * tiles, so dab n sees what dab n − 1 did.
497
+ *
498
+ * The Healing Brush clones while it is drawn and, when the stroke ends, replaces the clone with a
499
+ * seamless clone (`healPixels`, Poisson blending): the source's texture with the colour and light
500
+ * of the pixels around the stroke. The Spot Healing Brush finds its own source (`spotHealPixels`).
501
+ *
502
+ * Tone curves (`dodgeBurnCurve`, `dodgeBurn`, `sponge`) are photocraft's, made to behave like
503
+ * Photoshop's tools: the chosen range moves most, black and white stay put for midtones, and
504
+ * Protect Tones works on luma so hue and saturation are kept. Data in, pixels out; no DOM.
505
+ */
506
+
507
+ /** The tonal range Dodge and Burn work on most. */
508
+ type ToneRange = 'shadows' | 'midtones' | 'highlights';
509
+ declare const TONE_RANGES: readonly ToneRange[];
510
+ /** Rec. 601 luma of straight RGB (0..1). */
511
+ declare function luma(r: number, g: number, b: number): number;
512
+ /** The dodge (or burn) transfer of one value `v` (0..1) at exposure `e` (0..1). */
513
+ declare function dodgeBurnCurve(v: number, e: number, range: ToneRange, burn: boolean): number;
514
+ /**
515
+ * Dodge (or burn) straight RGB `c` (0..1, written in place) at exposure `e`. With `protectTones`
516
+ * the curve moves luma and the colour is scaled to it (hue and saturation kept); otherwise each
517
+ * channel goes through the curve.
518
+ */
519
+ declare function dodgeBurn(c: number[], e: number, range: ToneRange, burn: boolean, protectTones: boolean): number[];
520
+ /** HSV saturation (chroma / max) of straight RGB. */
521
+ declare function saturationOf(r: number, g: number, b: number): number;
522
+ /**
523
+ * Sponge: moves straight RGB `c` (written in place) away from (`saturate`) or towards its luma
524
+ * grey by `amount` (0..1). `vibrance` damps it where it would clip: saturating touches already
525
+ * saturated colours less, desaturating touches near-greys less. Gamut-compressed, never clipped.
526
+ */
527
+ declare function sponge(c: number[], amount: number, saturate: boolean, vibrance: boolean): number[];
528
+ /** Per-dab strength so that one pass over a point totals about `e`, whatever the spacing. */
529
+ declare function perDabStrength(e: number, spacing: number): number;
530
+ /** Which pixels the Clone Stamp and the Healing tools sample. */
531
+ type RetouchSample = 'current' | 'current-below' | 'all';
532
+ declare const RETOUCH_SAMPLES: readonly RetouchSample[];
533
+ /** How the Spot Healing Brush finds its source. */
534
+ type SpotHealType = 'proximity-match' | 'smooth';
535
+ declare const SPOT_HEAL_TYPES: readonly SpotHealType[];
536
+ /** The retouching tools' options. */
537
+ interface RetouchSettings {
538
+ /** Clone / heal: keep the source offset from stroke to stroke (default true); off, every stroke starts at the source point. */
539
+ aligned: boolean;
540
+ /** Clone / heal / spot heal: what is sampled (default `current`: the target layer). */
541
+ sample: RetouchSample;
542
+ /** Spot heal: `proximity-match` (default: the best matching patch nearby) or `smooth` (a smooth fill from the edges). */
543
+ spotType: SpotHealType;
544
+ /** Dodge / burn: the tonal range (default `midtones`). */
545
+ range: ToneRange;
546
+ /** Dodge / burn: exposure 0..1 (default 0.5). */
547
+ exposure: number;
548
+ /** Dodge / burn: tone luma only, keeping hue and saturation (default true). */
549
+ protectTones: boolean;
550
+ /** Sponge: `desaturate` (default) or `saturate`. */
551
+ spongeMode: 'desaturate' | 'saturate';
552
+ /** Sponge: damp the change where colours would clip (default true). */
553
+ vibrance: boolean;
554
+ /** Smudge: how strongly the finger carries and lays paint, 0..1 (default 0.5). */
555
+ strength: number;
556
+ }
557
+ declare const DEFAULT_RETOUCH: Readonly<RetouchSettings>;
558
+ /** Retouch settings with every field valid (missing or invalid fields from `base`). */
559
+ declare function normalizeRetouch(raw?: Partial<RetouchSettings>, base?: RetouchSettings): RetouchSettings;
560
+ /** Pixels a retouching stroke samples, by document pixel. */
561
+ interface PixelSource {
562
+ /** Straight RGBA 0..255 of document pixel (x, y) into `out`; false (and `out` zeroed) where there is nothing. */
563
+ sample(x: number, y: number, out: number[]): boolean;
564
+ }
565
+ /**
566
+ * A source over raster tiles (layer pixels, a mask, or composite tiles): `readTile` gives tile
567
+ * (tx, ty) in source space or `null` when it is empty; source pixel = document pixel − `offset`.
568
+ * One-channel tiles read as grey (alpha 255). Tiles are cached, so make one per stroke.
569
+ */
570
+ declare class TilePixelSource implements PixelSource {
571
+ private readonly readTile;
572
+ readonly channels: 1 | 4;
573
+ readonly offset: {
574
+ x: number;
575
+ y: number;
576
+ };
577
+ private readonly cache;
578
+ private lastKey;
579
+ private last;
580
+ constructor(readTile: (tx: number, ty: number) => Uint8ClampedArray | null, channels: 1 | 4, offset?: {
581
+ x: number;
582
+ y: number;
583
+ });
584
+ sample(x: number, y: number, out: number[]): boolean;
585
+ }
586
+ /** A source over a region of float RGBA pixels (0..255), e.g. a healed patch. */
587
+ declare class RegionPixelSource implements PixelSource {
588
+ readonly rect: RasterRect;
589
+ readonly data: Float32Array;
590
+ constructor(rect: RasterRect, data: Float32Array);
591
+ sample(x: number, y: number, out: number[]): boolean;
592
+ }
593
+ /** `rect` of a source, shifted by (dx, dy), as float RGBA 0..255 (`rect.width × rect.height × 4`). */
594
+ declare function readSourceRegion(source: PixelSource, rect: RasterRect, dx?: number, dy?: number): Float32Array;
595
+ /** What a coverage-based retouching stroke lays through its coverage. */
596
+ type RetouchPaint =
597
+ /** Source pixels at document pixel + (dx, dy) (Clone Stamp, a healed patch). */
598
+ {
599
+ kind: 'source';
600
+ source: PixelSource;
601
+ dx: number;
602
+ dy: number;
603
+ }
604
+ /** The target pixel itself, toned (Dodge, Burn): `tone` edits straight RGB 0..1 in place. */
605
+ | {
606
+ kind: 'tone';
607
+ tone: (rgb: number[]) => void;
608
+ }
609
+ /** A flat colour (the Spot Healing Brush's trail while it is drawn), RGBA 0..255. */
610
+ | {
611
+ kind: 'color';
612
+ color: readonly [number, number, number, number];
613
+ };
614
+ /** How a coverage-based retouching stroke composites. */
615
+ interface RetouchApply {
616
+ /** Stroke opacity 0..1. */
617
+ opacity: number;
618
+ /** Blend mode for source paint (default normal). */
619
+ blend?: BlendMode;
620
+ lockTransparency: boolean;
621
+ /** Selection coverage (document space, canvas-sized), or `null`. */
622
+ selection: {
623
+ width: number;
624
+ height: number;
625
+ data: ArrayLike<number>;
626
+ } | null;
627
+ /** Layer offset (target pixels are in layer space). */
628
+ offset: {
629
+ x: number;
630
+ y: number;
631
+ };
632
+ }
633
+ /**
634
+ * Composites `paint` through the stroke's coverage over `tileData` (target tile (tx, ty) as it was
635
+ * before the stroke, layer space; RGBA, or one byte per pixel for masks) and returns the new tile.
636
+ * With `into` (the previous result) and `region` (document space), only `region` is recomputed.
637
+ * Tone paint keeps alpha; source and colour paint composite with `blend` (source-over by
638
+ * default), keeping alpha on a locked layer.
639
+ */
640
+ declare function applyRetouchToTile(coverage: CoverageMap, tileData: Uint8ClampedArray, channels: 1 | 4, tx: number, ty: number, paint: RetouchPaint, s: RetouchApply, options?: {
641
+ into?: Uint8ClampedArray;
642
+ region?: RasterRect;
643
+ }): Uint8ClampedArray;
644
+ /** The tone function of a Dodge or Burn stroke. */
645
+ declare function toneOf(tool: 'dodge' | 'burn', settings: Pick<RetouchSettings, 'exposure' | 'range' | 'protectTones'>): (rgb: number[]) => void;
646
+ /**
647
+ * Heals `src` into `dst` over `mask` (all `w × h`, RGBA floats 0..255): a seamless clone solved
648
+ * only over the mask's bounds plus a one-pixel fixed ring; elsewhere the result is `dst`.
649
+ */
650
+ declare function healPixels(w: number, h: number, src: Float32Array, dst: Float32Array, mask: ArrayLike<boolean | number>): Float32Array;
651
+ /**
652
+ * Spot healing: fills `hole` (`w × h`) of `img` (RGBA floats 0..255) with no given source, then
653
+ * heals the fill into its surroundings. `proximity-match` copies the best matching nearby patch
654
+ * (falling back to `smooth` when none fits); `smooth` interpolates the edges inwards. `size` is
655
+ * the brush diameter in pixels. Returns the healed pixels over the whole grid.
656
+ */
657
+ declare function spotHealPixels(w: number, h: number, img: Float32Array, hole: ArrayLike<boolean | number>, size: number, type: SpotHealType,
658
+ /** Told the patch offset it copied (`null`: a smooth fill). */
659
+ onOffset?: (offset: [number, number] | null) => void): Float32Array;
660
+ /** The window a Spot Healing stroke over `bounds` looks for texture in: the bounds grown by their size, on the canvas. */
661
+ declare function spotHealWindow(bounds: RasterRect, canvas: {
662
+ width: number;
663
+ height: number;
664
+ }): RasterRect;
665
+ /**
666
+ * One dab of a sequential retouching stroke: `cov` is the tip's pure coverage over `rect`
667
+ * (document space, 0..1); `d.alpha` is the flow and `d.opacity` the pressure opacity.
668
+ */
669
+ type RetouchDabEffect = (medium: TileMedium, d: Dab, rect: RasterRect, cov: Float32Array) => void;
670
+ /**
671
+ * A stroke whose dabs edit live tiles in order (Smudge, Sponge). Feed points with `push` (any
672
+ * chunks give the same dabs), end with `finish`; each returns the document rectangles it touched.
673
+ */
674
+ declare class RetouchDabStroke {
675
+ readonly brush: BrushSettings;
676
+ private readonly effect;
677
+ dabCount: number;
678
+ bounds: RasterRect | null;
679
+ private readonly walker;
680
+ private readonly medium;
681
+ private smoothPos;
682
+ private buf;
683
+ constructor(brush: BrushSettings, target: PaintTileTarget, effect: RetouchDabEffect);
684
+ push(points: readonly StrokePoint[]): RasterRect[];
685
+ finish(last?: StrokePoint): RasterRect[];
686
+ private smooth;
687
+ private paint;
688
+ }
689
+ /** The Smudge's per-dab effect: a `SmudgeTip` whose strength carries and lays the paint. */
690
+ declare function smudgeEffect(brush: BrushSettings, strength: number, mixing?: SmudgeSettings['mixing']): RetouchDabEffect;
691
+ /** The Sponge's per-dab effect: each dab moves saturation by about half its flow, compounding over passes. */
692
+ declare function spongeEffect(brush: BrushSettings, saturate: boolean, vibrance: boolean): RetouchDabEffect;
693
+ /**
694
+ * An RGBA view of one-channel tiles (masks), for the sequential-dab tools: reads expand grey to
695
+ * opaque RGB, writes land in RGBA copies, and `flush` writes their red channel back through
696
+ * `target.writeTile`. Alpha is locked, so a mask's values are all a dab changes.
697
+ */
698
+ declare function rgbaViewOfGrey(target: PaintTileTarget): {
699
+ target: PaintTileTarget;
700
+ flush(): void;
701
+ };
702
+
703
+ export { cleanMixer as $, type PixelSource as A, type BrushSettings as B, CoverageMap as C, type Dab as D, EMPTY_MIXER_LOAD as E, RETOUCH_SAMPLES as F, RegionPixelSource as G, type RetouchDabEffect as H, RetouchDabStroke as I, type RetouchSample as J, SPOT_HEAL_TYPES as K, type SmudgeDab as L, type MixerSettings as M, SmudgeTip as N, type SpotHealType as O, type PaintTileTarget as P, TileMedium as Q, type RgbTriple as R, type SmudgeSettings as S, TONE_RANGES as T, type TileMediumOptions as U, TilePixelSource as V, type ToneRange as W, applyRetouchToTile as X, applyStrokeToTile as Y, blendRadius as Z, blenderDab as _, type MixingModel as a, coverageTileCoord as a0, createBlenderScratch as a1, dabCoverage as a2, dabRect as a3, dodgeBurn as a4, dodgeBurnCurve as a5, exchangeRates as a6, healPixels as a7, loadMixer as a8, luma as a9, mixerRates as aa, normalizeBlender as ab, normalizeBrush as ac, normalizeMixer as ad, normalizeRetouch as ae, normalizeSmudge as af, perDabStrength as ag, rasterizeDab as ah, readSourceRegion as ai, rgbaViewOfGrey as aj, saturationOf as ak, smoothPoints as al, smudgeEffect as am, sponge as an, spongeEffect as ao, spotHealPixels as ap, spotHealWindow as aq, tipFalloff as ar, tipReach as as, tipShape as at, toneOf as au, walkDabs as av, type BlenderSettings as b, type StrokePoint as c, type MixerLoad as d, MAX_BRUSH_SIZE as e, type RetouchSettings as f, StrokeCoverage as g, type MixerTarget as h, MixerStroke as i, type RetouchApply as j, type RetouchPaint as k, type StrokeApply as l, type BlenderScratch as m, DEFAULT_BLENDER as n, DEFAULT_BRUSH as o, DEFAULT_MIXER as p, DEFAULT_RETOUCH as q, DEFAULT_SMUDGE as r, DabWalker as s, type ExchangeRates as t, MIXER_DRAIN as u, MIXER_PICKUP_RATE as v, MIXING_MODELS as w, PaintExchange as x, type PaintMedium as y, type PaintSample as z };