pixel-data-js 0.25.2 → 0.26.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 (63) hide show
  1. package/dist/index.prod.cjs +1696 -1526
  2. package/dist/index.prod.cjs.map +1 -1
  3. package/dist/index.prod.d.ts +414 -311
  4. package/dist/index.prod.js +1676 -1519
  5. package/dist/index.prod.js.map +1 -1
  6. package/package.json +8 -9
  7. package/src/Algorithm/floodFillSelection.ts +49 -80
  8. package/src/Canvas/PixelCanvas.ts +1 -1
  9. package/src/Canvas/ReusableCanvas.ts +1 -1
  10. package/src/History/HistoryAction.ts +6 -5
  11. package/src/History/PixelMutator/mutatorApplyAlphaMask.ts +8 -10
  12. package/src/History/PixelMutator/mutatorApplyBinaryMask.ts +8 -10
  13. package/src/History/PixelMutator/mutatorApplyMask.ts +39 -0
  14. package/src/History/PixelMutator/{mutatorBlendPixelDataAlphaMask.ts → mutatorBlendAlphaMask.ts} +9 -9
  15. package/src/History/PixelMutator/{mutatorBlendPixelDataBinaryMask.ts → mutatorBlendBinaryMask.ts} +9 -9
  16. package/src/History/PixelMutator/mutatorBlendColor.ts +8 -9
  17. package/src/History/PixelMutator/mutatorBlendColorPaintAlphaMask.ts +51 -0
  18. package/src/History/PixelMutator/mutatorBlendColorPaintBinaryMask.ts +51 -0
  19. package/src/History/PixelMutator/{mutatorBlendPaintMask.ts → mutatorBlendColorPaintMask.ts} +3 -3
  20. package/src/History/PixelMutator/mutatorBlendMask.ts +43 -0
  21. package/src/History/PixelMutator/mutatorBlendPaintRect.ts +55 -0
  22. package/src/History/PixelMutator/mutatorBlendPixel.ts +2 -2
  23. package/src/History/PixelMutator/mutatorBlendPixelData.ts +8 -9
  24. package/src/History/PixelMutator/mutatorClear.ts +13 -11
  25. package/src/History/PixelMutator/mutatorFill.ts +2 -2
  26. package/src/History/PixelMutator/mutatorFillBinaryMask.ts +3 -4
  27. package/src/History/PixelMutator/mutatorInvert.ts +8 -9
  28. package/src/History/PixelMutator.ts +20 -4
  29. package/src/History/PixelWriter.ts +11 -13
  30. package/src/Input/fileToImageData.ts +1 -1
  31. package/src/Internal/helpers.ts +4 -1
  32. package/src/Mask/applyBinaryMaskToAlphaMask.ts +8 -10
  33. package/src/Paint/PaintBuffer.ts +3 -3
  34. package/src/Paint/PaintBufferCanvasRenderer.ts +1 -1
  35. package/src/Paint/makePaintMask.ts +5 -5
  36. package/src/Paint/makeRectFalloffPaintAlphaMask.ts +3 -3
  37. package/src/PixelData/applyAlphaMaskToPixelData.ts +14 -16
  38. package/src/PixelData/applyBinaryMaskToPixelData.ts +14 -16
  39. package/src/PixelData/applyMaskToPixelData.ts +22 -0
  40. package/src/PixelData/blendColorPixelData.ts +12 -15
  41. package/src/PixelData/blendColorPixelDataAlphaMask.ts +16 -16
  42. package/src/PixelData/blendColorPixelDataBinaryMask.ts +16 -16
  43. package/src/PixelData/blendColorPixelDataMask.ts +16 -0
  44. package/src/PixelData/blendColorPixelDataPaintAlphaMask.ts +30 -0
  45. package/src/PixelData/blendColorPixelDataPaintBinaryMask.ts +30 -0
  46. package/src/PixelData/blendColorPixelDataPaintMask.ts +35 -0
  47. package/src/PixelData/blendPixelData.ts +14 -16
  48. package/src/PixelData/blendPixelDataAlphaMask.ts +17 -19
  49. package/src/PixelData/blendPixelDataBinaryMask.ts +17 -19
  50. package/src/PixelData/blendPixelDataMask.ts +16 -0
  51. package/src/PixelData/blendPixelDataPaintBuffer.ts +1 -1
  52. package/src/PixelData/{clearPixelData.ts → clearPixelDataFast.ts} +2 -2
  53. package/src/PixelData/fillPixelDataBinaryMask.ts +8 -22
  54. package/src/PixelData/fillPixelDataFast.ts +2 -2
  55. package/src/PixelData/invertPixelData.ts +13 -16
  56. package/src/_types.ts +8 -7
  57. package/src/index.ts +41 -31
  58. package/dist/index.dev.cjs +0 -5419
  59. package/dist/index.dev.cjs.map +0 -1
  60. package/dist/index.dev.js +0 -5208
  61. package/dist/index.dev.js.map +0 -1
  62. package/src/Canvas/_constants.ts +0 -2
  63. package/src/PixelData/PixelBuffer32.ts +0 -28
@@ -57,18 +57,19 @@ declare enum MaskType {
57
57
  */
58
58
  BINARY = 1
59
59
  }
60
- interface Mask {
60
+ interface BaseMask {
61
61
  readonly type: MaskType;
62
62
  readonly data: Uint8Array;
63
63
  readonly w: number;
64
64
  readonly h: number;
65
65
  }
66
+ type Mask = BinaryMask | AlphaMask;
66
67
  /** Strictly 0 or 1 */
67
- interface BinaryMask extends Mask {
68
+ interface BinaryMask extends BaseMask {
68
69
  readonly type: MaskType.BINARY;
69
70
  }
70
71
  /** Strictly 0-255 */
71
- interface AlphaMask extends Mask {
72
+ interface AlphaMask extends BaseMask {
72
73
  readonly type: MaskType.ALPHA;
73
74
  }
74
75
  interface BasePaintMask {
@@ -176,6 +177,8 @@ interface ColorBlendOptions extends PixelRect, Alpha {
176
177
  }
177
178
  interface ColorBlendMaskOptions extends ColorBlendOptions, MaskOffset, InvertMask {
178
179
  }
180
+ interface ColorBlendPaintMaskOptions extends Omit<ColorBlendOptions, 'w' | 'h'> {
181
+ }
179
182
  type MaskRect<T extends MaskType> = Rect & {
180
183
  type: T;
181
184
  data: Uint8Array;
@@ -196,7 +199,6 @@ type NullableMaskRect = Rect & ({
196
199
  type?: null;
197
200
  data?: null;
198
201
  });
199
- type HistoryMutator<T extends {}, D extends {}> = (writer: PixelWriter<any>, deps?: Partial<D>) => T;
200
202
  interface IPixelData32 {
201
203
  readonly data32: Uint32Array;
202
204
  readonly width: number;
@@ -206,47 +208,6 @@ interface IPixelData<T extends ImageDataLike = ImageData> extends IPixelData32 {
206
208
  readonly imageData: T;
207
209
  }
208
210
 
209
- /**
210
- * Packs RGBA into a 32-bit integer compatible with
211
- * Little-Endian Uint32Array views on ImageData.
212
- */
213
- declare function packColor(r: number, g: number, b: number, a: number): Color32;
214
- declare function packRGBA({ r, g, b, a }: RGBA): Color32;
215
- declare const unpackRed: (packed: Color32) => number;
216
- declare const unpackGreen: (packed: Color32) => number;
217
- declare const unpackBlue: (packed: Color32) => number;
218
- declare const unpackAlpha: (packed: Color32) => number;
219
- declare function unpackColor(packed: Color32): RGBA;
220
- declare function unpackColorTo(packed: Color32, scratch?: RGBA): RGBA;
221
- declare function colorDistance(a: Color32, b: Color32): number;
222
- /**
223
- * Linearly interpolates between two 32-bit colors using a floating-point weight.
224
- * * This is the preferred method for UI animations or scenarios where high
225
- * precision is required. It uses the standard `a + t * (b - a)` formula
226
- * for each channel.
227
- * @param a - The starting color as a 32-bit integer (AABBGGRR).
228
- * @param b - The target color as a 32-bit integer (AABBGGRR).
229
- * @param t - The interpolation factor between 0.0 and 1.0.
230
- * @returns The interpolated 32-bit color.
231
- */
232
- declare function lerpColor32(a: Color32, b: Color32, t: number): Color32;
233
- /**
234
- * Linearly interpolates between two 32-bit colors using integer fixed-point math.
235
- * Highly optimized for image processing and real-time blitting. It processes
236
- * channels in parallel using bitmasks (RB and GA pairs).
237
- * **Note:** Subject to a 1-bit drift (rounding down) due to fast bit-shift division.
238
- * @param src - The source (foreground) color as a 32-bit integer.
239
- * @param dst - The destination (background) color as a 32-bit integer.
240
- * @param w - The blend weight as a byte value from 0 to 255. Where 0 is 100% dst and 255 is 100% src
241
- * @returns The blended 32-bit color.
242
- */ declare function lerpColor32Fast(src: Color32, dst: Color32, w: number): Color32;
243
- declare function color32ToHex(color: Color32): string;
244
- /**
245
- * Converts a 32-bit integer (0xAABBGGRR) to a CSS rgba() string.
246
- * Example: 0xFF0000FF -> "rgba(255,0,0,1)"
247
- */
248
- declare function color32ToCssRGBA(color: Color32): string;
249
-
250
211
  declare class PixelData<T extends ImageDataLike = ImageData> implements IPixelData<T> {
251
212
  readonly data32: Uint32Array;
252
213
  readonly imageData: T;
@@ -256,15 +217,9 @@ declare class PixelData<T extends ImageDataLike = ImageData> implements IPixelDa
256
217
  set(imageData: T): void;
257
218
  }
258
219
 
259
- type FloodFillImageDataOptions = {
260
- contiguous?: boolean;
261
- tolerance?: number;
262
- bounds?: Rect;
263
- };
264
- type FloodFillResult = {
220
+ type FloodFillResult = BinaryMaskRect & {
265
221
  startX: number;
266
222
  startY: number;
267
- selectionRect: BinaryMaskRect;
268
223
  pixels: Uint8ClampedArray;
269
224
  };
270
225
  /**
@@ -273,16 +228,15 @@ type FloodFillResult = {
273
228
  * color tolerance. It can operate in "contiguous" mode (classic bucket fill) or
274
229
  * "non-contiguous" mode (selects all matching pixels in the buffer).
275
230
  *
276
- * @param img - The source image data to process.
231
+ * @param target - The source image data to process.
277
232
  * @param startX - The starting horizontal coordinate.
278
233
  * @param startY - The starting vertical coordinate.
279
- * @param options - Configuration for the fill operation.
280
- * @param options.contiguous - If true, only connected pixels are
234
+ * @param contiguous - If true, only connected pixels are
281
235
  * selected. If false, all pixels within tolerance are selected regardless of position.
282
- * @param options.tolerance - The maximum allowed difference in color
236
+ * @param tolerance - The maximum allowed difference in color
283
237
  * distance (0-255) for a pixel to be included.
284
- * @param options.bounds - Optional bounding box to restrict the search area.
285
- *
238
+ * @param bounds - Optional bounding box to restrict the search area.
239
+ * @param out output object
286
240
  * @returns A {@link FloodFillResult} containing the mask and bounds of the selection,
287
241
  * or `null` if the starting coordinates are out of bounds.
288
242
  *
@@ -299,7 +253,7 @@ type FloodFillResult = {
299
253
  * );
300
254
  * ```
301
255
  */
302
- declare function floodFillSelection(img: ImageDataLike | PixelData, startX: number, startY: number, { contiguous, tolerance, bounds, }?: FloodFillImageDataOptions): FloodFillResult | null;
256
+ declare function floodFillSelection(target: PixelData, startX: number, startY: number, contiguous?: boolean, tolerance?: number, bounds?: Rect, out?: FloodFillResult): FloodFillResult | null;
303
257
 
304
258
  /**
305
259
  * Iterates through a line with sub-pixel precision.
@@ -307,6 +261,50 @@ declare function floodFillSelection(img: ImageDataLike | PixelData, startX: numb
307
261
  */
308
262
  declare function forEachLinePoint(x0: number, y0: number, x1: number, y1: number, callback: (x: number, y: number) => void): void;
309
263
 
264
+ declare const BaseBlendMode: {
265
+ readonly overwrite: 0;
266
+ readonly sourceOver: 1;
267
+ readonly darken: 2;
268
+ readonly multiply: 3;
269
+ readonly colorBurn: 4;
270
+ readonly linearBurn: 5;
271
+ readonly darkerColor: 6;
272
+ readonly lighten: 7;
273
+ readonly screen: 8;
274
+ readonly colorDodge: 9;
275
+ readonly linearDodge: 10;
276
+ readonly lighterColor: 11;
277
+ readonly overlay: 12;
278
+ readonly softLight: 13;
279
+ readonly hardLight: 14;
280
+ readonly vividLight: 15;
281
+ readonly linearLight: 16;
282
+ readonly pinLight: 17;
283
+ readonly hardMix: 18;
284
+ readonly difference: 19;
285
+ readonly exclusion: 20;
286
+ readonly subtract: 21;
287
+ readonly divide: 22;
288
+ };
289
+ interface RequiredBlendModes {
290
+ overwrite: 0;
291
+ }
292
+ type BaseBlendModes = RequiredBlendModes & Record<string, number>;
293
+ declare const overwriteBase: BlendColor32;
294
+
295
+ type BlendModeRegistry<BlendModes extends BaseBlendModes = BaseBlendModes, Name extends keyof BlendModes = keyof BlendModes, Index extends BlendModes[Name] = BlendModes[Name]> = ReturnType<typeof makeBlendModeRegistry<BlendModes, Name, Index>>;
296
+ declare function makeBlendModeRegistry<BlendModes extends BaseBlendModes, Name extends keyof BlendModes = keyof BlendModes, Index extends BlendModes[Name] = BlendModes[Name]>(blendModes: BlendModes, initialEntries: Record<Index, BlendColor32>, registryName?: string): {
297
+ registryName: string;
298
+ nameToBlend: { [K in keyof BlendModes]: BlendColor32; };
299
+ nameToIndex: Record<Name, Index>;
300
+ blendToIndex: Map<BlendColor32, Index>;
301
+ blendToName: Map<BlendColor32, Name>;
302
+ indexToBlend: BlendColor32[];
303
+ indexToName: Name[];
304
+ indexType: Index;
305
+ nameType: Name;
306
+ };
307
+
310
308
  declare const overwriteFast: BlendColor32;
311
309
  declare const sourceOverFast: BlendColor32;
312
310
  declare const darkenFast: BlendColor32;
@@ -473,77 +471,11 @@ declare function makePerfectBlendModeRegistry(name?: string): {
473
471
  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
472
  };
475
473
 
476
- declare const BaseBlendMode: {
477
- readonly overwrite: 0;
478
- readonly sourceOver: 1;
479
- readonly darken: 2;
480
- readonly multiply: 3;
481
- readonly colorBurn: 4;
482
- readonly linearBurn: 5;
483
- readonly darkerColor: 6;
484
- readonly lighten: 7;
485
- readonly screen: 8;
486
- readonly colorDodge: 9;
487
- readonly linearDodge: 10;
488
- readonly lighterColor: 11;
489
- readonly overlay: 12;
490
- readonly softLight: 13;
491
- readonly hardLight: 14;
492
- readonly vividLight: 15;
493
- readonly linearLight: 16;
494
- readonly pinLight: 17;
495
- readonly hardMix: 18;
496
- readonly difference: 19;
497
- readonly exclusion: 20;
498
- readonly subtract: 21;
499
- readonly divide: 22;
500
- };
501
- interface RequiredBlendModes {
502
- overwrite: 0;
503
- }
504
- type BaseBlendModes = RequiredBlendModes & Record<string, number>;
505
- declare const overwriteBase: BlendColor32;
506
-
507
- type BlendModeRegistry<BlendModes extends BaseBlendModes = BaseBlendModes, Name extends keyof BlendModes = keyof BlendModes, Index extends BlendModes[Name] = BlendModes[Name]> = ReturnType<typeof makeBlendModeRegistry<BlendModes, Name, Index>>;
508
- declare function makeBlendModeRegistry<BlendModes extends BaseBlendModes, Name extends keyof BlendModes = keyof BlendModes, Index extends BlendModes[Name] = BlendModes[Name]>(blendModes: BlendModes, initialEntries: Record<Index, BlendColor32>, registryName?: string): {
509
- registryName: string;
510
- nameToBlend: { [K in keyof BlendModes]: BlendColor32; };
511
- nameToIndex: Record<Name, Index>;
512
- blendToIndex: Map<BlendColor32, Index>;
513
- blendToName: Map<BlendColor32, Name>;
514
- indexToBlend: BlendColor32[];
515
- indexToName: Name[];
516
- indexType: Index;
517
- nameType: Name;
518
- };
519
-
520
474
  declare function toBlendModeIndexAndName(input: string | number): {
521
475
  blendIndex: number;
522
476
  blendName: string;
523
477
  };
524
478
 
525
- declare const OFFSCREEN_CANVAS_CTX_FAILED = "Failed to create OffscreenCanvas context";
526
- declare const CANVAS_CTX_FAILED = "Failed to create Canvas context";
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
-
547
479
  type PixelCanvas = {
548
480
  readonly canvas: HTMLCanvasElement;
549
481
  readonly ctx: CanvasRenderingContext2D;
@@ -586,14 +518,33 @@ declare function makeReusableOffscreenCanvas(): {
586
518
  type DrawPixelLayer = (ctx: CanvasRenderingContext2D) => void;
587
519
  type DrawScreenLayer = (ctx: CanvasRenderingContext2D, scale: number) => void;
588
520
  type CanvasFrameRenderer = ReturnType<typeof makeCanvasFrameRenderer>;
589
- declare const defaults$c: {
521
+ declare const defaults$h: {
590
522
  makeReusableCanvas: typeof makeReusableCanvas;
591
523
  };
592
- type Deps$c = Partial<typeof defaults$c>;
524
+ type Deps$h = Partial<typeof defaults$h>;
593
525
  /**
594
526
  * @param deps - @hidden
595
527
  */
596
- declare function makeCanvasFrameRenderer(deps?: Deps$c): (pixelCanvas: PixelCanvas, scale: number, getImageData: () => ImageData | undefined | null, drawPixelLayer?: DrawPixelLayer, drawScreenLayer?: DrawScreenLayer) => void;
528
+ declare function makeCanvasFrameRenderer(deps?: Deps$h): (pixelCanvas: PixelCanvas, scale: number, getImageData: () => ImageData | undefined | null, drawPixelLayer?: DrawPixelLayer, drawScreenLayer?: DrawScreenLayer) => void;
529
+
530
+ declare const CANVAS_COMPOSITE_MAP: {
531
+ readonly 0: "copy";
532
+ readonly 1: "source-over";
533
+ readonly 2: "darken";
534
+ readonly 3: "multiply";
535
+ readonly 4: "color-burn";
536
+ readonly 7: "lighten";
537
+ readonly 8: "screen";
538
+ readonly 9: "color-dodge";
539
+ readonly 10: "lighter";
540
+ readonly 12: "overlay";
541
+ readonly 13: "soft-light";
542
+ readonly 14: "hard-light";
543
+ readonly 19: "difference";
544
+ readonly 20: "exclusion";
545
+ };
546
+ type CanvasBlendModeIndex = keyof typeof CANVAS_COMPOSITE_MAP;
547
+ type CanvasCompositeOperation = typeof CANVAS_COMPOSITE_MAP[CanvasBlendModeIndex];
597
548
 
598
549
  /**
599
550
  * Extracts {@link ImageData} from a clipboard event if an image is present.
@@ -656,12 +607,83 @@ declare class PixelTile implements IPixelData {
656
607
  constructor(id: number, tx: number, ty: number, tileSize: number, tileArea: number);
657
608
  }
658
609
 
610
+ declare class PixelEngineConfig {
611
+ readonly tileSize: number;
612
+ readonly tileShift: number;
613
+ readonly tileMask: number;
614
+ readonly tileArea: number;
615
+ readonly target: PixelData;
616
+ readonly targetColumns: number;
617
+ readonly targetRows: number;
618
+ constructor(tileSize: number, target: PixelData);
619
+ }
620
+
621
+ declare class PixelTilePool {
622
+ pool: PixelTile[];
623
+ private tileSize;
624
+ private tileArea;
625
+ constructor(config: PixelEngineConfig);
626
+ getTile(id: number, tx: number, ty: number): PixelTile;
627
+ releaseTile(tile: PixelTile): void;
628
+ releaseTiles(tiles: (PixelTile | undefined)[]): void;
629
+ }
630
+
659
631
  type PixelPatchTiles = {
660
632
  beforeTiles: PixelTile[];
661
633
  afterTiles: PixelTile[];
662
634
  };
663
635
  declare function applyPatchTiles(target: IPixelData32, tiles: PixelTile[], tileSize: number): void;
664
636
 
637
+ type DidChangeFn = (didChange: boolean) => boolean;
638
+ declare class PixelAccumulator {
639
+ readonly config: PixelEngineConfig;
640
+ readonly tilePool: PixelTilePool;
641
+ lookup: (PixelTile | undefined)[];
642
+ beforeTiles: PixelTile[];
643
+ constructor(config: PixelEngineConfig, tilePool: PixelTilePool);
644
+ recyclePatch(patch: PixelPatchTiles): void;
645
+ /**
646
+ * @param x pixel x coordinate
647
+ * @param y pixel y coordinate
648
+ */
649
+ storePixelBeforeState(x: number, y: number): DidChangeFn;
650
+ /**
651
+ * @param x pixel x coordinate
652
+ * @param y pixel y coordinate
653
+ * @param w pixel width
654
+ * @param h pixel height
655
+ */
656
+ storeRegionBeforeState(x: number, y: number, w: number, h: number): DidChangeFn;
657
+ storeTileBeforeState(id: number, tx: number, ty: number): DidChangeFn;
658
+ extractState(tile: PixelTile): void;
659
+ extractPatch(): PixelPatchTiles;
660
+ rollbackAfterError(): void;
661
+ }
662
+
663
+ interface HistoryAction {
664
+ undo: () => void;
665
+ redo: () => void;
666
+ dispose?: () => void;
667
+ }
668
+ type HistoryActionFactory = typeof makeHistoryAction;
669
+ declare function makeHistoryAction(config: PixelEngineConfig, accumulator: PixelAccumulator, patch: PixelPatchTiles, after?: () => void, afterUndo?: () => void, afterRedo?: () => void, applyPatchTilesFn?: typeof applyPatchTiles): HistoryAction;
670
+
671
+ declare class HistoryManager {
672
+ maxSteps: number;
673
+ readonly undoStack: HistoryAction[];
674
+ readonly redoStack: HistoryAction[];
675
+ readonly listeners: Set<() => void>;
676
+ constructor(maxSteps?: number);
677
+ get canUndo(): boolean;
678
+ get canRedo(): boolean;
679
+ subscribe(fn: () => void): () => boolean;
680
+ notify(): void;
681
+ commit(action: HistoryAction): void;
682
+ undo(): void;
683
+ redo(): void;
684
+ clearRedoStack(): void;
685
+ }
686
+
665
687
  /**
666
688
  * Non destructively resizes the {@link ImageData} buffer to new dimensions, optionally
667
689
  * offsetting the original content.
@@ -693,27 +715,6 @@ declare function applyPatchTiles(target: IPixelData32, tiles: PixelTile[], tileS
693
715
  */
694
716
  declare function resizeImageData(target: ImageDataLike, newWidth: number, newHeight: number, offsetX?: number, offsetY?: number): ImageData;
695
717
 
696
- declare class PixelEngineConfig {
697
- readonly tileSize: number;
698
- readonly tileShift: number;
699
- readonly tileMask: number;
700
- readonly tileArea: number;
701
- readonly target: PixelData;
702
- readonly targetColumns: number;
703
- readonly targetRows: number;
704
- constructor(tileSize: number, target: PixelData);
705
- }
706
-
707
- declare class PixelTilePool {
708
- pool: PixelTile[];
709
- private tileSize;
710
- private tileArea;
711
- constructor(config: PixelEngineConfig);
712
- getTile(id: number, tx: number, ty: number): PixelTile;
713
- releaseTile(tile: PixelTile): void;
714
- releaseTiles(tiles: (PixelTile | undefined)[]): void;
715
- }
716
-
717
718
  declare class PaintBuffer {
718
719
  readonly config: PixelEngineConfig;
719
720
  readonly tilePool: PixelTilePool;
@@ -739,51 +740,9 @@ declare class PaintBuffer {
739
740
  * blendFn: COLOR_32_BLEND_MODES.multiply,
740
741
  * mask: brushMask,
741
742
  * 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
-
762
- type DidChangeFn = (didChange: boolean) => boolean;
763
- declare class PixelAccumulator {
764
- readonly config: PixelEngineConfig;
765
- readonly tilePool: PixelTilePool;
766
- lookup: (PixelTile | undefined)[];
767
- beforeTiles: PixelTile[];
768
- constructor(config: PixelEngineConfig, tilePool: PixelTilePool);
769
- recyclePatch(patch: PixelPatchTiles): void;
770
- /**
771
- * @param x pixel x coordinate
772
- * @param y pixel y coordinate
773
- */
774
- storePixelBeforeState(x: number, y: number): DidChangeFn;
775
- /**
776
- * @param x pixel x coordinate
777
- * @param y pixel y coordinate
778
- * @param w pixel width
779
- * @param h pixel height
780
- */
781
- storeRegionBeforeState(x: number, y: number, w: number, h: number): DidChangeFn;
782
- storeTileBeforeState(id: number, tx: number, ty: number): DidChangeFn;
783
- extractState(tile: PixelTile): void;
784
- extractPatch(): PixelPatchTiles;
785
- rollbackAfterError(): void;
786
- }
743
+ * });
744
+ */
745
+ declare function blendPixelData(target: IPixelData32, src: IPixelData32, opts?: PixelBlendOptions): boolean;
787
746
 
788
747
  interface PixelWriterOptions {
789
748
  maxHistorySteps?: number;
@@ -824,7 +783,7 @@ declare class PixelWriter<M> {
824
783
  readonly mutator: M;
825
784
  private blendPixelDataOpts;
826
785
  private _inProgress;
827
- constructor(target: PixelData, mutatorFactory: (writer: PixelWriter<any>) => M, { tileSize, maxHistorySteps, historyManager, historyActionFactory, pixelTilePool, accumulator, }?: PixelWriterOptions);
786
+ constructor(target: PixelData, mutatorFactory: (writer: PixelWriter<any>) => M, options?: PixelWriterOptions);
828
787
  /**
829
788
  * Executes `transaction` and commits the resulting pixel changes as a single
830
789
  * undoable history action.
@@ -844,26 +803,27 @@ declare class PixelWriter<M> {
844
803
  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
804
  commitPaintBuffer(alpha?: number, blendFn?: BlendColor32, blendPixelDataFn?: typeof blendPixelData): void;
846
805
  }
847
-
848
- interface HistoryAction {
849
- undo: () => void;
850
- redo: () => void;
851
- dispose?: () => void;
852
- }
853
- type HistoryActionFactory = typeof makeHistoryAction;
854
- declare function makeHistoryAction(writer: PixelWriter<any>, patch: PixelPatchTiles, after?: () => void, afterUndo?: () => void, afterRedo?: () => void, applyPatchTilesFn?: typeof applyPatchTiles): HistoryAction;
806
+ type HistoryMutator<T extends {}, D extends {}> = (writer: PixelWriter<any>, deps?: Partial<D>) => T;
855
807
 
856
808
  declare function makeFullPixelMutator(writer: PixelWriter<any>): {
857
809
  invert(opts?: PixelMutateOptions): boolean;
858
810
  fillRect(color: Color32, rect: Rect): boolean;
859
- fillBinaryMask(color: Color32, mask: BinaryMask, alpha?: number, x?: number, y?: number): boolean;
811
+ fillBinaryMask(color: Color32, mask: BinaryMask, x?: number, y?: number): boolean;
860
812
  fill(color: Color32, x?: number, y?: number, w?: number, h?: number): boolean;
861
- clear(rect?: Partial<Rect>): void;
862
- blendPixelDataBinaryMask(src: IPixelData32, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
863
- blendPixelDataAlphaMask(src: IPixelData32, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
813
+ clear(rect?: Partial<Rect>): boolean;
864
814
  blendPixelData(src: IPixelData32, opts?: PixelBlendOptions): boolean;
865
815
  blendPixel(x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
816
+ blendPaintRect(color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha?: number, blendFn?: BlendColor32): boolean;
817
+ blendMask(src: IPixelData32, mask: Mask, opts?: PixelBlendMaskOptions): boolean;
818
+ blendColorPaintMask(color: Color32, mask: PaintMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
819
+ blendColorPaintBinaryMask(color: Color32, mask: PaintBinaryMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
820
+ blendColorPaintAlphaMask(color: Color32, mask: PaintAlphaMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
866
821
  blendColor(color: Color32, opts?: ColorBlendOptions): boolean;
822
+ blendBinaryMask(src: IPixelData32, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
823
+ blendAlphaMask(src: IPixelData32, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
824
+ applyMask(mask: Mask, opts?: ApplyMaskToPixelDataOptions): boolean;
825
+ applyBinaryMask(mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
826
+ applyAlphaMask(mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
867
827
  };
868
828
 
869
829
  /**
@@ -871,16 +831,16 @@ declare function makeFullPixelMutator(writer: PixelWriter<any>): {
871
831
  * modifying the destination's alpha channel in-place.
872
832
  * @returns true if any pixels were actually modified.
873
833
  */
874
- declare function applyAlphaMaskToPixelData(dst: IPixelData32, mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
834
+ declare function applyAlphaMaskToPixelData(target: IPixelData32, mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
875
835
 
876
- declare const defaults$b: {
836
+ declare const defaults$g: {
877
837
  applyAlphaMaskToPixelData: typeof applyAlphaMaskToPixelData;
878
838
  };
879
- type Deps$b = Partial<typeof defaults$b>;
839
+ type Deps$g = Partial<typeof defaults$g>;
880
840
  /**
881
841
  * @param deps - @hidden
882
842
  */
883
- declare const mutatorApplyAlphaMask: (writer: PixelWriter<any>, deps?: Deps$b) => {
843
+ declare const mutatorApplyAlphaMask: (writer: PixelWriter<any>, deps?: Deps$g) => {
884
844
  applyAlphaMask(mask: AlphaMask, opts?: ApplyMaskToPixelDataOptions): boolean;
885
845
  };
886
846
 
@@ -889,33 +849,71 @@ declare const mutatorApplyAlphaMask: (writer: PixelWriter<any>, deps?: Deps$b) =
889
849
  * modifying the destination's alpha channel in-place.
890
850
  * @returns true if any pixels were actually modified.
891
851
  */
892
- declare function applyBinaryMaskToPixelData(dst: IPixelData32, mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
852
+ declare function applyBinaryMaskToPixelData(target: IPixelData32, mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
893
853
 
894
- declare const defaults$a: {
854
+ declare const defaults$f: {
895
855
  applyBinaryMaskToPixelData: typeof applyBinaryMaskToPixelData;
896
856
  };
897
- type Deps$a = Partial<typeof defaults$a>;
857
+ type Deps$f = Partial<typeof defaults$f>;
898
858
  /**
899
859
  * @param deps - @hidden
900
860
  */
901
- declare const mutatorApplyBinaryMask: (writer: PixelWriter<any>, deps?: Deps$a) => {
861
+ declare const mutatorApplyBinaryMask: (writer: PixelWriter<any>, deps?: Deps$f) => {
902
862
  applyBinaryMask(mask: BinaryMask, opts?: ApplyMaskToPixelDataOptions): boolean;
903
863
  };
904
864
 
865
+ declare const defaults$e: {
866
+ applyBinaryMaskToPixelData: typeof applyBinaryMaskToPixelData;
867
+ applyAlphaMaskToPixelData: typeof applyAlphaMaskToPixelData;
868
+ };
869
+ type Deps$e = Partial<typeof defaults$e>;
870
+ /**
871
+ * @param deps - @hidden
872
+ */
873
+ declare const mutatorApplyMask: (writer: PixelWriter<any>, deps?: Deps$e) => {
874
+ applyMask(mask: Mask, opts?: ApplyMaskToPixelDataOptions): boolean;
875
+ };
876
+
877
+ declare function blendPixelDataAlphaMask(target: IPixelData32, src: IPixelData32, alphaMask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
878
+
879
+ declare const defaults$d: {
880
+ blendPixelDataAlphaMask: typeof blendPixelDataAlphaMask;
881
+ };
882
+ type Deps$d = Partial<typeof defaults$d>;
883
+ /**
884
+ * @param deps - @hidden
885
+ */
886
+ declare const mutatorBlendAlphaMask: (writer: PixelWriter<any>, deps?: Partial<Deps$d>) => {
887
+ blendAlphaMask(src: IPixelData32, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
888
+ };
889
+
890
+ declare function blendPixelDataBinaryMask(target: IPixelData32, src: IPixelData32, binaryMask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
891
+
892
+ declare const defaults$c: {
893
+ blendPixelDataBinaryMask: typeof blendPixelDataBinaryMask;
894
+ };
895
+ type Deps$c = Partial<typeof defaults$c>;
896
+ /**
897
+ * @param deps - @hidden
898
+ */
899
+ declare const mutatorBlendBinaryMask: (writer: PixelWriter<any>, deps?: Partial<Deps$c>) => {
900
+ blendBinaryMask(src: IPixelData32, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
901
+ };
902
+
905
903
  /**
906
904
  * Blends a solid color into a target pixel buffer.
907
905
  * @returns true if any pixels were actually modified.
908
906
  */
909
- declare function blendColorPixelData(dst: IPixelData32, color: Color32, opts?: ColorBlendOptions): boolean;
907
+ declare function blendColorPixelData(target: IPixelData32, color: Color32, opts?: ColorBlendOptions): boolean;
910
908
 
911
- declare const defaults$9: {
909
+ declare const defaults$b: {
912
910
  blendColorPixelData: typeof blendColorPixelData;
913
911
  };
914
- type Deps$9 = Partial<typeof defaults$9>;
912
+ type Deps$b = Partial<typeof defaults$b>;
915
913
  /**
916
914
  * @param deps - @hidden
917
915
  */
918
- declare const mutatorBlendColor: (writer: PixelWriter<any>, deps?: Deps$9) => {
916
+ declare const mutatorBlendColor: (writer: PixelWriter<any>, deps?: Deps$b) => {
919
917
  blendColor(color: Color32, opts?: ColorBlendOptions): boolean;
920
918
  };
921
919
 
@@ -926,13 +924,24 @@ declare const mutatorBlendColor: (writer: PixelWriter<any>, deps?: Deps$9) => {
926
924
  * If the width (`w`) or height (`h`) are omitted from the options, they will safely
927
925
  * default to the dimensions of the provided mask to prevent out-of-bounds memory access.
928
926
  *
929
- * @param dst - The destination {@link IPixelData32} buffer to modify.
927
+ * @param target - The destination {@link IPixelData32} buffer to modify.
930
928
  * @param color - The solid color to apply.
931
929
  * @param mask - The mask defining the per-pixel opacity of the target area.
932
930
  * @param opts - Configuration options including placement coordinates, bounds, global alpha, and mask offsets.
933
931
  * @returns true if any pixels were actually modified.
934
932
  */
935
- declare function blendColorPixelDataAlphaMask(dst: IPixelData32, color: Color32, mask: AlphaMask, opts?: ColorBlendMaskOptions): boolean;
933
+ declare function blendColorPixelDataAlphaMask(target: IPixelData32, color: Color32, mask: AlphaMask, opts?: ColorBlendMaskOptions): boolean;
934
+
935
+ declare const defaults$a: {
936
+ blendColorPixelDataAlphaMask: typeof blendColorPixelDataAlphaMask;
937
+ };
938
+ type Deps$a = Partial<typeof defaults$a>;
939
+ /**
940
+ * @param deps - @hidden
941
+ */
942
+ declare const mutatorBlendColorPaintAlphaMask: (writer: PixelWriter<any>, deps?: Partial<Deps$a>) => {
943
+ blendColorPaintAlphaMask(color: Color32, mask: PaintAlphaMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
944
+ };
936
945
 
937
946
  /**
938
947
  * Blends a solid color into a target pixel buffer using a binary mask.
@@ -941,13 +950,24 @@ declare function blendColorPixelDataAlphaMask(dst: IPixelData32, color: Color32,
941
950
  * If the width (`w`) or height (`h`) are omitted from the options, they will safely
942
951
  * default to the dimensions of the provided mask to prevent out-of-bounds memory access.
943
952
  *
944
- * @param dst - The destination {@link IPixelData32} buffer to modify.
953
+ * @param target - The destination {@link IPixelData32} buffer to modify.
945
954
  * @param color - The solid color to apply.
946
955
  * @param mask - The mask defining the per-pixel opacity of the target area.
947
956
  * @param opts - Configuration options including placement coordinates, bounds, global alpha, and mask offsets.
948
957
  * @returns true if any pixels were actually modified.
949
958
  */
950
- declare function blendColorPixelDataBinaryMask(dst: IPixelData32, color: Color32, mask: BinaryMask, opts?: ColorBlendMaskOptions): boolean;
959
+ declare function blendColorPixelDataBinaryMask(target: IPixelData32, color: Color32, mask: BinaryMask, opts?: ColorBlendMaskOptions): boolean;
960
+
961
+ declare const defaults$9: {
962
+ blendColorPixelDataBinaryMask: typeof blendColorPixelDataBinaryMask;
963
+ };
964
+ type Deps$9 = Partial<typeof defaults$9>;
965
+ /**
966
+ * @param deps - @hidden
967
+ */
968
+ declare const mutatorBlendColorPaintBinaryMask: (writer: PixelWriter<any>, deps?: Partial<Deps$9>) => {
969
+ blendColorPaintBinaryMask(color: Color32, mask: PaintBinaryMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
970
+ };
951
971
 
952
972
  declare const defaults$8: {
953
973
  blendColorPixelDataAlphaMask: typeof blendColorPixelDataAlphaMask;
@@ -957,71 +977,66 @@ type Deps$8 = Partial<typeof defaults$8>;
957
977
  /**
958
978
  * @param deps - @hidden
959
979
  */
960
- declare const mutatorBlendPaintMask: (writer: PixelWriter<any>, deps?: Partial<Deps$8>) => {
980
+ declare const mutatorBlendColorPaintMask: (writer: PixelWriter<any>, deps?: Partial<Deps$8>) => {
961
981
  blendColorPaintMask(color: Color32, mask: PaintMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
962
982
  };
963
983
 
964
- declare function blendPixel(target: IPixelData32, x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
965
-
966
984
  declare const defaults$7: {
967
- blendPixel: typeof blendPixel;
985
+ blendPixelDataAlphaMask: typeof blendPixelDataAlphaMask;
986
+ blendPixelDataBinaryMask: typeof blendPixelDataBinaryMask;
968
987
  };
969
988
  type Deps$7 = Partial<typeof defaults$7>;
970
989
  /**
971
990
  * @param deps - @hidden
972
991
  */
973
- declare const mutatorBlendPixel: (writer: PixelWriter<any>, deps?: Partial<Deps$7>) => {
974
- blendPixel(x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
992
+ declare const mutatorBlendMask: (writer: PixelWriter<any>, deps?: Partial<Deps$7>) => {
993
+ blendMask(src: IPixelData32, mask: Mask, opts?: PixelBlendMaskOptions): boolean;
975
994
  };
976
995
 
977
996
  declare const defaults$6: {
978
- blendPixelData: typeof blendPixelData;
997
+ blendColorPixelData: typeof blendColorPixelData;
979
998
  };
980
999
  type Deps$6 = Partial<typeof defaults$6>;
981
1000
  /**
982
1001
  * @param deps - @hidden
983
1002
  */
984
- declare const mutatorBlendPixelData: (writer: PixelWriter<any>, deps?: Partial<Deps$6>) => {
985
- blendPixelData(src: IPixelData32, opts?: PixelBlendOptions): boolean;
1003
+ declare const mutatorBlendPaintRect: (writer: PixelWriter<any>, deps?: Deps$6) => {
1004
+ blendPaintRect(color: Color32, centerX: number, centerY: number, brushWidth: number, brushHeight: number, alpha?: number, blendFn?: BlendColor32): boolean;
986
1005
  };
987
1006
 
988
- declare function blendPixelDataAlphaMask(dst: IPixelData32, src: IPixelData32, alphaMask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
1007
+ declare function blendPixel(target: IPixelData32, x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
989
1008
 
990
1009
  declare const defaults$5: {
991
- blendPixelDataAlphaMask: typeof blendPixelDataAlphaMask;
1010
+ blendPixel: typeof blendPixel;
992
1011
  };
993
1012
  type Deps$5 = Partial<typeof defaults$5>;
994
1013
  /**
995
1014
  * @param deps - @hidden
996
1015
  */
997
- declare const mutatorBlendPixelDataAlphaMask: (writer: PixelWriter<any>, deps?: Partial<Deps$5>) => {
998
- blendPixelDataAlphaMask(src: IPixelData32, mask: AlphaMask, opts?: PixelBlendMaskOptions): boolean;
1016
+ declare const mutatorBlendPixel: (writer: PixelWriter<any>, deps?: Partial<Deps$5>) => {
1017
+ blendPixel(x: number, y: number, color: Color32, alpha?: number, blendFn?: BlendColor32): boolean;
999
1018
  };
1000
1019
 
1001
- declare function blendPixelDataBinaryMask(dst: IPixelData32, src: IPixelData32, binaryMask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
1002
-
1003
1020
  declare const defaults$4: {
1004
- blendPixelDataBinaryMask: typeof blendPixelDataBinaryMask;
1021
+ blendPixelData: typeof blendPixelData;
1005
1022
  };
1006
1023
  type Deps$4 = Partial<typeof defaults$4>;
1007
1024
  /**
1008
1025
  * @param deps - @hidden
1009
1026
  */
1010
- declare const mutatorBlendPixelDataBinaryMask: (writer: PixelWriter<any>, deps?: Partial<Deps$4>) => {
1011
- blendPixelDataBinaryMask(src: IPixelData32, mask: BinaryMask, opts?: PixelBlendMaskOptions): boolean;
1027
+ declare const mutatorBlendPixelData: (writer: PixelWriter<any>, deps?: Partial<Deps$4>) => {
1028
+ blendPixelData(src: IPixelData32, opts?: PixelBlendOptions): boolean;
1012
1029
  };
1013
1030
 
1014
1031
  /**
1015
1032
  * Fills a region or the {@link IPixelData32} buffer with a solid color.
1016
- * This function is faster than {@link fillPixelData} but does not
1017
- * return a boolean value indicating changes were made.
1018
1033
  *
1019
1034
  * @param dst - The target to modify.
1020
1035
  * @param color - The color to apply.
1021
1036
  * @param rect - Defines the area to fill. If omitted, the entire
1022
- * buffer is filled.
1037
+ * @returns true if any pixels were actually modified.
1023
1038
  */
1024
- declare function fillPixelDataFast(dst: IPixelData32, color: Color32, rect?: Partial<Rect>): void;
1039
+ declare function fillPixelData(dst: IPixelData32, color: Color32, rect?: Partial<Rect>): boolean;
1025
1040
  /**
1026
1041
  * @param dst - The target to modify.
1027
1042
  * @param color - The color to apply.
@@ -1030,38 +1045,19 @@ declare function fillPixelDataFast(dst: IPixelData32, color: Color32, rect?: Par
1030
1045
  * @param w - Width of the fill area.
1031
1046
  * @param h - Height of the fill area.
1032
1047
  */
1033
- declare function fillPixelDataFast(dst: IPixelData32, color: Color32, x: number, y: number, w: number, h: number): void;
1048
+ declare function fillPixelData(dst: IPixelData32, color: Color32, x: number, y: number, w: number, h: number): boolean;
1034
1049
 
1035
1050
  declare const defaults$3: {
1036
- fillPixelData: typeof fillPixelDataFast;
1051
+ fillPixelData: typeof fillPixelData;
1037
1052
  };
1038
1053
  type Deps$3 = Partial<typeof defaults$3>;
1039
1054
  /**
1040
1055
  * @param deps - @hidden
1041
1056
  */
1042
1057
  declare const mutatorClear: (writer: PixelWriter<any>, deps?: Deps$3) => {
1043
- clear(rect?: Partial<Rect>): void;
1058
+ clear(rect?: Partial<Rect>): boolean;
1044
1059
  };
1045
1060
 
1046
- /**
1047
- * Fills a region or the {@link IPixelData32} buffer with a solid color.
1048
- *
1049
- * @param dst - The target to modify.
1050
- * @param color - The color to apply.
1051
- * @param rect - Defines the area to fill. If omitted, the entire
1052
- * @returns true if any pixels were actually modified.
1053
- */
1054
- declare function fillPixelData(dst: IPixelData32, color: Color32, rect?: Partial<Rect>): boolean;
1055
- /**
1056
- * @param dst - The target to modify.
1057
- * @param color - The color to apply.
1058
- * @param x - Starting horizontal coordinate.
1059
- * @param y - Starting vertical coordinate.
1060
- * @param w - Width of the fill area.
1061
- * @param h - Height of the fill area.
1062
- */
1063
- declare function fillPixelData(dst: IPixelData32, color: Color32, x: number, y: number, w: number, h: number): boolean;
1064
-
1065
1061
  declare const defaults$2: {
1066
1062
  fillPixelData: typeof fillPixelData;
1067
1063
  };
@@ -1081,14 +1077,13 @@ declare const mutatorFillRect: (writer: PixelWriter<any>, deps?: Deps$2) => {
1081
1077
 
1082
1078
  /**
1083
1079
  * Fills a region of the {@link IPixelData32} buffer with a solid color using a mask.
1084
- * @param dst - The target to modify.
1080
+ * @param target - The target to modify.
1085
1081
  * @param color - The color to apply.
1086
1082
  * @param mask - The mask defining the area to fill.
1087
- * @param alpha - The overall opacity of the fill (0-255).
1088
1083
  * @param x - Starting horizontal coordinate for the mask placement.
1089
1084
  * @param y - Starting vertical coordinate for the mask placement.
1090
1085
  */
1091
- declare function fillPixelDataBinaryMask(dst: IPixelData32, color: Color32, mask: BinaryMask, alpha?: number, x?: number, y?: number): boolean;
1086
+ declare function fillPixelDataBinaryMask(target: IPixelData32, color: Color32, mask: BinaryMask, x?: number, y?: number): boolean;
1092
1087
 
1093
1088
  declare const defaults$1: {
1094
1089
  fillPixelDataBinaryMask: typeof fillPixelDataBinaryMask;
@@ -1098,10 +1093,10 @@ type Deps$1 = Partial<typeof defaults$1>;
1098
1093
  * @param deps - @hidden
1099
1094
  */
1100
1095
  declare const mutatorFillBinaryMask: (writer: PixelWriter<any>, deps?: Deps$1) => {
1101
- fillBinaryMask(color: Color32, mask: BinaryMask, alpha?: number, x?: number, y?: number): boolean;
1096
+ fillBinaryMask(color: Color32, mask: BinaryMask, x?: number, y?: number): boolean;
1102
1097
  };
1103
1098
 
1104
- declare function invertPixelData(pixelData: IPixelData32, opts?: PixelMutateOptions): boolean;
1099
+ declare function invertPixelData(target: IPixelData32, opts?: PixelMutateOptions): boolean;
1105
1100
 
1106
1101
  declare const defaults: {
1107
1102
  invertPixelData: typeof invertPixelData;
@@ -1114,6 +1109,17 @@ declare const mutatorInvert: (writer: PixelWriter<any>, deps?: Deps) => {
1114
1109
  invert(opts?: PixelMutateOptions): boolean;
1115
1110
  };
1116
1111
 
1112
+ declare function makeImageDataLike(width: number, height: number, data?: Buffer): ImageDataLike;
1113
+
1114
+ type ReusableImageData = ReturnType<typeof makeReusableImageData>;
1115
+ /**
1116
+ * Creates a factory function that manages a single, reusable ImageData instance.
1117
+ * This is used to minimize garbage collection overhead by recycling the
1118
+ * underlying pixel buffer across multiple operations.
1119
+ * @returns A function that takes width and height and returns a pooled ImageData instance.
1120
+ */
1121
+ declare function makeReusableImageData(): (width: number, height: number) => ImageData;
1122
+
1117
1123
  declare function copyImageData({ data, width, height }: ImageDataLike): ImageData;
1118
1124
  declare function copyImageDataLike({ data, width, height }: ImageDataLike): ImageDataLike;
1119
1125
 
@@ -1138,8 +1144,6 @@ declare function extractImageDataBuffer(imageData: ImageDataLike, rect: Rect): U
1138
1144
  */
1139
1145
  declare function extractImageDataBuffer(imageData: ImageDataLike, x: number, y: number, w: number, h: number): Uint8ClampedArray;
1140
1146
 
1141
- declare function makeImageDataLike(width: number, height: number, data?: Buffer): ImageDataLike;
1142
-
1143
1147
  /**
1144
1148
  * Extracts the alpha channel from raw ImageData into an AlphaMask.
1145
1149
  * When possible use {@link pixelDataToAlphaMask} instead.
@@ -1226,15 +1230,6 @@ declare function invertImageData(imageData: ImageData): ImageData;
1226
1230
  */
1227
1231
  declare function resampleImageData(source: ImageData, factor: number): ImageData;
1228
1232
 
1229
- type ReusableImageData = ReturnType<typeof makeReusableImageData>;
1230
- /**
1231
- * Creates a factory function that manages a single, reusable ImageData instance.
1232
- * This is used to minimize garbage collection overhead by recycling the
1233
- * underlying pixel buffer across multiple operations.
1234
- * @returns A function that takes width and height and returns a pooled ImageData instance.
1235
- */
1236
- declare function makeReusableImageData(): (width: number, height: number) => ImageData;
1237
-
1238
1233
  declare function base64EncodeArrayBuffer(buffer: ArrayBufferLike): Base64EncodedUInt8Array;
1239
1234
  declare function base64DecodeArrayBuffer(encoded: Base64EncodedUInt8Array): Uint8ClampedArray<ArrayBuffer>;
1240
1235
  /**
@@ -1456,6 +1451,49 @@ declare function fileToImageData(file: File | null | undefined): Promise<ImageDa
1456
1451
  */
1457
1452
  declare function getSupportedPixelFormats(rasterMimes?: string[]): Promise<string[]>;
1458
1453
 
1454
+ /**
1455
+ * @internal
1456
+ */
1457
+ type Resample32Result = {
1458
+ data: Int32Array;
1459
+ width: number;
1460
+ height: number;
1461
+ };
1462
+ /**
1463
+ * @internal
1464
+ */
1465
+ declare function resample32(srcData32: Uint32Array | Int32Array, srcW: number, srcH: number, factor: number): Resample32Result;
1466
+
1467
+ type ClippedRect = {
1468
+ x: number;
1469
+ y: number;
1470
+ w: number;
1471
+ h: number;
1472
+ inBounds: boolean;
1473
+ };
1474
+ type ClippedBlit = {
1475
+ x: number;
1476
+ y: number;
1477
+ sx: number;
1478
+ sy: number;
1479
+ w: number;
1480
+ h: number;
1481
+ inBounds: boolean;
1482
+ };
1483
+ declare const makeClippedRect: () => ClippedRect;
1484
+ declare const makeClippedBlit: () => ClippedBlit;
1485
+ /**
1486
+ * Calculates the intersection of a target rectangle and a bounding box (usually 0,0 -> width,height).
1487
+ * Handles negative offsets by shrinking dimensions.
1488
+ */
1489
+ declare function resolveRectClipping(x: number, y: number, w: number, h: number, boundaryW: number, boundaryH: number, out: ClippedRect): ClippedRect;
1490
+ /**
1491
+ * Calculates the clipping for transferring data from a Source to a Destination.
1492
+ * Handles cases where the source is out of bounds (shifting the destination target)
1493
+ * AND cases where the destination is out of bounds (shifting the source target).
1494
+ */
1495
+ declare function resolveBlitClipping(x: number, y: number, sx: number, sy: number, w: number, h: number, dstW: number, dstH: number, srcW: number, srcH: number, out: ClippedBlit): ClippedBlit;
1496
+
1459
1497
  /**
1460
1498
  * Creates an Alpha Mask
1461
1499
  * @param w - width
@@ -1546,13 +1584,44 @@ declare function mergeBinaryMaskRects(current: NullableBinaryMaskRect[], adding:
1546
1584
 
1547
1585
  declare function subtractBinaryMaskRects(current: NullableBinaryMaskRect[], subtracting: NullableBinaryMaskRect[]): NullableBinaryMaskRect[];
1548
1586
 
1549
- declare function blendPixelDataPaintBuffer(paintBuffer: PaintBuffer, target: IPixelData32, alpha?: number, blendFn?: BlendColor32, blendPixelDataFn?: typeof blendPixelData): void;
1587
+ type PaintBufferCanvasRenderer = ReturnType<typeof makePaintBufferCanvasRenderer>;
1588
+ /**
1589
+ *
1590
+ * @param offscreenCanvasClass - @internal
1591
+ */
1592
+ declare function makePaintBufferCanvasRenderer(paintBuffer: PaintBuffer, offscreenCanvasClass?: {
1593
+ new (width: number, height: number): OffscreenCanvas;
1594
+ prototype: OffscreenCanvas;
1595
+ }): (targetCtx: CanvasRenderingContext2D, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1596
+
1597
+ declare function makeCirclePaintAlphaMask(size: number, fallOff?: (d: number) => number): PaintAlphaMask;
1598
+
1599
+ declare function makeCirclePaintBinaryMask(size: number): PaintBinaryMask;
1600
+
1601
+ declare function makePaintBinaryMask(mask: BinaryMask): PaintBinaryMask;
1602
+ declare function makePaintAlphaMask(mask: AlphaMask): PaintAlphaMask;
1603
+
1604
+ declare function makeRectFalloffPaintAlphaMask(width: number, height: number, fallOff?: (d: number) => number): PaintAlphaMask;
1605
+
1606
+ declare function applyMaskToPixelData(dst: IPixelData32, mask: Mask, opts?: ApplyMaskToPixelDataOptions): boolean;
1607
+
1608
+ declare function blendColorPixelDataMask(dst: IPixelData32, color: Color32, mask: Mask, opts?: ColorBlendMaskOptions): boolean;
1609
+
1610
+ declare function blendColorPixelDataPaintAlphaMask(dst: IPixelData32, color: Color32, mask: PaintAlphaMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1611
+
1612
+ declare function blendColorPixelDataPaintBinaryMask(dst: IPixelData32, color: Color32, mask: PaintBinaryMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1613
+
1614
+ declare function blendColorPixelDataPaintMask(dst: IPixelData32, color: Color32, mask: PaintMask, x: number, y: number, alpha?: number, blendFn?: BlendColor32): boolean;
1615
+
1616
+ declare function blendPixelDataMask(target: IPixelData32, src: IPixelData32, mask: Mask, opts?: PixelBlendMaskOptions): boolean;
1617
+
1618
+ declare function blendPixelDataPaintBuffer(target: IPixelData32, paintBuffer: PaintBuffer, alpha?: number, blendFn?: BlendColor32, blendPixelDataFn?: typeof blendPixelData): void;
1550
1619
 
1551
1620
  /**
1552
1621
  * Clears a region of the PixelData to transparent (0x00000000).
1553
- * Internally uses the optimized fillPixelData.
1622
+ * Internally uses the optimized fillPixelDataFast.
1554
1623
  */
1555
- declare function clearPixelData(dst: IPixelData32, rect?: Partial<BinaryMaskRect>): void;
1624
+ declare function clearPixelDataFast(dst: IPixelData32, rect?: Partial<BinaryMaskRect>): void;
1556
1625
 
1557
1626
  /**
1558
1627
  * High-level extraction that returns a new PixelData instance.
@@ -1568,14 +1637,26 @@ declare function extractPixelData(source: IPixelData32, x: number, y: number, w:
1568
1637
  declare function extractPixelDataBuffer(source: IPixelData32, rect: Rect): Uint32Array;
1569
1638
  declare function extractPixelDataBuffer(source: IPixelData32, x: number, y: number, w: number, h: number): Uint32Array;
1570
1639
 
1571
- declare class PixelBuffer32 implements IPixelData32 {
1572
- readonly width: number;
1573
- readonly height: number;
1574
- readonly data32: Uint32Array;
1575
- constructor(width: number, height: number, data32?: Uint32Array);
1576
- set(width: number, height: number, data32?: Uint32Array): void;
1577
- copy(): PixelBuffer32;
1578
- }
1640
+ /**
1641
+ * Fills a region or the {@link IPixelData32} buffer with a solid color.
1642
+ * This function is faster than {@link fillPixelData} but does not
1643
+ * return a boolean value indicating changes were made.
1644
+ *
1645
+ * @param target - The target to modify.
1646
+ * @param color - The color to apply.
1647
+ * @param rect - Defines the area to fill. If omitted, the entire
1648
+ * buffer is filled.
1649
+ */
1650
+ declare function fillPixelDataFast(target: IPixelData32, color: Color32, rect?: Partial<Rect>): void;
1651
+ /**
1652
+ * @param dst - The target to modify.
1653
+ * @param color - The color to apply.
1654
+ * @param x - Starting horizontal coordinate.
1655
+ * @param y - Starting vertical coordinate.
1656
+ * @param w - Width of the fill area.
1657
+ * @param h - Height of the fill area.
1658
+ */
1659
+ declare function fillPixelDataFast(dst: IPixelData32, color: Color32, x: number, y: number, w: number, h: number): void;
1579
1660
 
1580
1661
  /**
1581
1662
  * Extracts the alpha channel from PixelData into a single-channel mask.
@@ -1633,23 +1714,45 @@ declare function trimMaskRectBounds<T extends NullableMaskRect>(target: T, bound
1633
1714
 
1634
1715
  declare function trimRectBounds(x: number, y: number, w: number, h: number, targetWidth: number, targetHeight: number, out?: Rect): Rect;
1635
1716
 
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;
1644
-
1645
- type PaintBufferCanvasRenderer = ReturnType<typeof makePaintBufferCanvasRenderer>;
1646
1717
  /**
1647
- *
1648
- * @param offscreenCanvasClass - @internal
1718
+ * Packs RGBA into a 32-bit integer compatible with
1719
+ * Little-Endian Uint32Array views on ImageData.
1649
1720
  */
1650
- declare function makePaintBufferCanvasRenderer(paintBuffer: PaintBuffer, offscreenCanvasClass?: {
1651
- new (width: number, height: number): OffscreenCanvas;
1652
- prototype: OffscreenCanvas;
1653
- }): (targetCtx: CanvasRenderingContext2D, alpha?: number, compOperation?: GlobalCompositeOperation) => void;
1721
+ declare function packColor(r: number, g: number, b: number, a: number): Color32;
1722
+ declare function packRGBA({ r, g, b, a }: RGBA): Color32;
1723
+ declare const unpackRed: (packed: Color32) => number;
1724
+ declare const unpackGreen: (packed: Color32) => number;
1725
+ declare const unpackBlue: (packed: Color32) => number;
1726
+ declare const unpackAlpha: (packed: Color32) => number;
1727
+ declare function unpackColor(packed: Color32): RGBA;
1728
+ declare function unpackColorTo(packed: Color32, scratch?: RGBA): RGBA;
1729
+ declare function colorDistance(a: Color32, b: Color32): number;
1730
+ /**
1731
+ * Linearly interpolates between two 32-bit colors using a floating-point weight.
1732
+ * * This is the preferred method for UI animations or scenarios where high
1733
+ * precision is required. It uses the standard `a + t * (b - a)` formula
1734
+ * for each channel.
1735
+ * @param a - The starting color as a 32-bit integer (AABBGGRR).
1736
+ * @param b - The target color as a 32-bit integer (AABBGGRR).
1737
+ * @param t - The interpolation factor between 0.0 and 1.0.
1738
+ * @returns The interpolated 32-bit color.
1739
+ */
1740
+ declare function lerpColor32(a: Color32, b: Color32, t: number): Color32;
1741
+ /**
1742
+ * Linearly interpolates between two 32-bit colors using integer fixed-point math.
1743
+ * Highly optimized for image processing and real-time blitting. It processes
1744
+ * channels in parallel using bitmasks (RB and GA pairs).
1745
+ * **Note:** Subject to a 1-bit drift (rounding down) due to fast bit-shift division.
1746
+ * @param src - The source (foreground) color as a 32-bit integer.
1747
+ * @param dst - The destination (background) color as a 32-bit integer.
1748
+ * @param w - The blend weight as a byte value from 0 to 255. Where 0 is 100% dst and 255 is 100% src
1749
+ * @returns The blended 32-bit color.
1750
+ */ declare function lerpColor32Fast(src: Color32, dst: Color32, w: number): Color32;
1751
+ declare function color32ToHex(color: Color32): string;
1752
+ /**
1753
+ * Converts a 32-bit integer (0xAABBGGRR) to a CSS rgba() string.
1754
+ * Example: 0xFF0000FF -> "rgba(255,0,0,1)"
1755
+ */
1756
+ declare function color32ToCssRGBA(color: Color32): string;
1654
1757
 
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 };
1758
+ export { type AlphaMask, type AlphaMaskRect, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BaseMask, type BasePixelBlendOptions, type BinaryMask, type BinaryMaskRect, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type ClippedBlit, type ClippedRect, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, type ColorBlendPaintMaskOptions, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, 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, type PaintAlphaMask, type PaintBinaryMask, PaintBuffer, type PaintBufferCanvasRenderer, type PaintMask, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, 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, 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, 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, makeClippedBlit, makeClippedRect, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makePaintAlphaMask, makePaintBinaryMask, makePaintBufferCanvasRenderer, makePerfectBlendModeRegistry, makePixelCanvas, makeRectFalloffPaintAlphaMask, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorApplyMask, mutatorBlendAlphaMask, mutatorBlendBinaryMask, mutatorBlendColor, mutatorBlendColorPaintAlphaMask, mutatorBlendColorPaintBinaryMask, mutatorBlendColorPaintMask, mutatorBlendMask, mutatorBlendPaintRect, mutatorBlendPixel, mutatorBlendPixelData, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorFillRect, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resample32, resampleImageData, resampleIndexedImage, resamplePixelData, resizeImageData, resolveBlitClipping, resolveRectClipping, 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 };