pixel-data-js 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.prod.cjs +473 -312
- package/dist/index.prod.cjs.map +1 -1
- package/dist/index.prod.d.ts +130 -55
- package/dist/index.prod.js +469 -308
- package/dist/index.prod.js.map +1 -1
- package/package.json +1 -1
- package/src/Control/BatchedQueue.ts +76 -0
- package/src/Control/RenderQueue.ts +49 -0
- package/src/History/PixelWriter.ts +5 -9
- package/src/ImageData/extractImageData.ts +55 -0
- package/src/ImageData/extractImageDataBuffer.ts +57 -28
- package/src/ImageData/writeImageData.ts +45 -66
- package/src/ImageData/writeImageDataBuffer.ts +79 -41
- package/src/PixelData/extractPixelDataBuffer.ts +53 -40
- package/src/PixelData/fillPixelData.ts +46 -28
- package/src/PixelData/fillPixelDataBinaryMask.ts +43 -38
- package/src/PixelData/fillPixelDataFast.ts +26 -16
- package/src/PixelData/invertPixelData.ts +38 -21
- package/src/PixelData/resizePixelData.ts +75 -0
- package/src/PixelData/writePixelDataBuffer.ts +53 -38
- package/src/index.ts +5 -1
- package/src/Rect/resolveClipping.ts +0 -140
package/dist/index.prod.d.ts
CHANGED
|
@@ -358,12 +358,12 @@ declare function makeFastBlendModeRegistry(name?: string): {
|
|
|
358
358
|
readonly destinationAtop: BlendColor32;
|
|
359
359
|
readonly xor: BlendColor32;
|
|
360
360
|
};
|
|
361
|
-
nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 24 | 16 | 8 | 2 | 3 |
|
|
362
|
-
blendToIndex: Map<BlendColor32, 0 | 24 | 16 | 8 | 2 | 3 |
|
|
361
|
+
nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
|
|
362
|
+
blendToIndex: Map<BlendColor32, 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
|
|
363
363
|
blendToName: Map<BlendColor32, "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor">;
|
|
364
364
|
indexToBlend: BlendColor32[];
|
|
365
365
|
indexToName: ("overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor")[];
|
|
366
|
-
indexType: 0 | 24 | 16 | 8 | 2 | 3 |
|
|
366
|
+
indexType: 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30;
|
|
367
367
|
nameType: "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor";
|
|
368
368
|
};
|
|
369
369
|
|
|
@@ -457,12 +457,12 @@ declare function makePerfectBlendModeRegistry(name?: string): {
|
|
|
457
457
|
readonly destinationAtop: BlendColor32;
|
|
458
458
|
readonly xor: BlendColor32;
|
|
459
459
|
};
|
|
460
|
-
nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 24 | 16 | 8 | 2 | 3 |
|
|
461
|
-
blendToIndex: Map<BlendColor32, 0 | 24 | 16 | 8 | 2 | 3 |
|
|
460
|
+
nameToIndex: Record<"overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor", 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
|
|
461
|
+
blendToIndex: Map<BlendColor32, 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30>;
|
|
462
462
|
blendToName: Map<BlendColor32, "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor">;
|
|
463
463
|
indexToBlend: BlendColor32[];
|
|
464
464
|
indexToName: ("overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor")[];
|
|
465
|
-
indexType: 0 | 24 | 16 | 8 | 2 | 3 |
|
|
465
|
+
indexType: 0 | 24 | 16 | 8 | 2 | 3 | 4 | 1 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30;
|
|
466
466
|
nameType: "overwrite" | "sourceOver" | "darken" | "multiply" | "colorBurn" | "linearBurn" | "darkerColor" | "lighten" | "screen" | "colorDodge" | "linearDodge" | "lighterColor" | "overlay" | "softLight" | "hardLight" | "vividLight" | "linearLight" | "pinLight" | "hardMix" | "difference" | "exclusion" | "subtract" | "divide" | "sourceIn" | "sourceOut" | "sourceAtop" | "destinationOver" | "destinationIn" | "destinationOut" | "destinationAtop" | "xor";
|
|
467
467
|
};
|
|
468
468
|
|
|
@@ -680,6 +680,65 @@ declare function color32ToHex(color: Color32): string;
|
|
|
680
680
|
*/
|
|
681
681
|
declare function color32ToCssRGBA(color: Color32): string;
|
|
682
682
|
|
|
683
|
+
type BatchedQueueFn = (fn: () => void) => void;
|
|
684
|
+
type BatchedQueue = ReturnType<typeof makeBatchedQueue>;
|
|
685
|
+
/**
|
|
686
|
+
* Creates a high-performance, zero-allocation batching queue.
|
|
687
|
+
* This utility collects items marked as "dirty" and flushes them in a single batch.
|
|
688
|
+
* * **⚠️ CRITICAL: Synchronous Processing Required**
|
|
689
|
+
* Because the internal sets are reused, the `Set` passed to the `processor` is instantly
|
|
690
|
+
* cleared the moment the processor function returns. If you need to process the items
|
|
691
|
+
* asynchronously, you **must** manually clone the set inside your processor.
|
|
692
|
+
* @template T - The type of items being batched.
|
|
693
|
+
* @param processor - The callback executed when the batch flushes. Receives a `Set` of all batched items.
|
|
694
|
+
* @param queue - The scheduling function used to defer the flush. Defaults to `queueMicrotask`.
|
|
695
|
+
* @returns An object containing methods to mark items as dirty.
|
|
696
|
+
* @example
|
|
697
|
+
* * @example
|
|
698
|
+
* ```ts
|
|
699
|
+
* import { nextTick } from 'vue'
|
|
700
|
+
* let bq = makeBatchedQueue<string>(
|
|
701
|
+
* (items) => drawSomething(items),
|
|
702
|
+
* nextTick,
|
|
703
|
+
* )
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
706
|
+
declare function makeBatchedQueue<T>(processor: (items: Set<T>) => void, queue: BatchedQueueFn): {
|
|
707
|
+
markDirty: (item: T) => void;
|
|
708
|
+
markMultipleDirty: (items: T[]) => void;
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Creates a debounced render queue using `requestAnimationFrame`.
|
|
713
|
+
* This utility ensures that a callback is executed exactly once right before
|
|
714
|
+
* the next visual frame, regardless of how many times the trigger is called
|
|
715
|
+
* synchronously. It safely prevents layout thrashing and redundant computations.
|
|
716
|
+
* @param cb - The function to execute on the next animation frame.
|
|
717
|
+
* @returns A trigger function that schedules the callback. It includes a `.cancel()` method to abort the pending frame.
|
|
718
|
+
* * @example
|
|
719
|
+
* ```ts
|
|
720
|
+
* let renderQueue = makeRenderQueue(() => {
|
|
721
|
+
* console.log('DOM updated!')
|
|
722
|
+
* })
|
|
723
|
+
* * // Calling this multiple times synchronously...
|
|
724
|
+
* renderQueue()
|
|
725
|
+
* renderQueue()
|
|
726
|
+
* renderQueue()
|
|
727
|
+
* * // ...will only result in one 'DOM updated!' log on the next frame.
|
|
728
|
+
* ```
|
|
729
|
+
* * @example
|
|
730
|
+
* ```ts
|
|
731
|
+
* // Canceling a scheduled render (e.g., when a component unmounts)
|
|
732
|
+
* let trigger = makeRenderQueue(updateLayout)
|
|
733
|
+
* trigger()
|
|
734
|
+
* trigger.cancel() // The callback will not execute
|
|
735
|
+
* ```
|
|
736
|
+
*/
|
|
737
|
+
declare function makeRenderQueue(cb: () => void): {
|
|
738
|
+
(): void;
|
|
739
|
+
cancel(): void;
|
|
740
|
+
};
|
|
741
|
+
|
|
683
742
|
declare const enum TileType {
|
|
684
743
|
PIXEL = 0,
|
|
685
744
|
MASK = 1
|
|
@@ -857,12 +916,11 @@ declare class PixelWriter<M> {
|
|
|
857
916
|
* throw immediately to prevent silent data loss from a nested extractPatch.
|
|
858
917
|
*
|
|
859
918
|
* @param transaction Callback to be executed inside the transaction.
|
|
860
|
-
* @param
|
|
861
|
-
* @param afterUndo Called after undo only — use for dimension or state changes specific to undo.
|
|
919
|
+
* @param afterUndo Called after undo only.
|
|
862
920
|
* @param afterRedo Called after redo only.
|
|
863
921
|
*/
|
|
864
|
-
withHistory(transaction: (mutator: M) => void,
|
|
865
|
-
resize(newWidth: number, newHeight: number, offsetX?: number, offsetY?: number,
|
|
922
|
+
withHistory(transaction: (mutator: M) => void, afterUndo?: (patch: PixelPatchTiles) => void, afterRedo?: (patch: PixelPatchTiles) => void): void;
|
|
923
|
+
resize(newWidth: number, newHeight: number, offsetX?: number, offsetY?: number, afterUndo?: (target: ImageData) => void, afterRedo?: (target: ImageData) => void, resizeImageDataFn?: typeof resizeImageData): void;
|
|
866
924
|
}
|
|
867
925
|
type HistoryMutator<T extends {}, D extends {}> = (writer: PixelWriter<any>, deps?: Partial<D>) => T;
|
|
868
926
|
|
|
@@ -1169,12 +1227,14 @@ declare const mutatorFillRect: (writer: PixelWriter<any>, deps?: Deps$2) => {
|
|
|
1169
1227
|
};
|
|
1170
1228
|
|
|
1171
1229
|
/**
|
|
1172
|
-
* Fills
|
|
1230
|
+
* Fills the target PixelData with a color based on a binary mask.
|
|
1231
|
+
*
|
|
1173
1232
|
* @param target - The target to modify.
|
|
1174
1233
|
* @param color - The color to apply.
|
|
1175
|
-
* @param mask - The mask
|
|
1176
|
-
* @param x -
|
|
1177
|
-
* @param y -
|
|
1234
|
+
* @param mask - The binary mask determining where to fill.
|
|
1235
|
+
* @param x - Horizontal offset to place the mask.
|
|
1236
|
+
* @param y - Vertical offset to place the mask.
|
|
1237
|
+
* @returns true if any pixels were actually modified.
|
|
1178
1238
|
*/
|
|
1179
1239
|
declare function fillPixelDataBinaryMask(target: PixelData32, color: Color32, mask: BinaryMask, x?: number, y?: number): boolean;
|
|
1180
1240
|
|
|
@@ -1189,6 +1249,12 @@ declare const mutatorFillBinaryMask: (writer: PixelWriter<any>, deps?: Deps$1) =
|
|
|
1189
1249
|
fillBinaryMask(color: Color32, mask: BinaryMask, x?: number, y?: number): boolean;
|
|
1190
1250
|
};
|
|
1191
1251
|
|
|
1252
|
+
/**
|
|
1253
|
+
* Inverts the RGB color data of the target PixelData, optionally controlled by a mask.
|
|
1254
|
+
* @param target - The target to modify.
|
|
1255
|
+
* @param opts - Options defining the area, mask, and offsets.
|
|
1256
|
+
* @returns true if the operation was performed within bounds.
|
|
1257
|
+
*/
|
|
1192
1258
|
declare function invertPixelData(target: PixelData32, opts?: PixelMutateOptions): boolean;
|
|
1193
1259
|
|
|
1194
1260
|
declare const defaults: {
|
|
@@ -1205,6 +1271,27 @@ declare const mutatorInvert: (writer: PixelWriter<any>, deps?: Deps) => {
|
|
|
1205
1271
|
declare function copyImageData({ data, width, height }: ImageDataLike): ImageData;
|
|
1206
1272
|
declare function copyImageDataLike({ data, width, height }: ImageDataLike): ImageDataLike;
|
|
1207
1273
|
|
|
1274
|
+
/**
|
|
1275
|
+
* Extracts a specific rectangular region of pixels from a larger {@link ImageDataLike}
|
|
1276
|
+
* source into a new {@link Uint8ClampedArray}.
|
|
1277
|
+
*
|
|
1278
|
+
* This is a "read-only" operation that returns a copy of the pixel data.
|
|
1279
|
+
*
|
|
1280
|
+
* @param imageData - The source image data to read from.
|
|
1281
|
+
* @param rect - A rect defining the region to extract.
|
|
1282
|
+
* @returns A buffer containing the RGBA pixel data of the region.
|
|
1283
|
+
*/
|
|
1284
|
+
declare function extractImageData(imageData: ImageDataLike, rect: Rect): ImageData | null;
|
|
1285
|
+
/**
|
|
1286
|
+
* @param imageData - The source image data to read from.
|
|
1287
|
+
* @param x - The starting horizontal coordinate.
|
|
1288
|
+
* @param y - The starting vertical coordinate.
|
|
1289
|
+
* @param w - The width of the region to extract.
|
|
1290
|
+
* @param h - The height of the region to extract.
|
|
1291
|
+
* @returns A buffer containing the RGBA pixel data of the region.
|
|
1292
|
+
*/
|
|
1293
|
+
declare function extractImageData(imageData: ImageDataLike, x: number, y: number, w: number, h: number): ImageData | null;
|
|
1294
|
+
|
|
1208
1295
|
/**
|
|
1209
1296
|
* Extracts a specific rectangular region of pixels from a larger {@link ImageDataLike}
|
|
1210
1297
|
* source into a new {@link Uint8ClampedArray}.
|
|
@@ -1345,14 +1432,8 @@ declare function uInt32ArrayToImageDataLike(data: Uint32Array, width: number, he
|
|
|
1345
1432
|
* @param source - The source ImageData to read from.
|
|
1346
1433
|
* @param x - The x-coordinate in the target where drawing starts.
|
|
1347
1434
|
* @param y - The y-coordinate in the target where drawing starts.
|
|
1348
|
-
* @param sx - The x-coordinate in the source to start copying from.
|
|
1349
|
-
* @param sy - The y-coordinate in the source to start copying from.
|
|
1350
|
-
* @param sw - The width of the rectangle to copy.
|
|
1351
|
-
* @param sh - The height of the rectangle to copy.
|
|
1352
|
-
* @param mask - An optional Uint8Array mask (0-255). 0 is transparent, 255 is opaque.
|
|
1353
|
-
* @param maskType - type of mask
|
|
1354
1435
|
*/
|
|
1355
|
-
declare function writeImageData(target: ImageData, source: ImageData, x: number, y: number
|
|
1436
|
+
declare function writeImageData(target: ImageData, source: ImageData, x: number, y: number): void;
|
|
1356
1437
|
|
|
1357
1438
|
/**
|
|
1358
1439
|
* Copies a pixel buffer into a specific region of an {@link ImageData} object.
|
|
@@ -1802,6 +1883,22 @@ declare function reflectPixelDataVertical(pixelData: PixelData32): void;
|
|
|
1802
1883
|
declare function resamplePixelData(pixelData: PixelData32, factor: number): PixelData;
|
|
1803
1884
|
declare function resamplePixelDataInPlace(pixelData: PixelData32, factor: number): void;
|
|
1804
1885
|
|
|
1886
|
+
/**
|
|
1887
|
+
* Non-destructively resizes the {@link PixelData32} buffer to new dimensions, optionally
|
|
1888
|
+
* offsetting the original content.
|
|
1889
|
+
* This operation creates a new buffer. It does not scale or stretch pixels;
|
|
1890
|
+
* instead, it crops or pads the image based on the new dimensions.
|
|
1891
|
+
*
|
|
1892
|
+
* @param target - The source pixel data to resize.
|
|
1893
|
+
* @param newWidth - The target width in pixels.
|
|
1894
|
+
* @param newHeight - The target height in pixels.
|
|
1895
|
+
* @param offsetX - The horizontal offset for placing the original image.
|
|
1896
|
+
* @param offsetY - The vertical offset for placing the original image.
|
|
1897
|
+
* @param out - output object
|
|
1898
|
+
* @returns A new {@link PixelData32} object with the specified dimensions.
|
|
1899
|
+
*/
|
|
1900
|
+
declare function resizePixelData(target: PixelData32, newWidth: number, newHeight: number, offsetX?: number, offsetY?: number, out?: MutablePixelData32): PixelData32;
|
|
1901
|
+
|
|
1805
1902
|
type ReusablePixelData = ReturnType<typeof makeReusablePixelData>;
|
|
1806
1903
|
/**
|
|
1807
1904
|
* Creates a factory function that manages a single, reusable PixelData instance.
|
|
@@ -1822,11 +1919,19 @@ declare function uInt32ArrayToPixelData(data: Uint32Array, width: number, height
|
|
|
1822
1919
|
|
|
1823
1920
|
/**
|
|
1824
1921
|
* Copies a pixel buffer into a specific region of a {@link PixelData32} object.
|
|
1825
|
-
*
|
|
1826
|
-
*
|
|
1827
|
-
*
|
|
1922
|
+
* @param target - The target to write into.
|
|
1923
|
+
* @param data - The source pixel data (Uint32Array).
|
|
1924
|
+
* @param rect - A rect defining the destination region.
|
|
1828
1925
|
*/
|
|
1829
1926
|
declare function writePixelDataBuffer(target: PixelData32, data: Uint32Array, rect: Rect): void;
|
|
1927
|
+
/**
|
|
1928
|
+
* @param target - The target to write into.
|
|
1929
|
+
* @param data - The source pixel data (Uint32Array).
|
|
1930
|
+
* @param x - The starting horizontal coordinate in the target.
|
|
1931
|
+
* @param y - The starting vertical coordinate in the target.
|
|
1932
|
+
* @param w - The width of the region to write.
|
|
1933
|
+
* @param h - The height of the region to write.
|
|
1934
|
+
*/
|
|
1830
1935
|
declare function writePixelDataBuffer(target: PixelData32, data: Uint32Array, x: number, y: number, w: number, h: number): void;
|
|
1831
1936
|
|
|
1832
1937
|
/**
|
|
@@ -1836,36 +1941,6 @@ declare function writePaintBufferToPixelData(target: PixelData, paintBuffer: Col
|
|
|
1836
1941
|
|
|
1837
1942
|
declare function getRectsBounds<T extends Rect>(rects: T[]): T;
|
|
1838
1943
|
|
|
1839
|
-
type ClippedRect = {
|
|
1840
|
-
x: number;
|
|
1841
|
-
y: number;
|
|
1842
|
-
w: number;
|
|
1843
|
-
h: number;
|
|
1844
|
-
inBounds: boolean;
|
|
1845
|
-
};
|
|
1846
|
-
type ClippedBlit = {
|
|
1847
|
-
x: number;
|
|
1848
|
-
y: number;
|
|
1849
|
-
sx: number;
|
|
1850
|
-
sy: number;
|
|
1851
|
-
w: number;
|
|
1852
|
-
h: number;
|
|
1853
|
-
inBounds: boolean;
|
|
1854
|
-
};
|
|
1855
|
-
declare const makeClippedRect: () => ClippedRect;
|
|
1856
|
-
declare const makeClippedBlit: () => ClippedBlit;
|
|
1857
|
-
/**
|
|
1858
|
-
* Calculates the intersection of a target rectangle and a bounding box (usually 0,0 -> width,height).
|
|
1859
|
-
* Handles negative offsets by shrinking dimensions.
|
|
1860
|
-
*/
|
|
1861
|
-
declare function resolveRectClipping(x: number, y: number, w: number, h: number, boundaryW: number, boundaryH: number, out: ClippedRect): ClippedRect;
|
|
1862
|
-
/**
|
|
1863
|
-
* Calculates the clipping for transferring data from a Source to a Destination.
|
|
1864
|
-
* Handles cases where the source is out of bounds (shifting the destination target)
|
|
1865
|
-
* AND cases where the destination is out of bounds (shifting the source target).
|
|
1866
|
-
*/
|
|
1867
|
-
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;
|
|
1868
|
-
|
|
1869
1944
|
/**
|
|
1870
1945
|
* Intersects a target rectangle with a boundary, trimming dimensions and masks in-place.
|
|
1871
1946
|
* This utility calculates the axis-aligned intersection between the `target` and `bounds`.
|
|
@@ -1889,4 +1964,4 @@ declare const makeBinaryMaskTile: TileFactory<BinaryMaskTile>;
|
|
|
1889
1964
|
|
|
1890
1965
|
declare function makePixelTile(id: number, tx: number, ty: number, tileSize: number, tileArea: number): PixelTile;
|
|
1891
1966
|
|
|
1892
|
-
export { type AlphaMask, AlphaMaskPaintBuffer, type AlphaMaskPaintBufferCanvasRenderer, type AlphaMaskPaintBufferManager, type AlphaMaskRect, type AlphaMaskTile, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BaseMask, type BasePixelBlendOptions, type BinaryMask, BinaryMaskPaintBuffer, type BinaryMaskPaintBufferCanvasRenderer, type BinaryMaskPaintBufferManager, type BinaryMaskRect, type BinaryMaskTile, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type CanvasObjectFactory, type CanvasPixelDataRenderer, type
|
|
1967
|
+
export { type AlphaMask, AlphaMaskPaintBuffer, type AlphaMaskPaintBufferCanvasRenderer, type AlphaMaskPaintBufferManager, type AlphaMaskRect, type AlphaMaskTile, type ApplyMaskToPixelDataOptions, BASE_FAST_BLEND_MODE_FUNCTIONS, BASE_PERFECT_BLEND_MODE_FUNCTIONS, type Base64EncodedUInt8Array, BaseBlendMode, type BaseBlendModes, type BaseMask, type BasePixelBlendOptions, type BatchedQueue, type BatchedQueueFn, type BinaryMask, BinaryMaskPaintBuffer, type BinaryMaskPaintBufferCanvasRenderer, type BinaryMaskPaintBufferManager, type BinaryMaskRect, type BinaryMaskTile, type BlendColor32, type BlendModeRegistry, CANVAS_COMPOSITE_MAP, type CanvasBlendModeIndex, type CanvasCompositeOperation, type CanvasContext, type CanvasFrameRenderer, type CanvasObjectFactory, type CanvasPixelDataRenderer, type Color32, type ColorBlendMaskOptions, type ColorBlendOptions, ColorPaintBuffer, type ColorPaintBufferCanvasRenderer, type ColorPaintBufferManager, type DidChangeFn, type DrawPixelLayer, type DrawScreenLayer, _errors as ERRORS, type FloodFillResult, type HistoryAction, type HistoryActionFactory, HistoryManager, type HistoryMutator, type ImageDataLike, type IndexedImage, type InvertMask, type Mask, type MaskOffset, type MaskRect, MaskType, type MergeAlphaMasksOptions, type MutableAlphaMask, type MutableBinaryMask, type MutableMask, type MutablePixelData32, type NullableBinaryMaskRect, type NullableMaskRect, type PaintAlphaMask, type PaintBinaryMask, type PaintCursorRenderer, type PaintMask, PaintMaskOutline, PixelAccumulator, type PixelBlendMaskOptions, type PixelBlendOptions, type PixelCanvas, type PixelData, type PixelData32, PixelEngineConfig, type PixelMutateOptions, type PixelPatchTiles, type PixelRect, type PixelTile, PixelWriter, type PixelWriterOptions, type RGBA, type Rect, type RequiredBlendModes, type ReusableCanvas, type ReusableCanvasFactory, type ReusableImageData, type ReusablePixelData, type SerializedImageData, type Tile, type TileFactory, TilePool, TileType, UnsupportedFormatError, _macro_imageDataToUint32Array, applyAlphaMaskToPixelData, applyBinaryMaskToAlphaMask, applyBinaryMaskToPixelData, applyMaskToPixelData, applyPatchTiles, base64DecodeArrayBuffer, base64EncodeArrayBuffer, blendColorPixelData, blendColorPixelDataAlphaMask, blendColorPixelDataBinaryMask, blendColorPixelDataMask, blendColorPixelDataPaintAlphaMask, blendColorPixelDataPaintBinaryMask, blendColorPixelDataPaintMask, blendPixel, blendPixelData, blendPixelDataAlphaMask, blendPixelDataBinaryMask, blendPixelDataMask, blendPixelDataPaintBuffer, clearPixelDataFast, color32ToCssRGBA, color32ToHex, colorBurnFast, colorBurnPerfect, colorDistance, colorDodgeFast, colorDodgePerfect, commitColorPaintBuffer, commitMaskPaintBuffer, copyImageData, copyImageDataLike, copyMask, copyPixelData, darkenFast, darkenPerfect, darkerFast, darkerPerfect, deserializeImageData, deserializeNullableImageData, deserializeRawImageData, destinationAtopFast, destinationAtopPerfect, destinationInFast, destinationInPerfect, destinationOutFast, destinationOutPerfect, destinationOverFast, destinationOverPerfect, differenceFast, differencePerfect, divideFast, dividePerfect, eachTileInBounds, exclusionFast, exclusionPerfect, extractImageData, extractImageDataBuffer, extractMask, extractMaskBuffer, extractPixelData, extractPixelDataBuffer, fileInputChangeToImageData, fileToImageData, fillPixelData, fillPixelDataBinaryMask, fillPixelDataFast, floodFillSelection, forEachLinePoint, getImageDataFromClipboard, getIndexedImageColor, getIndexedImageColorCounts, getRectsBounds, getSupportedPixelFormats, hardLightFast, hardLightPerfect, hardMixFast, hardMixPerfect, imageDataToAlphaMaskBuffer, imageDataToDataUrl, imageDataToImgBlob, imageDataToUint32Array, imgBlobToImageData, indexedImageToAverageColor, indexedImageToImageData, invertAlphaMask, invertBinaryMask, invertImageData, invertPixelData, lerpColor32, lerpColor32Fast, lightenFast, lightenPerfect, lighterFast, lighterPerfect, linearBurnFast, linearBurnPerfect, linearDodgeFast, linearDodgePerfect, linearLightFast, linearLightPerfect, makeAlphaMask, makeAlphaMaskPaintBufferCanvasRenderer, makeAlphaMaskPaintBufferCommitter, makeAlphaMaskPaintBufferManager, makeAlphaMaskTile, makeBatchedQueue, makeBinaryMask, makeBinaryMaskFromAlphaMask, makeBinaryMaskOutline, makeBinaryMaskPaintBufferCanvasRenderer, makeBinaryMaskPaintBufferCommitter, makeBinaryMaskPaintBufferManager, makeBinaryMaskTile, makeBlendModeRegistry, makeCanvasFrameRenderer, makeCanvasPixelDataRenderer, makeCircleBinaryMaskOutline, makeCirclePaintAlphaMask, makeCirclePaintBinaryMask, makeColorPaintBufferCanvasRenderer, makeColorPaintBufferCommitter, makeColorPaintBufferManager, makeFastBlendModeRegistry, makeFullPixelMutator, makeHistoryAction, makeImageDataLike, makeIndexedImage, makeIndexedImageFromImageData, makeIndexedImageFromImageDataRaw, makePaintAlphaMask, makePaintBinaryMask, makePaintCursorRenderer, makePerfectBlendModeRegistry, makePixelCanvas, makePixelData, makePixelTile, makeRectBinaryMaskOutline, makeRectFalloffPaintAlphaMask, makeRenderQueue, makeReusableCanvas, makeReusableImageData, makeReusableOffscreenCanvas, makeReusablePixelData, merge2BinaryMaskRects, mergeAlphaMasks, mergeBinaryMaskRects, mergeBinaryMasks, multiplyFast, multiplyPerfect, mutatorApplyAlphaMask, mutatorApplyBinaryMask, mutatorApplyMask, mutatorBlendAlphaMask, mutatorBlendBinaryMask, mutatorBlendColor, mutatorBlendColorPaintAlphaMask, mutatorBlendColorPaintBinaryMask, mutatorBlendColorPaintMask, mutatorBlendColorPaintRect, mutatorBlendMask, mutatorBlendPixel, mutatorBlendPixelData, mutatorClear, mutatorFill, mutatorFillBinaryMask, mutatorFillRect, mutatorInvert, overlayFast, overlayPerfect, overwriteBase, overwriteFast, overwritePerfect, packColor, packRGBA, pinLightFast, pinLightPerfect, pixelDataToAlphaMask, reflectPixelDataHorizontal, reflectPixelDataVertical, resampleImageData, resampleIndexedImage, resamplePixelData, resamplePixelDataInPlace, resampleUint32Array, resizeImageData, resizePixelData, rotatePixelData, screenFast, screenPerfect, serializeImageData, serializeNullableImageData, setMaskData, setPixelData, softLightFast, softLightPerfect, sourceAtopFast, sourceAtopPerfect, sourceInFast, sourceInPerfect, sourceOutFast, sourceOutPerfect, sourceOverFast, sourceOverPerfect, subtractBinaryMaskRects, subtractFast, subtractPerfect, toBlendModeIndexAndName, trimMaskRectBounds, trimRectBounds, uInt32ArrayToImageData, uInt32ArrayToImageDataLike, uInt32ArrayToPixelData, unpackAlpha, unpackBlue, unpackColor, unpackColorTo, unpackGreen, unpackRed, vividLightFast, vividLightPerfect, writeImageData, writeImageDataBuffer, writeImageDataToClipboard, writeImgBlobToClipboard, writePaintBufferToPixelData, writePixelDataBuffer, xorFast, xorPerfect };
|