@pixerate/editor 0.186.0 → 0.188.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-FW7N64XK.js → chunk-IGMNJM2H.js} +221 -20
- package/dist/{chunk-X2KQQZBT.cjs → chunk-JYV4R62M.cjs} +381 -180
- package/dist/image-editor/controller.d.cts +36 -3
- package/dist/image-editor/controller.d.ts +36 -3
- package/dist/image-editor/index.cjs +874 -718
- package/dist/image-editor/index.js +206 -50
- package/dist/image-editor/selection/index.d.cts +1 -0
- package/dist/image-editor/selection/index.d.ts +1 -0
- package/dist/image-editor/selection/mask-files.d.cts +20 -0
- package/dist/image-editor/selection/mask-files.d.ts +20 -0
- package/dist/image-editor/selection/mask.d.cts +20 -1
- package/dist/image-editor/selection/mask.d.ts +20 -1
- package/dist/image-editor/selection/shapes.d.cts +8 -0
- package/dist/image-editor/selection/shapes.d.ts +8 -0
- package/dist/image-editor/selection/tool-options.d.cts +1 -1
- package/dist/image-editor/selection/tool-options.d.ts +1 -1
- package/dist/paint-editor/index.cjs +6 -6
- package/dist/paint-editor/index.js +1 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +5 -24
- package/skills/pixerate-image-editor/references/painting.md +29 -0
- package/skills/pixerate-image-selection-masking/SKILL.md +7 -1
|
@@ -113,6 +113,12 @@ export interface SelectionCommandOptions {
|
|
|
113
113
|
}
|
|
114
114
|
/** How the canvas shows the selection: marching ants, a Quick Mask tint, or not at all. */
|
|
115
115
|
export type SelectionDisplay = 'ants' | 'quickMask' | 'none';
|
|
116
|
+
/** What `exportMaskImage` writes: the selection, an alpha channel or a layer's painted mask. */
|
|
117
|
+
export type MaskImageSource = 'selection' | {
|
|
118
|
+
channelId: string;
|
|
119
|
+
} | {
|
|
120
|
+
layerId: string;
|
|
121
|
+
};
|
|
116
122
|
/** Where an AI result goes (see `applyInpaintedImage`, `applyBackgroundRemovedImage`). */
|
|
117
123
|
export interface AIResultOptions {
|
|
118
124
|
/** `new-layer`: a new layer (inpainting) or a mask (background removal); `replace`: the Background's pixels. Default: by `isMultiLayer`. */
|
|
@@ -718,8 +724,8 @@ export declare class ImageEditorController {
|
|
|
718
724
|
private asOneStep;
|
|
719
725
|
private recordHistory;
|
|
720
726
|
/**
|
|
721
|
-
* Bytes of pixel tiles held only by undo / redo steps (not by the
|
|
722
|
-
* undo steps are dropped while it exceeds `maxHistoryBytes`.
|
|
727
|
+
* Bytes of pixel, selection and channel tiles held only by undo / redo steps (not by the
|
|
728
|
+
* current state). The oldest undo steps are dropped while it exceeds `maxHistoryBytes`.
|
|
723
729
|
*/
|
|
724
730
|
get historyBytes(): number;
|
|
725
731
|
private trimHistoryBytes;
|
|
@@ -1448,6 +1454,29 @@ export declare class ImageEditorController {
|
|
|
1448
1454
|
threshold?: number;
|
|
1449
1455
|
mode?: SelectionMode;
|
|
1450
1456
|
}): Promise<SelectionMask | null>;
|
|
1457
|
+
/**
|
|
1458
|
+
* Loads a mask image (a data URL / URL or RGBA pixels, any size, resampled) into a new alpha
|
|
1459
|
+
* channel, read like `loadSelectionFromImage`. The selection does not change. One undo step.
|
|
1460
|
+
*/
|
|
1461
|
+
loadChannelFromImage(source: string | PixelBuffer, options?: {
|
|
1462
|
+
name?: string;
|
|
1463
|
+
channel?: SelectionChannel;
|
|
1464
|
+
invert?: boolean;
|
|
1465
|
+
threshold?: number;
|
|
1466
|
+
}): Promise<AlphaChannel>;
|
|
1467
|
+
/**
|
|
1468
|
+
* A full-size greyscale PNG (white = selected / revealed) of the selection, an alpha channel or
|
|
1469
|
+
* a layer's painted mask, as a data URL; `invert` swaps black and white, `maxSide` scales it
|
|
1470
|
+
* down. Encoded in code, so it works without a canvas. Throws when the source is missing.
|
|
1471
|
+
*/
|
|
1472
|
+
exportMaskImage(source: MaskImageSource, options?: {
|
|
1473
|
+
invert?: boolean;
|
|
1474
|
+
maxSide?: number;
|
|
1475
|
+
}): {
|
|
1476
|
+
width: number;
|
|
1477
|
+
height: number;
|
|
1478
|
+
dataUrl: string;
|
|
1479
|
+
};
|
|
1451
1480
|
/** A mask image (data URL / URL, or pixels as they are) as RGBA pixels. */
|
|
1452
1481
|
private decodeMaskImage;
|
|
1453
1482
|
/**
|
|
@@ -1493,6 +1522,8 @@ export declare class ImageEditorController {
|
|
|
1493
1522
|
name?: string;
|
|
1494
1523
|
mode?: SelectionMode;
|
|
1495
1524
|
}): AlphaChannel;
|
|
1525
|
+
/** Appends a new channel holding `mask` (canvas-sized) as one undo step. */
|
|
1526
|
+
private addChannel;
|
|
1496
1527
|
/**
|
|
1497
1528
|
* Select › Load Selection from an alpha channel (inverted with `invert`), combined with the
|
|
1498
1529
|
* selection by `mode`. One undo step.
|
|
@@ -1528,7 +1559,7 @@ export declare class ImageEditorController {
|
|
|
1528
1559
|
setQuickMaskMode(on: boolean): void;
|
|
1529
1560
|
/** The selection as a 1-channel surface to paint in Quick Mask mode. */
|
|
1530
1561
|
private quickMaskSurface;
|
|
1531
|
-
/** The selection a painted Quick Mask surface stands for (
|
|
1562
|
+
/** The selection a painted Quick Mask surface stands for (it shares the surface's tiles). */
|
|
1532
1563
|
private selectionFromSurface;
|
|
1533
1564
|
private maskFromSelection;
|
|
1534
1565
|
/**
|
|
@@ -1546,6 +1577,8 @@ export declare class ImageEditorController {
|
|
|
1546
1577
|
* with `invert`. False without a painted mask (a depth mask is computed, not painted).
|
|
1547
1578
|
*/
|
|
1548
1579
|
selectionFromLayerMask(layerId: string, mode?: SelectionMode, invert?: boolean): boolean;
|
|
1580
|
+
/** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
|
|
1581
|
+
private layerMaskCoverage;
|
|
1549
1582
|
/**
|
|
1550
1583
|
* Histogram of the last rendered preview (after adjustments and layers, before annotations),
|
|
1551
1584
|
* or `null` before the first render or without canvas pixel access.
|
|
@@ -113,6 +113,12 @@ export interface SelectionCommandOptions {
|
|
|
113
113
|
}
|
|
114
114
|
/** How the canvas shows the selection: marching ants, a Quick Mask tint, or not at all. */
|
|
115
115
|
export type SelectionDisplay = 'ants' | 'quickMask' | 'none';
|
|
116
|
+
/** What `exportMaskImage` writes: the selection, an alpha channel or a layer's painted mask. */
|
|
117
|
+
export type MaskImageSource = 'selection' | {
|
|
118
|
+
channelId: string;
|
|
119
|
+
} | {
|
|
120
|
+
layerId: string;
|
|
121
|
+
};
|
|
116
122
|
/** Where an AI result goes (see `applyInpaintedImage`, `applyBackgroundRemovedImage`). */
|
|
117
123
|
export interface AIResultOptions {
|
|
118
124
|
/** `new-layer`: a new layer (inpainting) or a mask (background removal); `replace`: the Background's pixels. Default: by `isMultiLayer`. */
|
|
@@ -718,8 +724,8 @@ export declare class ImageEditorController {
|
|
|
718
724
|
private asOneStep;
|
|
719
725
|
private recordHistory;
|
|
720
726
|
/**
|
|
721
|
-
* Bytes of pixel tiles held only by undo / redo steps (not by the
|
|
722
|
-
* undo steps are dropped while it exceeds `maxHistoryBytes`.
|
|
727
|
+
* Bytes of pixel, selection and channel tiles held only by undo / redo steps (not by the
|
|
728
|
+
* current state). The oldest undo steps are dropped while it exceeds `maxHistoryBytes`.
|
|
723
729
|
*/
|
|
724
730
|
get historyBytes(): number;
|
|
725
731
|
private trimHistoryBytes;
|
|
@@ -1448,6 +1454,29 @@ export declare class ImageEditorController {
|
|
|
1448
1454
|
threshold?: number;
|
|
1449
1455
|
mode?: SelectionMode;
|
|
1450
1456
|
}): Promise<SelectionMask | null>;
|
|
1457
|
+
/**
|
|
1458
|
+
* Loads a mask image (a data URL / URL or RGBA pixels, any size, resampled) into a new alpha
|
|
1459
|
+
* channel, read like `loadSelectionFromImage`. The selection does not change. One undo step.
|
|
1460
|
+
*/
|
|
1461
|
+
loadChannelFromImage(source: string | PixelBuffer, options?: {
|
|
1462
|
+
name?: string;
|
|
1463
|
+
channel?: SelectionChannel;
|
|
1464
|
+
invert?: boolean;
|
|
1465
|
+
threshold?: number;
|
|
1466
|
+
}): Promise<AlphaChannel>;
|
|
1467
|
+
/**
|
|
1468
|
+
* A full-size greyscale PNG (white = selected / revealed) of the selection, an alpha channel or
|
|
1469
|
+
* a layer's painted mask, as a data URL; `invert` swaps black and white, `maxSide` scales it
|
|
1470
|
+
* down. Encoded in code, so it works without a canvas. Throws when the source is missing.
|
|
1471
|
+
*/
|
|
1472
|
+
exportMaskImage(source: MaskImageSource, options?: {
|
|
1473
|
+
invert?: boolean;
|
|
1474
|
+
maxSide?: number;
|
|
1475
|
+
}): {
|
|
1476
|
+
width: number;
|
|
1477
|
+
height: number;
|
|
1478
|
+
dataUrl: string;
|
|
1479
|
+
};
|
|
1451
1480
|
/** A mask image (data URL / URL, or pixels as they are) as RGBA pixels. */
|
|
1452
1481
|
private decodeMaskImage;
|
|
1453
1482
|
/**
|
|
@@ -1493,6 +1522,8 @@ export declare class ImageEditorController {
|
|
|
1493
1522
|
name?: string;
|
|
1494
1523
|
mode?: SelectionMode;
|
|
1495
1524
|
}): AlphaChannel;
|
|
1525
|
+
/** Appends a new channel holding `mask` (canvas-sized) as one undo step. */
|
|
1526
|
+
private addChannel;
|
|
1496
1527
|
/**
|
|
1497
1528
|
* Select › Load Selection from an alpha channel (inverted with `invert`), combined with the
|
|
1498
1529
|
* selection by `mode`. One undo step.
|
|
@@ -1528,7 +1559,7 @@ export declare class ImageEditorController {
|
|
|
1528
1559
|
setQuickMaskMode(on: boolean): void;
|
|
1529
1560
|
/** The selection as a 1-channel surface to paint in Quick Mask mode. */
|
|
1530
1561
|
private quickMaskSurface;
|
|
1531
|
-
/** The selection a painted Quick Mask surface stands for (
|
|
1562
|
+
/** The selection a painted Quick Mask surface stands for (it shares the surface's tiles). */
|
|
1532
1563
|
private selectionFromSurface;
|
|
1533
1564
|
private maskFromSelection;
|
|
1534
1565
|
/**
|
|
@@ -1546,6 +1577,8 @@ export declare class ImageEditorController {
|
|
|
1546
1577
|
* with `invert`. False without a painted mask (a depth mask is computed, not painted).
|
|
1547
1578
|
*/
|
|
1548
1579
|
selectionFromLayerMask(layerId: string, mode?: SelectionMode, invert?: boolean): boolean;
|
|
1580
|
+
/** A layer's painted mask over the canvas as a selection mask; null without one (or for a depth mask). */
|
|
1581
|
+
private layerMaskCoverage;
|
|
1549
1582
|
/**
|
|
1550
1583
|
* Histogram of the last rendered preview (after adjustments and layers, before annotations),
|
|
1551
1584
|
* or `null` before the first render or without canvas pixel access.
|