@pixerate/editor 0.214.0 → 0.216.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 (40) hide show
  1. package/dist/{chunk-UOGKSVRQ.cjs → chunk-B46UQUDC.cjs} +770 -733
  2. package/dist/{chunk-W3TOZTL7.js → chunk-F7Z2MKY2.js} +115 -4
  3. package/dist/{chunk-YBJXCQTR.js → chunk-QXY4YTRI.js} +738 -701
  4. package/dist/{chunk-H65IBXFI.cjs → chunk-S55JFWDA.cjs} +350 -239
  5. package/dist/{chunk-QYLWG22N.cjs → chunk-SS53NNZO.cjs} +304 -1
  6. package/dist/{chunk-LQ5SALHK.js → chunk-U7C655AM.js} +5 -311
  7. package/dist/{chunk-L52VMQZS.cjs → chunk-UC3PWFM3.cjs} +68 -374
  8. package/dist/{chunk-L3G23N5Y.js → chunk-ZNA3IQZF.js} +304 -1
  9. package/dist/image-editor/controller.d.cts +41 -0
  10. package/dist/image-editor/controller.d.ts +41 -0
  11. package/dist/image-editor/index.cjs +1461 -1125
  12. package/dist/image-editor/index.d.cts +1 -0
  13. package/dist/image-editor/index.d.ts +1 -0
  14. package/dist/image-editor/index.js +384 -48
  15. package/dist/image-editor/layers/edge-color.d.cts +27 -0
  16. package/dist/image-editor/layers/edge-color.d.ts +27 -0
  17. package/dist/image-editor/layers/serialize.d.cts +13 -0
  18. package/dist/image-editor/layers/serialize.d.ts +13 -0
  19. package/dist/image-editor/selection/index.d.cts +1 -0
  20. package/dist/image-editor/selection/index.d.ts +1 -0
  21. package/dist/image-editor/selection/inspect.d.cts +9 -0
  22. package/dist/image-editor/selection/inspect.d.ts +9 -0
  23. package/dist/image-editor/selection/uncertainty.d.cts +40 -0
  24. package/dist/image-editor/selection/uncertainty.d.ts +40 -0
  25. package/dist/image-editor/selection-worker.cjs +4 -4
  26. package/dist/image-editor/selection-worker.js +2 -2
  27. package/dist/paint-editor/index.cjs +79 -79
  28. package/dist/paint-editor/index.js +3 -3
  29. package/dist/raster/compositor.d.cts +10 -1
  30. package/dist/raster/compositor.d.ts +10 -1
  31. package/dist/raster/deep-compositor.d.cts +1 -1
  32. package/dist/raster/deep-compositor.d.ts +1 -1
  33. package/dist/raster/index.cjs +4 -2
  34. package/dist/raster/index.js +3 -1
  35. package/dist/raster/layers.d.cts +16 -0
  36. package/dist/raster/layers.d.ts +16 -0
  37. package/package.json +1 -1
  38. package/skills/pixerate-image-editor/SKILL.md +9 -7
  39. package/skills/pixerate-image-editor/references/paths.md +12 -0
  40. package/skills/pixerate-image-selection-masking/SKILL.md +11 -11
@@ -29,7 +29,7 @@ import { type BlendMode } from './blend.js';
29
29
  import { type GlobalLight, type LayerEffects } from './effects/model.js';
30
30
  import { type EffectPattern } from './effects/patterns.js';
31
31
  import { type EffectCompositeInput } from './effects/render.js';
32
- import type { RasterMask, RasterNode } from './layers.js';
32
+ import type { RasterMask, RasterNode, LayerEdgeColor } from './layers.js';
33
33
  import { type PixelSurface, type RasterRect, type TileKey, type TiledSurface } from './surface.js';
34
34
  /** What the compositor needs from its host besides the layers. */
35
35
  export interface RasterSources {
@@ -61,9 +61,18 @@ export interface CompositorLayer extends RasterNode {
61
61
  fillOpacity?: number;
62
62
  /** Layer effects. */
63
63
  effects?: LayerEffects;
64
+ /** Edge colour; the engine applies `ambient` (the profile's pixel filters handle the rest). */
65
+ edge?: LayerEdgeColor;
64
66
  /** Groups. */
65
67
  children?: readonly CompositorLayer[];
66
68
  }
69
+ /**
70
+ * Live edge cast (`LayerEdgeColor.ambient`): pulls straight RGBA `content` toward `below` (the
71
+ * composite behind it, same size) or a fixed colour, by `amount × (1 − α)` where α is the content's
72
+ * alpha times `coverage` (its mask). Opaque and invisible pixels are unchanged. `max` is 255 for
73
+ * bytes or 1 for float samples; `color` is in the same units.
74
+ */
75
+ export declare function applyEdgeAmbient(content: Uint8ClampedArray | Float32Array, below: ArrayLike<number>, coverage: ArrayLike<number> | null, amount: number, color: readonly [number, number, number] | null, max: number): void;
67
76
  /** A pixel layer's filters as the engine runs them. */
68
77
  export interface PixelFilterSpec {
69
78
  /** Identifies the settings (part of the cache key). */
@@ -17,7 +17,7 @@
17
17
  * each is rendered alone at 8 bits, converted, and blended in float with its blend mode and
18
18
  * opacity.
19
19
  */
20
- import type { CompositorLayer, CompositorProfile, RasterCompositor, RasterSources } from './compositor.cjs';
20
+ import { type CompositorLayer, type CompositorProfile, type RasterCompositor, type RasterSources } from './compositor.cjs';
21
21
  import type { RasterRect } from './surface.cjs';
22
22
  /** Float hooks of an editor's own layer kinds (see `CompositorProfile`). */
23
23
  export interface DeepCompositorProfile<L extends CompositorLayer, S extends RasterSources> {
@@ -17,7 +17,7 @@
17
17
  * each is rendered alone at 8 bits, converted, and blended in float with its blend mode and
18
18
  * opacity.
19
19
  */
20
- import type { CompositorLayer, CompositorProfile, RasterCompositor, RasterSources } from './compositor.js';
20
+ import { type CompositorLayer, type CompositorProfile, type RasterCompositor, type RasterSources } from './compositor.js';
21
21
  import type { RasterRect } from './surface.js';
22
22
  /** Float hooks of an editor's own layer kinds (see `CompositorProfile`). */
23
23
  export interface DeepCompositorProfile<L extends CompositorLayer, S extends RasterSources> {
@@ -59,7 +59,8 @@
59
59
 
60
60
 
61
61
 
62
- var _chunkUOGKSVRQcjs = require('../chunk-UOGKSVRQ.cjs');
62
+
63
+ var _chunkB46UQUDCcjs = require('../chunk-B46UQUDC.cjs');
63
64
  require('../chunk-QT26RHKK.cjs');
64
65
 
65
66
 
@@ -514,4 +515,5 @@ function drawSurfaceToViewport(ctx, surface, mapping, view, options) {
514
515
 
515
516
 
516
517
 
517
- exports.BIT_DEPTHS = _chunkOLNIPTB3cjs.BIT_DEPTHS; exports.BLEND_MODES = _chunkOLNIPTB3cjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkUOGKSVRQcjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkUOGKSVRQcjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkK6PXS6DOcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DeepCompositor = _chunkUOGKSVRQcjs.DeepCompositor; exports.INTERPOLATIONS = _chunkUOGKSVRQcjs.INTERPOLATIONS; exports.LAYER_EFFECT_KINDS = _chunkUOGKSVRQcjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunkUOGKSVRQcjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkUOGKSVRQcjs.MAX_EFFECT_REACH; exports.MAX_TRANSFORM_PIXELS = _chunkUOGKSVRQcjs.MAX_TRANSFORM_PIXELS; exports.PAINTERLY_BLEND_MODES = _chunkOLNIPTB3cjs.PAINTERLY_BLEND_MODES; exports.PatternPlacement = _chunkUOGKSVRQcjs.PatternPlacement; exports.PatternTile = _chunkUOGKSVRQcjs.PatternTile; exports.RasterCompositor = _chunkUOGKSVRQcjs.RasterCompositor; exports.SHADOW_AMBIENT = _chunkOLNIPTB3cjs.SHADOW_AMBIENT; exports.STROKE_CHAMFER_MAX = _chunkUOGKSVRQcjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunk474IQG74cjs.SurfaceDraft; exports.SurfaceViewportRenderer = SurfaceViewportRenderer; exports.TILE = _chunk474IQG74cjs.TILE; exports.TILE_SHIFT = _chunk474IQG74cjs.TILE_SHIFT; exports.TiledSurface = _chunk474IQG74cjs.TiledSurface; exports.TransformTooLargeError = _chunkUOGKSVRQcjs.TransformTooLargeError; exports.ZlibError = _chunkXFM3OCHUcjs.ZlibError; exports.activeEffectItems = _chunkUOGKSVRQcjs.activeEffectItems; exports.adler32 = _chunkXFM3OCHUcjs.adler32; exports.base64ToBytes = _chunkOLNIPTB3cjs.base64ToBytes; exports.blendChannel = _chunkOLNIPTB3cjs.blendChannel; exports.blendImageData = _chunkOLNIPTB3cjs.blendImageData; exports.blendLum = _chunkOLNIPTB3cjs.blendLum; exports.blendPixel = _chunkOLNIPTB3cjs.blendPixel; exports.blendRgb = _chunkOLNIPTB3cjs.blendRgb; exports.blendTile = _chunkUOGKSVRQcjs.blendTile; exports.buildEffectMaps = _chunkUOGKSVRQcjs.buildEffectMaps; exports.builtinPattern = _chunkUOGKSVRQcjs.builtinPattern; exports.builtinPatternIds = _chunkUOGKSVRQcjs.builtinPatternIds; exports.bytesToBase64 = _chunkOLNIPTB3cjs.bytesToBase64; exports.canvasCompositeOperation = _chunkOLNIPTB3cjs.canvasCompositeOperation; exports.changedTiles = _chunkUOGKSVRQcjs.changedTiles; exports.collectTiles = _chunk474IQG74cjs.collectTiles; exports.compositeLayerEffects = _chunkUOGKSVRQcjs.compositeLayerEffects; exports.compositeSurfaceOver = _chunkUOGKSVRQcjs.compositeSurfaceOver; exports.contentBounds = _chunk474IQG74cjs.contentBounds; exports.contourLut = _chunkUOGKSVRQcjs.contourLut; exports.convertSurfaceDepth = _chunkOLNIPTB3cjs.convertSurfaceDepth; exports.curveLut = _chunkUOGKSVRQcjs.curveLut; exports.decodePng = _chunkOLNIPTB3cjs.decodePng; exports.deepBytes = _chunkOLNIPTB3cjs.deepBytes; exports.deepTile = _chunkOLNIPTB3cjs.deepTile; exports.defaultEffectGradient = _chunkUOGKSVRQcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkUOGKSVRQcjs.defaultLayerEffect; exports.deflate = _chunkXFM3OCHUcjs.deflate; exports.deflateRaw = _chunkXFM3OCHUcjs.deflateRaw; exports.depthOf = _chunkOLNIPTB3cjs.depthOf; exports.drawSurfaceToViewport = drawSurfaceToViewport; exports.effectColorHex = _chunkUOGKSVRQcjs.effectColorHex; exports.effectFillColors = _chunkUOGKSVRQcjs.effectFillColors; exports.effectReach = _chunkUOGKSVRQcjs.effectReach; exports.effectsAreLocal = _chunkUOGKSVRQcjs.effectsAreLocal; exports.effectsFingerprint = _chunkUOGKSVRQcjs.effectsFingerprint; exports.effectsMargin = _chunkUOGKSVRQcjs.effectsMargin; exports.effectsScale = _chunkUOGKSVRQcjs.effectsScale; exports.emptySurface = _chunk474IQG74cjs.emptySurface; exports.encodePng = _chunkOLNIPTB3cjs.encodePng; exports.fillRect = _chunk474IQG74cjs.fillRect; exports.findLayer = _chunkUOGKSVRQcjs.findLayer; exports.finishTile = _chunk474IQG74cjs.finishTile; exports.flattenLayers = _chunkUOGKSVRQcjs.flattenLayers; exports.gaussianBlur = _chunkK6PXS6DOcjs.gaussianBlur; exports.gradientT = _chunkUOGKSVRQcjs.gradientT; exports.hasActiveEffects = _chunkUOGKSVRQcjs.hasActiveEffects; exports.hashNoise = _chunkUOGKSVRQcjs.hashNoise; exports.inflate = _chunkXFM3OCHUcjs.inflate; exports.inflateRaw = _chunkXFM3OCHUcjs.inflateRaw; exports.insertLayer = _chunkUOGKSVRQcjs.insertLayer; exports.isBitDepth = _chunkOLNIPTB3cjs.isBitDepth; exports.isBlendMode = _chunkOLNIPTB3cjs.isBlendMode; exports.isInterpolation = _chunkUOGKSVRQcjs.isInterpolation; exports.isLayerEffectKind = _chunkUOGKSVRQcjs.isLayerEffectKind; exports.isLayerLocked = _chunkUOGKSVRQcjs.isLayerLocked; exports.isPainterlyBlendMode = _chunkOLNIPTB3cjs.isPainterlyBlendMode; exports.isPng = _chunkOLNIPTB3cjs.isPng; exports.isSeparableBlendMode = _chunkOLNIPTB3cjs.isSeparableBlendMode; exports.keepDeepSamples = _chunkOLNIPTB3cjs.keepDeepSamples; exports.keysWeight = _chunkUOGKSVRQcjs.keysWeight; exports.layerEffectFields = _chunkUOGKSVRQcjs.layerEffectFields; exports.layerEffectLabel = _chunkUOGKSVRQcjs.layerEffectLabel; exports.mapLayer = _chunkUOGKSVRQcjs.mapLayer; exports.mergeLayerEffect = _chunkUOGKSVRQcjs.mergeLayerEffect; exports.mixPigment8 = _chunkOLNIPTB3cjs.mixPigment8; exports.mixPigmentRgb = _chunkOLNIPTB3cjs.mixPigmentRgb; exports.newEffectId = _chunkUOGKSVRQcjs.newEffectId; exports.normalizeBlendMode = _chunkOLNIPTB3cjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkUOGKSVRQcjs.normalizeLayerEffects; exports.packRgba = _chunk474IQG74cjs.packRgba; exports.parseDataUrl = _chunkOLNIPTB3cjs.parseDataUrl; exports.parseEffectColor = _chunkUOGKSVRQcjs.parseEffectColor; exports.patchEffectMaps = _chunkUOGKSVRQcjs.patchEffectMaps; exports.pigment8 = _chunkOLNIPTB3cjs.pigment8; exports.pngDataUrl = _chunkOLNIPTB3cjs.pngDataUrl; exports.proxyOf = _chunkOLNIPTB3cjs.proxyOf; exports.readDeepRegion = _chunkOLNIPTB3cjs.readDeepRegion; exports.readPixel = _chunk474IQG74cjs.readPixel; exports.readRegion = _chunk474IQG74cjs.readRegion; exports.reduceSurface = _chunkUOGKSVRQcjs.reduceSurface; exports.renderLayerEffects = _chunkUOGKSVRQcjs.renderLayerEffects; exports.scaleLayerEffect = _chunkUOGKSVRQcjs.scaleLayerEffect; exports.screenToWorld = screenToWorld; exports.setLum = _chunkOLNIPTB3cjs.setLum; exports.solidSurface = _chunk474IQG74cjs.solidSurface; exports.srgbDecode = _chunkOLNIPTB3cjs.srgbDecode; exports.srgbEncode = _chunkOLNIPTB3cjs.srgbEncode; exports.standardBlendMode = _chunkOLNIPTB3cjs.standardBlendMode; exports.surfaceBytes = _chunk474IQG74cjs.surfaceBytes; exports.surfaceDepth = _chunkOLNIPTB3cjs.surfaceDepth; exports.surfaceFromDeepPixels = _chunkOLNIPTB3cjs.surfaceFromDeepPixels; exports.surfaceFromPixels = _chunk474IQG74cjs.surfaceFromPixels; exports.surfaceMipLevel = surfaceMipLevel; exports.surfaceResolutionForZoom = surfaceResolutionForZoom; exports.surfaceToWorld = surfaceToWorld; exports.surfacesEqual = _chunk474IQG74cjs.surfacesEqual; exports.tileCoord = _chunk474IQG74cjs.tileCoord; exports.tileKey = _chunk474IQG74cjs.tileKey; exports.tileRect = _chunk474IQG74cjs.tileRect; exports.tileSamples = _chunkOLNIPTB3cjs.tileSamples; exports.tileSamples16 = _chunkOLNIPTB3cjs.tileSamples16; exports.tileSamples32 = _chunkOLNIPTB3cjs.tileSamples32; exports.tilesInRect = _chunk474IQG74cjs.tilesInRect; exports.to16From32 = _chunkOLNIPTB3cjs.to16From32; exports.to16From8 = _chunkOLNIPTB3cjs.to16From8; exports.to32From16 = _chunkOLNIPTB3cjs.to32From16; exports.to32From8 = _chunkOLNIPTB3cjs.to32From8; exports.to8From16 = _chunkOLNIPTB3cjs.to8From16; exports.to8From32 = _chunkOLNIPTB3cjs.to8From32; exports.transformSurface = _chunkUOGKSVRQcjs.transformSurface; exports.transformedBounds = _chunkUOGKSVRQcjs.transformedBounds; exports.translateSurface = _chunk474IQG74cjs.translateSurface; exports.uniformTile = _chunk474IQG74cjs.uniformTile; exports.validateEffectGradient = _chunkUOGKSVRQcjs.validateEffectGradient; exports.validateLayerEffect = _chunkUOGKSVRQcjs.validateLayerEffect; exports.validateLayerEffects = _chunkUOGKSVRQcjs.validateLayerEffects; exports.visibleSurfaceRect = visibleSurfaceRect; exports.visibleWorldRect = visibleWorldRect; exports.warpSurface = _chunkUOGKSVRQcjs.warpSurface; exports.workingToSamples = _chunkUOGKSVRQcjs.workingToSamples; exports.worldRectToSurface = worldRectToSurface; exports.worldToSurface = worldToSurface; exports.writeDeepRegion = _chunkOLNIPTB3cjs.writeDeepRegion; exports.writeRegion = _chunk474IQG74cjs.writeRegion;
518
+
519
+ exports.BIT_DEPTHS = _chunkOLNIPTB3cjs.BIT_DEPTHS; exports.BLEND_MODES = _chunkOLNIPTB3cjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkB46UQUDCcjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkB46UQUDCcjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkK6PXS6DOcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DeepCompositor = _chunkB46UQUDCcjs.DeepCompositor; exports.INTERPOLATIONS = _chunkB46UQUDCcjs.INTERPOLATIONS; exports.LAYER_EFFECT_KINDS = _chunkB46UQUDCcjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunkB46UQUDCcjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkB46UQUDCcjs.MAX_EFFECT_REACH; exports.MAX_TRANSFORM_PIXELS = _chunkB46UQUDCcjs.MAX_TRANSFORM_PIXELS; exports.PAINTERLY_BLEND_MODES = _chunkOLNIPTB3cjs.PAINTERLY_BLEND_MODES; exports.PatternPlacement = _chunkB46UQUDCcjs.PatternPlacement; exports.PatternTile = _chunkB46UQUDCcjs.PatternTile; exports.RasterCompositor = _chunkB46UQUDCcjs.RasterCompositor; exports.SHADOW_AMBIENT = _chunkOLNIPTB3cjs.SHADOW_AMBIENT; exports.STROKE_CHAMFER_MAX = _chunkB46UQUDCcjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunk474IQG74cjs.SurfaceDraft; exports.SurfaceViewportRenderer = SurfaceViewportRenderer; exports.TILE = _chunk474IQG74cjs.TILE; exports.TILE_SHIFT = _chunk474IQG74cjs.TILE_SHIFT; exports.TiledSurface = _chunk474IQG74cjs.TiledSurface; exports.TransformTooLargeError = _chunkB46UQUDCcjs.TransformTooLargeError; exports.ZlibError = _chunkXFM3OCHUcjs.ZlibError; exports.activeEffectItems = _chunkB46UQUDCcjs.activeEffectItems; exports.adler32 = _chunkXFM3OCHUcjs.adler32; exports.applyEdgeAmbient = _chunkB46UQUDCcjs.applyEdgeAmbient; exports.base64ToBytes = _chunkOLNIPTB3cjs.base64ToBytes; exports.blendChannel = _chunkOLNIPTB3cjs.blendChannel; exports.blendImageData = _chunkOLNIPTB3cjs.blendImageData; exports.blendLum = _chunkOLNIPTB3cjs.blendLum; exports.blendPixel = _chunkOLNIPTB3cjs.blendPixel; exports.blendRgb = _chunkOLNIPTB3cjs.blendRgb; exports.blendTile = _chunkB46UQUDCcjs.blendTile; exports.buildEffectMaps = _chunkB46UQUDCcjs.buildEffectMaps; exports.builtinPattern = _chunkB46UQUDCcjs.builtinPattern; exports.builtinPatternIds = _chunkB46UQUDCcjs.builtinPatternIds; exports.bytesToBase64 = _chunkOLNIPTB3cjs.bytesToBase64; exports.canvasCompositeOperation = _chunkOLNIPTB3cjs.canvasCompositeOperation; exports.changedTiles = _chunkB46UQUDCcjs.changedTiles; exports.collectTiles = _chunk474IQG74cjs.collectTiles; exports.compositeLayerEffects = _chunkB46UQUDCcjs.compositeLayerEffects; exports.compositeSurfaceOver = _chunkB46UQUDCcjs.compositeSurfaceOver; exports.contentBounds = _chunk474IQG74cjs.contentBounds; exports.contourLut = _chunkB46UQUDCcjs.contourLut; exports.convertSurfaceDepth = _chunkOLNIPTB3cjs.convertSurfaceDepth; exports.curveLut = _chunkB46UQUDCcjs.curveLut; exports.decodePng = _chunkOLNIPTB3cjs.decodePng; exports.deepBytes = _chunkOLNIPTB3cjs.deepBytes; exports.deepTile = _chunkOLNIPTB3cjs.deepTile; exports.defaultEffectGradient = _chunkB46UQUDCcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkB46UQUDCcjs.defaultLayerEffect; exports.deflate = _chunkXFM3OCHUcjs.deflate; exports.deflateRaw = _chunkXFM3OCHUcjs.deflateRaw; exports.depthOf = _chunkOLNIPTB3cjs.depthOf; exports.drawSurfaceToViewport = drawSurfaceToViewport; exports.effectColorHex = _chunkB46UQUDCcjs.effectColorHex; exports.effectFillColors = _chunkB46UQUDCcjs.effectFillColors; exports.effectReach = _chunkB46UQUDCcjs.effectReach; exports.effectsAreLocal = _chunkB46UQUDCcjs.effectsAreLocal; exports.effectsFingerprint = _chunkB46UQUDCcjs.effectsFingerprint; exports.effectsMargin = _chunkB46UQUDCcjs.effectsMargin; exports.effectsScale = _chunkB46UQUDCcjs.effectsScale; exports.emptySurface = _chunk474IQG74cjs.emptySurface; exports.encodePng = _chunkOLNIPTB3cjs.encodePng; exports.fillRect = _chunk474IQG74cjs.fillRect; exports.findLayer = _chunkB46UQUDCcjs.findLayer; exports.finishTile = _chunk474IQG74cjs.finishTile; exports.flattenLayers = _chunkB46UQUDCcjs.flattenLayers; exports.gaussianBlur = _chunkK6PXS6DOcjs.gaussianBlur; exports.gradientT = _chunkB46UQUDCcjs.gradientT; exports.hasActiveEffects = _chunkB46UQUDCcjs.hasActiveEffects; exports.hashNoise = _chunkB46UQUDCcjs.hashNoise; exports.inflate = _chunkXFM3OCHUcjs.inflate; exports.inflateRaw = _chunkXFM3OCHUcjs.inflateRaw; exports.insertLayer = _chunkB46UQUDCcjs.insertLayer; exports.isBitDepth = _chunkOLNIPTB3cjs.isBitDepth; exports.isBlendMode = _chunkOLNIPTB3cjs.isBlendMode; exports.isInterpolation = _chunkB46UQUDCcjs.isInterpolation; exports.isLayerEffectKind = _chunkB46UQUDCcjs.isLayerEffectKind; exports.isLayerLocked = _chunkB46UQUDCcjs.isLayerLocked; exports.isPainterlyBlendMode = _chunkOLNIPTB3cjs.isPainterlyBlendMode; exports.isPng = _chunkOLNIPTB3cjs.isPng; exports.isSeparableBlendMode = _chunkOLNIPTB3cjs.isSeparableBlendMode; exports.keepDeepSamples = _chunkOLNIPTB3cjs.keepDeepSamples; exports.keysWeight = _chunkB46UQUDCcjs.keysWeight; exports.layerEffectFields = _chunkB46UQUDCcjs.layerEffectFields; exports.layerEffectLabel = _chunkB46UQUDCcjs.layerEffectLabel; exports.mapLayer = _chunkB46UQUDCcjs.mapLayer; exports.mergeLayerEffect = _chunkB46UQUDCcjs.mergeLayerEffect; exports.mixPigment8 = _chunkOLNIPTB3cjs.mixPigment8; exports.mixPigmentRgb = _chunkOLNIPTB3cjs.mixPigmentRgb; exports.newEffectId = _chunkB46UQUDCcjs.newEffectId; exports.normalizeBlendMode = _chunkOLNIPTB3cjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkB46UQUDCcjs.normalizeLayerEffects; exports.packRgba = _chunk474IQG74cjs.packRgba; exports.parseDataUrl = _chunkOLNIPTB3cjs.parseDataUrl; exports.parseEffectColor = _chunkB46UQUDCcjs.parseEffectColor; exports.patchEffectMaps = _chunkB46UQUDCcjs.patchEffectMaps; exports.pigment8 = _chunkOLNIPTB3cjs.pigment8; exports.pngDataUrl = _chunkOLNIPTB3cjs.pngDataUrl; exports.proxyOf = _chunkOLNIPTB3cjs.proxyOf; exports.readDeepRegion = _chunkOLNIPTB3cjs.readDeepRegion; exports.readPixel = _chunk474IQG74cjs.readPixel; exports.readRegion = _chunk474IQG74cjs.readRegion; exports.reduceSurface = _chunkB46UQUDCcjs.reduceSurface; exports.renderLayerEffects = _chunkB46UQUDCcjs.renderLayerEffects; exports.scaleLayerEffect = _chunkB46UQUDCcjs.scaleLayerEffect; exports.screenToWorld = screenToWorld; exports.setLum = _chunkOLNIPTB3cjs.setLum; exports.solidSurface = _chunk474IQG74cjs.solidSurface; exports.srgbDecode = _chunkOLNIPTB3cjs.srgbDecode; exports.srgbEncode = _chunkOLNIPTB3cjs.srgbEncode; exports.standardBlendMode = _chunkOLNIPTB3cjs.standardBlendMode; exports.surfaceBytes = _chunk474IQG74cjs.surfaceBytes; exports.surfaceDepth = _chunkOLNIPTB3cjs.surfaceDepth; exports.surfaceFromDeepPixels = _chunkOLNIPTB3cjs.surfaceFromDeepPixels; exports.surfaceFromPixels = _chunk474IQG74cjs.surfaceFromPixels; exports.surfaceMipLevel = surfaceMipLevel; exports.surfaceResolutionForZoom = surfaceResolutionForZoom; exports.surfaceToWorld = surfaceToWorld; exports.surfacesEqual = _chunk474IQG74cjs.surfacesEqual; exports.tileCoord = _chunk474IQG74cjs.tileCoord; exports.tileKey = _chunk474IQG74cjs.tileKey; exports.tileRect = _chunk474IQG74cjs.tileRect; exports.tileSamples = _chunkOLNIPTB3cjs.tileSamples; exports.tileSamples16 = _chunkOLNIPTB3cjs.tileSamples16; exports.tileSamples32 = _chunkOLNIPTB3cjs.tileSamples32; exports.tilesInRect = _chunk474IQG74cjs.tilesInRect; exports.to16From32 = _chunkOLNIPTB3cjs.to16From32; exports.to16From8 = _chunkOLNIPTB3cjs.to16From8; exports.to32From16 = _chunkOLNIPTB3cjs.to32From16; exports.to32From8 = _chunkOLNIPTB3cjs.to32From8; exports.to8From16 = _chunkOLNIPTB3cjs.to8From16; exports.to8From32 = _chunkOLNIPTB3cjs.to8From32; exports.transformSurface = _chunkB46UQUDCcjs.transformSurface; exports.transformedBounds = _chunkB46UQUDCcjs.transformedBounds; exports.translateSurface = _chunk474IQG74cjs.translateSurface; exports.uniformTile = _chunk474IQG74cjs.uniformTile; exports.validateEffectGradient = _chunkB46UQUDCcjs.validateEffectGradient; exports.validateLayerEffect = _chunkB46UQUDCcjs.validateLayerEffect; exports.validateLayerEffects = _chunkB46UQUDCcjs.validateLayerEffects; exports.visibleSurfaceRect = visibleSurfaceRect; exports.visibleWorldRect = visibleWorldRect; exports.warpSurface = _chunkB46UQUDCcjs.warpSurface; exports.workingToSamples = _chunkB46UQUDCcjs.workingToSamples; exports.worldRectToSurface = worldRectToSurface; exports.worldToSurface = worldToSurface; exports.writeDeepRegion = _chunkOLNIPTB3cjs.writeDeepRegion; exports.writeRegion = _chunk474IQG74cjs.writeRegion;
@@ -13,6 +13,7 @@ import {
13
13
  STROKE_CHAMFER_MAX,
14
14
  TransformTooLargeError,
15
15
  activeEffectItems,
16
+ applyEdgeAmbient,
16
17
  blendTile,
17
18
  buildEffectMaps,
18
19
  builtinPattern,
@@ -59,7 +60,7 @@ import {
59
60
  validateLayerEffects,
60
61
  warpSurface,
61
62
  workingToSamples
62
- } from "../chunk-YBJXCQTR.js";
63
+ } from "../chunk-QXY4YTRI.js";
63
64
  import "../chunk-OHKOFKBY.js";
64
65
  import {
65
66
  DIRECT_GAUSSIAN_MAX_SIGMA,
@@ -391,6 +392,7 @@ export {
391
392
  ZlibError,
392
393
  activeEffectItems,
393
394
  adler32,
395
+ applyEdgeAmbient,
394
396
  base64ToBytes,
395
397
  blendChannel,
396
398
  blendImageData,
@@ -44,6 +44,20 @@ export interface RasterMask<Source = unknown> {
44
44
  linked?: boolean;
45
45
  source?: Source;
46
46
  }
47
+ /**
48
+ * Colour corrections at a layer's soft edge, applied when compositing (nothing is baked). Amounts
49
+ * are 0..1; missing or 0 is off.
50
+ */
51
+ export interface LayerEdgeColor {
52
+ /** Replaces edge colour with the subject's own, unmixed from the old background (the pixels the layer's mask hides). */
53
+ decontaminate?: number;
54
+ /** Limits how much of the old background's hue the edge carries (a heuristic; bounced light is not removed). */
55
+ despill?: number;
56
+ /** Pulls edge colour toward what is behind the layer now, more where the edge is more transparent. */
57
+ ambient?: number;
58
+ /** sRGB 0..255 for `ambient`; missing: the composite behind the layer, sampled live. */
59
+ ambientColor?: [number, number, number];
60
+ }
47
61
  export interface RasterLayerBase {
48
62
  id: string;
49
63
  name: string;
@@ -57,6 +71,8 @@ export interface RasterLayerBase {
57
71
  locks?: LayerLocks;
58
72
  /** Live layer effects (drop shadow, stroke, …), rendered between the content and its blend. */
59
73
  effects?: LayerEffects;
74
+ /** Colour corrections at the layer's soft edge (see `LayerEdgeColor`). */
75
+ edge?: LayerEdgeColor;
60
76
  }
61
77
  export interface RasterPixelLayer extends RasterLayerBase {
62
78
  type: 'pixel';
@@ -44,6 +44,20 @@ export interface RasterMask<Source = unknown> {
44
44
  linked?: boolean;
45
45
  source?: Source;
46
46
  }
47
+ /**
48
+ * Colour corrections at a layer's soft edge, applied when compositing (nothing is baked). Amounts
49
+ * are 0..1; missing or 0 is off.
50
+ */
51
+ export interface LayerEdgeColor {
52
+ /** Replaces edge colour with the subject's own, unmixed from the old background (the pixels the layer's mask hides). */
53
+ decontaminate?: number;
54
+ /** Limits how much of the old background's hue the edge carries (a heuristic; bounced light is not removed). */
55
+ despill?: number;
56
+ /** Pulls edge colour toward what is behind the layer now, more where the edge is more transparent. */
57
+ ambient?: number;
58
+ /** sRGB 0..255 for `ambient`; missing: the composite behind the layer, sampled live. */
59
+ ambientColor?: [number, number, number];
60
+ }
47
61
  export interface RasterLayerBase {
48
62
  id: string;
49
63
  name: string;
@@ -57,6 +71,8 @@ export interface RasterLayerBase {
57
71
  locks?: LayerLocks;
58
72
  /** Live layer effects (drop shadow, stroke, …), rendered between the content and its blend. */
59
73
  effects?: LayerEffects;
74
+ /** Colour corrections at the layer's soft edge (see `LayerEdgeColor`). */
75
+ edge?: LayerEdgeColor;
60
76
  }
61
77
  export interface RasterPixelLayer extends RasterLayerBase {
62
78
  type: 'pixel';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.214.0",
3
+ "version": "0.216.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -98,13 +98,11 @@ drawing or editing either.
98
98
 
99
99
  Live per-layer effects (shadows, glows, bevel, overlays, strokes): see `references/layer-effects.md`.
100
100
 
101
- ### Paths
101
+ ### Paths and cutout edges
102
102
 
103
- 1. **Keep outlines as paths**: `make_work_path` turns the selection into the Work Path (the next
104
- one replaces it; `rename_path` saves it), `add_path` adds one from geometry.
105
- 2. **Use them**: `path_to_selection` / `add_vector_mask` with `pathId`, `fill_path`, `stroke_path`.
106
- 3. **Edit anchors** as the Pen and Direct Selection tools do: `get_path` → change anchors and handles
107
- → `set_path_geometry` (one undo step); shapes `set_shape_component`, vector masks `set_vector_mask_path`.
103
+ Keep outlines as paths (`make_work_path`, `add_path`) and edit their anchors: see
104
+ [references/paths.md](references/paths.md). Fix a cutout's fringe live with `set_edge_decontamination`,
105
+ `set_edge_despill` and `set_edge_ambient` (see `pixerate-image-selection-masking`).
108
106
 
109
107
  ### Painting
110
108
 
@@ -260,7 +258,7 @@ in the source frame at the document's bit depth, colour mode and profile. Read
260
258
  | `grow_selection` | Select › Grow: add connected pixels within `tolerance` (default 32) of a selected colour; follows colour, not distance. `sample`, `sampleMerged`. Fails when nothing is selected. Returns the summary. |
261
259
  | `select_similar` | Select › Similar: add every pixel in the image within `tolerance` of a selected colour, connected or not. Fails when nothing is selected. Returns the summary. |
262
260
  | `reselect` | Bring back the last selection `deselect` cleared (one undo step). Fails when there is none. Returns the summary. |
263
- | `refine_selection` | Select and Mask: snap the selection edge to image edges within `radius` px (0..64, default 8), with `smartRadius`, `smooth` 0..100, `feather` px, `contrast` 0..100 and `shiftEdge` -100..100 %, then `output` to `selection` (default), `layer-mask`, `new-layer`, `new-layer-with-mask` (on `layerId`, default active; new layers hide the source), or `new-document` / `new-document-with-mask` (host must open documents; returns `documentId`), with `decontaminate` 0..100 for new layers and documents. `edits` (`quick-select`, `brush`, `lasso`, `object` add/subtract; `refine-brush` over hair) apply first; `refineMode: "object"` uses the host model. One step; returns `refineMode`, `layerId` / `newLayerId`. Use on hair, fur, foliage or a coarse AI mask. |
261
+ | `refine_selection` | Select and Mask: snap the selection edge to image edges within `radius` px (0..64, default 8), with `smartRadius`, `smooth` 0..100, `feather` px, `contrast` 0..100 and `shiftEdge` -100..100 %, then `output` to `selection` (default), `layer-mask`, `new-layer`, `new-layer-with-mask` (on `layerId`, default active; new layers hide the source), or `new-document` / `new-document-with-mask` (host must open documents; returns `documentId`), with `decontaminate` 0..100 for new layers and documents. `edits` (`quick-select`, `brush`, `lasso`, `object` add/subtract; `refine-brush` over hair) apply first; `refineMode: "object"` uses the host model; `regions` (rects, e.g. `uncertainRegions` bounds) limits it to those. One step; returns `refineMode`, `layerId` / `newLayerId`. Use on hair, fur, foliage or a coarse AI mask. |
264
262
  | `update_adjustment_layer` | Change a layer's `enabled` (false hides it without deleting), `blend`, `opacity` (0..1) or `name` in one undo step. Returns the layer. Its parameters change with `set_adjustments`. Toggle `enabled` to compare a layer's effect before and after. |
265
263
  | `move_adjustment_layer` | Move a layer to index `to` (0 = bottom, applied first; past the top means top). Order matters: a curves layer above a hue/saturation layer works on its output. Fails when the layer is already there. Returns the ids bottom to top. |
266
264
  | `remove_adjustment_layer` | Delete a layer and its mask. Prefer hiding it with `update_adjustment_layer` when the user may want it back. Returns the remaining ids. |
@@ -293,6 +291,10 @@ in the source frame at the document's bit depth, colour mode and profile. Read
293
291
  | `set_layer_mask_properties` | Change any layer mask's `density`, `feather`, `enabled` or `linked` (false: the mask stays put when the layer moves or transforms) without touching its pixels. |
294
292
  | `apply_layer_mask` | Bake a pixel layer's mask into its alpha and remove it. Destructive. |
295
293
  | `set_mask_view` | Show a layer's mask to check it (`view` `gray` alone, `overlay` red tint over what it hides, `off`; `layerId`, default active). View state only; look with `capture_view` `includeOverlays: true`, then `off`. Returns `{view, layerId}`. |
294
+ | `get_edge_color` | A layer's edge colour: `decontaminate`, `despill`, `ambient` (percent) and `ambientSource` (`auto` or `#rrggbb`). |
295
+ | `set_edge_decontamination` | Unmix the old background from a cutout's soft mask edge at composite time (`amount` %; 0 off; nothing baked). Needs a pixel layer whose mask has a soft band. Check with `inspect_mask_edge` `haloScore`. Returns the settings. |
296
+ | `set_edge_despill` | Take the old background's hue out of a soft edge (`amount` %), luminance kept; never changes fully covered pixels. A heuristic: bounced light stays. Same mask needs. Returns the settings. |
297
+ | `set_edge_ambient` | Tint a soft edge with what is behind the layer, live (`source` `auto`) or a fixed `#rrggbb` (`amount` %). For a subject moved onto a new background. Returns the settings. |
296
298
  | `remove_layer_mask` | Delete a mask without applying it; disable it instead to keep it. |
297
299
  | `layer_via_copy` | Copy the selected pixels of a pixel layer (default the active one) to a new layer above it; `cut: true` removes them from the source. Needs a selection. Returns the new layer. |
298
300
  | `rasterize_layer` | Turn a shape layer into a pixel layer showing the same pixels (same id, mask, effects, opacity, blend; the paths are gone), an annotation layer into pixels (browser only), a smart object into a pixel layer (as `rasterize_smart_object`), or bake a pixel layer's develop / blur filters into its pixels. Do it before painting over a shape or annotation, or when the user wants the filters fixed. Destructive. |
@@ -0,0 +1,12 @@
1
+ # Paths
2
+
3
+ Document paths are vector outlines kept with the document but on no layer (Photoshop's Paths
4
+ panel). The Work Path is the scratch path; saved paths stay until deleted.
5
+
6
+ 1. **Keep outlines as paths**: `make_work_path` turns the selection into the Work Path (the next
7
+ one replaces it; `rename_path` saves it), `add_path` adds one from geometry.
8
+ 2. **Use them**: `path_to_selection` / `add_vector_mask` with `pathId`, `fill_path`, `stroke_path`.
9
+ 3. **Edit anchors** as the Pen and Direct Selection tools do: `get_path` → change anchors and
10
+ handles → `set_path_geometry` (one undo step); shapes `set_shape_component`, vector masks
11
+ `set_vector_mask_path`.
12
+ 4. **Read first**: `list_paths` for ids, names and bounds; `get_path` for the `components` to edit.
@@ -43,7 +43,8 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
43
43
  2. **Build it in steps** with `mode`: start with `replace`, `add` what was missed, `subtract`
44
44
  what leaked, and `intersect` to limit it to a region (for example `select_rect` around the
45
45
  subject).
46
- **Check:** `bounds` hug the subject. A bounds as large as the image means a leak.
46
+ **Check:** `bounds` hug the subject. A bounds as large as the image means a leak. Smart tools
47
+ return `uncertainRegions` (edge with no image edge under it): look there, refine with `regions`.
47
48
  3. **Measure the edge, then look.** `inspect_mask_edge` scores it: `haloScore` ≥ 0.35 is old
48
49
  background inside the edge, `edgeAlignment` < 0.5 is off the image's edges, `jaggedness` ≥ 15
49
50
  zigzags; it counts `holes` and `islands`, `issues` names fixes, `worst` gives `capture_view` rects.
@@ -121,12 +122,11 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
121
122
 
122
123
  ## Recipes
123
124
 
124
- - **Cut out a subject onto a new background:** select (table), then `refine_selection` with
125
- `output: "new-layer-with-mask"` (revisable) and, for hair or fur, `decontaminate` 50–100 so
126
- the old background's colour leaves the soft edge. Add the new background with
127
- `add_pixel_layer` and move it under the cutout (`move_layer`). `render_preview` and look for a
128
- halo; if there is one, raise `decontaminate`, or load the mask as a selection, `contract`
129
- 1 px, and output again.
125
+ - **Cut out a subject onto a new background:** select (table), `refine_selection` with `output:
126
+ "new-layer-with-mask"`, put the new background under it (`add_pixel_layer`, `move_layer`). Fix
127
+ the fringe live on the masked layer: `set_edge_decontamination` 80–100, `set_edge_despill` 50–100
128
+ for a coloured backdrop, `set_edge_ambient` 20–50 to take on the new scene's colour. Re-run
129
+ `inspect_mask_edge`; if `haloScore` stays high, `contract` the mask 1 px.
130
130
  - **Replace the sky:** `select_sky` (or `magic_wand` / `select_color_range` `preset: "blues"`
131
131
  if it finds none), `add` missed patches, `refine_selection` radius 8–16 along the horizon and trees, then
132
132
  `add_layer_mask` on the new sky layer. Match it with a clipped curves layer (`clipped: true`).
@@ -185,8 +185,8 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
185
185
  background, and drop `snapToEdges` where the edge is too faint.
186
186
  - **Over-feathering hard objects:** a 10 px feather on a product looks like a glow. Keep hard
187
187
  edges at 0–2 px and refine soft ones instead.
188
- - **Halo:** the old background shows as a light or dark fringe. `decontaminate` on a
189
- new-layer output for soft edges; for hard ones `contract` 1–2 px or
188
+ - **Halo:** the old background shows as a light or dark fringe. `set_edge_decontamination` on the
189
+ masked layer (live) for soft edges; for hard ones `contract` 1–2 px or
190
190
  `shiftEdge` negative before masking.
191
191
  - **Baking too early:** `apply_layer_mask`, `merge_down` and `layer_via_copy` with `cut: true`
192
192
  are hard to revise. Keep masks until the user is happy.
@@ -211,13 +211,12 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
211
211
 
212
212
  - `get_selection`: empty, bounds, area and percent after every step
213
213
  - `select_all`, `deselect`, `invert_selection`: whole-image selections
214
- - `select_rect`, `select_ellipse`: marquees
214
+ - `select_rect`, `select_ellipse`, `select_line`: marquees, and a single row or column
215
215
  - `select_polygon`: the lasso, along a contour; with `snapToEdges`, the Magnetic Lasso
216
216
  - `quick_select`: brush strokes that grow out to the region's edges
217
217
  - `select_object`: the object in a box or under a point
218
218
  - `select_focus_area`: what is in focus
219
219
  - `select_sky`: the sky
220
- - `select_line`: a single row or column
221
220
  - `select_layer_transparency`: a layer's own pixels
222
221
  - `grow_selection`, `select_similar`: add similar colour, connected or anywhere
223
222
  - `reselect`: undo a deselect
@@ -241,6 +240,7 @@ This skill is the method. `pixerate-image-editor` has the full tool reference.
241
240
  - `refine_selection`: snap the edge to the image
242
241
  - `transform_selection`: move or scale the outline only
243
242
  - `inspect_mask_edge`: measured halo, alignment, jaggedness, softness, holes and islands of an edge
243
+ - `set_edge_decontamination`, `set_edge_despill`, `set_edge_ambient`, `get_edge_color`: live edge colour on a masked cutout
244
244
  - `capture_view`, `render_preview`: look at the edge at pixel level; check the result
245
245
  - `apply_selection_as_mask`: a masked adjustment layer in one step
246
246
  - `add_layer_mask`, `set_layer_mask_properties`, `apply_layer_mask`, `remove_layer_mask`: layer masks