@pixerate/editor 0.204.0 → 0.205.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.
@@ -161,6 +161,16 @@ export interface FocusAreaCommandOptions extends FocusAreaOptions {
161
161
  /** Sample every layer (default true) or only the active pixel layer. */
162
162
  sampleAllLayers?: boolean;
163
163
  }
164
+ /** Where Select and Mask puts its result (Photoshop's Output To). */
165
+ export type RefineOutput = 'selection' | 'layer-mask' | 'new-layer' | 'new-layer-with-mask';
166
+ /** What {@link ImageEditorController.refineSelectionTo} made. */
167
+ export interface RefineOutputResult {
168
+ output: RefineOutput;
169
+ /** The layer the output came from (all but `selection`). */
170
+ layerId?: string;
171
+ /** The layer it made (`new-layer`, `new-layer-with-mask`). */
172
+ newLayerId?: string;
173
+ }
164
174
  /** Options of {@link ImageEditorController.selectSky}. */
165
175
  export interface SkyCommandOptions extends SkyOptions {
166
176
  /** With a segmentation provider set, ask it for the sky (default true); false finds it classically. */
@@ -1632,6 +1642,26 @@ export declare class ImageEditorController {
1632
1642
  * to the image's edges with a guided filter, then smooth / feather / contrast / shift edge.
1633
1643
  */
1634
1644
  refineSelection(params: RefineEdgeParams, options?: SampleOptions): Promise<boolean>;
1645
+ /**
1646
+ * Select and Mask's output: refines the selection with `params`, then puts the result where
1647
+ * `output` says, as one undo step:
1648
+ * - `selection`: the refined selection;
1649
+ * - `layer-mask`: a mask on the layer (`layerId`, default the active one), then deselects;
1650
+ * - `new-layer`: a new layer of the layer's selected pixels (Layer via Copy), the source hidden;
1651
+ * - `new-layer-with-mask`: a copy of the layer masked by the selection, the source hidden.
1652
+ * `decontaminate` (0..100, new-layer outputs only) replaces the old background's colour in the
1653
+ * soft edge with the subject's own (see `decontaminateColors`).
1654
+ */
1655
+ refineSelectionTo(params: RefineEdgeParams, output?: RefineOutput, options?: SampleOptions & {
1656
+ layerId?: string;
1657
+ decontaminate?: number;
1658
+ }): Promise<RefineOutputResult>;
1659
+ /**
1660
+ * Decontaminate Colors along the soft edge of `coverage`: the colours are estimated from the
1661
+ * source layer (whose background is still there) and written into layer `id`'s RGB, keeping
1662
+ * its alpha.
1663
+ */
1664
+ private decontaminateLayer;
1635
1665
  /**
1636
1666
  * Loads a selection from a mask image (an AI segmentation, a saved mask): a data URL / URL or
1637
1667
  * RGBA pixels, by luminance (white = selected) or a channel. Any size; it is resampled.
@@ -161,6 +161,16 @@ export interface FocusAreaCommandOptions extends FocusAreaOptions {
161
161
  /** Sample every layer (default true) or only the active pixel layer. */
162
162
  sampleAllLayers?: boolean;
163
163
  }
164
+ /** Where Select and Mask puts its result (Photoshop's Output To). */
165
+ export type RefineOutput = 'selection' | 'layer-mask' | 'new-layer' | 'new-layer-with-mask';
166
+ /** What {@link ImageEditorController.refineSelectionTo} made. */
167
+ export interface RefineOutputResult {
168
+ output: RefineOutput;
169
+ /** The layer the output came from (all but `selection`). */
170
+ layerId?: string;
171
+ /** The layer it made (`new-layer`, `new-layer-with-mask`). */
172
+ newLayerId?: string;
173
+ }
164
174
  /** Options of {@link ImageEditorController.selectSky}. */
165
175
  export interface SkyCommandOptions extends SkyOptions {
166
176
  /** With a segmentation provider set, ask it for the sky (default true); false finds it classically. */
@@ -1632,6 +1642,26 @@ export declare class ImageEditorController {
1632
1642
  * to the image's edges with a guided filter, then smooth / feather / contrast / shift edge.
1633
1643
  */
1634
1644
  refineSelection(params: RefineEdgeParams, options?: SampleOptions): Promise<boolean>;
1645
+ /**
1646
+ * Select and Mask's output: refines the selection with `params`, then puts the result where
1647
+ * `output` says, as one undo step:
1648
+ * - `selection`: the refined selection;
1649
+ * - `layer-mask`: a mask on the layer (`layerId`, default the active one), then deselects;
1650
+ * - `new-layer`: a new layer of the layer's selected pixels (Layer via Copy), the source hidden;
1651
+ * - `new-layer-with-mask`: a copy of the layer masked by the selection, the source hidden.
1652
+ * `decontaminate` (0..100, new-layer outputs only) replaces the old background's colour in the
1653
+ * soft edge with the subject's own (see `decontaminateColors`).
1654
+ */
1655
+ refineSelectionTo(params: RefineEdgeParams, output?: RefineOutput, options?: SampleOptions & {
1656
+ layerId?: string;
1657
+ decontaminate?: number;
1658
+ }): Promise<RefineOutputResult>;
1659
+ /**
1660
+ * Decontaminate Colors along the soft edge of `coverage`: the colours are estimated from the
1661
+ * source layer (whose background is still there) and written into layer `id`'s RGB, keeping
1662
+ * its alpha.
1663
+ */
1664
+ private decontaminateLayer;
1635
1665
  /**
1636
1666
  * Loads a selection from a mask image (an AI segmentation, a saved mask): a data URL / URL or
1637
1667
  * RGBA pixels, by luminance (white = selected) or a channel. Any size; it is resampled.