pixel-data-js 0.35.0 → 0.37.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 (84) hide show
  1. package/dist/index.prod.cjs +521 -326
  2. package/dist/index.prod.cjs.map +1 -1
  3. package/dist/index.prod.d.ts +132 -78
  4. package/dist/index.prod.js +513 -324
  5. package/dist/index.prod.js.map +1 -1
  6. package/package.json +2 -2
  7. package/src/Algorithm/floodFillSelection.ts +3 -2
  8. package/src/BlendModes/blend-modes-fast.ts +2 -1
  9. package/src/BlendModes/blend-modes-perfect.ts +2 -1
  10. package/src/Canvas/ReusableCanvas.ts +0 -5
  11. package/src/Color/_color-types.ts +8 -0
  12. package/src/Color/colorDistance.ts +9 -0
  13. package/src/Color/convert-color.ts +43 -0
  14. package/src/Color/lerpColor32.ts +44 -0
  15. package/src/Color/pack-color.ts +38 -0
  16. package/src/History/HistoryAction.ts +2 -2
  17. package/src/History/PixelAccumulator.ts +32 -13
  18. package/src/History/PixelMutator/mutatorApplyAlphaMask.ts +2 -0
  19. package/src/History/PixelMutator/mutatorApplyBinaryMask.ts +5 -1
  20. package/src/History/PixelMutator/mutatorApplyMask.ts +1 -0
  21. package/src/History/PixelMutator/mutatorBlendAlphaMask.ts +1 -0
  22. package/src/History/PixelMutator/mutatorBlendBinaryMask.ts +1 -0
  23. package/src/History/PixelMutator/mutatorBlendColor.ts +4 -1
  24. package/src/History/PixelMutator/mutatorBlendColorPaintAlphaMask.ts +2 -1
  25. package/src/History/PixelMutator/mutatorBlendColorPaintBinaryMask.ts +2 -1
  26. package/src/History/PixelMutator/mutatorBlendColorPaintMask.ts +24 -8
  27. package/src/History/PixelMutator/mutatorBlendColorPaintRect.ts +4 -1
  28. package/src/History/PixelMutator/mutatorBlendMask.ts +1 -0
  29. package/src/History/PixelMutator/mutatorBlendPixel.ts +3 -1
  30. package/src/History/PixelMutator/mutatorBlendPixelData.ts +1 -0
  31. package/src/History/PixelMutator/mutatorClear.ts +3 -2
  32. package/src/History/PixelMutator/mutatorFill.ts +54 -38
  33. package/src/History/PixelMutator/mutatorFillBinaryMask.ts +3 -2
  34. package/src/History/PixelMutator/mutatorInvert.ts +3 -2
  35. package/src/History/PixelMutator.ts +1 -2
  36. package/src/History/PixelWriter.ts +5 -5
  37. package/src/IndexedImage/IndexedImage.ts +1 -1
  38. package/src/IndexedImage/indexedImageToAverageColor.ts +3 -2
  39. package/src/Mask/_mask-types.ts +9 -0
  40. package/src/Paint/AlphaMaskPaintBuffer.ts +26 -26
  41. package/src/Paint/BinaryMaskPaintBuffer.ts +19 -19
  42. package/src/Paint/ColorPaintBuffer.ts +40 -42
  43. package/src/Paint/Commit/AlphaMaskPaintBufferCommitter.ts +1 -1
  44. package/src/Paint/Commit/AlphaMaskPaintBufferManager.ts +6 -7
  45. package/src/Paint/Commit/BinaryMaskPaintBufferCommitter.ts +1 -1
  46. package/src/Paint/Commit/BinaryMaskPaintBufferManager.ts +6 -7
  47. package/src/Paint/Commit/ColorPaintBufferManager.ts +6 -7
  48. package/src/Paint/Commit/commitColorPaintBuffer.ts +2 -6
  49. package/src/Paint/Commit/commitMaskPaintBuffer.ts +3 -7
  50. package/src/Paint/Render/AlphaMaskPaintBufferCanvasRenderer.ts +42 -25
  51. package/src/Paint/Render/BinaryMaskPaintBufferCanvasRenderer.ts +40 -24
  52. package/src/Paint/Render/ColorPaintBufferCanvasRenderer.ts +21 -21
  53. package/src/Paint/Render/PaintCursorRenderer.ts +12 -2
  54. package/src/Paint/eachTileInBounds.ts +9 -10
  55. package/src/PixelData/_pixelData-types.ts +7 -0
  56. package/src/PixelData/blendColorPixelData.ts +2 -1
  57. package/src/PixelData/blendColorPixelDataAlphaMask.ts +2 -1
  58. package/src/PixelData/blendColorPixelDataBinaryMask.ts +2 -1
  59. package/src/PixelData/blendColorPixelDataMask.ts +2 -1
  60. package/src/PixelData/blendColorPixelDataPaintAlphaMask.ts +1 -1
  61. package/src/PixelData/blendColorPixelDataPaintBinaryMask.ts +1 -1
  62. package/src/PixelData/blendColorPixelDataPaintMask.ts +19 -8
  63. package/src/PixelData/blendPixel.ts +2 -1
  64. package/src/PixelData/blendPixelData.ts +2 -1
  65. package/src/PixelData/blendPixelDataAlphaMask.ts +2 -1
  66. package/src/PixelData/blendPixelDataBinaryMask.ts +2 -1
  67. package/src/PixelData/blendPixelDataPaintBuffer.ts +2 -3
  68. package/src/PixelData/clearPixelDataFast.ts +1 -1
  69. package/src/PixelData/cropPixelData.ts +36 -0
  70. package/src/PixelData/fillPixelData.ts +7 -7
  71. package/src/PixelData/fillPixelDataBinaryMask.ts +1 -1
  72. package/src/PixelData/fillPixelDataFast.ts +1 -1
  73. package/src/PixelData/trimPixelData.ts +49 -0
  74. package/src/PixelData/writePaintBufferToPixelData.ts +1 -5
  75. package/src/Tile/MaskTile.ts +4 -0
  76. package/src/Tile/PixelTile.ts +2 -0
  77. package/src/Tile/TilePool.ts +9 -8
  78. package/src/Tile/TileTargetConfig.ts +27 -0
  79. package/src/Tile/_tile-types.ts +16 -0
  80. package/src/_types.ts +1 -6
  81. package/src/index.ts +9 -3
  82. package/src/History/PixelEngineConfig.ts +0 -28
  83. package/src/Internal/_constants.ts +0 -3
  84. package/src/color.ts +0 -112
@@ -7,6 +7,27 @@ declare namespace _errors {
7
7
  export { _errors_CANVAS_CTX_FAILED as CANVAS_CTX_FAILED, _errors_OFFSCREEN_CANVAS_CTX_FAILED as OFFSCREEN_CANVAS_CTX_FAILED };
8
8
  }
9
9
 
10
+ /** Represents a 32-bit color in 0xAABBGGRR (Little endian) */
11
+ type Color32 = number & {
12
+ readonly __brandColor32: unique symbol;
13
+ };
14
+ /** ALL values are 0-255 */
15
+ type RGBA = {
16
+ r: number;
17
+ g: number;
18
+ b: number;
19
+ a: number;
20
+ };
21
+ /** r, g, b are 0-255. a is 0-1 for css use */
22
+ type CssRGBA = {
23
+ r: number;
24
+ g: number;
25
+ b: number;
26
+ a: number;
27
+ } & {
28
+ readonly __brandCssRGBA: unique symbol;
29
+ };
30
+
10
31
  /** Rectangle definition */
11
32
  type Rect = {
12
33
  x: number;
@@ -68,6 +89,13 @@ type NullableBinaryMaskRect = Rect & ({
68
89
  type?: null;
69
90
  data?: null;
70
91
  });
92
+ type NullableAlphaMaskRect = Rect & ({
93
+ type: MaskType.ALPHA;
94
+ data: Uint8Array;
95
+ } | {
96
+ type?: null;
97
+ data?: null;
98
+ });
71
99
  type NullableMaskRect = Rect & ({
72
100
  type: MaskType;
73
101
  data: Uint8Array;
@@ -76,17 +104,6 @@ type NullableMaskRect = Rect & ({
76
104
  data?: null;
77
105
  });
78
106
 
79
- /** ALL values are 0-255 (including alpha which in CSS is 0-1) */
80
- type RGBA = {
81
- r: number;
82
- g: number;
83
- b: number;
84
- a: number;
85
- };
86
- /** Represents a 32-bit color in 0xAABBGGRR (Little endian) */
87
- type Color32 = number & {
88
- readonly __brandColor32: unique symbol;
89
- };
90
107
  /**
91
108
  * A function that defines how to combine a source color with a destination color.
92
109
  * @param src - The incoming color (source).
@@ -221,6 +238,12 @@ interface MutablePixelData32 {
221
238
  interface PixelData<T extends ImageDataLike = ImageData> extends PixelData32 {
222
239
  readonly imageData: T;
223
240
  }
241
+ interface MutablePixelData<T extends ImageDataLike = ImageData> extends PixelData32 {
242
+ imageData: T;
243
+ data: Uint32Array;
244
+ w: number;
245
+ h: number;
246
+ }
224
247
 
225
248
  type FloodFillResult = BinaryMaskRect & {
226
249
  startX: number;
@@ -358,12 +381,12 @@ declare function makeFastBlendModeRegistry(name?: string): {
358
381
  readonly destinationAtop: BlendColor32;
359
382
  readonly xor: BlendColor32;
360
383
  };
361
- nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
362
- blendToIndex: Map<BlendColor32, 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
384
+ nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 8 | 16 | 24 | 2 | 4 | 1 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
385
+ blendToIndex: Map<BlendColor32, 0 | 8 | 16 | 24 | 2 | 4 | 1 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
363
386
  blendToName: Map<BlendColor32, "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor">;
364
387
  indexToBlend: BlendColor32[];
365
388
  indexToName: ("overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor")[];
366
- indexType: 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30;
389
+ indexType: 0 | 8 | 16 | 24 | 2 | 4 | 1 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30;
367
390
  nameType: "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor";
368
391
  };
369
392
 
@@ -457,12 +480,12 @@ declare function makePerfectBlendModeRegistry(name?: string): {
457
480
  readonly destinationAtop: BlendColor32;
458
481
  readonly xor: BlendColor32;
459
482
  };
460
- nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
461
- blendToIndex: Map<BlendColor32, 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
483
+ nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 8 | 16 | 24 | 2 | 4 | 1 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
484
+ blendToIndex: Map<BlendColor32, 0 | 8 | 16 | 24 | 2 | 4 | 1 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
462
485
  blendToName: Map<BlendColor32, "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor">;
463
486
  indexToBlend: BlendColor32[];
464
487
  indexToName: ("overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor")[];
465
- indexType: 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30;
488
+ indexType: 0 | 8 | 16 | 24 | 2 | 4 | 1 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30;
466
489
  nameType: "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor";
467
490
  };
468
491
 
@@ -639,19 +662,6 @@ declare function writeImageDataToClipboard(imageData: ImageData): Promise<void>;
639
662
  */
640
663
  declare function writeImgBlobToClipboard(blob: Blob): Promise<void>;
641
664
 
642
- /**
643
- * Packs RGBA into a 32-bit integer compatible with
644
- * Little-Endian Uint32Array views on ImageData.
645
- */
646
- declare function packColor(r: number, g: number, b: number, a: number): Color32;
647
- declare function packRGBA({ r, g, b, a }: RGBA): Color32;
648
- declare const unpackRed: (packed: Color32) => number;
649
- declare const unpackGreen: (packed: Color32) => number;
650
- declare const unpackBlue: (packed: Color32) => number;
651
- declare const unpackAlpha: (packed: Color32) => number;
652
- declare function unpackColor(packed: Color32): RGBA;
653
- declare function unpackColorTo(packed: Color32, scratch?: RGBA): RGBA;
654
- declare function colorDistance(a: Color32, b: Color32): number;
655
665
  /**
656
666
  * Linearly interpolates between two 32-bit colors using a floating-point weight.
657
667
  * * This is the preferred method for UI animations or scenarios where high
@@ -672,13 +682,30 @@ declare function lerpColor32(a: Color32, b: Color32, t: number): Color32;
672
682
  * @param dst - The destination (background) color as a 32-bit integer.
673
683
  * @param w - The blend weight as a byte value from 0 to 255. Where 0 is 100% dst and 255 is 100% src
674
684
  * @returns The blended 32-bit color.
675
- */ declare function lerpColor32Fast(src: Color32, dst: Color32, w: number): Color32;
685
+ */
686
+ declare function lerpColor32Fast(src: Color32, dst: Color32, w: number): Color32;
687
+
676
688
  declare function color32ToHex(color: Color32): string;
677
689
  /**
678
690
  * Converts a 32-bit integer (0xAABBGGRR) to a CSS rgba() string.
679
691
  * Example: 0xFF0000FF -> "rgba(255,0,0,1)"
680
692
  */
681
- declare function color32ToCssRGBA(color: Color32): string;
693
+ declare function color32ToCssRGBAString(color: Color32): string;
694
+ declare function color32ToCssRGBA(color: Color32): CssRGBA;
695
+ declare function cssRGBAToColor32({ r, g, b, a }: CssRGBA): Color32;
696
+
697
+ /**
698
+ * Packs RGBA into a 32-bit integer compatible with
699
+ * Little-Endian Uint32Array views on ImageData.
700
+ */
701
+ declare function packColor(r: number, g: number, b: number, a: number): Color32;
702
+ declare function packRGBA({ r, g, b, a }: RGBA): Color32;
703
+ declare const unpackRed: (packed: Color32) => number;
704
+ declare const unpackGreen: (packed: Color32) => number;
705
+ declare const unpackBlue: (packed: Color32) => number;
706
+ declare const unpackAlpha: (packed: Color32) => number;
707
+ declare function unpackColor(packed: Color32): RGBA;
708
+ declare function unpackColorTo(packed: Color32, scratch?: RGBA): RGBA;
682
709
 
683
710
  type BatchedQueueFn = (fn: () => void) => void;
684
711
  type BatchedQueue = ReturnType<typeof makeBatchedQueue>;
@@ -748,6 +775,8 @@ interface BaseTile {
748
775
  id: number;
749
776
  tx: number;
750
777
  ty: number;
778
+ x: number;
779
+ y: number;
751
780
  }
752
781
  interface PixelTile extends PixelData, BaseTile {
753
782
  }
@@ -757,24 +786,25 @@ interface BinaryMaskTile extends BinaryMask, BaseTile {
757
786
  }
758
787
  type Tile = PixelTile | AlphaMaskTile | BinaryMaskTile;
759
788
  type TileFactory<T extends Tile> = (id: number, tx: number, ty: number, tileSize: number, tileArea: number) => T;
760
-
761
- declare class PixelEngineConfig {
762
- readonly tileSize: number;
763
- readonly tileShift: number;
764
- readonly tileMask: number;
789
+ interface TileTargetMeta {
765
790
  readonly tileArea: number;
766
- readonly target: PixelData;
767
791
  readonly targetColumns: number;
768
792
  readonly targetRows: number;
769
- constructor(tileSize: number, target: PixelData);
793
+ readonly targetWidth: number;
794
+ readonly targetHeight: number;
795
+ readonly tileSize: number;
796
+ readonly invTileSize: number;
797
+ }
798
+ interface TileTargetConfig extends TileTargetMeta {
799
+ readonly target: PixelData;
770
800
  }
771
801
 
772
802
  declare class TilePool<T extends Tile> {
773
- private tileFactory;
803
+ protected tileSize: number;
804
+ protected tileFactory: TileFactory<T>;
774
805
  pool: T[];
775
- private tileSize;
776
- private tileArea;
777
- constructor(config: PixelEngineConfig, tileFactory: TileFactory<T>);
806
+ protected tileArea: number;
807
+ constructor(tileSize: number, tileFactory: TileFactory<T>);
778
808
  getTile(id: number, tx: number, ty: number): T;
779
809
  releaseTile(tile: T): void;
780
810
  releaseTiles(tiles: (T | undefined)[]): void;
@@ -788,24 +818,24 @@ declare function applyPatchTiles(target: PixelData32, tiles: PixelTile[], tileSi
788
818
 
789
819
  type DidChangeFn = (didChange: boolean) => boolean;
790
820
  declare class PixelAccumulator {
791
- readonly config: PixelEngineConfig;
821
+ readonly config: TileTargetConfig;
792
822
  readonly pixelTilePool: TilePool<PixelTile>;
793
823
  lookup: (PixelTile | undefined)[];
794
824
  beforeTiles: PixelTile[];
795
- constructor(config: PixelEngineConfig, pixelTilePool: TilePool<PixelTile>);
825
+ constructor(config: TileTargetConfig, pixelTilePool: TilePool<PixelTile>);
796
826
  recyclePatch(patch: PixelPatchTiles): void;
797
827
  /**
798
828
  * @param x pixel x coordinate
799
829
  * @param y pixel y coordinate
800
830
  */
801
- storePixelBeforeState(x: number, y: number): DidChangeFn;
831
+ storePixelBeforeState(x: number, y: number): DidChangeFn | null;
802
832
  /**
803
833
  * @param x pixel x coordinate
804
834
  * @param y pixel y coordinate
805
835
  * @param w pixel width
806
836
  * @param h pixel height
807
837
  */
808
- storeRegionBeforeState(x: number, y: number, w: number, h: number): DidChangeFn;
838
+ storeRegionBeforeState(x: number, y: number, w: number, h: number): DidChangeFn | null;
809
839
  storeTileBeforeState(id: number, tx: number, ty: number): DidChangeFn;
810
840
  extractState(tile: PixelTile): void;
811
841
  extractPatch(): PixelPatchTiles;
@@ -818,7 +848,7 @@ interface HistoryAction {
818
848
  dispose?: () => void;
819
849
  }
820
850
  type HistoryActionFactory = typeof makeHistoryAction;
821
- declare function makeHistoryAction(config: PixelEngineConfig, accumulator: PixelAccumulator, patch: PixelPatchTiles, afterUndo?: (patch: PixelPatchTiles) => void, afterRedo?: (patch: PixelPatchTiles) => void, applyPatchTilesFn?: typeof applyPatchTiles): HistoryAction;
851
+ declare function makeHistoryAction(config: TileTargetConfig, accumulator: PixelAccumulator, patch: PixelPatchTiles, afterUndo?: (patch: PixelPatchTiles) => void, afterRedo?: (patch: PixelPatchTiles) => void, applyPatchTilesFn?: typeof applyPatchTiles): HistoryAction;
822
852
 
823
853
  declare class HistoryManager {
824
854
  maxSteps: number;
@@ -900,7 +930,7 @@ declare class PixelWriter<M> {
900
930
  readonly historyManager: HistoryManager;
901
931
  readonly accumulator: PixelAccumulator;
902
932
  readonly historyActionFactory: HistoryActionFactory;
903
- readonly config: PixelEngineConfig;
933
+ readonly config: TileTargetConfig;
904
934
  readonly pixelTilePool: TilePool<PixelTile>;
905
935
  readonly mutator: M;
906
936
  private _inProgress;
@@ -926,15 +956,17 @@ type HistoryMutator<T extends {}, D extends {}> = (writer: PixelWriter<any>, dep
926
956
 
927
957
  declare function makeFullPixelMutator(writer: PixelWriter<any>): {
928
958
  invert(opts?: PixelMutateOptions): boolean;
929
- fillRect(color: Color32, rect: Rect): boolean;
930
959
  fillBinaryMask(color: Color32, mask: BinaryMask, x?: number, y?: number): boolean;
931
- fill(color: Color32, x?: number, y?: number, w?: number, h?: number): boolean;
960
+ fill: {
961
+ (color: Color32, rect?: Partial<Rect>): boolean;
962
+ (color: Color32, x: number, y: number, w: number, h: number): boolean;
963
+ };
932
964
  clear(rect?: Partial<Rect>): boolean;
933
965
  blendPixelData(src: PixelData32, opts?: PixelBlendOptions): boolean;
934
966
  blendPixel(x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
935
967
  blendMask(src: PixelData32, mask: Mask, opts?: PixelBlendMaskOptions): boolean;
936
968
  blendColorPaintRect(color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha?: number, blendFn?: BlendColor32): boolean;
937
- blendColorPaintMask(color: Color32, mask: PaintMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
969
+ blendColorPaintMask(color: Color32, mask: PaintMask | PaintRect, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
938
970
  blendColorPaintBinaryMask(color: Color32, mask: PaintBinaryMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
939
971
  blendColorPaintAlphaMask(color: Color32, mask: PaintAlphaMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
940
972
  blendColor(color: Color32, opts?: ColorBlendOptions): boolean;
@@ -1117,13 +1149,14 @@ declare const mutatorBlendColorPaintBinaryMask: (writer: PixelWriter<any>, deps?
1117
1149
  declare const defaults$8: {
1118
1150
  blendColorPixelDataAlphaMask: typeof blendColorPixelDataAlphaMask;
1119
1151
  blendColorPixelDataBinaryMask: typeof blendColorPixelDataBinaryMask;
1152
+ blendColorPixelData: typeof blendColorPixelData;
1120
1153
  };
1121
1154
  type Deps$8 = Partial<typeof defaults$8>;
1122
1155
  /**
1123
1156
  * @param deps - @hidden
1124
1157
  */
1125
1158
  declare const mutatorBlendColorPaintMask: (writer: PixelWriter<any>, deps?: Partial<Deps$8>) => {
1126
- blendColorPaintMask(color: Color32, mask: PaintMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1159
+ blendColorPaintMask(color: Color32, mask: PaintMask | PaintRect, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1127
1160
  };
1128
1161
 
1129
1162
  declare const defaults$7: {
@@ -1227,13 +1260,10 @@ type Deps$2 = Partial<typeof defaults$2>;
1227
1260
  * @param deps - @hidden
1228
1261
  */
1229
1262
  declare const mutatorFill: (writer: PixelWriter<any>, deps?: Deps$2) => {
1230
- fill(color: Color32, x?: number, y?: number, w?: number, h?: number): boolean;
1231
- };
1232
- /**
1233
- * @param deps - @hidden
1234
- */
1235
- declare const mutatorFillRect: (writer: PixelWriter<any>, deps?: Deps$2) => {
1236
- fillRect(color: Color32, rect: Rect): boolean;
1263
+ fill: {
1264
+ (color: Color32, rect?: Partial<Rect>): boolean;
1265
+ (color: Color32, x: number, y: number, w: number, h: number): boolean;
1266
+ };
1237
1267
  };
1238
1268
 
1239
1269
  /**
@@ -1705,14 +1735,14 @@ declare function mergeBinaryMaskRects(current: NullableBinaryMaskRect[], adding:
1705
1735
  declare function subtractBinaryMaskRects(current: NullableBinaryMaskRect[], subtracting: NullableBinaryMaskRect[]): NullableBinaryMaskRect[];
1706
1736
 
1707
1737
  declare class AlphaMaskPaintBuffer {
1708
- readonly config: PixelEngineConfig;
1738
+ readonly config: TileTargetMeta;
1709
1739
  readonly tilePool: TilePool<AlphaMaskTile>;
1710
1740
  readonly lookup: (AlphaMaskTile | undefined)[];
1711
1741
  private readonly scratchBounds;
1712
1742
  private forEachLinePointFn;
1713
1743
  private trimRectBoundsFn;
1714
1744
  private eachTileInBoundsFn;
1715
- constructor(config: PixelEngineConfig, tilePool: TilePool<AlphaMaskTile>);
1745
+ constructor(config: TileTargetMeta, tilePool?: TilePool<AlphaMaskTile>);
1716
1746
  paintAlphaMask(brush: PaintAlphaMask, x: number, y: number): boolean;
1717
1747
  paintAlphaMask(brush: PaintAlphaMask, startX: number, startY: number, endX: number, endY: number): boolean;
1718
1748
  paintBinaryMask(brush: PaintBinaryMask, alpha: number, x: number, y: number): boolean;
@@ -1723,14 +1753,14 @@ declare class AlphaMaskPaintBuffer {
1723
1753
  }
1724
1754
 
1725
1755
  declare class BinaryMaskPaintBuffer {
1726
- readonly config: PixelEngineConfig;
1756
+ readonly config: TileTargetMeta;
1727
1757
  readonly tilePool: TilePool<BinaryMaskTile>;
1728
1758
  readonly lookup: (BinaryMaskTile | undefined)[];
1729
1759
  private readonly scratchBounds;
1730
1760
  private forEachLinePointFn;
1731
1761
  private trimRectBoundsFn;
1732
1762
  private eachTileInBoundsFn;
1733
- constructor(config: PixelEngineConfig, tilePool: TilePool<BinaryMaskTile>);
1763
+ constructor(config: TileTargetMeta, tilePool?: TilePool<BinaryMaskTile>);
1734
1764
  paintBinaryMask(brush: PaintBinaryMask, x: number, y: number): boolean;
1735
1765
  paintBinaryMask(brush: PaintBinaryMask, startX: number, startY: number, endX: number, endY: number): boolean;
1736
1766
  paintRect(brush: PaintRect, x: number, y: number): boolean;
@@ -1739,11 +1769,11 @@ declare class BinaryMaskPaintBuffer {
1739
1769
  }
1740
1770
 
1741
1771
  declare class ColorPaintBuffer {
1742
- readonly config: PixelEngineConfig;
1772
+ readonly config: TileTargetMeta;
1743
1773
  readonly tilePool: TilePool<PixelTile>;
1744
1774
  readonly lookup: (PixelTile | undefined)[];
1745
1775
  private readonly scratchBounds;
1746
- constructor(config: PixelEngineConfig, tilePool: TilePool<PixelTile>);
1776
+ constructor(config: TileTargetMeta, tilePool: TilePool<PixelTile>);
1747
1777
  paintAlphaMask(color: Color32, brush: PaintAlphaMask, x: number, y: number): boolean;
1748
1778
  paintAlphaMask(color: Color32, brush: PaintAlphaMask, startX: number, startY: number, endX: number, endY: number): boolean;
1749
1779
  paintBinaryMask(color: Color32, brush: PaintBinaryMask, x: number, y: number): boolean;
@@ -1756,45 +1786,54 @@ declare class ColorPaintBuffer {
1756
1786
  declare function makeAlphaMaskPaintBufferCommitter(accumulator: PixelAccumulator, paintBuffer: AlphaMaskPaintBuffer): (color: Color32, alpha?: number, blendFn?: BlendColor32) => void;
1757
1787
 
1758
1788
  type AlphaMaskPaintBufferCanvasRenderer = ReturnType<typeof makeAlphaMaskPaintBufferCanvasRenderer>;
1759
- declare function makeAlphaMaskPaintBufferCanvasRenderer(paintBuffer: AlphaMaskPaintBuffer, canvasFactory?: CanvasObjectFactory<any>): (targetCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, color: Color32, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1789
+ declare function makeAlphaMaskPaintBufferCanvasRenderer<T extends HTMLCanvasElement | OffscreenCanvas>(paintBuffer: AlphaMaskPaintBuffer, reusableCanvasFactory?: () => ReusableCanvasFactory<T>): {
1790
+ draw: (targetCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, color: Color32, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1791
+ setBuffer: (value: AlphaMaskPaintBuffer) => void;
1792
+ };
1760
1793
 
1761
1794
  type AlphaMaskPaintBufferManager = Pick<AlphaMaskPaintBuffer, 'paintAlphaMask' | 'paintBinaryMask' | 'paintRect'> & {
1762
1795
  commit: ReturnType<typeof makeAlphaMaskPaintBufferCommitter>;
1763
- draw: ReturnType<typeof makeAlphaMaskPaintBufferCanvasRenderer>;
1796
+ renderer: ReturnType<typeof makeAlphaMaskPaintBufferCanvasRenderer>;
1764
1797
  clear: () => void;
1765
1798
  };
1766
- declare function makeAlphaMaskPaintBufferManager(writer: Pick<PixelWriter<any>, 'accumulator' | 'config'>, canvasFactory?: CanvasObjectFactory<any>): AlphaMaskPaintBufferManager;
1799
+ declare function makeAlphaMaskPaintBufferManager(writer: Pick<PixelWriter<any>, 'accumulator' | 'config'>, reusableCanvasFactory?: () => ReusableCanvasFactory<any>): AlphaMaskPaintBufferManager;
1767
1800
 
1768
1801
  declare function makeBinaryMaskPaintBufferCommitter(accumulator: PixelAccumulator, paintBuffer: BinaryMaskPaintBuffer): (color: Color32, alpha?: number, blendFn?: BlendColor32) => void;
1769
1802
 
1770
1803
  type BinaryMaskPaintBufferCanvasRenderer = ReturnType<typeof makeBinaryMaskPaintBufferCanvasRenderer>;
1771
- declare function makeBinaryMaskPaintBufferCanvasRenderer(paintBuffer: BinaryMaskPaintBuffer, canvasFactory?: CanvasObjectFactory<any>): (targetCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, color: Color32, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1804
+ declare function makeBinaryMaskPaintBufferCanvasRenderer<T extends HTMLCanvasElement | OffscreenCanvas>(paintBuffer: BinaryMaskPaintBuffer, reusableCanvasFactory?: () => ReusableCanvasFactory<T>): {
1805
+ draw: (targetCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, color: Color32, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1806
+ setBuffer: (value: BinaryMaskPaintBuffer) => void;
1807
+ };
1772
1808
 
1773
1809
  type BinaryMaskPaintBufferManager = Pick<BinaryMaskPaintBuffer, 'paintBinaryMask' | 'paintRect'> & {
1774
1810
  commit: ReturnType<typeof makeBinaryMaskPaintBufferCommitter>;
1775
- draw: ReturnType<typeof makeBinaryMaskPaintBufferCanvasRenderer>;
1811
+ renderer: ReturnType<typeof makeBinaryMaskPaintBufferCanvasRenderer>;
1776
1812
  clear: () => void;
1777
1813
  };
1778
- declare function makeBinaryMaskPaintBufferManager(writer: Pick<PixelWriter<any>, 'accumulator' | 'config'>, canvasFactory?: CanvasObjectFactory<any>): BinaryMaskPaintBufferManager;
1814
+ declare function makeBinaryMaskPaintBufferManager(writer: Pick<PixelWriter<any>, 'accumulator' | 'config'>, reusableCanvasFactory?: () => ReusableCanvasFactory<any>): BinaryMaskPaintBufferManager;
1779
1815
 
1780
1816
  declare function makeColorPaintBufferCommitter(accumulator: PixelAccumulator, paintBuffer: ColorPaintBuffer): (alpha?: number, blendFn?: BlendColor32) => void;
1781
1817
 
1782
1818
  type ColorPaintBufferCanvasRenderer = ReturnType<typeof makeColorPaintBufferCanvasRenderer>;
1783
- declare function makeColorPaintBufferCanvasRenderer(paintBuffer: ColorPaintBuffer, canvasFactory?: CanvasObjectFactory<any>): (targetCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1819
+ declare function makeColorPaintBufferCanvasRenderer<T extends HTMLCanvasElement | OffscreenCanvas>(paintBuffer: ColorPaintBuffer, reusableCanvasFactory?: () => ReusableCanvasFactory<T>): {
1820
+ draw: (targetCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1821
+ setBuffer(value: ColorPaintBuffer): void;
1822
+ };
1784
1823
 
1785
1824
  type ColorPaintBufferManager = Pick<ColorPaintBuffer, 'paintAlphaMask' | 'paintBinaryMask' | 'paintRect'> & {
1786
1825
  commit: ReturnType<typeof makeColorPaintBufferCommitter>;
1787
- draw: ReturnType<typeof makeColorPaintBufferCanvasRenderer>;
1826
+ renderer: ReturnType<typeof makeColorPaintBufferCanvasRenderer>;
1788
1827
  clear: () => void;
1789
1828
  };
1790
- declare function makeColorPaintBufferManager(writer: Pick<PixelWriter<any>, 'accumulator' | 'config'>, canvasFactory?: CanvasObjectFactory<any>): ColorPaintBufferManager;
1829
+ declare function makeColorPaintBufferManager(writer: Pick<PixelWriter<any>, 'accumulator' | 'config'>, reusableCanvasFactory?: () => ReusableCanvasFactory<any>): ColorPaintBufferManager;
1791
1830
 
1792
1831
  declare function commitColorPaintBuffer(accumulator: PixelAccumulator, paintBuffer: ColorPaintBuffer, alpha?: number, blendFn?: BlendColor32, blendPixelDataFn?: typeof blendPixelData): void;
1793
1832
 
1794
1833
  declare function commitMaskPaintBuffer(accumulator: PixelAccumulator, paintBuffer: BinaryMaskPaintBuffer, color: Color32, alpha: number | undefined, blendFn: typeof sourceOverPerfect | undefined, blendColorPixelDataMaskFn: typeof blendColorPixelDataBinaryMask): void;
1795
1834
  declare function commitMaskPaintBuffer(accumulator: PixelAccumulator, paintBuffer: AlphaMaskPaintBuffer, color: Color32, alpha: number | undefined, blendFn: typeof sourceOverPerfect | undefined, blendColorPixelDataMaskFn: typeof blendColorPixelDataAlphaMask): void;
1796
1835
 
1797
- declare function eachTileInBounds<T extends Tile>(config: PixelEngineConfig, lookup: (T | undefined)[], tilePool: TilePool<T>, bounds: Rect, callback: (tile: T, bX: number, bY: number, bW: number, bH: number) => void): void;
1836
+ declare function eachTileInBounds<T extends Tile>(config: TileTargetMeta, lookup: (T | undefined)[], tilePool: TilePool<T>, bounds: Rect, callback: (tile: T, bX: number, bY: number, bW: number, bH: number) => void): void;
1798
1837
 
1799
1838
  declare function makeCirclePaintAlphaMask(size: number, fallOff?: (d: number) => number): PaintAlphaMask;
1800
1839
  declare function makeCirclePaintBinaryMask(size: number): PaintBinaryMask;
@@ -1812,6 +1851,7 @@ declare function makePaintCursorRenderer<T extends HTMLCanvasElement | Offscreen
1812
1851
  getBounds: (centerX: number, centerY: number) => Rect;
1813
1852
  getBoundsScaled: (centerX: number, centerY: number) => Rect;
1814
1853
  draw: (drawCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, centerX: number, centerY: number) => void;
1854
+ drawRaw: (drawCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, x: number, y: number) => void;
1815
1855
  getSettings: () => {
1816
1856
  color: Color32;
1817
1857
  scale: number;
@@ -1827,7 +1867,7 @@ declare function blendColorPixelDataPaintAlphaMask(dst: PixelData32, color: Colo
1827
1867
 
1828
1868
  declare function blendColorPixelDataPaintBinaryMask(dst: PixelData32, color: Color32, mask: PaintBinaryMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1829
1869
 
1830
- declare function blendColorPixelDataPaintMask(dst: PixelData32, color: Color32, mask: PaintMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1870
+ declare function blendColorPixelDataPaintMask(target: PixelData32, color: Color32, mask: PaintMask | PaintRect, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1831
1871
 
1832
1872
  declare function blendPixelDataMask(target: PixelData32, src: PixelData32, mask: Mask, opts?: PixelBlendMaskOptions): boolean;
1833
1873
 
@@ -1841,6 +1881,8 @@ declare function clearPixelDataFast(dst: PixelData32, rect?: Partial<BinaryMaskR
1841
1881
 
1842
1882
  declare function copyPixelData<T extends ImageDataLike = ImageData>(target: PixelData<T>): PixelData;
1843
1883
 
1884
+ declare function cropPixelData(src: PixelData32, x: number, y: number, w: number, h: number, out?: MutablePixelData): PixelData;
1885
+
1844
1886
  /**
1845
1887
  * High-level extraction that returns a new PixelData instance.
1846
1888
  * Leverages extractPixelDataBuffer for optimized 32-bit memory moves.
@@ -1927,6 +1969,10 @@ declare function makeReusablePixelData(): (width: number, height: number) => Pix
1927
1969
  */
1928
1970
  declare function rotatePixelData(pixelData: PixelData): void;
1929
1971
 
1972
+ declare function getPixelDataTransparentTrimmedBounds(target: PixelData32): Rect | null;
1973
+ declare function trimTransparentPixelData(target: PixelData32): PixelData;
1974
+ declare function trimTransparentPixelDataInPlace(target: MutablePixelData): void;
1975
+
1930
1976
  declare function uInt32ArrayToPixelData(data: Uint32Array, width: number, height: number): PixelData;
1931
1977
 
1932
1978
  /**
@@ -1985,4 +2031,12 @@ declare const makeBinaryMaskTile: TileFactory<BinaryMaskTile>;
1985
2031
 
1986
2032
  declare function makePixelTile(id: number, tx: number, ty: number, tileSize: number, tileArea: number): PixelTile;
1987
2033
 
1988
- export { type AlphaMask, AlphaMaskPaintBuffer, type AlphaMaskPaintBufferCanvasRenderer, type AlphaMaskPaintBufferManager, type AlphaMaskRect, type AlphaMaskTile, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BaseMask, type BasePixelBlendOptions, type BatchedQueue, type BatchedQueueFn, type BinaryMask, BinaryMaskPaintBuffer, type BinaryMaskPaintBufferCanvasRenderer, type BinaryMaskPaintBufferManager, type BinaryMaskRect, type BinaryMaskTile, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type CanvasObjectFactory, type CanvasPixelDataRenderer, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, ColorPaintBuffer, type ColorPaintBufferCanvasRenderer, type ColorPaintBufferManager, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, _errors as ERRORS, type FloodFillResult, type HistoryAction, type HistoryActionFactory, HistoryManager, type HistoryMutator, type ImageDataLike, type IndexedImage, type InvertMask, type Mask, type MaskOffset, type MaskRect, MaskType, type MergeAlphaMasksOptions, type MutableAlphaMask, type MutableBinaryMask, type MutableMask, type MutablePixelData32, type NullableBinaryMaskRect, type NullableMaskRect, type PaintAlphaMask, type PaintBinaryMask, type PaintBrush, type PaintCursorRenderer, type PaintMask, PaintMaskOutline, type PaintRect, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, type PixelCanvas, type PixelData, type PixelData32, PixelEngineConfig, type PixelMutateOptions, type PixelPatchTiles, type PixelRect, type PixelTile, PixelWriter, type PixelWriterOptions, type RGBA, type Rect, type RequiredBlendModes, type ReusableCanvas, type ReusableCanvasFactory, type ReusableImageData, type ReusablePixelData, type SerializedImageData, type Tile, type TileFactory, TilePool, TileType, UnsupportedFormatError, _macro_imageDataToUint32Array, applyAlphaMaskToPixelData, applyBinaryMaskToAlphaMask, applyBinaryMaskToPixelData, applyMaskToPixelData, applyPatchTiles, base64DecodeArrayBuffer, base64EncodeArrayBuffer, blendColorPixelData, blendColorPixelDataAlphaMask, blendColorPixelDataBinaryMask, blendColorPixelDataMask, blendColorPixelDataPaintAlphaMask, blendColorPixelDataPaintBinaryMask, blendColorPixelDataPaintMask, blendPixel, blendPixelData, blendPixelDataAlphaMask, blendPixelDataBinaryMask, blendPixelDataMask, blendPixelDataPaintBuffer, clearPixelDataFast, color32ToCssRGBA, color32ToHex, colorBurnFast, colorBurnPerfect, colorDistance, colorDodgeFast, colorDodgePerfect, commitColorPaintBuffer, commitMaskPaintBuffer, copyImageData, copyImageDataLike, copyMask, copyPixelData, darkenFast, darkenPerfect, darkerFast, darkerPerfect, deserializeImageData, deserializeNullableImageData, deserializeRawImageData, destinationAtopFast, destinationAtopPerfect, destinationInFast, destinationInPerfect, destinationOutFast, destinationOutPerfect, destinationOverFast, destinationOverPerfect, differenceFast, differencePerfect, divideFast, dividePerfect, eachTileInBounds, exclusionFast, exclusionPerfect, extractImageData, extractImageDataBuffer, extractMask, extractMaskBuffer, extractPixelData, extractPixelDataBuffer, fileInputChangeToImageData, fileToImageData, fillPixelData, fillPixelDataBinaryMask, fillPixelDataFast, floodFillSelection, forEachLinePoint, getImageDataFromClipboard, getIndexedImageColor, getIndexedImageColorCounts, getRectsBounds, getSupportedPixelFormats, hardLightFast, hardLightPerfect, hardMixFast, hardMixPerfect, imageDataToAlphaMaskBuffer, imageDataToDataUrl, imageDataToImgBlob, imageDataToUint32Array, imgBlobToImageData, indexedImageToAverageColor, indexedImageToImageData, invertAlphaMask, invertBinaryMask, invertImageData, invertPixelData, lerpColor32, lerpColor32Fast, lightenFast, lightenPerfect, lighterFast, lighterPerfect, linearBurnFast, linearBurnPerfect, linearDodgeFast, linearDodgePerfect, linearLightFast, linearLightPerfect, makeAlphaMask, makeAlphaMaskPaintBufferCanvasRenderer, makeAlphaMaskPaintBufferCommitter, makeAlphaMaskPaintBufferManager, makeAlphaMaskTile, makeBatchedQueue, makeBinaryMask, makeBinaryMaskFromAlphaMask, makeBinaryMaskOutline, makeBinaryMaskPaintBufferCanvasRenderer, makeBinaryMaskPaintBufferCommitter, makeBinaryMaskPaintBufferManager, makeBinaryMaskTile, makeBlendModeRegistry, makeCanvasFrameRenderer, makeCanvasPixelDataRenderer, makeCircleBinaryMaskOutline, makeCirclePaintAlphaMask, makeCirclePaintBinaryMask, makeColorPaintBufferCanvasRenderer, makeColorPaintBufferCommitter, makeColorPaintBufferManager, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makeIndexedImage, makeIndexedImageFromImageData, makeIndexedImageFromImageDataRaw, makePaintAlphaMask, makePaintBinaryMask, makePaintCursorRenderer, makePaintRect, makePerfectBlendModeRegistry, makePixelCanvas, makePixelData, makePixelTile, makeRectBinaryMaskOutline, makeRectFalloffPaintAlphaMask, makeRenderQueue, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, makeReusablePixelData, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorApplyMask, mutatorBlendAlphaMask, mutatorBlendBinaryMask, mutatorBlendColor, mutatorBlendColorPaintAlphaMask, mutatorBlendColorPaintBinaryMask, mutatorBlendColorPaintMask, mutatorBlendColorPaintRect, mutatorBlendMask, mutatorBlendPixel, mutatorBlendPixelData, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorFillRect, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resampleImageData, resampleIndexedImage, resamplePixelData, resamplePixelDataInPlace, resampleUint32Array, resizeImageData, resizePixelData, rotatePixelData, screenFast, screenPerfect, serializeImageData, serializeNullableImageData, setMaskData, setPixelData, softLightFast, softLightPerfect, sourceAtopFast, sourceAtopPerfect, sourceInFast, sourceInPerfect, sourceOutFast, sourceOutPerfect, sourceOverFast, sourceOverPerfect, subtractBinaryMaskRects, subtractFast, subtractPerfect, toBlendModeIndexAndName, trimMaskRectBounds, trimRectBounds, uInt32ArrayToImageData, uInt32ArrayToImageDataLike, uInt32ArrayToPixelData, unpackAlpha, unpackBlue, unpackColor, unpackColorTo, unpackGreen, unpackRed, vividLightFast, vividLightPerfect, writeImageData, writeImageDataBuffer, writeImageDataToClipboard, writeImgBlobToClipboard, writePaintBufferToPixelData, writePixelData, writePixelDataBuffer, xorFast, xorPerfect };
2034
+ declare function makeTileTargetConfig(tileSize: number, target: PixelData): TileTargetConfig;
2035
+ declare function makeTileTargetMeta(tileSize: number, target: {
2036
+ w: number;
2037
+ h: number;
2038
+ }): TileTargetMeta;
2039
+
2040
+ declare function colorDistance(a: Color32, b: Color32): number;
2041
+
2042
+ export { type AlphaMask, AlphaMaskPaintBuffer, type AlphaMaskPaintBufferCanvasRenderer, type AlphaMaskPaintBufferManager, type AlphaMaskRect, type AlphaMaskTile, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BaseMask, type BasePixelBlendOptions, type BatchedQueue, type BatchedQueueFn, type BinaryMask, BinaryMaskPaintBuffer, type BinaryMaskPaintBufferCanvasRenderer, type BinaryMaskPaintBufferManager, type BinaryMaskRect, type BinaryMaskTile, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type CanvasObjectFactory, type CanvasPixelDataRenderer, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, ColorPaintBuffer, type ColorPaintBufferCanvasRenderer, type ColorPaintBufferManager, type CssRGBA, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, _errors as ERRORS, type FloodFillResult, type HistoryAction, type HistoryActionFactory, HistoryManager, type HistoryMutator, type ImageDataLike, type IndexedImage, type InvertMask, type Mask, type MaskOffset, type MaskRect, MaskType, type MergeAlphaMasksOptions, type MutableAlphaMask, type MutableBinaryMask, type MutableMask, type MutablePixelData, type MutablePixelData32, type NullableAlphaMaskRect, type NullableBinaryMaskRect, type NullableMaskRect, type PaintAlphaMask, type PaintBinaryMask, type PaintBrush, type PaintCursorRenderer, type PaintMask, PaintMaskOutline, type PaintRect, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, type PixelCanvas, type PixelData, type PixelData32, type PixelMutateOptions, type PixelPatchTiles, type PixelRect, type PixelTile, PixelWriter, type PixelWriterOptions, type RGBA, type Rect, type RequiredBlendModes, type ReusableCanvas, type ReusableCanvasFactory, type ReusableImageData, type ReusablePixelData, type SerializedImageData, type Tile, type TileFactory, TilePool, type TileTargetConfig, type TileTargetMeta, TileType, UnsupportedFormatError, _macro_imageDataToUint32Array, applyAlphaMaskToPixelData, applyBinaryMaskToAlphaMask, applyBinaryMaskToPixelData, applyMaskToPixelData, applyPatchTiles, base64DecodeArrayBuffer, base64EncodeArrayBuffer, blendColorPixelData, blendColorPixelDataAlphaMask, blendColorPixelDataBinaryMask, blendColorPixelDataMask, blendColorPixelDataPaintAlphaMask, blendColorPixelDataPaintBinaryMask, blendColorPixelDataPaintMask, blendPixel, blendPixelData, blendPixelDataAlphaMask, blendPixelDataBinaryMask, blendPixelDataMask, blendPixelDataPaintBuffer, clearPixelDataFast, color32ToCssRGBA, color32ToCssRGBAString, color32ToHex, colorBurnFast, colorBurnPerfect, colorDistance, colorDodgeFast, colorDodgePerfect, commitColorPaintBuffer, commitMaskPaintBuffer, copyImageData, copyImageDataLike, copyMask, copyPixelData, cropPixelData, cssRGBAToColor32, darkenFast, darkenPerfect, darkerFast, darkerPerfect, deserializeImageData, deserializeNullableImageData, deserializeRawImageData, destinationAtopFast, destinationAtopPerfect, destinationInFast, destinationInPerfect, destinationOutFast, destinationOutPerfect, destinationOverFast, destinationOverPerfect, differenceFast, differencePerfect, divideFast, dividePerfect, eachTileInBounds, exclusionFast, exclusionPerfect, extractImageData, extractImageDataBuffer, extractMask, extractMaskBuffer, extractPixelData, extractPixelDataBuffer, fileInputChangeToImageData, fileToImageData, fillPixelData, fillPixelDataBinaryMask, fillPixelDataFast, floodFillSelection, forEachLinePoint, getImageDataFromClipboard, getIndexedImageColor, getIndexedImageColorCounts, getPixelDataTransparentTrimmedBounds, getRectsBounds, getSupportedPixelFormats, hardLightFast, hardLightPerfect, hardMixFast, hardMixPerfect, imageDataToAlphaMaskBuffer, imageDataToDataUrl, imageDataToImgBlob, imageDataToUint32Array, imgBlobToImageData, indexedImageToAverageColor, indexedImageToImageData, invertAlphaMask, invertBinaryMask, invertImageData, invertPixelData, lerpColor32, lerpColor32Fast, lightenFast, lightenPerfect, lighterFast, lighterPerfect, linearBurnFast, linearBurnPerfect, linearDodgeFast, linearDodgePerfect, linearLightFast, linearLightPerfect, makeAlphaMask, makeAlphaMaskPaintBufferCanvasRenderer, makeAlphaMaskPaintBufferCommitter, makeAlphaMaskPaintBufferManager, makeAlphaMaskTile, makeBatchedQueue, makeBinaryMask, makeBinaryMaskFromAlphaMask, makeBinaryMaskOutline, makeBinaryMaskPaintBufferCanvasRenderer, makeBinaryMaskPaintBufferCommitter, makeBinaryMaskPaintBufferManager, makeBinaryMaskTile, makeBlendModeRegistry, makeCanvasFrameRenderer, makeCanvasPixelDataRenderer, makeCircleBinaryMaskOutline, makeCirclePaintAlphaMask, makeCirclePaintBinaryMask, makeColorPaintBufferCanvasRenderer, makeColorPaintBufferCommitter, makeColorPaintBufferManager, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makeIndexedImage, makeIndexedImageFromImageData, makeIndexedImageFromImageDataRaw, makePaintAlphaMask, makePaintBinaryMask, makePaintCursorRenderer, makePaintRect, makePerfectBlendModeRegistry, makePixelCanvas, makePixelData, makePixelTile, makeRectBinaryMaskOutline, makeRectFalloffPaintAlphaMask, makeRenderQueue, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, makeReusablePixelData, makeTileTargetConfig, makeTileTargetMeta, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorApplyMask, mutatorBlendAlphaMask, mutatorBlendBinaryMask, mutatorBlendColor, mutatorBlendColorPaintAlphaMask, mutatorBlendColorPaintBinaryMask, mutatorBlendColorPaintMask, mutatorBlendColorPaintRect, mutatorBlendMask, mutatorBlendPixel, mutatorBlendPixelData, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resampleImageData, resampleIndexedImage, resamplePixelData, resamplePixelDataInPlace, resampleUint32Array, resizeImageData, resizePixelData, rotatePixelData, screenFast, screenPerfect, serializeImageData, serializeNullableImageData, setMaskData, setPixelData, softLightFast, softLightPerfect, sourceAtopFast, sourceAtopPerfect, sourceInFast, sourceInPerfect, sourceOutFast, sourceOutPerfect, sourceOverFast, sourceOverPerfect, subtractBinaryMaskRects, subtractFast, subtractPerfect, toBlendModeIndexAndName, trimMaskRectBounds, trimRectBounds, trimTransparentPixelData, trimTransparentPixelDataInPlace, uInt32ArrayToImageData, uInt32ArrayToImageDataLike, uInt32ArrayToPixelData, unpackAlpha, unpackBlue, unpackColor, unpackColorTo, unpackGreen, unpackRed, vividLightFast, vividLightPerfect, writeImageData, writeImageDataBuffer, writeImageDataToClipboard, writeImgBlobToClipboard, writePaintBufferToPixelData, writePixelData, writePixelDataBuffer, xorFast, xorPerfect };