@pixerate/editor 0.179.0 → 0.180.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.
@@ -6,6 +6,7 @@ import { type PixelBuffer, type SelectionChannel, type SelectionMask, type Selec
6
6
  import { type ShapeSelectionOptions } from './selection/shapes.cjs';
7
7
  import { type ColorRangeOptions, type ColorRangeSample, type MagicWandOptions } from './selection/wand.cjs';
8
8
  import { type SelectionModifyOp } from './selection/modify.cjs';
9
+ import { type SegmentationProvider } from './selection/segmentation.cjs';
9
10
  import { type RefineEdgeParams } from './selection/refine.cjs';
10
11
  import type { LayerMaskProps } from './selection/layer-mask.cjs';
11
12
  import type { AdjustmentLayerMask } from './types.cjs';
@@ -538,6 +539,8 @@ export declare class ImageEditorController {
538
539
  private viewKey;
539
540
  /** For `compositePixels` and mask evaluation (the renderer keeps its own for the viewport). */
540
541
  private compositor;
542
+ /** The segmentation provider behind `selectSubject` (see `setSegmentationProvider`). */
543
+ private segmentation;
541
544
  /** The effects provider slot (see `setEffectsProvider`). */
542
545
  readonly effects: EffectsSlot;
543
546
  /** Renders provider effects: effect smart filter results and effect layers. */
@@ -566,6 +569,10 @@ export declare class ImageEditorController {
566
569
  * or those drawn while a result was rendering, once it is in. A cache refresh: no undo step.
567
570
  */
568
571
  private refreshEffectSurfaces;
572
+ /** The registered segmentation provider, or `null` (then `selectSubject` is unavailable). */
573
+ get segmentationProvider(): SegmentationProvider | null;
574
+ /** Registers (or with `null` removes) the segmentation provider. Not an edit: no undo step. */
575
+ setSegmentationProvider(provider: SegmentationProvider | null): void;
569
576
  /** The registered effects provider, or `null`. */
570
577
  get effectsProvider(): EffectProvider | null;
571
578
  /** Registers (or with `null` removes) the effects provider. Not an edit: no undo step. */
@@ -1304,6 +1311,24 @@ export declare class ImageEditorController {
1304
1311
  threshold?: number;
1305
1312
  mode?: SelectionMode;
1306
1313
  }): Promise<SelectionMask | null>;
1314
+ /** A mask image (data URL / URL, or pixels as they are) as RGBA pixels. */
1315
+ private decodeMaskImage;
1316
+ /**
1317
+ * Select › Subject: asks the segmentation provider for the objects matching `target` ("the
1318
+ * dog", "the sky") in the flattened image and selects their shapes, combined with the
1319
+ * selection by `mode`, as one undo step. Returns what was found (labels and bounds in natural
1320
+ * pixels); an empty list leaves the selection as it was. Throws without a provider.
1321
+ */
1322
+ selectSubject(target: string, options?: SelectionCommandOptions & {
1323
+ maxSegments?: number;
1324
+ signal?: AbortSignal;
1325
+ }): Promise<{
1326
+ segments: {
1327
+ label: string;
1328
+ bounds: CropBox | null;
1329
+ score?: number;
1330
+ }[];
1331
+ }>;
1307
1332
  /** Quick Mask view (tints the unselected area). View state: no undo step. */
1308
1333
  setQuickMask(on: boolean): void;
1309
1334
  private maskFromSelection;
@@ -6,6 +6,7 @@ import { type PixelBuffer, type SelectionChannel, type SelectionMask, type Selec
6
6
  import { type ShapeSelectionOptions } from './selection/shapes.js';
7
7
  import { type ColorRangeOptions, type ColorRangeSample, type MagicWandOptions } from './selection/wand.js';
8
8
  import { type SelectionModifyOp } from './selection/modify.js';
9
+ import { type SegmentationProvider } from './selection/segmentation.js';
9
10
  import { type RefineEdgeParams } from './selection/refine.js';
10
11
  import type { LayerMaskProps } from './selection/layer-mask.js';
11
12
  import type { AdjustmentLayerMask } from './types.js';
@@ -538,6 +539,8 @@ export declare class ImageEditorController {
538
539
  private viewKey;
539
540
  /** For `compositePixels` and mask evaluation (the renderer keeps its own for the viewport). */
540
541
  private compositor;
542
+ /** The segmentation provider behind `selectSubject` (see `setSegmentationProvider`). */
543
+ private segmentation;
541
544
  /** The effects provider slot (see `setEffectsProvider`). */
542
545
  readonly effects: EffectsSlot;
543
546
  /** Renders provider effects: effect smart filter results and effect layers. */
@@ -566,6 +569,10 @@ export declare class ImageEditorController {
566
569
  * or those drawn while a result was rendering, once it is in. A cache refresh: no undo step.
567
570
  */
568
571
  private refreshEffectSurfaces;
572
+ /** The registered segmentation provider, or `null` (then `selectSubject` is unavailable). */
573
+ get segmentationProvider(): SegmentationProvider | null;
574
+ /** Registers (or with `null` removes) the segmentation provider. Not an edit: no undo step. */
575
+ setSegmentationProvider(provider: SegmentationProvider | null): void;
569
576
  /** The registered effects provider, or `null`. */
570
577
  get effectsProvider(): EffectProvider | null;
571
578
  /** Registers (or with `null` removes) the effects provider. Not an edit: no undo step. */
@@ -1304,6 +1311,24 @@ export declare class ImageEditorController {
1304
1311
  threshold?: number;
1305
1312
  mode?: SelectionMode;
1306
1313
  }): Promise<SelectionMask | null>;
1314
+ /** A mask image (data URL / URL, or pixels as they are) as RGBA pixels. */
1315
+ private decodeMaskImage;
1316
+ /**
1317
+ * Select › Subject: asks the segmentation provider for the objects matching `target` ("the
1318
+ * dog", "the sky") in the flattened image and selects their shapes, combined with the
1319
+ * selection by `mode`, as one undo step. Returns what was found (labels and bounds in natural
1320
+ * pixels); an empty list leaves the selection as it was. Throws without a provider.
1321
+ */
1322
+ selectSubject(target: string, options?: SelectionCommandOptions & {
1323
+ maxSegments?: number;
1324
+ signal?: AbortSignal;
1325
+ }): Promise<{
1326
+ segments: {
1327
+ label: string;
1328
+ bounds: CropBox | null;
1329
+ score?: number;
1330
+ }[];
1331
+ }>;
1307
1332
  /** Quick Mask view (tints the unselected area). View state: no undo step. */
1308
1333
  setQuickMask(on: boolean): void;
1309
1334
  private maskFromSelection;