pixel-data-js 0.24.0 → 0.25.2

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 (72) hide show
  1. package/dist/index.dev.cjs +1476 -1834
  2. package/dist/index.dev.cjs.map +1 -1
  3. package/dist/index.dev.js +1465 -1816
  4. package/dist/index.dev.js.map +1 -1
  5. package/dist/index.prod.cjs +1475 -1833
  6. package/dist/index.prod.cjs.map +1 -1
  7. package/dist/index.prod.d.ts +233 -310
  8. package/dist/index.prod.js +1465 -1816
  9. package/dist/index.prod.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/Algorithm/floodFillSelection.ts +2 -2
  12. package/src/Canvas/canvas-blend-modes.ts +28 -0
  13. package/src/History/PixelAccumulator.ts +52 -29
  14. package/src/History/PixelEngineConfig.ts +7 -9
  15. package/src/History/PixelMutator/mutatorBlendPaintMask.ts +60 -0
  16. package/src/History/PixelMutator/mutatorBlendPixelData.ts +2 -2
  17. package/src/History/PixelMutator/mutatorBlendPixelDataAlphaMask.ts +2 -2
  18. package/src/History/PixelMutator/mutatorBlendPixelDataBinaryMask.ts +2 -2
  19. package/src/History/PixelMutator.ts +0 -20
  20. package/src/History/PixelPatchTiles.ts +2 -2
  21. package/src/History/PixelWriter.ts +132 -9
  22. package/src/Internal/helpers.ts +2 -0
  23. package/src/Paint/PaintBuffer.ts +269 -0
  24. package/src/{PixelTile/PaintBufferRenderer.ts → Paint/PaintBufferCanvasRenderer.ts} +13 -5
  25. package/src/Paint/makeCirclePaintAlphaMask.ts +41 -0
  26. package/src/{Mask/CircleBinaryMask.ts → Paint/makeCirclePaintBinaryMask.ts} +5 -6
  27. package/src/Paint/makePaintMask.ts +28 -0
  28. package/src/Paint/makeRectFalloffPaintAlphaMask.ts +47 -0
  29. package/src/PixelData/PixelBuffer32.ts +2 -2
  30. package/src/PixelData/PixelData.ts +1 -1
  31. package/src/PixelData/applyAlphaMaskToPixelData.ts +2 -2
  32. package/src/PixelData/applyBinaryMaskToPixelData.ts +2 -2
  33. package/src/PixelData/blendColorPixelData.ts +2 -2
  34. package/src/PixelData/blendColorPixelDataAlphaMask.ts +3 -3
  35. package/src/PixelData/blendColorPixelDataBinaryMask.ts +3 -3
  36. package/src/PixelData/blendPixel.ts +2 -2
  37. package/src/PixelData/blendPixelData.ts +3 -3
  38. package/src/PixelData/blendPixelDataAlphaMask.ts +3 -3
  39. package/src/PixelData/blendPixelDataBinaryMask.ts +3 -3
  40. package/src/PixelData/blendPixelDataPaintBuffer.ts +3 -3
  41. package/src/PixelData/clearPixelData.ts +2 -2
  42. package/src/PixelData/extractPixelData.ts +4 -4
  43. package/src/PixelData/extractPixelDataBuffer.ts +4 -4
  44. package/src/PixelData/fillPixelData.ts +5 -5
  45. package/src/PixelData/fillPixelDataBinaryMask.ts +3 -3
  46. package/src/PixelData/fillPixelDataFast.ts +5 -5
  47. package/src/PixelData/invertPixelData.ts +2 -2
  48. package/src/PixelData/pixelDataToAlphaMask.ts +2 -2
  49. package/src/PixelData/reflectPixelData.ts +3 -3
  50. package/src/PixelData/resamplePixelData.ts +2 -2
  51. package/src/PixelData/writePaintBufferToPixelData.ts +26 -0
  52. package/src/PixelData/writePixelDataBuffer.ts +5 -5
  53. package/src/Rect/trimMaskRectBounds.ts +121 -0
  54. package/src/Rect/trimRectBounds.ts +25 -116
  55. package/src/_types.ts +16 -15
  56. package/src/index.ts +11 -24
  57. package/src/History/PixelMutator/mutatorApplyCircleBrushStroke.ts +0 -182
  58. package/src/History/PixelMutator/mutatorApplyCirclePencil.ts +0 -59
  59. package/src/History/PixelMutator/mutatorApplyCirclePencilStroke.ts +0 -172
  60. package/src/History/PixelMutator/mutatorApplyRectBrush.ts +0 -64
  61. package/src/History/PixelMutator/mutatorApplyRectBrushStroke.ts +0 -184
  62. package/src/History/PixelMutator/mutatorApplyRectPencil.ts +0 -65
  63. package/src/History/PixelMutator/mutatorApplyRectPencilStroke.ts +0 -166
  64. package/src/History/PixelMutator/mutatorBlendColorCircleMask.ts +0 -71
  65. package/src/Mask/CircleAlphaMask.ts +0 -32
  66. package/src/PixelData/applyRectBrushToPixelData.ts +0 -98
  67. package/src/PixelData/blendColorPixelDataCircleMask.ts +0 -92
  68. package/src/PixelTile/PaintBuffer.ts +0 -122
  69. package/src/Rect/getCircleBrushOrPencilBounds.ts +0 -43
  70. package/src/Rect/getCircleBrushOrPencilStrokeBounds.ts +0 -24
  71. package/src/Rect/getRectBrushOrPencilBounds.ts +0 -38
  72. package/src/Rect/getRectBrushOrPencilStrokeBounds.ts +0 -26
@@ -71,16 +71,15 @@ interface BinaryMask extends Mask {
71
71
  interface AlphaMask extends Mask {
72
72
  readonly type: MaskType.ALPHA;
73
73
  }
74
- interface BaseCircleMask {
75
- readonly size: number;
76
- readonly radius: number;
77
- readonly minOffset: number;
74
+ interface BasePaintMask {
75
+ readonly centerOffsetX: number;
76
+ readonly centerOffsetY: number;
78
77
  }
79
- interface CircleAlphaMask extends BaseCircleMask, AlphaMask {
78
+ interface PaintAlphaMask extends BasePaintMask, AlphaMask {
80
79
  }
81
- interface CircleBinaryMask extends BaseCircleMask, BinaryMask {
80
+ interface PaintBinaryMask extends BasePaintMask, BinaryMask {
82
81
  }
83
- type CircleMask = CircleAlphaMask | CircleBinaryMask;
82
+ type PaintMask = PaintAlphaMask | PaintBinaryMask;
84
83
  /**
85
84
  * Configuration for pixel manipulation operations.
86
85
  * Designed to be used by spreading a Rect object ({x, y, w, h}) directly.
@@ -177,14 +176,12 @@ interface ColorBlendOptions extends PixelRect, Alpha {
177
176
  }
178
177
  interface ColorBlendMaskOptions extends ColorBlendOptions, MaskOffset, InvertMask {
179
178
  }
180
- type BinaryMaskRect = Rect & {
181
- type: MaskType.BINARY;
182
- data: Uint8Array;
183
- };
184
- type AlphaMaskRect = Rect & {
185
- type: MaskType.ALPHA;
179
+ type MaskRect<T extends MaskType> = Rect & {
180
+ type: T;
186
181
  data: Uint8Array;
187
182
  };
183
+ type BinaryMaskRect = MaskRect<MaskType.BINARY>;
184
+ type AlphaMaskRect = MaskRect<MaskType.ALPHA>;
188
185
  type NullableBinaryMaskRect = Rect & ({
189
186
  type: MaskType.BINARY;
190
187
  data: Uint8Array;
@@ -200,11 +197,14 @@ type NullableMaskRect = Rect & ({
200
197
  data?: null;
201
198
  });
202
199
  type HistoryMutator<T extends {}, D extends {}> = (writer: PixelWriter<any>, deps?: Partial<D>) => T;
203
- interface IPixelData {
200
+ interface IPixelData32 {
204
201
  readonly data32: Uint32Array;
205
202
  readonly width: number;
206
203
  readonly height: number;
207
204
  }
205
+ interface IPixelData<T extends ImageDataLike = ImageData> extends IPixelData32 {
206
+ readonly imageData: T;
207
+ }
208
208
 
209
209
  /**
210
210
  * Packs RGBA into a 32-bit integer compatible with
@@ -247,7 +247,7 @@ declare function color32ToHex(color: Color32): string;
247
247
  */
248
248
  declare function color32ToCssRGBA(color: Color32): string;
249
249
 
250
- declare class PixelData<T extends ImageDataLike = ImageData> implements IPixelData {
250
+ declare class PixelData<T extends ImageDataLike = ImageData> implements IPixelData<T> {
251
251
  readonly data32: Uint32Array;
252
252
  readonly imageData: T;
253
253
  readonly width: number;
@@ -381,12 +381,12 @@ declare function makeFastBlendModeRegistry(name?: string): {
381
381
  readonly subtract: BlendColor32;
382
382
  readonly divide: BlendColor32;
383
383
  };
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", 0 | 16 | 8 | 2 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
385
- blendToIndex: Map<BlendColor32, 0 | 16 | 8 | 2 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
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", 0 | 2 | 16 | 8 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
385
+ blendToIndex: Map<BlendColor32, 0 | 2 | 16 | 8 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
386
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">;
387
387
  indexToBlend: BlendColor32[];
388
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")[];
389
- indexType: 0 | 16 | 8 | 2 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22;
389
+ indexType: 0 | 2 | 16 | 8 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22;
390
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";
391
391
  };
392
392
 
@@ -464,12 +464,12 @@ declare function makePerfectBlendModeRegistry(name?: string): {
464
464
  readonly subtract: BlendColor32;
465
465
  readonly divide: BlendColor32;
466
466
  };
467
- 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", 0 | 16 | 8 | 2 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
468
- blendToIndex: Map<BlendColor32, 0 | 16 | 8 | 2 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
467
+ 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", 0 | 2 | 16 | 8 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
468
+ blendToIndex: Map<BlendColor32, 0 | 2 | 16 | 8 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22>;
469
469
  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">;
470
470
  indexToBlend: BlendColor32[];
471
471
  indexToName: ("overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide")[];
472
- indexType: 0 | 16 | 8 | 2 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22;
472
+ indexType: 0 | 2 | 16 | 8 | 3 | 1 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22;
473
473
  nameType: "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide";
474
474
  };
475
475
 
@@ -525,6 +525,25 @@ declare function toBlendModeIndexAndName(input: string | number): {
525
525
  declare const OFFSCREEN_CANVAS_CTX_FAILED = "Failed to create OffscreenCanvas context";
526
526
  declare const CANVAS_CTX_FAILED = "Failed to create Canvas context";
527
527
 
528
+ declare const CANVAS_COMPOSITE_MAP: {
529
+ readonly 0: "copy";
530
+ readonly 1: "source-over";
531
+ readonly 2: "darken";
532
+ readonly 3: "multiply";
533
+ readonly 4: "color-burn";
534
+ readonly 7: "lighten";
535
+ readonly 8: "screen";
536
+ readonly 9: "color-dodge";
537
+ readonly 10: "lighter";
538
+ readonly 12: "overlay";
539
+ readonly 13: "soft-light";
540
+ readonly 14: "hard-light";
541
+ readonly 19: "difference";
542
+ readonly 20: "exclusion";
543
+ };
544
+ type CanvasBlendModeIndex = keyof typeof CANVAS_COMPOSITE_MAP;
545
+ type CanvasCompositeOperation = typeof CANVAS_COMPOSITE_MAP[CanvasBlendModeIndex];
546
+
528
547
  type PixelCanvas = {
529
548
  readonly canvas: HTMLCanvasElement;
530
549
  readonly ctx: CanvasRenderingContext2D;
@@ -567,14 +586,14 @@ declare function makeReusableOffscreenCanvas(): {
567
586
  type DrawPixelLayer = (ctx: CanvasRenderingContext2D) => void;
568
587
  type DrawScreenLayer = (ctx: CanvasRenderingContext2D, scale: number) => void;
569
588
  type CanvasFrameRenderer = ReturnType<typeof makeCanvasFrameRenderer>;
570
- declare const defaults$j: {
589
+ declare const defaults$c: {
571
590
  makeReusableCanvas: typeof makeReusableCanvas;
572
591
  };
573
- type Deps$j = Partial<typeof defaults$j>;
592
+ type Deps$c = Partial<typeof defaults$c>;
574
593
  /**
575
594
  * @param deps - @hidden
576
595
  */
577
- declare function makeCanvasFrameRenderer(deps?: Deps$j): (pixelCanvas: PixelCanvas, scale: number, getImageData: () => ImageData | undefined | null, drawPixelLayer?: DrawPixelLayer, drawScreenLayer?: DrawScreenLayer) => void;
596
+ declare function makeCanvasFrameRenderer(deps?: Deps$c): (pixelCanvas: PixelCanvas, scale: number, getImageData: () => ImageData | undefined | null, drawPixelLayer?: DrawPixelLayer, drawScreenLayer?: DrawScreenLayer) => void;
578
597
 
579
598
  /**
580
599
  * Extracts {@link ImageData} from a clipboard event if an image is present.
@@ -641,33 +660,48 @@ type PixelPatchTiles = {
641
660
  beforeTiles: PixelTile[];
642
661
  afterTiles: PixelTile[];
643
662
  };
644
- declare function applyPatchTiles(target: IPixelData, tiles: PixelTile[], tileSize: number): void;
663
+ declare function applyPatchTiles(target: IPixelData32, tiles: PixelTile[], tileSize: number): void;
645
664
 
646
- declare class HistoryManager {
647
- maxSteps: number;
648
- readonly undoStack: HistoryAction[];
649
- readonly redoStack: HistoryAction[];
650
- readonly listeners: Set<() => void>;
651
- constructor(maxSteps?: number);
652
- get canUndo(): boolean;
653
- get canRedo(): boolean;
654
- subscribe(fn: () => void): () => boolean;
655
- notify(): void;
656
- commit(action: HistoryAction): void;
657
- undo(): void;
658
- redo(): void;
659
- clearRedoStack(): void;
660
- }
665
+ /**
666
+ * Non destructively resizes the {@link ImageData} buffer to new dimensions, optionally
667
+ * offsetting the original content.
668
+ * This operation creates a new buffer. It does not scale or stretch pixels;
669
+ * instead, it crops or pads the image based on the new dimensions and
670
+ * provides an offset for repositioning.
671
+ *
672
+ * @param target The target to resize.
673
+ * @param newWidth The target width in pixels.
674
+ * @param newHeight The target height in pixels.
675
+ * @param offsetX The horizontal offset for placing the
676
+ * original image within the new buffer.
677
+ * @param offsetY The vertical offset for placing the
678
+ * original image within the new buffer.
679
+ *
680
+ * @returns A new {@link ImageData} instance with the specified dimensions.
681
+ *
682
+ * @example
683
+ * ```typescript
684
+ * // Centers an 80x80 image in a new 100x100 buffer
685
+ * const resized = resizeImageData(
686
+ * originalData,
687
+ * 100,
688
+ * 100,
689
+ * 10,
690
+ * 10
691
+ * );
692
+ * ```
693
+ */
694
+ declare function resizeImageData(target: ImageDataLike, newWidth: number, newHeight: number, offsetX?: number, offsetY?: number): ImageData;
661
695
 
662
696
  declare class PixelEngineConfig {
663
697
  readonly tileSize: number;
664
698
  readonly tileShift: number;
665
699
  readonly tileMask: number;
666
700
  readonly tileArea: number;
667
- readonly target: IPixelData;
701
+ readonly target: PixelData;
668
702
  readonly targetColumns: number;
669
- constructor(tileSize: number, target: IPixelData);
670
- setTarget(target: IPixelData): void;
703
+ readonly targetRows: number;
704
+ constructor(tileSize: number, target: PixelData);
671
705
  }
672
706
 
673
707
  declare class PixelTilePool {
@@ -680,6 +714,51 @@ declare class PixelTilePool {
680
714
  releaseTiles(tiles: (PixelTile | undefined)[]): void;
681
715
  }
682
716
 
717
+ declare class PaintBuffer {
718
+ readonly config: PixelEngineConfig;
719
+ readonly tilePool: PixelTilePool;
720
+ readonly lookup: (PixelTile | undefined)[];
721
+ private readonly scratchBounds;
722
+ constructor(config: PixelEngineConfig, tilePool: PixelTilePool);
723
+ private eachTileInBounds;
724
+ writePaintAlphaMaskStroke(color: Color32, brush: PaintAlphaMask, x0: number, y0: number, x1: number, y1: number): boolean;
725
+ writePaintBinaryMaskStroke(color: Color32, brush: PaintBinaryMask, x0: number, y0: number, x1: number, y1: number): boolean;
726
+ writeRectStroke(color: Color32, brushWidth: number, brushHeight: number, x0: number, y0: number, x1: number, y1: number): boolean;
727
+ clear(): void;
728
+ }
729
+
730
+ /**
731
+ * Blits source PixelData into a destination PixelData using 32-bit integer bitwise blending.
732
+ * This function bypasses standard ImageData limitations by operating directly on
733
+ * Uint32Array views. It supports various blend modes, binary/alpha masking, and
734
+ * automatic clipping of both source and destination bounds.
735
+ * @example
736
+ *
737
+ * const dst = new PixelData(ctx.getImageData(0,0,100,100))
738
+ * blendImageData32(dst, sprite, {
739
+ * blendFn: COLOR_32_BLEND_MODES.multiply,
740
+ * mask: brushMask,
741
+ * maskType: MaskType.ALPHA
742
+ * });
743
+ */
744
+ declare function blendPixelData(dst: IPixelData32, src: IPixelData32, opts?: PixelBlendOptions): boolean;
745
+
746
+ declare class HistoryManager {
747
+ maxSteps: number;
748
+ readonly undoStack: HistoryAction[];
749
+ readonly redoStack: HistoryAction[];
750
+ readonly listeners: Set<() => void>;
751
+ constructor(maxSteps?: number);
752
+ get canUndo(): boolean;
753
+ get canRedo(): boolean;
754
+ subscribe(fn: () => void): () => boolean;
755
+ notify(): void;
756
+ commit(action: HistoryAction): void;
757
+ undo(): void;
758
+ redo(): void;
759
+ clearRedoStack(): void;
760
+ }
761
+
683
762
  type DidChangeFn = (didChange: boolean) => boolean;
684
763
  declare class PixelAccumulator {
685
764
  readonly config: PixelEngineConfig;
@@ -700,9 +779,10 @@ declare class PixelAccumulator {
700
779
  * @param h pixel height
701
780
  */
702
781
  storeRegionBeforeState(x: number, y: number, w: number, h: number): DidChangeFn;
782
+ storeTileBeforeState(id: number, tx: number, ty: number): DidChangeFn;
703
783
  extractState(tile: PixelTile): void;
704
784
  extractPatch(): PixelPatchTiles;
705
- rollback(): void;
785
+ rollbackAfterError(): void;
706
786
  }
707
787
 
708
788
  interface PixelWriterOptions {
@@ -711,6 +791,7 @@ interface PixelWriterOptions {
711
791
  historyManager?: HistoryManager;
712
792
  historyActionFactory?: HistoryActionFactory;
713
793
  pixelTilePool?: PixelTilePool;
794
+ accumulator?: PixelAccumulator;
714
795
  }
715
796
  /**
716
797
  * @example
@@ -738,9 +819,30 @@ declare class PixelWriter<M> {
738
819
  readonly accumulator: PixelAccumulator;
739
820
  readonly historyActionFactory: HistoryActionFactory;
740
821
  readonly config: PixelEngineConfig;
822
+ readonly pixelTilePool: PixelTilePool;
823
+ readonly paintBuffer: PaintBuffer;
741
824
  readonly mutator: M;
742
- constructor(target: IPixelData, mutatorFactory: (writer: PixelWriter<any>) => M, { tileSize, maxHistorySteps, historyManager, historyActionFactory, pixelTilePool, }?: PixelWriterOptions);
743
- withHistory(cb: (mutator: M) => void, after?: () => void, afterUndo?: () => void, afterRedo?: () => void): void;
825
+ private blendPixelDataOpts;
826
+ private _inProgress;
827
+ constructor(target: PixelData, mutatorFactory: (writer: PixelWriter<any>) => M, { tileSize, maxHistorySteps, historyManager, historyActionFactory, pixelTilePool, accumulator, }?: PixelWriterOptions);
828
+ /**
829
+ * Executes `transaction` and commits the resulting pixel changes as a single
830
+ * undoable history action.
831
+ *
832
+ * - If `transaction` throws, all accumulated changes are rolled back and the error
833
+ * is re-thrown. No action is committed.
834
+ * - If `transaction` completes without modifying any pixels, no action is committed.
835
+ * - `withHistory` is not re-entrant. Calling it again from inside `transaction` will
836
+ * throw immediately to prevent silent data loss from a nested extractPatch.
837
+ *
838
+ * @param transaction Callback to be executed inside the transaction.
839
+ * @param after Called after both undo and redo — use for generic change notifications.
840
+ * @param afterUndo Called after undo only — use for dimension or state changes specific to undo.
841
+ * @param afterRedo Called after redo only.
842
+ */
843
+ withHistory(transaction: (mutator: M) => void, after?: () => void, afterUndo?: () => void, afterRedo?: () => void): void;
844
+ resize(newWidth: number, newHeight: number, offsetX?: number, offsetY?: number, after?: (target: ImageData) => void, afterUndo?: (target: ImageData) => void, afterRedo?: (target: ImageData) => void, resizeImageDataFn?: typeof resizeImageData): void;
845
+ commitPaintBuffer(alpha?: number, blendFn?: BlendColor32, blendPixelDataFn?: typeof blendPixelData): void;
744
846
  }
745
847
 
746
848
  interface HistoryAction {
@@ -757,21 +859,11 @@ declare function makeFullPixelMutator(writer: PixelWriter<any>): {
757
859
  fillBinaryMask(color: Color32, mask: BinaryMask, alpha?: number, x?: number, y?: number): boolean;
758
860
  fill(color: Color32, x?: number, y?: number, w?: number, h?: number): boolean;
759
861
  clear(rect?: Partial<Rect>): void;
760
- blendPixelDataBinaryMask(src: IPixelData, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
761
- blendPixelDataAlphaMask(src: IPixelData, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
762
- blendPixelData(src: IPixelData, opts?: PixelBlendOptions): boolean;
862
+ blendPixelDataBinaryMask(src: IPixelData32, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
863
+ blendPixelDataAlphaMask(src: IPixelData32, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
864
+ blendPixelData(src: IPixelData32, opts?: PixelBlendOptions): boolean;
763
865
  blendPixel(x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
764
- applyCircleMask(color: Color32, centerX: number, centerY: number, brush: CircleMask, alpha?: number, blendFn?: BlendColor32): boolean;
765
866
  blendColor(color: Color32, opts?: ColorBlendOptions): boolean;
766
- applyRectPencilStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brushWidth: number, brushHeight: number, alpha?: number, blendFn?: BlendColor32): void;
767
- applyRectPencil(color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha?: number, blendFn?: BlendColor32): boolean;
768
- applyRectBrushStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brushWidth: number, brushHeight: number, alpha: number | undefined, fallOff: (dist: number) => number, blendFn?: BlendColor32): void;
769
- applyRectBrush(color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha: number | undefined, fallOff: (dist: number) => number, blendFn?: BlendColor32): boolean;
770
- applyCirclePencilStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brush: CircleBinaryMask, alpha?: number, blendFn?: BlendColor32): void;
771
- applyCirclePencil(color: Color32, centerX: number, centerY: number, brush: CircleMask, alpha?: number, blendFn?: BlendColor32): boolean;
772
- applyCircleBrushStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brush: CircleAlphaMask, alpha?: number, blendFn?: BlendColor32): void;
773
- applyBinaryMask(mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
774
- applyAlphaMask(mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
775
867
  };
776
868
 
777
869
  /**
@@ -779,16 +871,16 @@ declare function makeFullPixelMutator(writer: PixelWriter<any>): {
779
871
  * modifying the destination's alpha channel in-place.
780
872
  * @returns true if any pixels were actually modified.
781
873
  */
782
- declare function applyAlphaMaskToPixelData(dst: IPixelData, mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
874
+ declare function applyAlphaMaskToPixelData(dst: IPixelData32, mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
783
875
 
784
- declare const defaults$i: {
876
+ declare const defaults$b: {
785
877
  applyAlphaMaskToPixelData: typeof applyAlphaMaskToPixelData;
786
878
  };
787
- type Deps$i = Partial<typeof defaults$i>;
879
+ type Deps$b = Partial<typeof defaults$b>;
788
880
  /**
789
881
  * @param deps - @hidden
790
882
  */
791
- declare const mutatorApplyAlphaMask: (writer: PixelWriter<any>, deps?: Deps$i) => {
883
+ declare const mutatorApplyAlphaMask: (writer: PixelWriter<any>, deps?: Deps$b) => {
792
884
  applyAlphaMask(mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
793
885
  };
794
886
 
@@ -797,90 +889,50 @@ declare const mutatorApplyAlphaMask: (writer: PixelWriter<any>, deps?: Deps$i) =
797
889
  * modifying the destination's alpha channel in-place.
798
890
  * @returns true if any pixels were actually modified.
799
891
  */
800
- declare function applyBinaryMaskToPixelData(dst: IPixelData, mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
892
+ declare function applyBinaryMaskToPixelData(dst: IPixelData32, mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
801
893
 
802
- declare const defaults$h: {
894
+ declare const defaults$a: {
803
895
  applyBinaryMaskToPixelData: typeof applyBinaryMaskToPixelData;
804
896
  };
805
- type Deps$h = Partial<typeof defaults$h>;
897
+ type Deps$a = Partial<typeof defaults$a>;
806
898
  /**
807
899
  * @param deps - @hidden
808
900
  */
809
- declare const mutatorApplyBinaryMask: (writer: PixelWriter<any>, deps?: Deps$h) => {
901
+ declare const mutatorApplyBinaryMask: (writer: PixelWriter<any>, deps?: Deps$a) => {
810
902
  applyBinaryMask(mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
811
903
  };
812
904
 
813
905
  /**
814
- * Blends a solid color into a target pixel buffer using an alpha mask.
815
- *
816
- * @remarks
817
- * If the width (`w`) or height (`h`) are omitted from the options, they will safely
818
- * default to the dimensions of the provided mask to prevent out-of-bounds memory access.
819
- *
820
- * @param dst - The destination {@link IPixelData} buffer to modify.
821
- * @param color - The solid color to apply.
822
- * @param mask - The mask defining the per-pixel opacity of the target area.
823
- * @param opts - Configuration options including placement coordinates, bounds, global alpha, and mask offsets.
906
+ * Blends a solid color into a target pixel buffer.
824
907
  * @returns true if any pixels were actually modified.
825
908
  */
826
- declare function blendColorPixelDataAlphaMask(dst: IPixelData, color: Color32, mask: AlphaMask, opts?: ColorBlendMaskOptions): boolean;
827
-
828
- declare function getCircleBrushOrPencilBounds(centerX: number, centerY: number, brushSize: number, targetWidth: number, targetHeight: number, out?: Rect): Rect;
909
+ declare function blendColorPixelData(dst: IPixelData32, color: Color32, opts?: ColorBlendOptions): boolean;
829
910
 
830
- declare function getCircleBrushOrPencilStrokeBounds(x0: number, y0: number, x1: number, y1: number, brushSize: number, result: Rect): Rect;
831
-
832
- declare const defaults$g: {
833
- forEachLinePoint: typeof forEachLinePoint;
834
- blendColorPixelDataAlphaMask: typeof blendColorPixelDataAlphaMask;
835
- getCircleBrushOrPencilBounds: typeof getCircleBrushOrPencilBounds;
836
- getCircleBrushOrPencilStrokeBounds: typeof getCircleBrushOrPencilStrokeBounds;
911
+ declare const defaults$9: {
912
+ blendColorPixelData: typeof blendColorPixelData;
837
913
  };
838
- type Deps$g = Partial<typeof defaults$g>;
914
+ type Deps$9 = Partial<typeof defaults$9>;
839
915
  /**
840
916
  * @param deps - @hidden
841
917
  */
842
- declare const mutatorApplyCircleBrushStroke: (writer: PixelWriter<any>, deps?: Deps$g) => {
843
- applyCircleBrushStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brush: CircleAlphaMask, alpha?: number, blendFn?: BlendColor32): void;
918
+ declare const mutatorBlendColor: (writer: PixelWriter<any>, deps?: Deps$9) => {
919
+ blendColor(color: Color32, opts?: ColorBlendOptions): boolean;
844
920
  };
845
921
 
846
922
  /**
847
- * Applies a circular mask to pixel data using a pre-calculated alpha mask.
923
+ * Blends a solid color into a target pixel buffer using an alpha mask.
848
924
  *
849
- * @param target The PixelData to modify.
850
- * @param color The brush color.
851
- * @param centerX The center x-coordinate of the brush.
852
- * @param centerY The center y-coordinate of the brush.
853
- * @param brush The pre-calculated CircleBrushAlphaMask.
854
- * @param alpha The overall opacity of the brush (0-255).
855
- * @param blendFn
856
- * @param scratchOptions
857
- * @param bounds precalculated result from {@link getCircleBrushOrPencilBounds}
858
- */
859
- declare function blendColorPixelDataCircleMask(target: IPixelData, color: Color32, centerX: number, centerY: number, brush: CircleMask, alpha?: number, blendFn?: BlendColor32, scratchOptions?: ColorBlendMaskOptions, bounds?: Rect): boolean;
860
-
861
- declare const defaults$f: {
862
- blendColorPixelDataCircleMask: typeof blendColorPixelDataCircleMask;
863
- getCircleBrushOrPencilBounds: typeof getCircleBrushOrPencilBounds;
864
- };
865
- type Deps$f = Partial<typeof defaults$f>;
866
- /**
867
- * @param deps - @hidden
925
+ * @remarks
926
+ * If the width (`w`) or height (`h`) are omitted from the options, they will safely
927
+ * default to the dimensions of the provided mask to prevent out-of-bounds memory access.
928
+ *
929
+ * @param dst - The destination {@link IPixelData32} buffer to modify.
930
+ * @param color - The solid color to apply.
931
+ * @param mask - The mask defining the per-pixel opacity of the target area.
932
+ * @param opts - Configuration options including placement coordinates, bounds, global alpha, and mask offsets.
933
+ * @returns true if any pixels were actually modified.
868
934
  */
869
- declare const mutatorBlendColorCircleMask: (writer: PixelWriter<any>, deps?: Deps$f) => {
870
- applyCircleMask(color: Color32, centerX: number, centerY: number, brush: CircleMask, alpha?: number, blendFn?: BlendColor32): boolean;
871
- };
872
-
873
- declare const defaults$e: {
874
- applyCircleMaskToPixelData: typeof blendColorPixelDataCircleMask;
875
- getCircleBrushOrPencilBounds: typeof getCircleBrushOrPencilBounds;
876
- };
877
- type Deps$e = Partial<typeof defaults$e>;
878
- /**
879
- * @param deps - @hidden
880
- **/
881
- declare const mutatorApplyCirclePencil: (writer: PixelWriter<any>, deps?: Deps$e) => {
882
- applyCirclePencil(color: Color32, centerX: number, centerY: number, brush: CircleMask, alpha?: number, blendFn?: BlendColor32): boolean;
883
- };
935
+ declare function blendColorPixelDataAlphaMask(dst: IPixelData32, color: Color32, mask: AlphaMask, opts?: ColorBlendMaskOptions): boolean;
884
936
 
885
937
  /**
886
938
  * Blends a solid color into a target pixel buffer using a binary mask.
@@ -889,109 +941,27 @@ declare const mutatorApplyCirclePencil: (writer: PixelWriter<any>, deps?: Deps$e
889
941
  * If the width (`w`) or height (`h`) are omitted from the options, they will safely
890
942
  * default to the dimensions of the provided mask to prevent out-of-bounds memory access.
891
943
  *
892
- * @param dst - The destination {@link IPixelData} buffer to modify.
944
+ * @param dst - The destination {@link IPixelData32} buffer to modify.
893
945
  * @param color - The solid color to apply.
894
946
  * @param mask - The mask defining the per-pixel opacity of the target area.
895
947
  * @param opts - Configuration options including placement coordinates, bounds, global alpha, and mask offsets.
896
948
  * @returns true if any pixels were actually modified.
897
949
  */
898
- declare function blendColorPixelDataBinaryMask(dst: IPixelData, color: Color32, mask: BinaryMask, opts?: ColorBlendMaskOptions): boolean;
899
-
900
- declare const defaults$d: {
901
- forEachLinePoint: typeof forEachLinePoint;
902
- blendColorPixelDataBinaryMask: typeof blendColorPixelDataBinaryMask;
903
- getCircleBrushOrPencilBounds: typeof getCircleBrushOrPencilBounds;
904
- getCircleBrushOrPencilStrokeBounds: typeof getCircleBrushOrPencilStrokeBounds;
905
- };
906
- type Deps$d = Partial<typeof defaults$d>;
907
- /**
908
- * @param deps - @hidden
909
- */
910
- declare const mutatorApplyCirclePencilStroke: (writer: PixelWriter<any>, deps?: Deps$d) => {
911
- applyCirclePencilStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brush: CircleBinaryMask, alpha?: number, blendFn?: BlendColor32): void;
912
- };
913
-
914
- /**
915
- * Applies a rectangular brush to the pixel data.
916
- * @returns true if any pixels were actually modified.
917
- */
918
- declare function applyRectBrushToPixelData(target: IPixelData, color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha: number | undefined, fallOff: (dist: number) => number, blendFn?: BlendColor32, bounds?: Rect): boolean;
919
-
920
- declare function getRectBrushOrPencilBounds(centerX: number, centerY: number, brushWidth: number, brushHeight: number, targetWidth: number, targetHeight: number, out?: Rect): Rect;
921
-
922
- declare const defaults$c: {
923
- applyRectBrushToPixelData: typeof applyRectBrushToPixelData;
924
- getRectBrushOrPencilBounds: typeof getRectBrushOrPencilBounds;
925
- fallOff: () => number;
926
- };
927
- type Deps$c = Partial<typeof defaults$c>;
928
- /**
929
- * @param deps - @hidden
930
- */
931
- declare const mutatorApplyRectPencil: (writer: PixelWriter<any>, deps?: Deps$c) => {
932
- applyRectPencil(color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha?: number, blendFn?: BlendColor32): boolean;
933
- };
934
-
935
- declare function getRectBrushOrPencilStrokeBounds(x0: number, y0: number, x1: number, y1: number, brushWidth: number, brushHeight: number, result: Rect): Rect;
936
-
937
- declare const defaults$b: {
938
- forEachLinePoint: typeof forEachLinePoint;
939
- getRectBrushOrPencilBounds: typeof getRectBrushOrPencilBounds;
940
- getRectBrushOrPencilStrokeBounds: typeof getRectBrushOrPencilStrokeBounds;
941
- blendColorPixelDataBinaryMask: typeof blendColorPixelDataBinaryMask;
942
- };
943
- type Deps$b = Partial<typeof defaults$b>;
944
- /**
945
- * @param deps - @hidden
946
- */
947
- declare const mutatorApplyRectPencilStroke: (writer: PixelWriter<any>, deps?: Deps$b) => {
948
- applyRectPencilStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brushWidth: number, brushHeight: number, alpha?: number, blendFn?: BlendColor32): void;
949
- };
950
-
951
- declare const defaults$a: {
952
- applyRectBrushToPixelData: typeof applyRectBrushToPixelData;
953
- getRectBrushOrPencilBounds: typeof getRectBrushOrPencilBounds;
954
- };
955
- type Deps$a = Partial<typeof defaults$a>;
956
- /**
957
- * @param deps - @hidden
958
- */
959
- declare const mutatorApplyRectBrush: (writer: PixelWriter<any>, deps?: Deps$a) => {
960
- applyRectBrush(color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha: number | undefined, fallOff: (dist: number) => number, blendFn?: BlendColor32): boolean;
961
- };
962
-
963
- declare const defaults$9: {
964
- forEachLinePoint: typeof forEachLinePoint;
965
- blendColorPixelDataAlphaMask: typeof blendColorPixelDataAlphaMask;
966
- getRectBrushOrPencilBounds: typeof getRectBrushOrPencilBounds;
967
- getRectBrushOrPencilStrokeBounds: typeof getRectBrushOrPencilStrokeBounds;
968
- };
969
- type Deps$9 = Partial<typeof defaults$9>;
970
- /**
971
- * @param deps - @hidden
972
- */
973
- declare const mutatorApplyRectBrushStroke: (writer: PixelWriter<any>, deps?: Deps$9) => {
974
- applyRectBrushStroke(color: Color32, x0: number, y0: number, x1: number, y1: number, brushWidth: number, brushHeight: number, alpha: number | undefined, fallOff: (dist: number) => number, blendFn?: BlendColor32): void;
975
- };
976
-
977
- /**
978
- * Blends a solid color into a target pixel buffer.
979
- * @returns true if any pixels were actually modified.
980
- */
981
- declare function blendColorPixelData(dst: IPixelData, color: Color32, opts?: ColorBlendOptions): boolean;
950
+ declare function blendColorPixelDataBinaryMask(dst: IPixelData32, color: Color32, mask: BinaryMask, opts?: ColorBlendMaskOptions): boolean;
982
951
 
983
952
  declare const defaults$8: {
984
- blendColorPixelData: typeof blendColorPixelData;
953
+ blendColorPixelDataAlphaMask: typeof blendColorPixelDataAlphaMask;
954
+ blendColorPixelDataBinaryMask: typeof blendColorPixelDataBinaryMask;
985
955
  };
986
956
  type Deps$8 = Partial<typeof defaults$8>;
987
957
  /**
988
958
  * @param deps - @hidden
989
959
  */
990
- declare const mutatorBlendColor: (writer: PixelWriter<any>, deps?: Deps$8) => {
991
- blendColor(color: Color32, opts?: ColorBlendOptions): boolean;
960
+ declare const mutatorBlendPaintMask: (writer: PixelWriter<any>, deps?: Partial<Deps$8>) => {
961
+ blendColorPaintMask(color: Color32, mask: PaintMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
992
962
  };
993
963
 
994
- declare function blendPixel(target: IPixelData, x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
964
+ declare function blendPixel(target: IPixelData32, x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
995
965
 
996
966
  declare const defaults$7: {
997
967
  blendPixel: typeof blendPixel;
@@ -1004,22 +974,6 @@ declare const mutatorBlendPixel: (writer: PixelWriter<any>, deps?: Partial<Deps$
1004
974
  blendPixel(x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
1005
975
  };
1006
976
 
1007
- /**
1008
- * Blits source PixelData into a destination PixelData using 32-bit integer bitwise blending.
1009
- * This function bypasses standard ImageData limitations by operating directly on
1010
- * Uint32Array views. It supports various blend modes, binary/alpha masking, and
1011
- * automatic clipping of both source and destination bounds.
1012
- * @example
1013
- *
1014
- * const dst = new PixelData(ctx.getImageData(0,0,100,100))
1015
- * blendImageData32(dst, sprite, {
1016
- * blendFn: COLOR_32_BLEND_MODES.multiply,
1017
- * mask: brushMask,
1018
- * maskType: MaskType.ALPHA
1019
- * });
1020
- */
1021
- declare function blendPixelData(dst: IPixelData, src: IPixelData, opts?: PixelBlendOptions): boolean;
1022
-
1023
977
  declare const defaults$6: {
1024
978
  blendPixelData: typeof blendPixelData;
1025
979
  };
@@ -1028,10 +982,10 @@ type Deps$6 = Partial<typeof defaults$6>;
1028
982
  * @param deps - @hidden
1029
983
  */
1030
984
  declare const mutatorBlendPixelData: (writer: PixelWriter<any>, deps?: Partial<Deps$6>) => {
1031
- blendPixelData(src: IPixelData, opts?: PixelBlendOptions): boolean;
985
+ blendPixelData(src: IPixelData32, opts?: PixelBlendOptions): boolean;
1032
986
  };
1033
987
 
1034
- declare function blendPixelDataAlphaMask(dst: IPixelData, src: IPixelData, alphaMask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
988
+ declare function blendPixelDataAlphaMask(dst: IPixelData32, src: IPixelData32, alphaMask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
1035
989
 
1036
990
  declare const defaults$5: {
1037
991
  blendPixelDataAlphaMask: typeof blendPixelDataAlphaMask;
@@ -1041,10 +995,10 @@ type Deps$5 = Partial<typeof defaults$5>;
1041
995
  * @param deps - @hidden
1042
996
  */
1043
997
  declare const mutatorBlendPixelDataAlphaMask: (writer: PixelWriter<any>, deps?: Partial<Deps$5>) => {
1044
- blendPixelDataAlphaMask(src: IPixelData, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
998
+ blendPixelDataAlphaMask(src: IPixelData32, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
1045
999
  };
1046
1000
 
1047
- declare function blendPixelDataBinaryMask(dst: IPixelData, src: IPixelData, binaryMask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
1001
+ declare function blendPixelDataBinaryMask(dst: IPixelData32, src: IPixelData32, binaryMask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
1048
1002
 
1049
1003
  declare const defaults$4: {
1050
1004
  blendPixelDataBinaryMask: typeof blendPixelDataBinaryMask;
@@ -1054,11 +1008,11 @@ type Deps$4 = Partial<typeof defaults$4>;
1054
1008
  * @param deps - @hidden
1055
1009
  */
1056
1010
  declare const mutatorBlendPixelDataBinaryMask: (writer: PixelWriter<any>, deps?: Partial<Deps$4>) => {
1057
- blendPixelDataBinaryMask(src: IPixelData, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
1011
+ blendPixelDataBinaryMask(src: IPixelData32, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
1058
1012
  };
1059
1013
 
1060
1014
  /**
1061
- * Fills a region or the {@link IPixelData} buffer with a solid color.
1015
+ * Fills a region or the {@link IPixelData32} buffer with a solid color.
1062
1016
  * This function is faster than {@link fillPixelData} but does not
1063
1017
  * return a boolean value indicating changes were made.
1064
1018
  *
@@ -1067,7 +1021,7 @@ declare const mutatorBlendPixelDataBinaryMask: (writer: PixelWriter<any>, deps?:
1067
1021
  * @param rect - Defines the area to fill. If omitted, the entire
1068
1022
  * buffer is filled.
1069
1023
  */
1070
- declare function fillPixelDataFast(dst: IPixelData, color: Color32, rect?: Partial<Rect>): void;
1024
+ declare function fillPixelDataFast(dst: IPixelData32, color: Color32, rect?: Partial<Rect>): void;
1071
1025
  /**
1072
1026
  * @param dst - The target to modify.
1073
1027
  * @param color - The color to apply.
@@ -1076,7 +1030,7 @@ declare function fillPixelDataFast(dst: IPixelData, color: Color32, rect?: Parti
1076
1030
  * @param w - Width of the fill area.
1077
1031
  * @param h - Height of the fill area.
1078
1032
  */
1079
- declare function fillPixelDataFast(dst: IPixelData, color: Color32, x: number, y: number, w: number, h: number): void;
1033
+ declare function fillPixelDataFast(dst: IPixelData32, color: Color32, x: number, y: number, w: number, h: number): void;
1080
1034
 
1081
1035
  declare const defaults$3: {
1082
1036
  fillPixelData: typeof fillPixelDataFast;
@@ -1090,14 +1044,14 @@ declare const mutatorClear: (writer: PixelWriter<any>, deps?: Deps$3) => {
1090
1044
  };
1091
1045
 
1092
1046
  /**
1093
- * Fills a region or the {@link IPixelData} buffer with a solid color.
1047
+ * Fills a region or the {@link IPixelData32} buffer with a solid color.
1094
1048
  *
1095
1049
  * @param dst - The target to modify.
1096
1050
  * @param color - The color to apply.
1097
1051
  * @param rect - Defines the area to fill. If omitted, the entire
1098
1052
  * @returns true if any pixels were actually modified.
1099
1053
  */
1100
- declare function fillPixelData(dst: IPixelData, color: Color32, rect?: Partial<Rect>): boolean;
1054
+ declare function fillPixelData(dst: IPixelData32, color: Color32, rect?: Partial<Rect>): boolean;
1101
1055
  /**
1102
1056
  * @param dst - The target to modify.
1103
1057
  * @param color - The color to apply.
@@ -1106,7 +1060,7 @@ declare function fillPixelData(dst: IPixelData, color: Color32, rect?: Partial<R
1106
1060
  * @param w - Width of the fill area.
1107
1061
  * @param h - Height of the fill area.
1108
1062
  */
1109
- declare function fillPixelData(dst: IPixelData, color: Color32, x: number, y: number, w: number, h: number): boolean;
1063
+ declare function fillPixelData(dst: IPixelData32, color: Color32, x: number, y: number, w: number, h: number): boolean;
1110
1064
 
1111
1065
  declare const defaults$2: {
1112
1066
  fillPixelData: typeof fillPixelData;
@@ -1126,7 +1080,7 @@ declare const mutatorFillRect: (writer: PixelWriter<any>, deps?: Deps$2) => {
1126
1080
  };
1127
1081
 
1128
1082
  /**
1129
- * Fills a region of the {@link IPixelData} buffer with a solid color using a mask.
1083
+ * Fills a region of the {@link IPixelData32} buffer with a solid color using a mask.
1130
1084
  * @param dst - The target to modify.
1131
1085
  * @param color - The color to apply.
1132
1086
  * @param mask - The mask defining the area to fill.
@@ -1134,7 +1088,7 @@ declare const mutatorFillRect: (writer: PixelWriter<any>, deps?: Deps$2) => {
1134
1088
  * @param x - Starting horizontal coordinate for the mask placement.
1135
1089
  * @param y - Starting vertical coordinate for the mask placement.
1136
1090
  */
1137
- declare function fillPixelDataBinaryMask(dst: IPixelData, color: Color32, mask: BinaryMask, alpha?: number, x?: number, y?: number): boolean;
1091
+ declare function fillPixelDataBinaryMask(dst: IPixelData32, color: Color32, mask: BinaryMask, alpha?: number, x?: number, y?: number): boolean;
1138
1092
 
1139
1093
  declare const defaults$1: {
1140
1094
  fillPixelDataBinaryMask: typeof fillPixelDataBinaryMask;
@@ -1147,7 +1101,7 @@ declare const mutatorFillBinaryMask: (writer: PixelWriter<any>, deps?: Deps$1) =
1147
1101
  fillBinaryMask(color: Color32, mask: BinaryMask, alpha?: number, x?: number, y?: number): boolean;
1148
1102
  };
1149
1103
 
1150
- declare function invertPixelData(pixelData: IPixelData, opts?: PixelMutateOptions): boolean;
1104
+ declare function invertPixelData(pixelData: IPixelData32, opts?: PixelMutateOptions): boolean;
1151
1105
 
1152
1106
  declare const defaults: {
1153
1107
  invertPixelData: typeof invertPixelData;
@@ -1272,37 +1226,6 @@ declare function invertImageData(imageData: ImageData): ImageData;
1272
1226
  */
1273
1227
  declare function resampleImageData(source: ImageData, factor: number): ImageData;
1274
1228
 
1275
- /**
1276
- * Non destructively resizes the {@link ImageData} buffer to new dimensions, optionally
1277
- * offsetting the original content.
1278
- * This operation creates a new buffer. It does not scale or stretch pixels;
1279
- * instead, it crops or pads the image based on the new dimensions and
1280
- * provides an offset for repositioning.
1281
- *
1282
- * @param target The target to resize.
1283
- * @param newWidth The target width in pixels.
1284
- * @param newHeight The target height in pixels.
1285
- * @param offsetX The horizontal offset for placing the
1286
- * original image within the new buffer.
1287
- * @param offsetY The vertical offset for placing the
1288
- * original image within the new buffer.
1289
- *
1290
- * @returns A new {@link ImageData} instance with the specified dimensions.
1291
- *
1292
- * @example
1293
- * ```typescript
1294
- * // Centers an 80x80 image in a new 100x100 buffer
1295
- * const resized = resizeImageData(
1296
- * originalData,
1297
- * 100,
1298
- * 100,
1299
- * 10,
1300
- * 10
1301
- * );
1302
- * ```
1303
- */
1304
- declare function resizeImageData(target: ImageDataLike, newWidth: number, newHeight: number, offsetX?: number, offsetY?: number): ImageData;
1305
-
1306
1229
  type ReusableImageData = ReturnType<typeof makeReusableImageData>;
1307
1230
  /**
1308
1231
  * Creates a factory function that manages a single, reusable ImageData instance.
@@ -1549,10 +1472,6 @@ declare function makeAlphaMask(w: number, h: number, data?: Uint8Array): AlphaMa
1549
1472
  */
1550
1473
  declare function makeBinaryMask(w: number, h: number, data?: Uint8Array): BinaryMask;
1551
1474
 
1552
- declare function makeCircleAlphaMask(size: number, fallOff?: (d: number) => number): CircleAlphaMask;
1553
-
1554
- declare function makeCircleBinaryMask(size: number): CircleBinaryMask;
1555
-
1556
1475
  declare function applyBinaryMaskToAlphaMask(alphaMaskDst: AlphaMask, binaryMaskSrc: BinaryMask, opts?: ApplyMaskToPixelDataOptions): void;
1557
1476
 
1558
1477
  /**
@@ -1627,40 +1546,29 @@ declare function mergeBinaryMaskRects(current: NullableBinaryMaskRect[], adding:
1627
1546
 
1628
1547
  declare function subtractBinaryMaskRects(current: NullableBinaryMaskRect[], subtracting: NullableBinaryMaskRect[]): NullableBinaryMaskRect[];
1629
1548
 
1630
- declare class PaintBuffer {
1631
- readonly config: PixelEngineConfig;
1632
- readonly tilePool: PixelTilePool;
1633
- readonly lookup: (PixelTile | undefined)[];
1634
- constructor(config: PixelEngineConfig, tilePool: PixelTilePool);
1635
- private processMaskTiles;
1636
- writeColorBinaryMaskRect(color: Color32, mask: BinaryMaskRect): void;
1637
- writeColorAlphaMaskRect(color: Color32, mask: AlphaMaskRect): void;
1638
- clear(): void;
1639
- }
1640
-
1641
- declare function blendPixelDataPaintBuffer(paintBuffer: PaintBuffer, target: IPixelData, alpha?: number, blendFn?: BlendColor32, blendPixelDataFn?: typeof blendPixelData): void;
1549
+ declare function blendPixelDataPaintBuffer(paintBuffer: PaintBuffer, target: IPixelData32, alpha?: number, blendFn?: BlendColor32, blendPixelDataFn?: typeof blendPixelData): void;
1642
1550
 
1643
1551
  /**
1644
1552
  * Clears a region of the PixelData to transparent (0x00000000).
1645
1553
  * Internally uses the optimized fillPixelData.
1646
1554
  */
1647
- declare function clearPixelData(dst: IPixelData, rect?: Partial<BinaryMaskRect>): void;
1555
+ declare function clearPixelData(dst: IPixelData32, rect?: Partial<BinaryMaskRect>): void;
1648
1556
 
1649
1557
  /**
1650
1558
  * High-level extraction that returns a new PixelData instance.
1651
1559
  * Leverages extractPixelDataBuffer for optimized 32-bit memory moves.
1652
1560
  */
1653
- declare function extractPixelData(source: IPixelData, rect: Rect): PixelData;
1654
- declare function extractPixelData(source: IPixelData, x: number, y: number, w: number, h: number): PixelData;
1561
+ declare function extractPixelData(source: IPixelData32, rect: Rect): PixelData;
1562
+ declare function extractPixelData(source: IPixelData32, x: number, y: number, w: number, h: number): PixelData;
1655
1563
 
1656
1564
  /**
1657
1565
  * Extracts a rectangular region of pixels from PixelData.
1658
1566
  * Returns a new Uint32Array containing the extracted pixels.
1659
1567
  */
1660
- declare function extractPixelDataBuffer(source: IPixelData, rect: Rect): Uint32Array;
1661
- declare function extractPixelDataBuffer(source: IPixelData, x: number, y: number, w: number, h: number): Uint32Array;
1568
+ declare function extractPixelDataBuffer(source: IPixelData32, rect: Rect): Uint32Array;
1569
+ declare function extractPixelDataBuffer(source: IPixelData32, x: number, y: number, w: number, h: number): Uint32Array;
1662
1570
 
1663
- declare class PixelBuffer32 implements IPixelData {
1571
+ declare class PixelBuffer32 implements IPixelData32 {
1664
1572
  readonly width: number;
1665
1573
  readonly height: number;
1666
1574
  readonly data32: Uint32Array;
@@ -1673,16 +1581,16 @@ declare class PixelBuffer32 implements IPixelData {
1673
1581
  * Extracts the alpha channel from PixelData into a single-channel mask.
1674
1582
  * Returns a Uint8Array branded as AlphaMask.
1675
1583
  */
1676
- declare function pixelDataToAlphaMask(pixelData: IPixelData): AlphaMask;
1584
+ declare function pixelDataToAlphaMask(pixelData: IPixelData32): AlphaMask;
1677
1585
 
1678
- declare function reflectPixelDataHorizontal(pixelData: IPixelData): void;
1679
- declare function reflectPixelDataVertical(pixelData: IPixelData): void;
1586
+ declare function reflectPixelDataHorizontal(pixelData: IPixelData32): void;
1587
+ declare function reflectPixelDataVertical(pixelData: IPixelData32): void;
1680
1588
 
1681
1589
  /**
1682
1590
  * Resamples PixelData by a specific factor using nearest neighbor.
1683
1591
  * Factor > 1 upscales, Factor < 1 downscales.
1684
1592
  */
1685
- declare function resamplePixelData(pixelData: IPixelData, factor: number): PixelData;
1593
+ declare function resamplePixelData(pixelData: IPixelData32, factor: number): PixelData;
1686
1594
 
1687
1595
  /**
1688
1596
  * Rotates pixel data 90 degrees clockwise.
@@ -1692,13 +1600,18 @@ declare function resamplePixelData(pixelData: IPixelData, factor: number): Pixel
1692
1600
  declare function rotatePixelData(pixelData: PixelData): void;
1693
1601
 
1694
1602
  /**
1695
- * Copies a pixel buffer into a specific region of a {@link IPixelData} object.
1603
+ * Copies a pixel buffer into a specific region of a {@link IPixelData32} object.
1696
1604
  *
1697
1605
  * This function performs a direct memory copy from a {@link Uint32Array}
1698
1606
  * into the target buffer.
1699
1607
  */
1700
- declare function writePixelDataBuffer(target: IPixelData, data: Uint32Array, rect: Rect): void;
1701
- declare function writePixelDataBuffer(target: IPixelData, data: Uint32Array, x: number, y: number, w: number, h: number): void;
1608
+ declare function writePixelDataBuffer(target: IPixelData32, data: Uint32Array, rect: Rect): void;
1609
+ declare function writePixelDataBuffer(target: IPixelData32, data: Uint32Array, x: number, y: number, w: number, h: number): void;
1610
+
1611
+ /**
1612
+ * @param writePixelDataBufferFn - @hidden
1613
+ */
1614
+ declare function writePaintBufferToPixelData(target: IPixelData, paintBuffer: PaintBuffer, writePixelDataBufferFn?: typeof writePixelDataBuffer): void;
1702
1615
 
1703
1616
  declare function getRectsBounds<T extends Rect>(rects: T[]): T;
1704
1617
 
@@ -1716,17 +1629,27 @@ declare function getRectsBounds<T extends Rect>(rects: T[]): T;
1716
1629
  * // The mask is cropped by 10 px on the top and left.
1717
1630
  * trimRectBounds(selection, canvas);
1718
1631
  */
1719
- declare function trimRectBounds<T extends NullableMaskRect>(target: T, bounds: Rect): void;
1632
+ declare function trimMaskRectBounds<T extends NullableMaskRect>(target: T, bounds: Rect): void;
1633
+
1634
+ declare function trimRectBounds(x: number, y: number, w: number, h: number, targetWidth: number, targetHeight: number, out?: Rect): Rect;
1635
+
1636
+ declare function makeCirclePaintAlphaMask(size: number, fallOff?: (d: number) => number): PaintAlphaMask;
1637
+
1638
+ declare function makeCirclePaintBinaryMask(size: number): PaintBinaryMask;
1639
+
1640
+ declare function makePaintBinaryMask(mask: BinaryMask): PaintBinaryMask;
1641
+ declare function makePaintAlphaMask(mask: AlphaMask): PaintAlphaMask;
1642
+
1643
+ declare function makeRectFalloffPaintAlphaMask(width: number, height: number, fallOff?: (d: number) => number): PaintAlphaMask;
1720
1644
 
1721
- type PaintBufferRenderer = ReturnType<typeof makePaintBufferRenderer>;
1645
+ type PaintBufferCanvasRenderer = ReturnType<typeof makePaintBufferCanvasRenderer>;
1722
1646
  /**
1723
1647
  *
1724
- * @param paintBuffer
1725
1648
  * @param offscreenCanvasClass - @internal
1726
1649
  */
1727
- declare function makePaintBufferRenderer(paintBuffer: PaintBuffer, offscreenCanvasClass?: {
1650
+ declare function makePaintBufferCanvasRenderer(paintBuffer: PaintBuffer, offscreenCanvasClass?: {
1728
1651
  new (width: number, height: number): OffscreenCanvas;
1729
1652
  prototype: OffscreenCanvas;
1730
- }): (target: CanvasRenderingContext2D) => void;
1653
+ }): (targetCtx: CanvasRenderingContext2D, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1731
1654
 
1732
- export { type AlphaMask, type AlphaMaskRect, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BasePixelBlendOptions, type BinaryMask, type BinaryMaskRect, type BlendColor32, type BlendModeRegistry, CANVAS_CTX_FAILED, type CanvasContext, type CanvasFrameRenderer, type CircleAlphaMask, type CircleBinaryMask, type CircleMask, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, type FloodFillImageDataOptions, type FloodFillResult, type HistoryAction, type HistoryActionFactory, HistoryManager, type HistoryMutator, type IPixelData, type ImageDataLike, type ImageDataLikeConstructor, IndexedImage, type InvertMask, type Mask, type MaskOffset, MaskType, type MergeAlphaMasksOptions, type NullableBinaryMaskRect, type NullableMaskRect, OFFSCREEN_CANVAS_CTX_FAILED, PaintBuffer, type PaintBufferRenderer, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, PixelBuffer32, type PixelCanvas, PixelData, PixelEngineConfig, type PixelMutateOptions, type PixelPatchTiles, type PixelRect, PixelTile, PixelTilePool, PixelWriter, type PixelWriterOptions, type RGBA, type Rect, type RequiredBlendModes, type ReusableCanvas, type ReusableImageData, type SerializedImageData, UnsupportedFormatError, applyAlphaMaskToPixelData, applyBinaryMaskToAlphaMask, applyBinaryMaskToPixelData, applyPatchTiles, applyRectBrushToPixelData, base64DecodeArrayBuffer, base64EncodeArrayBuffer, blendColorPixelData, blendColorPixelDataAlphaMask, blendColorPixelDataBinaryMask, blendColorPixelDataCircleMask, blendPixel, blendPixelData, blendPixelDataAlphaMask, blendPixelDataBinaryMask, blendPixelDataPaintBuffer, clearPixelData, color32ToCssRGBA, color32ToHex, colorBurnFast, colorBurnPerfect, colorDistance, colorDodgeFast, colorDodgePerfect, copyImageData, copyImageDataLike, copyMask, darkenFast, darkenPerfect, darkerFast, darkerPerfect, deserializeImageData, deserializeNullableImageData, deserializeRawImageData, differenceFast, differencePerfect, divideFast, dividePerfect, exclusionFast, exclusionPerfect, extractImageDataBuffer, extractMask, extractMaskBuffer, extractPixelData, extractPixelDataBuffer, fileInputChangeToImageData, fileToImageData, fillPixelData, fillPixelDataBinaryMask, fillPixelDataFast, floodFillSelection, forEachLinePoint, getCircleBrushOrPencilBounds, getCircleBrushOrPencilStrokeBounds, getImageDataFromClipboard, getIndexedImageColorCounts, getRectBrushOrPencilBounds, getRectBrushOrPencilStrokeBounds, 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, makeBinaryMask, makeBlendModeRegistry, makeCanvasFrameRenderer, makeCircleAlphaMask, makeCircleBinaryMask, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makePaintBufferRenderer, makePerfectBlendModeRegistry, makePixelCanvas, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorApplyCircleBrushStroke, mutatorApplyCirclePencil, mutatorApplyCirclePencilStroke, mutatorApplyRectBrush, mutatorApplyRectBrushStroke, mutatorApplyRectPencil, mutatorApplyRectPencilStroke, mutatorBlendColor, mutatorBlendColorCircleMask, mutatorBlendPixel, mutatorBlendPixelData, mutatorBlendPixelDataAlphaMask, mutatorBlendPixelDataBinaryMask, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorFillRect, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resampleImageData, resampleIndexedImage, resamplePixelData, resizeImageData, rotatePixelData, screenFast, screenPerfect, serializeImageData, serializeNullableImageData, setMaskData, softLightFast, softLightPerfect, sourceOverFast, sourceOverPerfect, subtractBinaryMaskRects, subtractFast, subtractPerfect, toBlendModeIndexAndName, trimRectBounds, uInt32ArrayToImageData, uInt32ArrayToImageDataLike, unpackAlpha, unpackBlue, unpackColor, unpackColorTo, unpackGreen, unpackRed, vividLightFast, vividLightPerfect, writeImageData, writeImageDataBuffer, writeImageDataToClipboard, writeImgBlobToClipboard, writePixelDataBuffer };
1655
+ export { type AlphaMask, type AlphaMaskRect, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BasePixelBlendOptions, type BinaryMask, type BinaryMaskRect, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, CANVAS_CTX_FAILED, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, type FloodFillImageDataOptions, type FloodFillResult, type HistoryAction, type HistoryActionFactory, HistoryManager, type HistoryMutator, type IPixelData, type IPixelData32, type ImageDataLike, type ImageDataLikeConstructor, IndexedImage, type InvertMask, type Mask, type MaskOffset, type MaskRect, MaskType, type MergeAlphaMasksOptions, type NullableBinaryMaskRect, type NullableMaskRect, OFFSCREEN_CANVAS_CTX_FAILED, type PaintAlphaMask, type PaintBinaryMask, PaintBuffer, type PaintBufferCanvasRenderer, type PaintMask, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, PixelBuffer32, type PixelCanvas, PixelData, PixelEngineConfig, type PixelMutateOptions, type PixelPatchTiles, type PixelRect, PixelTile, PixelTilePool, PixelWriter, type PixelWriterOptions, type RGBA, type Rect, type RequiredBlendModes, type ReusableCanvas, type ReusableImageData, type SerializedImageData, UnsupportedFormatError, applyAlphaMaskToPixelData, applyBinaryMaskToAlphaMask, applyBinaryMaskToPixelData, applyPatchTiles, base64DecodeArrayBuffer, base64EncodeArrayBuffer, blendColorPixelData, blendColorPixelDataAlphaMask, blendColorPixelDataBinaryMask, blendPixel, blendPixelData, blendPixelDataAlphaMask, blendPixelDataBinaryMask, blendPixelDataPaintBuffer, clearPixelData, color32ToCssRGBA, color32ToHex, colorBurnFast, colorBurnPerfect, colorDistance, colorDodgeFast, colorDodgePerfect, copyImageData, copyImageDataLike, copyMask, darkenFast, darkenPerfect, darkerFast, darkerPerfect, deserializeImageData, deserializeNullableImageData, deserializeRawImageData, differenceFast, differencePerfect, divideFast, dividePerfect, exclusionFast, exclusionPerfect, extractImageDataBuffer, extractMask, extractMaskBuffer, extractPixelData, extractPixelDataBuffer, fileInputChangeToImageData, fileToImageData, fillPixelData, fillPixelDataBinaryMask, fillPixelDataFast, floodFillSelection, forEachLinePoint, getImageDataFromClipboard, 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, makeBinaryMask, makeBlendModeRegistry, makeCanvasFrameRenderer, makeCirclePaintAlphaMask, makeCirclePaintBinaryMask, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makePaintAlphaMask, makePaintBinaryMask, makePaintBufferCanvasRenderer, makePerfectBlendModeRegistry, makePixelCanvas, makeRectFalloffPaintAlphaMask, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorBlendColor, mutatorBlendPaintMask, mutatorBlendPixel, mutatorBlendPixelData, mutatorBlendPixelDataAlphaMask, mutatorBlendPixelDataBinaryMask, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorFillRect, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resampleImageData, resampleIndexedImage, resamplePixelData, resizeImageData, rotatePixelData, screenFast, screenPerfect, serializeImageData, serializeNullableImageData, setMaskData, softLightFast, softLightPerfect, sourceOverFast, sourceOverPerfect, subtractBinaryMaskRects, subtractFast, subtractPerfect, toBlendModeIndexAndName, trimMaskRectBounds, trimRectBounds, uInt32ArrayToImageData, uInt32ArrayToImageDataLike, unpackAlpha, unpackBlue, unpackColor, unpackColorTo, unpackGreen, unpackRed, vividLightFast, vividLightPerfect, writeImageData, writeImageDataBuffer, writeImageDataToClipboard, writeImgBlobToClipboard, writePaintBufferToPixelData, writePixelDataBuffer };