@pixerate/editor 0.209.0 → 0.210.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/{chunk-X4LUGTQX.cjs → chunk-L52VMQZS.cjs} +21 -10
- package/dist/{chunk-DWYQPL2A.js → chunk-LQ5SALHK.js} +13 -2
- package/dist/chunk-MQDIP4CF.cjs +462 -0
- package/dist/chunk-XI2NV5U7.js +462 -0
- package/dist/{chunk-3EHPLDFQ.cjs → chunk-YF3YZZ6G.cjs} +16 -453
- package/dist/{chunk-USQCKRZG.js → chunk-ZGJGSCUW.js} +8 -445
- package/dist/image-editor/content-aware-fill-session.d.cts +109 -0
- package/dist/image-editor/content-aware-fill-session.d.ts +109 -0
- package/dist/image-editor/controller.d.cts +60 -1
- package/dist/image-editor/controller.d.ts +60 -1
- package/dist/image-editor/index.cjs +620 -252
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +396 -28
- package/dist/image-editor/selection/worker.d.cts +10 -0
- package/dist/image-editor/selection/worker.d.ts +10 -0
- package/dist/image-editor/selection-worker.cjs +4 -3
- package/dist/image-editor/selection-worker.js +2 -1
- package/dist/paint/heal.d.cts +3 -1
- package/dist/paint/heal.d.ts +3 -1
- package/dist/paint/index.cjs +4 -2
- package/dist/paint/index.js +10 -8
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +20 -22
- package/skills/pixerate-image-editor/references/layer-effects.md +24 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +2 -1
|
@@ -488,6 +488,31 @@ export interface ContentAwareFillOptions {
|
|
|
488
488
|
sampleRadius?: number;
|
|
489
489
|
/** Random seed: the same seed gives the same fill (default 0). */
|
|
490
490
|
seed?: number;
|
|
491
|
+
/**
|
|
492
|
+
* Where the fill may copy from (natural pixels), instead of the automatic ring around the
|
|
493
|
+
* selection: a mask (the Content-Aware Fill workspace's painted area), an alpha channel, or
|
|
494
|
+
* rectangles. `excludeRects` are never copied from, whichever way the area is given.
|
|
495
|
+
*/
|
|
496
|
+
samplingArea?: SelectionMask | null;
|
|
497
|
+
samplingChannelId?: string;
|
|
498
|
+
sampleRects?: CropBox[];
|
|
499
|
+
excludeRects?: CropBox[];
|
|
500
|
+
}
|
|
501
|
+
/** What a Content-Aware Fill works on: the selection's window of a pixel layer (see `prepareContentAwareFill`). */
|
|
502
|
+
export interface ContentAwareFillPlan {
|
|
503
|
+
layerId: string;
|
|
504
|
+
/** The window it fills and samples in (document pixels). */
|
|
505
|
+
window: CropBox;
|
|
506
|
+
/** The selection's bounds. */
|
|
507
|
+
bounds: CropBox;
|
|
508
|
+
/** The layer's pixels in the window, RGBA. */
|
|
509
|
+
before: Uint8ClampedArray;
|
|
510
|
+
/** 1 where the selection covers (the hole), per window pixel. */
|
|
511
|
+
hole: Uint8Array;
|
|
512
|
+
/** The selection's coverage 0..255 per window pixel. */
|
|
513
|
+
coverage: Uint8Array;
|
|
514
|
+
/** 1 where the fill may not copy from, per window pixel (null: everywhere outside the hole). */
|
|
515
|
+
exclude: Uint8Array | null;
|
|
491
516
|
}
|
|
492
517
|
/** Pixels on the editor's clipboard: RGBA, and where they were copied from (document pixels). */
|
|
493
518
|
export interface ClipboardImage extends PixelBuffer {
|
|
@@ -1452,13 +1477,47 @@ export declare class ImageEditorController {
|
|
|
1452
1477
|
* (PatchMatch, as the Spot Healing Brush's content-aware mode), blended by the selection's
|
|
1453
1478
|
* coverage. `output` `current` paints into the layer; `new-layer` puts the fill on a new layer
|
|
1454
1479
|
* above it. Samples within `sampleRadius` px of the selection (default its larger side, at
|
|
1455
|
-
* least 32). Deterministic for a `seed`. One undo step.
|
|
1480
|
+
* least 32), or from the given sampling area. Deterministic for a `seed`. One undo step.
|
|
1481
|
+
* 8-bit documents only for now. Runs here; see `contentAwareFillAsync` for the worker.
|
|
1456
1482
|
*/
|
|
1457
1483
|
contentAwareFill(options?: ContentAwareFillOptions): {
|
|
1458
1484
|
layerId: string;
|
|
1459
1485
|
bounds: CropBox;
|
|
1460
1486
|
output: 'current' | 'new-layer';
|
|
1461
1487
|
};
|
|
1488
|
+
/**
|
|
1489
|
+
* `contentAwareFill` with the synthesis in the selection worker when there is one, with
|
|
1490
|
+
* `signal` and `onProgress`. The layer is checked again before the result lands.
|
|
1491
|
+
*/
|
|
1492
|
+
contentAwareFillAsync(options?: ContentAwareFillOptions & {
|
|
1493
|
+
signal?: AbortSignal;
|
|
1494
|
+
onProgress?: SelectionProgress;
|
|
1495
|
+
}): Promise<{
|
|
1496
|
+
layerId: string;
|
|
1497
|
+
bounds: CropBox;
|
|
1498
|
+
output: 'current' | 'new-layer';
|
|
1499
|
+
}>;
|
|
1500
|
+
/**
|
|
1501
|
+
* The fill without changing anything: the window, its pixels before and after (RGBA, the fill
|
|
1502
|
+
* blended by the selection's coverage) and the sampling area used, for a preview.
|
|
1503
|
+
*/
|
|
1504
|
+
previewContentAwareFill(options?: ContentAwareFillOptions & {
|
|
1505
|
+
signal?: AbortSignal;
|
|
1506
|
+
onProgress?: SelectionProgress;
|
|
1507
|
+
}): Promise<{
|
|
1508
|
+
plan: ContentAwareFillPlan;
|
|
1509
|
+
after: Uint8ClampedArray;
|
|
1510
|
+
}>;
|
|
1511
|
+
private synthesiseFill;
|
|
1512
|
+
/**
|
|
1513
|
+
* Checks and gathers what a Content-Aware Fill needs: the selection, the 8-bit pixel layer, the
|
|
1514
|
+
* window around the selection (and the sampling area), and which pixels it may copy from.
|
|
1515
|
+
*/
|
|
1516
|
+
prepareContentAwareFill(options?: ContentAwareFillOptions): ContentAwareFillPlan;
|
|
1517
|
+
/** The window's pixels with `filled` blended in by the coverage (`current`), or the fill alone, its alpha by the coverage (`new-layer`). */
|
|
1518
|
+
private blendFill;
|
|
1519
|
+
/** Puts a computed fill into the document as one undo step. */
|
|
1520
|
+
private applyContentAwareFill;
|
|
1462
1521
|
/** The pixel clipboard (Copy / Cut), or null. */
|
|
1463
1522
|
private clipboard;
|
|
1464
1523
|
/** What Copy or Cut last put on the editor's clipboard, or null. */
|
|
@@ -488,6 +488,31 @@ export interface ContentAwareFillOptions {
|
|
|
488
488
|
sampleRadius?: number;
|
|
489
489
|
/** Random seed: the same seed gives the same fill (default 0). */
|
|
490
490
|
seed?: number;
|
|
491
|
+
/**
|
|
492
|
+
* Where the fill may copy from (natural pixels), instead of the automatic ring around the
|
|
493
|
+
* selection: a mask (the Content-Aware Fill workspace's painted area), an alpha channel, or
|
|
494
|
+
* rectangles. `excludeRects` are never copied from, whichever way the area is given.
|
|
495
|
+
*/
|
|
496
|
+
samplingArea?: SelectionMask | null;
|
|
497
|
+
samplingChannelId?: string;
|
|
498
|
+
sampleRects?: CropBox[];
|
|
499
|
+
excludeRects?: CropBox[];
|
|
500
|
+
}
|
|
501
|
+
/** What a Content-Aware Fill works on: the selection's window of a pixel layer (see `prepareContentAwareFill`). */
|
|
502
|
+
export interface ContentAwareFillPlan {
|
|
503
|
+
layerId: string;
|
|
504
|
+
/** The window it fills and samples in (document pixels). */
|
|
505
|
+
window: CropBox;
|
|
506
|
+
/** The selection's bounds. */
|
|
507
|
+
bounds: CropBox;
|
|
508
|
+
/** The layer's pixels in the window, RGBA. */
|
|
509
|
+
before: Uint8ClampedArray;
|
|
510
|
+
/** 1 where the selection covers (the hole), per window pixel. */
|
|
511
|
+
hole: Uint8Array;
|
|
512
|
+
/** The selection's coverage 0..255 per window pixel. */
|
|
513
|
+
coverage: Uint8Array;
|
|
514
|
+
/** 1 where the fill may not copy from, per window pixel (null: everywhere outside the hole). */
|
|
515
|
+
exclude: Uint8Array | null;
|
|
491
516
|
}
|
|
492
517
|
/** Pixels on the editor's clipboard: RGBA, and where they were copied from (document pixels). */
|
|
493
518
|
export interface ClipboardImage extends PixelBuffer {
|
|
@@ -1452,13 +1477,47 @@ export declare class ImageEditorController {
|
|
|
1452
1477
|
* (PatchMatch, as the Spot Healing Brush's content-aware mode), blended by the selection's
|
|
1453
1478
|
* coverage. `output` `current` paints into the layer; `new-layer` puts the fill on a new layer
|
|
1454
1479
|
* above it. Samples within `sampleRadius` px of the selection (default its larger side, at
|
|
1455
|
-
* least 32). Deterministic for a `seed`. One undo step.
|
|
1480
|
+
* least 32), or from the given sampling area. Deterministic for a `seed`. One undo step.
|
|
1481
|
+
* 8-bit documents only for now. Runs here; see `contentAwareFillAsync` for the worker.
|
|
1456
1482
|
*/
|
|
1457
1483
|
contentAwareFill(options?: ContentAwareFillOptions): {
|
|
1458
1484
|
layerId: string;
|
|
1459
1485
|
bounds: CropBox;
|
|
1460
1486
|
output: 'current' | 'new-layer';
|
|
1461
1487
|
};
|
|
1488
|
+
/**
|
|
1489
|
+
* `contentAwareFill` with the synthesis in the selection worker when there is one, with
|
|
1490
|
+
* `signal` and `onProgress`. The layer is checked again before the result lands.
|
|
1491
|
+
*/
|
|
1492
|
+
contentAwareFillAsync(options?: ContentAwareFillOptions & {
|
|
1493
|
+
signal?: AbortSignal;
|
|
1494
|
+
onProgress?: SelectionProgress;
|
|
1495
|
+
}): Promise<{
|
|
1496
|
+
layerId: string;
|
|
1497
|
+
bounds: CropBox;
|
|
1498
|
+
output: 'current' | 'new-layer';
|
|
1499
|
+
}>;
|
|
1500
|
+
/**
|
|
1501
|
+
* The fill without changing anything: the window, its pixels before and after (RGBA, the fill
|
|
1502
|
+
* blended by the selection's coverage) and the sampling area used, for a preview.
|
|
1503
|
+
*/
|
|
1504
|
+
previewContentAwareFill(options?: ContentAwareFillOptions & {
|
|
1505
|
+
signal?: AbortSignal;
|
|
1506
|
+
onProgress?: SelectionProgress;
|
|
1507
|
+
}): Promise<{
|
|
1508
|
+
plan: ContentAwareFillPlan;
|
|
1509
|
+
after: Uint8ClampedArray;
|
|
1510
|
+
}>;
|
|
1511
|
+
private synthesiseFill;
|
|
1512
|
+
/**
|
|
1513
|
+
* Checks and gathers what a Content-Aware Fill needs: the selection, the 8-bit pixel layer, the
|
|
1514
|
+
* window around the selection (and the sampling area), and which pixels it may copy from.
|
|
1515
|
+
*/
|
|
1516
|
+
prepareContentAwareFill(options?: ContentAwareFillOptions): ContentAwareFillPlan;
|
|
1517
|
+
/** The window's pixels with `filled` blended in by the coverage (`current`), or the fill alone, its alpha by the coverage (`new-layer`). */
|
|
1518
|
+
private blendFill;
|
|
1519
|
+
/** Puts a computed fill into the document as one undo step. */
|
|
1520
|
+
private applyContentAwareFill;
|
|
1462
1521
|
/** The pixel clipboard (Copy / Cut), or null. */
|
|
1463
1522
|
private clipboard;
|
|
1464
1523
|
/** What Copy or Cut last put on the editor's clipboard, or null. */
|