@pixerate/editor 0.97.0 → 0.99.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.
Files changed (52) hide show
  1. package/THIRD_PARTY_NOTICES.md +4 -2
  2. package/dist/animation-editor/index.cjs +55 -53
  3. package/dist/animation-editor/index.cjs.map +1 -1
  4. package/dist/animation-editor/index.d.cts +3 -2
  5. package/dist/animation-editor/index.d.ts +3 -2
  6. package/dist/animation-editor/index.js +11 -9
  7. package/dist/animation-editor/index.js.map +1 -1
  8. package/dist/chunk-DWGZUSES.cjs +694 -0
  9. package/dist/chunk-DWGZUSES.cjs.map +1 -0
  10. package/dist/chunk-GX332W2C.js +181 -0
  11. package/dist/chunk-GX332W2C.js.map +1 -0
  12. package/dist/{chunk-7MD7C6XQ.cjs → chunk-JF5PXN7W.cjs} +96 -744
  13. package/dist/chunk-JF5PXN7W.cjs.map +1 -0
  14. package/dist/chunk-KKREERP2.js +694 -0
  15. package/dist/chunk-KKREERP2.js.map +1 -0
  16. package/dist/chunk-MUUXNRU4.cjs +181 -0
  17. package/dist/chunk-MUUXNRU4.cjs.map +1 -0
  18. package/dist/{chunk-OEVSVA6V.js → chunk-WIR377F6.js} +788 -22
  19. package/dist/chunk-WIR377F6.js.map +1 -0
  20. package/dist/{chunk-4AB5BHYK.cjs → chunk-WT6ZAWJP.cjs} +788 -22
  21. package/dist/chunk-WT6ZAWJP.cjs.map +1 -0
  22. package/dist/{chunk-4JLB2USO.js → chunk-YGZNGDIT.js} +45 -693
  23. package/dist/chunk-YGZNGDIT.js.map +1 -0
  24. package/dist/image-editor/index.cjs +1798 -333
  25. package/dist/image-editor/index.cjs.map +1 -1
  26. package/dist/image-editor/index.d.cts +482 -6
  27. package/dist/image-editor/index.d.ts +482 -6
  28. package/dist/image-editor/index.js +1488 -23
  29. package/dist/image-editor/index.js.map +1 -1
  30. package/dist/raster/index.cjs +23 -2
  31. package/dist/raster/index.cjs.map +1 -1
  32. package/dist/raster/index.d.cts +98 -2
  33. package/dist/raster/index.d.ts +98 -2
  34. package/dist/raster/index.js +23 -2
  35. package/dist/{svg-ymShkNtu.d.cts → svg-C9r284x8.d.cts} +6 -9
  36. package/dist/{svg-Dh17jCyA.d.ts → svg-MVKBqwD4.d.ts} +6 -9
  37. package/dist/types-CwMPoRMU.d.cts +40 -0
  38. package/dist/types-CwMPoRMU.d.ts +40 -0
  39. package/dist/vector/index.cjs +490 -554
  40. package/dist/vector/index.cjs.map +1 -1
  41. package/dist/vector/index.d.cts +154 -292
  42. package/dist/vector/index.d.ts +154 -292
  43. package/dist/vector/index.js +91 -155
  44. package/dist/vector/index.js.map +1 -1
  45. package/dist/warp-B8rAguzs.d.ts +165 -0
  46. package/dist/warp-nYs2DPrx.d.cts +165 -0
  47. package/package.json +1 -1
  48. package/skills/pixerate-image-editor/SKILL.md +49 -3
  49. package/dist/chunk-4AB5BHYK.cjs.map +0 -1
  50. package/dist/chunk-4JLB2USO.js.map +0 -1
  51. package/dist/chunk-7MD7C6XQ.cjs.map +0 -1
  52. package/dist/chunk-OEVSVA6V.js.map +0 -1
@@ -1,9 +1,13 @@
1
- import { RasterLayerBase, RasterMask as RasterMask$1, RasterPixelLayer, GroupBlendMode, LayerLocation as LayerLocation$1, LayerLocks, LayerEffect, GlobalLight, LayerEffects, EffectPattern, RasterSources, RasterCompositor, CompositorOptions, LayerEffectKind } from '../raster/index.js';
2
- export { BevelContour, BevelEmbossEffect, BevelStyle, BevelTechnique, BevelTexture, ColorOverlayEffect, CompositeCallOptions, CompositeStats, ContourPoint, DEFAULT_GLOBAL_LIGHT, DIRECT_GAUSSIAN_MAX_SIGMA, DecodedPng, DropShadowEffect, EffectContour, EffectFill, EffectGradient, EffectPatternRef, EffectRect, GlowTechnique, GradientColorStop, GradientOpacityStop, GradientOverlayEffect, GradientStyle, InnerGlowEffect, InnerShadowEffect, LAYER_EFFECT_KINDS, LayerEffectError, MAX_EFFECT_REACH, OuterGlowEffect, PatternOverlayEffect, PatternPlacement, PatternTile, SatinEffect, StrokeEffect, StrokePosition, ZlibError, adler32, base64ToBytes, blendTile, builtinPattern, builtinPatternIds, bytesToBase64, changedTiles, curveLut, decodePng, defaultEffectGradient, defaultLayerEffect, deflate, deflateRaw, effectColorHex, effectReach, effectsFingerprint, effectsMargin, effectsScale, encodePng, findLayer, flattenLayers, gaussianBlur, hasActiveEffects, hashNoise, inflate, inflateRaw, insertLayer, isLayerEffectKind, isLayerLocked, isPng, layerEffectFields, layerEffectLabel, mapLayer, mergeLayerEffect, newEffectId, normalizeLayerEffects, parseDataUrl, parseEffectColor, pngDataUrl, renderLayerEffects, scaleLayerEffect, validateEffectGradient, validateLayerEffect, validateLayerEffects } from '../raster/index.js';
1
+ import { RasterLayerBase, RasterMask as RasterMask$1, RasterPixelLayer, GroupBlendMode, LayerLocation as LayerLocation$1, LayerLocks, LayerEffect, GlobalLight, LayerEffects, EffectPattern, RasterSources, RasterCompositor, CompositorOptions, LayerEffectKind, Interpolation } from '../raster/index.js';
2
+ export { BevelContour, BevelEmbossEffect, BevelStyle, BevelTechnique, BevelTexture, ColorOverlayEffect, CompositeCallOptions, CompositeStats, ContourPoint, DEFAULT_GLOBAL_LIGHT, DIRECT_GAUSSIAN_MAX_SIGMA, DecodedPng, DropShadowEffect, EffectContour, EffectFill, EffectGradient, EffectPatternRef, EffectRect, GlowTechnique, GradientColorStop, GradientOpacityStop, GradientOverlayEffect, GradientStyle, INTERPOLATIONS, InnerGlowEffect, InnerShadowEffect, LAYER_EFFECT_KINDS, LayerEffectError, MAX_EFFECT_REACH, MAX_TRANSFORM_PIXELS, OuterGlowEffect, PatternOverlayEffect, PatternPlacement, PatternTile, ResampleOptions, SatinEffect, StrokeEffect, StrokePosition, TransformTooLargeError, ZlibError, adler32, base64ToBytes, blendTile, builtinPattern, builtinPatternIds, bytesToBase64, changedTiles, compositeSurfaceOver, curveLut, decodePng, defaultEffectGradient, defaultLayerEffect, deflate, deflateRaw, effectColorHex, effectReach, effectsFingerprint, effectsMargin, effectsScale, encodePng, findLayer, flattenLayers, gaussianBlur, hasActiveEffects, hashNoise, inflate, inflateRaw, insertLayer, isInterpolation, isLayerEffectKind, isLayerLocked, isPng, keysWeight, layerEffectFields, layerEffectLabel, mapLayer, mergeLayerEffect, newEffectId, normalizeLayerEffects, parseDataUrl, parseEffectColor, pngDataUrl, reduceSurface, renderLayerEffects, scaleLayerEffect, transformSurface, transformedBounds, validateEffectGradient, validateLayerEffect, validateLayerEffects, warpSurface } from '../raster/index.js';
3
3
  import { P as PixelSurface, T as TiledSurface, B as BlendMode } from '../surface-DIA-XatS.js';
4
4
  export { a as BLEND_MODES, b as BlendModeInfo, M as MaskSurface, R as RasterRect, c as Rgb, d as Rgba, S as SurfaceDraft, e as TILE, f as TILE_SHIFT, g as Tile, h as TileKey, i as blendChannel, j as blendImageData, k as blendLum, l as blendPixel, m as blendRgb, n as canvasCompositeOperation, o as collectTiles, p as contentBounds, q as emptySurface, r as fillRect, s as finishTile, t as isBlendMode, u as isSeparableBlendMode, v as mixPigment8, w as mixPigmentRgb, x as normalizeBlendMode, y as packRgba, z as readPixel, A as readRegion, C as setLum, D as solidSurface, E as surfaceBytes, F as surfaceFromPixels, G as surfacesEqual, H as tileCoord, I as tileKey, J as tileRect, K as tilesInRect, L as translateSurface, N as uniformTile, O as writeRegion } from '../surface-DIA-XatS.js';
5
5
  import { BrushSettings, MixerSettings, MixerLoad, StrokeCoverage, MixerTarget, MixerStroke, StrokeApply, StrokePoint } from '../paint/index.js';
6
6
  export { CoverageMap, DEFAULT_BRUSH, DEFAULT_MIXER, Dab, DabWalker, EMPTY_MIXER_LOAD, MAX_BRUSH_SIZE, MIXER_DRAIN, MIXER_PICKUP_RATE, MIXING_MODELS, MixingModel, PIGMENT_BANDS, PIGMENT_LAMBDA_MIN, PIGMENT_LAMBDA_STEP, PIGMENT_WAVELENGTHS, Pigment, PigmentOptions, PigmentRgb, applyStrokeToTile, cleanMixer, coverageTileCoord, createPigment, createPigmentTools, dabCoverage, dabRect, lerpPigment, lerpPigmentInto, loadMixer, mixPigments, normalizeBrush, normalizeMixer, rasterizeDab, reflectanceToRgb, rgbToReflectance, setPigmentColor, smoothPoints, tipFalloff, tipReach, tipShape, walkDabs } from '../paint/index.js';
7
+ import { Q as Quad, a as WarpMesh, V as Vec2, A as AffineMatrix, H as Homography } from '../types-CwMPoRMU.js';
8
+ export { W as WarpStyle } from '../types-CwMPoRMU.js';
9
+ import { b as WarpPreset } from '../warp-B8rAguzs.js';
10
+ export { W as WARP_STYLES, a as WARP_STYLE_LABELS, c as applyHomography, B as boxQuad, d as dragWarpMeshPoint, e as evalWarpMesh, C as homographyFromAffine, l as homographyFromPoints, q as identityWarpMesh, D as invertHomography, p as pullWarpMesh, E as rectToQuad, h as resizeWarpMesh, u as warpMeshEditPoints, v as warpMeshGridCurves, x as warpMeshParamAt, A as warpPresetMesh } from '../warp-B8rAguzs.js';
7
11
  import { b as LoadReport, J as JsonObject, f as MigrationStep } from '../migrate-iTlm3a8h.js';
8
12
  import { a as AgentToolProvider, A as AgentTool } from '../registry-D-4fit9C.js';
9
13
  import { b as CaptureSurface } from '../capture-wwNGaW05.js';
@@ -213,6 +217,8 @@ interface SerializedRasterMask {
213
217
  density?: number;
214
218
  feather?: number;
215
219
  enabled?: boolean;
220
+ /** `false`: unlinked from the layer's pixels. */
221
+ linked?: boolean;
216
222
  source?: DepthMaskOptions;
217
223
  }
218
224
  interface SerializedLayerBase {
@@ -466,6 +472,12 @@ interface RenderOptions {
466
472
  y: number;
467
473
  diameter: number;
468
474
  } | null;
475
+ /** Free Transform's frame, handles and reference point in natural pixels (`FreeTransformTool.overlay()`). */
476
+ freeTransform?: {
477
+ outline: ImagePoint[];
478
+ handles: ImagePoint[];
479
+ reference: ImagePoint;
480
+ } | null;
469
481
  }
470
482
  /**
471
483
  * Image Cache to avoid refetching HTMLImageElement objects repeatedly during re-renders.
@@ -924,6 +936,11 @@ interface LayerMaskProps {
924
936
  feather?: number;
925
937
  /** Disabled masks are kept but ignored (the layer applies everywhere). Default true. */
926
938
  enabled?: boolean;
939
+ /**
940
+ * Layer masks only: `false` unlinks the mask, so moving or transforming the layer's pixels leaves
941
+ * it in place. Default true. Adjustment-layer masks in canvas space ignore it.
942
+ */
943
+ linked?: boolean;
927
944
  }
928
945
  /**
929
946
  * A clean layer mask from stored data, or `null` when it is unusable. Defaults are left out
@@ -1018,7 +1035,7 @@ declare function ungroupLayer(layers: readonly ImageLayer[], id: string): {
1018
1035
  layers: ImageLayer[];
1019
1036
  ids: string[];
1020
1037
  };
1021
- /** Sets a pixel layer's offset (refused when its position is locked). */
1038
+ /** Sets a pixel layer's offset (refused when its position is locked). An unlinked mask stays in place. */
1022
1039
  declare function offsetLayer(layers: readonly ImageLayer[], id: string, offset: {
1023
1040
  x: number;
1024
1041
  y: number;
@@ -1206,6 +1223,252 @@ declare function psdToLayers(file: PsdFile, options?: PsdImportOptions): PsdImpo
1206
1223
  /** Parses and maps PSD / PSB bytes. Throws `PsdError` for files that cannot be read at all. */
1207
1224
  declare function importPsd(bytes: Uint8Array, options?: PsdImportOptions): PsdImportResult;
1208
1225
 
1226
+ /**
1227
+ * Free Transform geometry for the image editor, as pure functions both the UI bindings and the
1228
+ * agent tools use: a transform is the frame being transformed (`box`, document pixels), where its
1229
+ * four corners land (`corners`, TL, TR, BR, BL) and an optional warp mesh over the box. Scale,
1230
+ * rotate, skew and flips keep the corners a parallelogram (an affine map); Distort and Perspective
1231
+ * move them freely (a projective map); Warp bends the box through a Bézier mesh before the corner
1232
+ * map.
1233
+ *
1234
+ * The maths (homographies, meshes, presets) is shared with the vector editor in `src/geom`.
1235
+ */
1236
+
1237
+ /** Free Transform modes (Edit › Transform). Scale, rotate and skew stay affine. */
1238
+ type FreeTransformMode = 'scale' | 'rotate' | 'skew' | 'distort' | 'perspective' | 'warp';
1239
+ declare const FREE_TRANSFORM_MODES: readonly FreeTransformMode[];
1240
+ /** The nine reference-point positions of the options bar's locator, over the transformed box. */
1241
+ type TransformAnchor = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
1242
+ declare const TRANSFORM_ANCHORS: readonly TransformAnchor[];
1243
+ declare function isTransformAnchor(value: unknown): value is TransformAnchor;
1244
+ /** A transform in progress: the frame, where its corners go and an optional warp over the frame. */
1245
+ interface FreeTransformGeometry {
1246
+ /** The frame being transformed, in document pixels (the content bounds when it began). */
1247
+ box: CropBox;
1248
+ /** Where the frame's corners land: top-left, top-right, bottom-right, bottom-left (document pixels). */
1249
+ corners: Quad;
1250
+ /**
1251
+ * A warp applied in the frame's own space before the corner map: its control points are in
1252
+ * document pixels of the untransformed frame (`identityWarpMesh(box)` is no warp).
1253
+ */
1254
+ warp?: WarpMesh | null;
1255
+ }
1256
+ /** The untransformed geometry of a box. */
1257
+ declare function identityTransform(box: CropBox): FreeTransformGeometry;
1258
+ /** Where `box`'s corners go under the affine `m`. */
1259
+ declare function cornersFromMatrix(box: CropBox, m: AffineMatrix): Quad;
1260
+ /** The affine matrix taking `box` onto `corners` when they form a parallelogram, else `null`. */
1261
+ declare function matrixFromCorners(box: CropBox, corners: Quad, eps?: number): AffineMatrix | null;
1262
+ /** The projective map of the corner move (box → corners), or `null` when the corners are degenerate. */
1263
+ declare function transformHomography(geometry: FreeTransformGeometry): Homography | null;
1264
+ /** Whether a warp mesh changes anything (not the identity over the box). */
1265
+ declare function hasWarp(geometry: FreeTransformGeometry): boolean;
1266
+ /** Whether the geometry changes nothing. */
1267
+ declare function isIdentityTransform(geometry: FreeTransformGeometry): boolean;
1268
+ /**
1269
+ * The forward map of the whole transform (document pixels of the source → document pixels of the
1270
+ * result): the warp over the box, then the corner map. `null` where it is undefined.
1271
+ */
1272
+ declare function transformMap(geometry: FreeTransformGeometry): ((p: Vec2) => Vec2 | null) | null;
1273
+ /** A point of the transformed box at box fractions (`fx`, `fy`), warp included. */
1274
+ declare function transformedPoint(geometry: FreeTransformGeometry, fx: number, fy: number): Vec2 | null;
1275
+ /** Where an anchor of the box is after the corner map (the warp ignored). */
1276
+ declare function anchorPoint(geometry: FreeTransformGeometry, anchor: TransformAnchor): Vec2;
1277
+ /** Bounds of the transformed result's outline (document pixels, not rounded). */
1278
+ declare function transformedBox(geometry: FreeTransformGeometry): CropBox | null;
1279
+ /** Free Transform as numbers, as Photoshop's options bar shows it. */
1280
+ interface TransformParams {
1281
+ /** Width in percent of the frame (default 100; negative flips). */
1282
+ scaleX?: number;
1283
+ /** Height in percent of the frame (default 100; negative flips). */
1284
+ scaleY?: number;
1285
+ /** Rotation in degrees, clockwise (default 0). */
1286
+ rotate?: number;
1287
+ /** Horizontal skew in degrees: vertical edges lean right for positive angles (default 0). */
1288
+ skewX?: number;
1289
+ /** Vertical skew in degrees: horizontal edges lean down for positive angles (default 0). */
1290
+ skewY?: number;
1291
+ /** Move after scaling and rotating, in document pixels (default 0). */
1292
+ dx?: number;
1293
+ dy?: number;
1294
+ /** The fixed point of scale, skew and rotation: an anchor of the frame or a document point (default the centre). */
1295
+ reference?: TransformAnchor | Vec2;
1296
+ }
1297
+ /** The reference point of params over a box (default its centre). */
1298
+ declare function referencePoint(box: CropBox, reference: TransformParams['reference']): Vec2;
1299
+ /**
1300
+ * The affine matrix of `params` over `box`: about the reference point, skew, then scale, then
1301
+ * rotate; then the move.
1302
+ */
1303
+ declare function matrixFromParams(box: CropBox, params: TransformParams): AffineMatrix;
1304
+ /** What the options bar shows for a transform. */
1305
+ interface TransformReadout {
1306
+ /** False for Distort, Perspective and Warp: only `bounds` and `corners` then mean anything. */
1307
+ affine: boolean;
1308
+ /** Width and height in percent of the frame. */
1309
+ scaleX: number;
1310
+ scaleY: number;
1311
+ /** Rotation in degrees, clockwise, in (−180, 180]. */
1312
+ rotate: number;
1313
+ /** Horizontal skew in degrees (vertical skew is folded into rotation and scale). */
1314
+ skewX: number;
1315
+ /** Where the reference point is now (document pixels). */
1316
+ x: number;
1317
+ y: number;
1318
+ /** Bounds of the transformed outline. */
1319
+ bounds: CropBox | null;
1320
+ corners: Quad;
1321
+ }
1322
+ /**
1323
+ * Decomposes a transform for the options bar: the linear part as rotate · scale · skew (QR) with
1324
+ * the given reference point. Non-affine geometry reports its bounds and corners only.
1325
+ */
1326
+ declare function describeTransform(geometry: FreeTransformGeometry, reference?: TransformParams['reference']): TransformReadout;
1327
+ /**
1328
+ * Corners for a transform given as numbers relative to the current corners: `params` are applied
1329
+ * after the current affine part (when the corners are a parallelogram) about the reference point
1330
+ * of the current geometry, so typing "rotate 15" rotates the box as it is now.
1331
+ */
1332
+ declare function applyParams(geometry: FreeTransformGeometry, params: TransformParams): Quad;
1333
+ /** Flip of the corners about the box's centre line (horizontal: left ↔ right). */
1334
+ declare function flipCorners(geometry: FreeTransformGeometry, axis: 'horizontal' | 'vertical'): Quad;
1335
+ /** Inverse of `matrixFromCorners` (box space → document) for mapping a document point back into the box. */
1336
+ declare function boxPointOf(geometry: FreeTransformGeometry, p: Vec2): Vec2 | null;
1337
+ /** A warp mesh from a preset over the box (null when it changes nothing). */
1338
+ declare function presetWarp(box: CropBox, preset: WarpPreset): WarpMesh | null;
1339
+ /** Validates a warp mesh for a box: well formed, finite, the right number of points. */
1340
+ declare function isValidWarp(mesh: unknown): mesh is WarpMesh;
1341
+ /** The geometry's affine map when it is one (no warp, a parallelogram), as a homography; else the projective map. */
1342
+ declare function geometryHomography(geometry: FreeTransformGeometry): Homography | null;
1343
+
1344
+ /**
1345
+ * Free Transform sessions: what a transform moves (a layer's pixels with its linked mask, a lone
1346
+ * unlinked mask, the selected pixels as a floating piece, a copy of them on a new layer, or just
1347
+ * the selection outline), a live preview while the geometry changes, and one undo step when it is
1348
+ * committed with full-quality resampling.
1349
+ */
1350
+
1351
+ /**
1352
+ * What a Free Transform moves:
1353
+ * - `layer`: the layer's pixels with its linked mask (or, with `channel: 'mask'` on an unlinked
1354
+ * mask, the mask alone);
1355
+ * - `selection`: the selected pixels (and the same part of a linked mask), lifted and committed
1356
+ * back into the layer; the selection outline moves with them;
1357
+ * - `selection-copy`: Layer via Copy, then the copy is transformed on a new layer above;
1358
+ * - `selection-outline`: Transform Selection, only the outline;
1359
+ * - `auto` (default): `selection` when something is selected, else `layer`.
1360
+ */
1361
+ type FreeTransformContent = 'auto' | 'layer' | 'selection' | 'selection-copy' | 'selection-outline';
1362
+ declare const FREE_TRANSFORM_CONTENTS: readonly FreeTransformContent[];
1363
+ interface FreeTransformInit {
1364
+ /** The layer (default the active one); not needed for `selection-outline`. */
1365
+ layerId?: string;
1366
+ content?: FreeTransformContent;
1367
+ /**
1368
+ * `pixels` (default) moves the pixels with a linked mask; `mask` moves an unlinked mask alone (a
1369
+ * linked one moves with its pixels). Defaults to the active target on the active layer.
1370
+ */
1371
+ channel?: LayerTarget;
1372
+ /** Resampling of the committed result (default bicubic). */
1373
+ interpolation?: Interpolation;
1374
+ }
1375
+ /** How a live preview is drawn (the UI knows these, the controller doesn't). */
1376
+ interface FreeTransformPreview {
1377
+ /** Screen pixels per document pixel: below 1 the preview samples a reduced copy in blocks. */
1378
+ scale?: number;
1379
+ /** Only this part of the document (the visible area) is resampled. */
1380
+ clip?: CropBox;
1381
+ }
1382
+ /** What a committed transform changed. */
1383
+ interface FreeTransformResult {
1384
+ /** The layer that holds the result (the new layer for `selection-copy`; `null` for `selection-outline`). */
1385
+ layerId: string | null;
1386
+ content: Exclude<FreeTransformContent, 'auto'>;
1387
+ /** What moved. */
1388
+ moved: Array<'pixels' | 'mask' | 'selection'>;
1389
+ /** The frame the transform started from (document pixels). */
1390
+ box: CropBox;
1391
+ /** Where the frame's corners went. */
1392
+ corners: FreeTransformGeometry['corners'];
1393
+ /** Document bounds of the moved content after the transform (pixels, or the mask or the outline). */
1394
+ bounds: CropBox | null;
1395
+ /** False when the geometry was the identity and nothing was recorded. */
1396
+ changed: boolean;
1397
+ }
1398
+ /** @internal What the session needs from the controller. */
1399
+ interface FreeTransformHost {
1400
+ layers(): ImageLayer[];
1401
+ activeLayerId(): string | null;
1402
+ activeTarget(): LayerTarget;
1403
+ selection(): SelectionMask | null;
1404
+ canvas(): {
1405
+ width: number;
1406
+ height: number;
1407
+ };
1408
+ /** The pixels a pixel layer composites (the decoded source for the Background). */
1409
+ pixelsOf(layer: PixelLayer): TiledSurface;
1410
+ /** Opaque pre-transform snapshot. */
1411
+ capture(): unknown;
1412
+ /** Shows a live state (no history). */
1413
+ show(layers: ImageLayer[], selection: SelectionMask | null, activeLayerId: string | null): void;
1414
+ /** Records `before` as the undo step of the state now shown. */
1415
+ record(before: unknown): void;
1416
+ /** Puts `before` back (no history). */
1417
+ restore(before: unknown): void;
1418
+ }
1419
+ /** Preview block size for a screen scale: 1 at 100 % and above, then powers of two up to 8. */
1420
+ declare function previewStep(scale: number | undefined): number;
1421
+ /**
1422
+ * A Free Transform in progress (see `ImageEditorController.beginFreeTransform`). Change the
1423
+ * geometry with `update` (each change shows a live preview without history), then `commit()`
1424
+ * (one undo step, resampled at full quality) or `cancel()` (everything back as it was).
1425
+ */
1426
+ declare class FreeTransformSession {
1427
+ private readonly host;
1428
+ readonly content: Exclude<FreeTransformContent, 'auto'>;
1429
+ /** The layer being transformed (`null` for `selection-outline`). */
1430
+ readonly layerId: string | null;
1431
+ /** The new layer of a `selection-copy`. */
1432
+ readonly copyId: string | null;
1433
+ /** The frame (document pixels). */
1434
+ readonly box: CropBox;
1435
+ /** What moves. */
1436
+ readonly moves: ReadonlyArray<'pixels' | 'mask' | 'selection'>;
1437
+ private geometryValue;
1438
+ private interp;
1439
+ private readonly parts;
1440
+ private readonly before;
1441
+ private readonly startLayers;
1442
+ private readonly startSelection;
1443
+ private readonly startActive;
1444
+ /** The stack this session last showed: anything else means the document changed under it. */
1445
+ private shown;
1446
+ private closed;
1447
+ constructor(host: FreeTransformHost, init?: FreeTransformInit);
1448
+ /** The current geometry. */
1449
+ get geometry(): FreeTransformGeometry;
1450
+ get interpolation(): Interpolation;
1451
+ get isOpen(): boolean;
1452
+ private check;
1453
+ /**
1454
+ * Changes the geometry (`corners`, `warp`) or the interpolation and, unless `preview` is `false`,
1455
+ * shows the result live (no history). Returns the geometry.
1456
+ */
1457
+ update(changes: {
1458
+ corners?: FreeTransformGeometry['corners'];
1459
+ warp?: FreeTransformGeometry['warp'];
1460
+ interpolation?: Interpolation;
1461
+ }, preview?: FreeTransformPreview | false): FreeTransformGeometry;
1462
+ /** Resamples every part for the current geometry and shows it (or returns it, for commit). */
1463
+ private resample;
1464
+ private render;
1465
+ /** Finishes the transform with full-quality resampling, as one undo step. */
1466
+ commit(): FreeTransformResult;
1467
+ /** Abandons the transform and puts everything back (no history). */
1468
+ cancel(): void;
1469
+ private result;
1470
+ }
1471
+
1209
1472
  /** Latest serialized schema version (`3`: layers). Documents with the old shape still write 1 or 2. */
1210
1473
  declare const IMAGE_EDITOR_SCHEMA_VERSION: 3;
1211
1474
  /** Changes to an adjustment layer; `params` is merged into the current parameters. */
@@ -1586,7 +1849,7 @@ declare class ImageEditorController {
1586
1849
  addLayerMask(id: string, from?: 'reveal-all' | 'hide-all' | 'selection', props?: LayerMaskProps): RasterMask;
1587
1850
  /** Removes a layer's mask (one undo step). */
1588
1851
  removeLayerMask(id: string): void;
1589
- /** Changes any layer mask's density, feather or enabled flag (pixels kept). Returns the mask. */
1852
+ /** Changes any layer mask's density, feather, enabled or linked flag (pixels kept). Returns the mask. */
1590
1853
  setLayerMaskProps(id: string, props: LayerMaskProps, commitToHistory?: boolean): RasterMask;
1591
1854
  /**
1592
1855
  * Bakes a pixel layer's mask into its pixels (alpha × coverage, including density, feather or
@@ -1602,6 +1865,37 @@ declare class ImageEditorController {
1602
1865
  cut?: boolean;
1603
1866
  name?: string;
1604
1867
  }): string;
1868
+ private openTransform;
1869
+ /** The Free Transform in progress (see `beginFreeTransform`), or `null`. */
1870
+ getFreeTransform(): FreeTransformSession | null;
1871
+ private transformHost;
1872
+ /**
1873
+ * Starts a Free Transform (Edit › Free Transform, Transform Selection, or a transform of a Layer
1874
+ * via Copy): of the layer's pixels with its linked mask, an unlinked mask alone, the selected
1875
+ * pixels or just the selection outline (see `FreeTransformInit`). Change the geometry with
1876
+ * `session.update` (live preview, no history), then `commit()` (one undo step) or `cancel()`.
1877
+ * Refused while another transform is open.
1878
+ */
1879
+ beginFreeTransform(init?: FreeTransformInit): FreeTransformSession;
1880
+ /**
1881
+ * Transforms in one step (agents, scripts): begins a Free Transform for `spec`, sets its corners
1882
+ * from exactly one of `matrix` (document-space affine), `corners` (where the frame's corners go:
1883
+ * distort / perspective) or `params` (scale, rotate, skew and move about a reference point), and
1884
+ * commits it as one undo step. Returns what changed and the new bounds.
1885
+ */
1886
+ transformLayer(spec: FreeTransformInit & {
1887
+ matrix?: AffineMatrix;
1888
+ corners?: Quad;
1889
+ params?: TransformParams;
1890
+ warp?: WarpMesh | WarpPreset | null;
1891
+ }): FreeTransformResult;
1892
+ /** Flips the layer (or its selected pixels, or the outline) about the frame's centre, exactly (one undo step). */
1893
+ flipLayer(axis: 'horizontal' | 'vertical', init?: FreeTransformInit): FreeTransformResult;
1894
+ /**
1895
+ * Rotates by a quarter turn (90 clockwise, −90 counter-clockwise) or 180 about the frame's
1896
+ * centre, snapped so pixels land on whole pixels: exact, no resampling (one undo step).
1897
+ */
1898
+ rotateLayer90(turn: 90 | -90 | 180, init?: FreeTransformInit): FreeTransformResult;
1605
1899
  /** Adds a `develop` or `blur` filter to a pixel layer (one undo step). Returns the layer's filters. */
1606
1900
  addLayerFilter(id: string, filter: Partial<LayerFilter> & {
1607
1901
  kind: LayerFilter['kind'];
@@ -2837,6 +3131,8 @@ interface ImageEditorToolProviderOptions {
2837
3131
  * - Layers, geometry and history: `get_image_info`, `get_histogram`, `update_adjustment_layer`,
2838
3132
  * `remove_adjustment_layer`, `move_adjustment_layer`, `set_crop`, `reset_crop`, `set_rotation`,
2839
3133
  * `flip_image`, `undo_image`, `redo_image` (see `createImageEditTools`).
3134
+ * - Free Transform: `get_transform_frame`, `transform_layer`, `warp_layer`, `transform_selection`,
3135
+ * `flip_layer`, `rotate_layer_90` (see `createImageTransformTools`).
2840
3136
  */
2841
3137
  declare function createImageEditorToolProvider(controller: ImageEditorController, options?: ImageEditorToolProviderOptions): AgentToolProvider;
2842
3138
 
@@ -2993,6 +3289,15 @@ declare function describeLayer(layer: ImageLayer, activeId: string | null, bound
2993
3289
  */
2994
3290
  declare function createImageLayerTools(controller: ImageEditorController): AgentTool[];
2995
3291
 
3292
+ /**
3293
+ * Agent tools for Free Transform in the image editor: `get_transform_frame`, `transform_layer`
3294
+ * (scale, rotate, skew and move as numbers, a matrix, or distort / perspective corners),
3295
+ * `warp_layer` (a preset or a Bézier mesh), `transform_selection` (the outline only),
3296
+ * `flip_layer` and `rotate_layer_90`. Every write is one undo step, resamples tile by tile and
3297
+ * returns the new bounds.
3298
+ */
3299
+ declare function createImageTransformTools(controller: ImageEditorController): AgentTool[];
3300
+
2996
3301
  /** A layer's effects for agents: the master switch, scale, reach and every effect with its settings. */
2997
3302
  declare function describeLayerEffects(effects: LayerEffects): Record<string, unknown>;
2998
3303
  /**
@@ -3237,7 +3542,7 @@ type DropZone = 'above' | 'below' | 'inside';
3237
3542
  declare function dropZone(fraction: number, isGroup: boolean): DropZone;
3238
3543
  /** The placement for `move_layer` when `dragId` is dropped on row `targetId` in `zone`, or `null` for a no-op. */
3239
3544
  declare function dropPlacement(layers: readonly ImageLayer[], dragId: string, targetId: string, zone: DropZone): LayerPlacement | null;
3240
- type LayerMenuAction = 'new-layer' | 'new-group' | 'duplicate' | 'delete' | 'group-selected' | 'ungroup' | 'merge-down' | 'merge-visible' | 'flatten' | 'via-copy' | 'via-cut' | 'add-mask' | 'add-mask-selection' | 'apply-mask' | 'delete-mask' | 'toggle-mask' | 'toggle-clip' | 'rasterize';
3545
+ type LayerMenuAction = 'new-layer' | 'new-group' | 'duplicate' | 'delete' | 'group-selected' | 'ungroup' | 'merge-down' | 'merge-visible' | 'flatten' | 'via-copy' | 'via-cut' | 'add-mask' | 'add-mask-selection' | 'apply-mask' | 'delete-mask' | 'toggle-mask' | 'toggle-mask-link' | 'toggle-clip' | 'rasterize';
3241
3546
  interface LayerMenuItem {
3242
3547
  action: LayerMenuAction;
3243
3548
  label: string;
@@ -3657,4 +3962,175 @@ declare function psdBytesFromBase64(data: unknown): Uint8Array;
3657
3962
  */
3658
3963
  declare function createImagePsdTools(controller: ImageEditorController): AgentTool[];
3659
3964
 
3660
- export { ADJUSTMENT_KEYS, ADJUSTMENT_KINDS, ADJUSTMENT_LAYER_CONTROLS, ADJUSTMENT_LAYER_OPACITY_CONTROL, ADJUSTMENT_LUT_SIZE, type AIResultOptions, AS_SHOT_KELVIN, type AdjustmentKind, type AdjustmentKindInfo, type AdjustmentLayer, type AdjustmentLayerBase, type AdjustmentLayerInit, type AdjustmentLayerMask, type AdjustmentLayerNode, type AdjustmentLayerOf, type AdjustmentLayerUpdate, type AdjustmentParamsMap, type Annotation, type AnnotationLayer, type AnnotationPlacement, type AnnotationType, type ArrowAnnotation, type AspectRatio, BACKGROUND_LAYER_ID, BACKGROUND_LAYER_NAME, BLUR_FILTER_ID, BRUSH_OPTION_CONTROLS, type BaseAnnotation, type BlackWhiteParams, BlendMode, type BlurFilter, BrushSettings, type Chromaticity, type CircleAnnotation, type ColorBalanceParams, type ColorBalanceTone, type ColorDistance, type ColorRangeOptions, type ColorRangeSample, CompositorOptions, type CompositorSources, type ControlSection, type ControlSpec, type ControlTrack, type CreateAnnotationPayload, type CropBox, type CropHandle, type CurvePoint, type CurvesParams, D50, D65, DEFAULT_ADJUSTMENTS, DEFAULT_DEPTH_MASK, DEFAULT_REFINE_EDGE_PARAMS, DEFAULT_SELECTION_TOOL_OPTIONS, DEFAULT_TRANSFORM, DEVELOP_FILTER_ID, type DepthMaskOptions, type DescValue, type Descriptor, type DeserializeContext, type DevelopFilter, type DevelopSettings, type DropZone, EMPTY_DISTANCE, type EffectControl, EffectPattern, type ExportOptions, type FillOptions, GUIDED_FILTER_EPS, type GestureModifiers, GlobalLight, type GroupLayer, HISTOGRAM_BINS, HUE_RANGE_LABELS, type HistogramChannel, type HistoryEntryHandle, type HueRange, type HueSaturationParams, IDENTITY_MATRIX3, IMAGE_ADJUSTMENT_CONTROLS, IMAGE_EDITOR_SCHEMA_VERSION, IMAGE_EDITOR_STATE_VERSION, type ImageAdjustments, type ImageAnnotation, type ImageDimensions, type ImageEditorAIHooks, type ImageEditorAssetStore, ImageEditorController, type ImageEditorDocumentLoad, type ImageEditorFit, type ImageEditorOptions, ImageEditorRenderer, type ImageEditorState, type ImageEditorTool, type ImageEditorToolProviderOptions, type ImageHistogram, type ImageLayer, type ImageLayerType, type ImagePoint, type ImageProcessVersion, type ImageProjection, type ImageTransform, type InpaintHook, type InpaintOptions, type InvertParams, LATEST_PROCESS_VERSION, LAYERED_SCHEMA_VERSION, LAYER_EFFECT_MENU, LEGACY_PROCESS_VERSION, LUMA_709, type LayerBase, type LayerBlendMode, LayerCompositor, LayerEffect, LayerEffectKind, type LayerEffectRow, LayerEffects, type LayerEffectsPanelModel, type LayerFilter, type LayerFilterKind, type LayerLocation, LayerLocks, type LayerMaskProps, type LayerMenuAction, type LayerMenuItem, LayerOperationError, type LayerPanelRow, type LayerPlacement, type LayerProperties, type LayerSourcesHost, type LayerStack, type LayerTarget, type LegacyParts, type LegacySerializedImageEditorState, type LegacyViewResult, type LevelsChannel, type LevelsParams, type LineAnnotation, MAX_KELVIN, MIN_KELVIN, MIRED_PER_TEMPERATURE_UNIT, MIXER_MIXING_OPTIONS, MIXER_OPTION_CONTROLS, type MagicWandOptions, type Matrix3, MixerLoad, MixerSettings, MixerStroke, type MixerStrokeInit, MixerTarget, type MosaicImageDataLike, type MosaicRegion, PAINT_TOOLS, PATTERN_BLOCK_KEYS, PSD_BLEND_KEYS, PSD_FILE_ACCEPT, PaintGesture, type PaintOptions, type PaintPointerSample, type PaintStrokeResult, PaintStrokeSession, type PaintTool, type ParsedAdjustment, type ParsedLayerEffects, type PenAnnotation, type PhotoFilterParams, type PixelBuffer, type PixelLayer, type PixelLayerInit, type PixelOp, PixelSurface, type PlaneLayout, type PosterizeParams, type PsdChannel, PsdError, type PsdExportInput, type PsdExportResult, type PsdFile, type PsdHeader, type PsdImportOptions, type PsdImportResult, type PsdLayerMask, type PsdLayerRecord, type PsdLayerSummary, type PsdPattern, type PsdRect, type PsdResource, type PsdTaggedBlock, type PsdTreeNode, type QuickMaskStyle, REFINE_EDGE_CONTROLS, type RasterMask, type RectAnnotation, type ReferenceItem, type RefineEdgeControl, type RefineEdgeParams, type RemoveBackgroundHook, type RemoveBackgroundOptions, type RenderOptions, type RouteInput, SELECTION_MODES, SELECTION_MODE_LABELS, SELECTION_MODIFY_OPS, SELECTION_TOOLS, SUPPORTED_ADJUSTMENT_KEYS, type SampleOptions, type SelectionChannel, type SelectionCommandOptions, SelectionGesture, type SelectionMask, type SelectionMode, type SelectionModifyOp, type SelectionToolKind, type SelectionToolOptions, type SerializeContext, type SerializedAdjustmentLayer, type SerializedAnnotationLayer, type SerializedGroupLayer, type SerializedImageEditorState, type SerializedLayer, type SerializedLayerEffects, type SerializedLayeredImageEditorState, type SerializedPattern, type SerializedPixelLayer, type SerializedRasterMask, type SerializedSelection, type ShapeSelectionOptions, type ShortcutEvent, StrokeApply, StrokeCoverage, type StrokeInit, StrokePoint, type StrokeTool, TINT_SCALE, TONE_LUT_SIZE, TONE_RANGE_PRESETS, type TextAnnotation, type ThresholdParams, TiledSurface, type ToneRangePreset, type UnitLevels, VIBRANCE_GREY, type VibranceParams, type ViewportMetrics, XYZ_D50_TO_SRGB, activeAdjustmentLayers, addLayerEffect, addLayerFilter, addToHistogram, adjustmentKindLabel, adjustmentLayersKey, adjustmentNodeAsLayer, adjustmentNodeFromLegacy, annotationLayerFor, annotationLayerName, applyAdjustmentLayers, applyAdjustments, applyBoxBlur, applyDepthMask, applyImageProjectionToContext, applyLegacyAdjustments, applyMatrix3, applyOutputStage, applyProcess2Adjustments, applyRegionBlur, applyRegionMosaic, backgroundLayer, baseProjection, blackWhiteGray, blurFilter, borderCoverage, boxMean, boxToCurvePoint, bradfordAdaptation, buildLayerMaskPlanes, buildToneLut, calculateCropDrag, canvasToImagePoint, clampControlValue, clampCropToImage, colorBalanceChannel, colorRange, combineSelections, compileAdjustmentLayer, computeHistogram, computeSelectionBounds, contractCoverage, controlPosition, controlTrackBackground, coverageToByte, coveringRect, createAdjustmentLayer, createImageCaptureSurface, createImageEditTools, createImageEditorToolProvider, createImageEffectTools, createImageLayerTools, createImagePaintTools, createImagePsdTools, createImageSelectionTools, createSelectionMask, curveLutFromLevels, curvePointToBox, curveSvgPath, decodeLayerChannel, decodeLayerMask, decodeMergedImage, decodePlanes, decodePngDataUrl, decodeSelectionRle, defaultAdjustmentParams, depthMaskAlpha, depthRasterMask, describeLayer, describeLayerEffects, describeSelection, deserializeEffects, deserializeLayer, deserializeLayers, deserializePatterns, deserializeSelection, developFilter, developFromAdjustments, developTarget, distanceTransform, downloadPsd, dropPlacement, dropZone, duplicateLayer, edgeWidth, effectControlChange, ellipsePoints, ellipseSelection, emptyHistogram, encodeRle, encodeSelectionRle, encodeSurface, evaluateAdjustmentLayers, expandCoverage, exportPsd, featherCoverage, findAdjustmentControl, findLayerControl, formatControlValue, fullSelection, getAnnotationBounds, getControlPath, getCropCursor, getRotatedSize, getViewportMetrics, getViewportProjection, globalImageCache, greyMorphology, groupLayers, guidePlanes, guidedFilterColor, handlePaintShortcut, hasResampledLegacyMask, hashMaskContent, hexToRgb, histogramPath, hitTestAnnotation, hitTestCrop, hitTestCurvePoint, hslToRgb, hueRange, hueRangeTables, hueRangeWeight, hueSaturation, identityCurve, identityLevels, imageEditorStateMigrations, imageToCanvasPoint, importPsd, insertCurvePoint, invertMatrix3, invertSelection, isActiveFilter, isAdjustmentKind, isDefaultDepthMask, isLegacyShape, isPaintTool, isQuarterTurn, isQuarterTurnSwapped, isSelectionEmpty, isSelectionMode, isSpatialFilter, kelvinToTemperature, layerBadge, layerEffectControls, layerEffectsBadge, layerEffectsOf, layerEffectsPanel, layerLabel, layerMaskCoverage, layerMaskFromSelection, layerMaskKey, layerMenu, layerName, layerPanelRows, layerTree, layerTypeLabel, layersFromLegacy, legacyAdjustmentLayer, legacyMaskOf, legacyView, levelsValue, linearSrgbToXy, linearToSrgb, loadImageEditorDocument, magicWand, mapCropHandle, maskSummary, migrateSerializedImageEditorState, migrateToLayeredState, mixerLoadResult, modifySelection, moveCurvePoint, moveLayer, mulMatrix3, needsLegacyBase, neutralHueRange, newLayerId, normalizeAdjustmentLayer, normalizeAdjustmentLayers, normalizeAngle, normalizeFilter, normalizeLayerMask, normalizeProcessVersion, normalizeRect, normalizeRefineEdgeParams, normalizeStoredAdjustments, offsetLayer, openPsdFile, parseAdjustmentBlock, parseBlend, parseColor, parseLfx2, parseLrfx, parsePatternBlock, parseSelectionMode, parseVersionedDescriptor, photoFilterMatrix, pixelLayerBounds, pixelLayers, placeLayer, pointerPressure, polygonCoverage, polygonSelection, posterizeValue, projectImagePoint, projectImageRect, projectMaskCoverage, projectQuarterTurn, psdBytesFromBase64, psdFileName, psdPatternToEffectPattern, psdToLayers, quickMaskPixels, rangeLightness, rasterMaskFromLegacy, readAdjustmentControls, readPsd, rectSelection, refineCoverage, refineEdgeHalo, refineSelection, removeAlpha, removeCurvePoint, removeLayer, removeLayerEffect, removeLayerFilter, renderLayeredBase, requireLayer, requireUnlocked, resizePixels, resizeSelection, resolveExternalAssets, resolveMosaicRegionBounds, rgbToGray, rgbToHsl, rgbUnitToHex, runLayerMenuAction, sampleLut, sampleToneLut, selectionArea, selectionFromCoverage, selectionFromPixels, selectionModeFromModifiers, selectionOutline, selectionToCoverage, selectionToPixels, selectionValueAt, serializeEffects, serializeLayer, serializeLayers, serializeLayersExternal, serializePatterns, serializeSelection, setControlPath, setLayerEffects, setLayerEffectsEnabled, setLayerMask, setLayerProperties, shiftCoverage, smoothCoverage, splitOverlayAnnotations, srgb8ToLab, srgbToLinear, sumHistograms, tempTintToXy, temperatureToKelvin, toHex, toneCurve, toneLuts, toneRange, ungroupLayer, unionRect, unprojectCanvasPoint, updateLayerEffect, updateLayerFilter, updateLayerMaskProps, uvToXy, versionedDescriptorBytes, vibranceLinear, vibrancePixel, wbMatrix, whiteBalanceFromSample, whiteBalanceMatrix, withNewIds, writeAdjustmentBlock, writeLfx2, writePatternBlock, writePsd, xyToTempTint, xyToUv };
3965
+ /**
3966
+ * Free Transform's view model, shared by the React and Svelte editors: the overlay (outline,
3967
+ * eight handles, the reference point), what a pointer is over, Photoshop's drags and modifiers,
3968
+ * the options bar's readout and fields, and the keyboard (Enter commits, Esc cancels, arrows
3969
+ * nudge). It drives a `FreeTransformSession`; the bindings forward pointer and key events and draw
3970
+ * `overlay()` through the renderer's `freeTransform` option.
3971
+ *
3972
+ * Drags (as Photoshop CC, where a corner scales proportionally by default):
3973
+ * - corner: scale from the opposite corner (Alt: from the reference point); Shift toggles
3974
+ * proportional; side: scale one axis;
3975
+ * - Mod (Ctrl / Cmd) + corner: distort that corner; Mod + side: skew along the side (Alt: about
3976
+ * the centre); Mod + Alt + Shift + corner: perspective;
3977
+ * - outside the box: rotate about the reference point (Shift: 15° steps); inside: move (Shift:
3978
+ * along one axis); the reference point: move it;
3979
+ * - the mode switch (rotate, skew, distort, perspective) makes every handle do that.
3980
+ */
3981
+
3982
+ /** What a pointer is over. */
3983
+ type TransformHandle = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'reference' | 'inside' | 'outside';
3984
+ interface TransformModifiers {
3985
+ shiftKey?: boolean;
3986
+ altKey?: boolean;
3987
+ /** Ctrl or Cmd. */
3988
+ ctrlKey?: boolean;
3989
+ metaKey?: boolean;
3990
+ }
3991
+ /** The modes of the options bar's switch (Warp comes with its own mesh UI). */
3992
+ declare const FREE_TRANSFORM_MODE_OPTIONS: readonly {
3993
+ id: Exclude<FreeTransformMode, 'warp'>;
3994
+ label: string;
3995
+ title: string;
3996
+ }[];
3997
+ /** The options bar's numeric fields (Photoshop's X, Y, W, H, angle and skews). */
3998
+ declare const FREE_TRANSFORM_FIELDS: readonly [{
3999
+ readonly id: "x";
4000
+ readonly label: "X";
4001
+ readonly unit: "px";
4002
+ readonly title: "Reference point X (document pixels)";
4003
+ }, {
4004
+ readonly id: "y";
4005
+ readonly label: "Y";
4006
+ readonly unit: "px";
4007
+ readonly title: "Reference point Y (document pixels)";
4008
+ }, {
4009
+ readonly id: "scaleX";
4010
+ readonly label: "W";
4011
+ readonly unit: "%";
4012
+ readonly title: "Width in percent of the original";
4013
+ }, {
4014
+ readonly id: "scaleY";
4015
+ readonly label: "H";
4016
+ readonly unit: "%";
4017
+ readonly title: "Height in percent of the original";
4018
+ }, {
4019
+ readonly id: "rotate";
4020
+ readonly label: "∠";
4021
+ readonly unit: "°";
4022
+ readonly title: "Rotation in degrees, clockwise";
4023
+ }, {
4024
+ readonly id: "skewX";
4025
+ readonly label: "H skew";
4026
+ readonly unit: "°";
4027
+ readonly title: "Horizontal skew in degrees";
4028
+ }, {
4029
+ readonly id: "skewY";
4030
+ readonly label: "V skew";
4031
+ readonly unit: "°";
4032
+ readonly title: "Vertical skew in degrees";
4033
+ }];
4034
+ type FreeTransformField = (typeof FREE_TRANSFORM_FIELDS)[number]['id'];
4035
+ /** What the options bar shows. */
4036
+ interface FreeTransformBar extends Record<FreeTransformField, number> {
4037
+ /** False after Distort or Perspective: the numbers no longer describe the shape. */
4038
+ affine: boolean;
4039
+ }
4040
+ interface TransformOverlay {
4041
+ /** The transformed frame, corner to corner (document pixels). */
4042
+ outline: ImagePoint[];
4043
+ /** The eight handles. */
4044
+ handles: Array<{
4045
+ id: Exclude<TransformHandle, 'reference' | 'inside' | 'outside'>;
4046
+ x: number;
4047
+ y: number;
4048
+ }>;
4049
+ reference: ImagePoint;
4050
+ }
4051
+ interface FreeTransformToolOptions {
4052
+ /** Defers preview resampling to the next frame (pass `requestAnimationFrame`; default: at once). */
4053
+ schedule?: (run: () => void) => void;
4054
+ /** Called whenever the overlay, readout or error changes. */
4055
+ onChange?: () => void;
4056
+ }
4057
+ /**
4058
+ * The interactive Free Transform (see the module comment). `begin` opens a session on the
4059
+ * controller; pointer and key methods drive it; `commit` / `cancel` close it.
4060
+ */
4061
+ declare class FreeTransformTool {
4062
+ private readonly controller;
4063
+ private readonly options;
4064
+ private sessionRef;
4065
+ private modeValue;
4066
+ /** The reference point in the untransformed frame's space (follows the transform). */
4067
+ private refBox;
4068
+ private corners;
4069
+ private drag;
4070
+ private pending;
4071
+ private viewScale;
4072
+ private viewClip;
4073
+ /** Values typed into the options bar since the last drag (V skew is not recovered from the shape). */
4074
+ private typed;
4075
+ /** Width and height scale together when typed (the chain icon). */
4076
+ proportional: boolean;
4077
+ error: string | null;
4078
+ lastResult: FreeTransformResult | null;
4079
+ constructor(controller: ImageEditorController, options?: FreeTransformToolOptions);
4080
+ get active(): boolean;
4081
+ get session(): FreeTransformSession | null;
4082
+ get mode(): Exclude<FreeTransformMode, 'warp'>;
4083
+ get interpolation(): Interpolation;
4084
+ private readonly listeners;
4085
+ /** Calls `listener` whenever the overlay, readout, mode or error changes. Returns the unsubscribe. */
4086
+ subscribe(listener: () => void): () => void;
4087
+ private changed;
4088
+ /** Opens a Free Transform (default: the selected pixels of the active layer, or the whole layer). Returns an error message or `null`. */
4089
+ begin(init?: FreeTransformInit): string | null;
4090
+ setMode(mode: Exclude<FreeTransformMode, 'warp'>): void;
4091
+ /** Sets the reference point to an anchor of the frame (the options bar's locator). */
4092
+ setReference(anchor: TransformAnchor): void;
4093
+ setInterpolation(interpolation: Interpolation): void;
4094
+ /** Screen pixels per document pixel and the visible document area, for previews. */
4095
+ setView(scale: number, clip?: {
4096
+ x: number;
4097
+ y: number;
4098
+ width: number;
4099
+ height: number;
4100
+ }): void;
4101
+ private homography;
4102
+ /** The reference point in document pixels. */
4103
+ referencePoint(): Vec2 | null;
4104
+ /** The outline, handles and reference point to draw, or `null` when no transform is open. */
4105
+ overlay(): TransformOverlay | null;
4106
+ /** What a document point is over (`tolerance` in document pixels: a few screen pixels / scale). */
4107
+ hit(p: ImagePoint, tolerance: number): TransformHandle | null;
4108
+ /** The CSS cursor for a handle. */
4109
+ cursor(handle: TransformHandle | null): string;
4110
+ /** Starts a drag on what `p` is over. */
4111
+ down(p: ImagePoint, tolerance: number): TransformHandle | null;
4112
+ /** Continues the drag to `p` with the modifiers held now. */
4113
+ move(p: ImagePoint, m?: TransformModifiers): void;
4114
+ /** Ends the drag (the transform stays open). */
4115
+ up(): void;
4116
+ private dragCorners;
4117
+ /** Sets new corners and refreshes the preview (scheduled). Invalid shapes keep the last good one. */
4118
+ setCorners(corners: Quad): void;
4119
+ private preview;
4120
+ private run;
4121
+ /** The options bar's numbers for the current shape. */
4122
+ bar(): FreeTransformBar | null;
4123
+ /** Applies a typed options-bar value (W and H together while `proportional`). */
4124
+ setField(field: FreeTransformField, value: number): void;
4125
+ /** Finishes with full-quality resampling (one undo step). */
4126
+ commit(): FreeTransformResult | null;
4127
+ /** Abandons the transform and restores everything. */
4128
+ cancel(): void;
4129
+ /**
4130
+ * Keyboard: Enter commits, Escape cancels, arrows nudge by 1 px (Shift: 10). Ctrl/Cmd+T opens a
4131
+ * Free Transform when none is open. Returns true when the key was used (prevent its default).
4132
+ */
4133
+ key(e: ShortcutEvent): boolean;
4134
+ }
4135
+
4136
+ export { ADJUSTMENT_KEYS, ADJUSTMENT_KINDS, ADJUSTMENT_LAYER_CONTROLS, ADJUSTMENT_LAYER_OPACITY_CONTROL, ADJUSTMENT_LUT_SIZE, type AIResultOptions, AS_SHOT_KELVIN, type AdjustmentKind, type AdjustmentKindInfo, type AdjustmentLayer, type AdjustmentLayerBase, type AdjustmentLayerInit, type AdjustmentLayerMask, type AdjustmentLayerNode, type AdjustmentLayerOf, type AdjustmentLayerUpdate, type AdjustmentParamsMap, AffineMatrix, type Annotation, type AnnotationLayer, type AnnotationPlacement, type AnnotationType, type ArrowAnnotation, type AspectRatio, BACKGROUND_LAYER_ID, BACKGROUND_LAYER_NAME, BLUR_FILTER_ID, BRUSH_OPTION_CONTROLS, type BaseAnnotation, type BlackWhiteParams, BlendMode, type BlurFilter, BrushSettings, type Chromaticity, type CircleAnnotation, type ColorBalanceParams, type ColorBalanceTone, type ColorDistance, type ColorRangeOptions, type ColorRangeSample, CompositorOptions, type CompositorSources, type ControlSection, type ControlSpec, type ControlTrack, type CreateAnnotationPayload, type CropBox, type CropHandle, type CurvePoint, type CurvesParams, D50, D65, DEFAULT_ADJUSTMENTS, DEFAULT_DEPTH_MASK, DEFAULT_REFINE_EDGE_PARAMS, DEFAULT_SELECTION_TOOL_OPTIONS, DEFAULT_TRANSFORM, DEVELOP_FILTER_ID, type DepthMaskOptions, type DescValue, type Descriptor, type DeserializeContext, type DevelopFilter, type DevelopSettings, type DropZone, EMPTY_DISTANCE, type EffectControl, EffectPattern, type ExportOptions, FREE_TRANSFORM_CONTENTS, FREE_TRANSFORM_FIELDS, FREE_TRANSFORM_MODES, FREE_TRANSFORM_MODE_OPTIONS, type FillOptions, type FreeTransformBar, type FreeTransformContent, type FreeTransformField, type FreeTransformGeometry, type FreeTransformHost, type FreeTransformInit, type FreeTransformMode, type FreeTransformPreview, type FreeTransformResult, FreeTransformSession, FreeTransformTool, type FreeTransformToolOptions, GUIDED_FILTER_EPS, type GestureModifiers, GlobalLight, type GroupLayer, HISTOGRAM_BINS, HUE_RANGE_LABELS, type HistogramChannel, type HistoryEntryHandle, Homography, type HueRange, type HueSaturationParams, IDENTITY_MATRIX3, IMAGE_ADJUSTMENT_CONTROLS, IMAGE_EDITOR_SCHEMA_VERSION, IMAGE_EDITOR_STATE_VERSION, type ImageAdjustments, type ImageAnnotation, type ImageDimensions, type ImageEditorAIHooks, type ImageEditorAssetStore, ImageEditorController, type ImageEditorDocumentLoad, type ImageEditorFit, type ImageEditorOptions, ImageEditorRenderer, type ImageEditorState, type ImageEditorTool, type ImageEditorToolProviderOptions, type ImageHistogram, type ImageLayer, type ImageLayerType, type ImagePoint, type ImageProcessVersion, type ImageProjection, type ImageTransform, type InpaintHook, type InpaintOptions, Interpolation, type InvertParams, LATEST_PROCESS_VERSION, LAYERED_SCHEMA_VERSION, LAYER_EFFECT_MENU, LEGACY_PROCESS_VERSION, LUMA_709, type LayerBase, type LayerBlendMode, LayerCompositor, LayerEffect, LayerEffectKind, type LayerEffectRow, LayerEffects, type LayerEffectsPanelModel, type LayerFilter, type LayerFilterKind, type LayerLocation, LayerLocks, type LayerMaskProps, type LayerMenuAction, type LayerMenuItem, LayerOperationError, type LayerPanelRow, type LayerPlacement, type LayerProperties, type LayerSourcesHost, type LayerStack, type LayerTarget, type LegacyParts, type LegacySerializedImageEditorState, type LegacyViewResult, type LevelsChannel, type LevelsParams, type LineAnnotation, MAX_KELVIN, MIN_KELVIN, MIRED_PER_TEMPERATURE_UNIT, MIXER_MIXING_OPTIONS, MIXER_OPTION_CONTROLS, type MagicWandOptions, type Matrix3, MixerLoad, MixerSettings, MixerStroke, type MixerStrokeInit, MixerTarget, type MosaicImageDataLike, type MosaicRegion, PAINT_TOOLS, PATTERN_BLOCK_KEYS, PSD_BLEND_KEYS, PSD_FILE_ACCEPT, PaintGesture, type PaintOptions, type PaintPointerSample, type PaintStrokeResult, PaintStrokeSession, type PaintTool, type ParsedAdjustment, type ParsedLayerEffects, type PenAnnotation, type PhotoFilterParams, type PixelBuffer, type PixelLayer, type PixelLayerInit, type PixelOp, PixelSurface, type PlaneLayout, type PosterizeParams, type PsdChannel, PsdError, type PsdExportInput, type PsdExportResult, type PsdFile, type PsdHeader, type PsdImportOptions, type PsdImportResult, type PsdLayerMask, type PsdLayerRecord, type PsdLayerSummary, type PsdPattern, type PsdRect, type PsdResource, type PsdTaggedBlock, type PsdTreeNode, Quad, type QuickMaskStyle, REFINE_EDGE_CONTROLS, type RasterMask, type RectAnnotation, type ReferenceItem, type RefineEdgeControl, type RefineEdgeParams, type RemoveBackgroundHook, type RemoveBackgroundOptions, type RenderOptions, type RouteInput, SELECTION_MODES, SELECTION_MODE_LABELS, SELECTION_MODIFY_OPS, SELECTION_TOOLS, SUPPORTED_ADJUSTMENT_KEYS, type SampleOptions, type SelectionChannel, type SelectionCommandOptions, SelectionGesture, type SelectionMask, type SelectionMode, type SelectionModifyOp, type SelectionToolKind, type SelectionToolOptions, type SerializeContext, type SerializedAdjustmentLayer, type SerializedAnnotationLayer, type SerializedGroupLayer, type SerializedImageEditorState, type SerializedLayer, type SerializedLayerEffects, type SerializedLayeredImageEditorState, type SerializedPattern, type SerializedPixelLayer, type SerializedRasterMask, type SerializedSelection, type ShapeSelectionOptions, type ShortcutEvent, StrokeApply, StrokeCoverage, type StrokeInit, StrokePoint, type StrokeTool, TINT_SCALE, TONE_LUT_SIZE, TONE_RANGE_PRESETS, TRANSFORM_ANCHORS, type TextAnnotation, type ThresholdParams, TiledSurface, type ToneRangePreset, type TransformAnchor, type TransformHandle, type TransformModifiers, type TransformOverlay, type TransformParams, type TransformReadout, type UnitLevels, VIBRANCE_GREY, Vec2, type VibranceParams, type ViewportMetrics, WarpMesh, WarpPreset, XYZ_D50_TO_SRGB, activeAdjustmentLayers, addLayerEffect, addLayerFilter, addToHistogram, adjustmentKindLabel, adjustmentLayersKey, adjustmentNodeAsLayer, adjustmentNodeFromLegacy, anchorPoint, annotationLayerFor, annotationLayerName, applyAdjustmentLayers, applyAdjustments, applyBoxBlur, applyDepthMask, applyImageProjectionToContext, applyLegacyAdjustments, applyMatrix3, applyOutputStage, applyParams, applyProcess2Adjustments, applyRegionBlur, applyRegionMosaic, backgroundLayer, baseProjection, blackWhiteGray, blurFilter, borderCoverage, boxMean, boxPointOf, boxToCurvePoint, bradfordAdaptation, buildLayerMaskPlanes, buildToneLut, calculateCropDrag, canvasToImagePoint, clampControlValue, clampCropToImage, colorBalanceChannel, colorRange, combineSelections, compileAdjustmentLayer, computeHistogram, computeSelectionBounds, contractCoverage, controlPosition, controlTrackBackground, cornersFromMatrix, coverageToByte, coveringRect, createAdjustmentLayer, createImageCaptureSurface, createImageEditTools, createImageEditorToolProvider, createImageEffectTools, createImageLayerTools, createImagePaintTools, createImagePsdTools, createImageSelectionTools, createImageTransformTools, createSelectionMask, curveLutFromLevels, curvePointToBox, curveSvgPath, decodeLayerChannel, decodeLayerMask, decodeMergedImage, decodePlanes, decodePngDataUrl, decodeSelectionRle, defaultAdjustmentParams, depthMaskAlpha, depthRasterMask, describeLayer, describeLayerEffects, describeSelection, describeTransform, deserializeEffects, deserializeLayer, deserializeLayers, deserializePatterns, deserializeSelection, developFilter, developFromAdjustments, developTarget, distanceTransform, downloadPsd, dropPlacement, dropZone, duplicateLayer, edgeWidth, effectControlChange, ellipsePoints, ellipseSelection, emptyHistogram, encodeRle, encodeSelectionRle, encodeSurface, evaluateAdjustmentLayers, expandCoverage, exportPsd, featherCoverage, findAdjustmentControl, findLayerControl, flipCorners, formatControlValue, fullSelection, geometryHomography, getAnnotationBounds, getControlPath, getCropCursor, getRotatedSize, getViewportMetrics, getViewportProjection, globalImageCache, greyMorphology, groupLayers, guidePlanes, guidedFilterColor, handlePaintShortcut, hasResampledLegacyMask, hasWarp, hashMaskContent, hexToRgb, histogramPath, hitTestAnnotation, hitTestCrop, hitTestCurvePoint, hslToRgb, hueRange, hueRangeTables, hueRangeWeight, hueSaturation, identityCurve, identityLevels, identityTransform, imageEditorStateMigrations, imageToCanvasPoint, importPsd, insertCurvePoint, invertMatrix3, invertSelection, isActiveFilter, isAdjustmentKind, isDefaultDepthMask, isIdentityTransform, isLegacyShape, isPaintTool, isQuarterTurn, isQuarterTurnSwapped, isSelectionEmpty, isSelectionMode, isSpatialFilter, isTransformAnchor, isValidWarp, kelvinToTemperature, layerBadge, layerEffectControls, layerEffectsBadge, layerEffectsOf, layerEffectsPanel, layerLabel, layerMaskCoverage, layerMaskFromSelection, layerMaskKey, layerMenu, layerName, layerPanelRows, layerTree, layerTypeLabel, layersFromLegacy, legacyAdjustmentLayer, legacyMaskOf, legacyView, levelsValue, linearSrgbToXy, linearToSrgb, loadImageEditorDocument, magicWand, mapCropHandle, maskSummary, matrixFromCorners, matrixFromParams, migrateSerializedImageEditorState, migrateToLayeredState, mixerLoadResult, modifySelection, moveCurvePoint, moveLayer, mulMatrix3, needsLegacyBase, neutralHueRange, newLayerId, normalizeAdjustmentLayer, normalizeAdjustmentLayers, normalizeAngle, normalizeFilter, normalizeLayerMask, normalizeProcessVersion, normalizeRect, normalizeRefineEdgeParams, normalizeStoredAdjustments, offsetLayer, openPsdFile, parseAdjustmentBlock, parseBlend, parseColor, parseLfx2, parseLrfx, parsePatternBlock, parseSelectionMode, parseVersionedDescriptor, photoFilterMatrix, pixelLayerBounds, pixelLayers, placeLayer, pointerPressure, polygonCoverage, polygonSelection, posterizeValue, presetWarp, previewStep, projectImagePoint, projectImageRect, projectMaskCoverage, projectQuarterTurn, psdBytesFromBase64, psdFileName, psdPatternToEffectPattern, psdToLayers, quickMaskPixels, rangeLightness, rasterMaskFromLegacy, readAdjustmentControls, readPsd, rectSelection, referencePoint, refineCoverage, refineEdgeHalo, refineSelection, removeAlpha, removeCurvePoint, removeLayer, removeLayerEffect, removeLayerFilter, renderLayeredBase, requireLayer, requireUnlocked, resizePixels, resizeSelection, resolveExternalAssets, resolveMosaicRegionBounds, rgbToGray, rgbToHsl, rgbUnitToHex, runLayerMenuAction, sampleLut, sampleToneLut, selectionArea, selectionFromCoverage, selectionFromPixels, selectionModeFromModifiers, selectionOutline, selectionToCoverage, selectionToPixels, selectionValueAt, serializeEffects, serializeLayer, serializeLayers, serializeLayersExternal, serializePatterns, serializeSelection, setControlPath, setLayerEffects, setLayerEffectsEnabled, setLayerMask, setLayerProperties, shiftCoverage, smoothCoverage, splitOverlayAnnotations, srgb8ToLab, srgbToLinear, sumHistograms, tempTintToXy, temperatureToKelvin, toHex, toneCurve, toneLuts, toneRange, transformHomography, transformMap, transformedBox, transformedPoint, ungroupLayer, unionRect, unprojectCanvasPoint, updateLayerEffect, updateLayerFilter, updateLayerMaskProps, uvToXy, versionedDescriptorBytes, vibranceLinear, vibrancePixel, wbMatrix, whiteBalanceFromSample, whiteBalanceMatrix, withNewIds, writeAdjustmentBlock, writeLfx2, writePatternBlock, writePsd, xyToTempTint, xyToUv };