@pixerate/editor 0.96.0 → 0.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.md +4 -2
- package/dist/animation-editor/index.cjs +55 -53
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +3 -2
- package/dist/animation-editor/index.d.ts +3 -2
- package/dist/animation-editor/index.js +11 -9
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/chunk-DWGZUSES.cjs +694 -0
- package/dist/chunk-DWGZUSES.cjs.map +1 -0
- package/dist/chunk-GX332W2C.js +181 -0
- package/dist/chunk-GX332W2C.js.map +1 -0
- package/dist/{chunk-7MD7C6XQ.cjs → chunk-JF5PXN7W.cjs} +96 -744
- package/dist/chunk-JF5PXN7W.cjs.map +1 -0
- package/dist/chunk-KKREERP2.js +694 -0
- package/dist/chunk-KKREERP2.js.map +1 -0
- package/dist/chunk-MUUXNRU4.cjs +181 -0
- package/dist/chunk-MUUXNRU4.cjs.map +1 -0
- package/dist/{chunk-KFTQ2PKP.js → chunk-WIR377F6.js} +1001 -61
- package/dist/chunk-WIR377F6.js.map +1 -0
- package/dist/{chunk-T422YCHR.cjs → chunk-WT6ZAWJP.cjs} +1023 -83
- package/dist/chunk-WT6ZAWJP.cjs.map +1 -0
- package/dist/{chunk-4JLB2USO.js → chunk-YGZNGDIT.js} +45 -693
- package/dist/chunk-YGZNGDIT.js.map +1 -0
- package/dist/image-editor/index.cjs +1519 -360
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +378 -5
- package/dist/image-editor/index.d.ts +378 -5
- package/dist/image-editor/index.js +1244 -85
- package/dist/image-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +25 -2
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +143 -4
- package/dist/raster/index.d.ts +143 -4
- package/dist/raster/index.js +25 -2
- package/dist/{svg-ymShkNtu.d.cts → svg-C9r284x8.d.cts} +6 -9
- package/dist/{svg-Dh17jCyA.d.ts → svg-MVKBqwD4.d.ts} +6 -9
- package/dist/types-CwMPoRMU.d.cts +40 -0
- package/dist/types-CwMPoRMU.d.ts +40 -0
- package/dist/vector/index.cjs +490 -554
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +154 -292
- package/dist/vector/index.d.ts +154 -292
- package/dist/vector/index.js +91 -155
- package/dist/vector/index.js.map +1 -1
- package/dist/warp-B8rAguzs.d.ts +165 -0
- package/dist/warp-nYs2DPrx.d.cts +165 -0
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +49 -3
- package/dist/chunk-4JLB2USO.js.map +0 -1
- package/dist/chunk-7MD7C6XQ.cjs.map +0 -1
- package/dist/chunk-KFTQ2PKP.js.map +0 -1
- package/dist/chunk-T422YCHR.cjs.map +0 -1
package/dist/raster/index.cjs
CHANGED
|
@@ -60,7 +60,19 @@
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var _chunkWT6ZAWJPcjs = require('../chunk-WT6ZAWJP.cjs');
|
|
75
|
+
require('../chunk-MUUXNRU4.cjs');
|
|
64
76
|
|
|
65
77
|
|
|
66
78
|
|
|
@@ -197,5 +209,16 @@ var _chunkCRMAXIUVcjs = require('../chunk-CRMAXIUV.cjs');
|
|
|
197
209
|
|
|
198
210
|
|
|
199
211
|
|
|
200
|
-
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
exports.BLEND_MODES = _chunkCRMAXIUVcjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkWT6ZAWJPcjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkWT6ZAWJPcjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkWT6ZAWJPcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.INTERPOLATIONS = _chunkWT6ZAWJPcjs.INTERPOLATIONS; exports.LAYER_EFFECT_KINDS = _chunkWT6ZAWJPcjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunkWT6ZAWJPcjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkWT6ZAWJPcjs.MAX_EFFECT_REACH; exports.MAX_TRANSFORM_PIXELS = _chunkWT6ZAWJPcjs.MAX_TRANSFORM_PIXELS; exports.PatternPlacement = _chunkWT6ZAWJPcjs.PatternPlacement; exports.PatternTile = _chunkWT6ZAWJPcjs.PatternTile; exports.RasterCompositor = _chunkWT6ZAWJPcjs.RasterCompositor; exports.STROKE_CHAMFER_MAX = _chunkWT6ZAWJPcjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunkCRMAXIUVcjs.SurfaceDraft; exports.TILE = _chunkCRMAXIUVcjs.TILE; exports.TILE_SHIFT = _chunkCRMAXIUVcjs.TILE_SHIFT; exports.TiledSurface = _chunkCRMAXIUVcjs.TiledSurface; exports.TransformTooLargeError = _chunkWT6ZAWJPcjs.TransformTooLargeError; exports.ZlibError = _chunkWT6ZAWJPcjs.ZlibError; exports.activeEffectItems = _chunkWT6ZAWJPcjs.activeEffectItems; exports.adler32 = _chunkWT6ZAWJPcjs.adler32; exports.base64ToBytes = _chunkWT6ZAWJPcjs.base64ToBytes; exports.blendChannel = _chunkCRMAXIUVcjs.blendChannel; exports.blendImageData = _chunkCRMAXIUVcjs.blendImageData; exports.blendLum = _chunkCRMAXIUVcjs.blendLum; exports.blendPixel = _chunkCRMAXIUVcjs.blendPixel; exports.blendRgb = _chunkCRMAXIUVcjs.blendRgb; exports.blendTile = _chunkWT6ZAWJPcjs.blendTile; exports.buildEffectMaps = _chunkWT6ZAWJPcjs.buildEffectMaps; exports.builtinPattern = _chunkWT6ZAWJPcjs.builtinPattern; exports.builtinPatternIds = _chunkWT6ZAWJPcjs.builtinPatternIds; exports.bytesToBase64 = _chunkWT6ZAWJPcjs.bytesToBase64; exports.canvasCompositeOperation = _chunkCRMAXIUVcjs.canvasCompositeOperation; exports.changedTiles = _chunkWT6ZAWJPcjs.changedTiles; exports.collectTiles = _chunkCRMAXIUVcjs.collectTiles; exports.compositeLayerEffects = _chunkWT6ZAWJPcjs.compositeLayerEffects; exports.compositeSurfaceOver = _chunkWT6ZAWJPcjs.compositeSurfaceOver; exports.contentBounds = _chunkCRMAXIUVcjs.contentBounds; exports.contourLut = _chunkWT6ZAWJPcjs.contourLut; exports.curveLut = _chunkWT6ZAWJPcjs.curveLut; exports.decodePng = _chunkWT6ZAWJPcjs.decodePng; exports.defaultEffectGradient = _chunkWT6ZAWJPcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkWT6ZAWJPcjs.defaultLayerEffect; exports.deflate = _chunkWT6ZAWJPcjs.deflate; exports.deflateRaw = _chunkWT6ZAWJPcjs.deflateRaw; exports.effectColorHex = _chunkWT6ZAWJPcjs.effectColorHex; exports.effectReach = _chunkWT6ZAWJPcjs.effectReach; exports.effectsAreLocal = _chunkWT6ZAWJPcjs.effectsAreLocal; exports.effectsFingerprint = _chunkWT6ZAWJPcjs.effectsFingerprint; exports.effectsMargin = _chunkWT6ZAWJPcjs.effectsMargin; exports.effectsScale = _chunkWT6ZAWJPcjs.effectsScale; exports.emptySurface = _chunkCRMAXIUVcjs.emptySurface; exports.encodePng = _chunkWT6ZAWJPcjs.encodePng; exports.fillRect = _chunkCRMAXIUVcjs.fillRect; exports.findLayer = _chunkWT6ZAWJPcjs.findLayer; exports.finishTile = _chunkCRMAXIUVcjs.finishTile; exports.flattenLayers = _chunkWT6ZAWJPcjs.flattenLayers; exports.gaussianBlur = _chunkWT6ZAWJPcjs.gaussianBlur; exports.gradientT = _chunkWT6ZAWJPcjs.gradientT; exports.hasActiveEffects = _chunkWT6ZAWJPcjs.hasActiveEffects; exports.hashNoise = _chunkWT6ZAWJPcjs.hashNoise; exports.inflate = _chunkWT6ZAWJPcjs.inflate; exports.inflateRaw = _chunkWT6ZAWJPcjs.inflateRaw; exports.insertLayer = _chunkWT6ZAWJPcjs.insertLayer; exports.isBlendMode = _chunkCRMAXIUVcjs.isBlendMode; exports.isInterpolation = _chunkWT6ZAWJPcjs.isInterpolation; exports.isLayerEffectKind = _chunkWT6ZAWJPcjs.isLayerEffectKind; exports.isLayerLocked = _chunkWT6ZAWJPcjs.isLayerLocked; exports.isPng = _chunkWT6ZAWJPcjs.isPng; exports.isSeparableBlendMode = _chunkCRMAXIUVcjs.isSeparableBlendMode; exports.keysWeight = _chunkWT6ZAWJPcjs.keysWeight; exports.layerEffectFields = _chunkWT6ZAWJPcjs.layerEffectFields; exports.layerEffectLabel = _chunkWT6ZAWJPcjs.layerEffectLabel; exports.mapLayer = _chunkWT6ZAWJPcjs.mapLayer; exports.mergeLayerEffect = _chunkWT6ZAWJPcjs.mergeLayerEffect; exports.mixPigment8 = _chunkCRMAXIUVcjs.mixPigment8; exports.mixPigmentRgb = _chunkCRMAXIUVcjs.mixPigmentRgb; exports.newEffectId = _chunkWT6ZAWJPcjs.newEffectId; exports.normalizeBlendMode = _chunkCRMAXIUVcjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkWT6ZAWJPcjs.normalizeLayerEffects; exports.packRgba = _chunkCRMAXIUVcjs.packRgba; exports.parseDataUrl = _chunkWT6ZAWJPcjs.parseDataUrl; exports.parseEffectColor = _chunkWT6ZAWJPcjs.parseEffectColor; exports.patchEffectMaps = _chunkWT6ZAWJPcjs.patchEffectMaps; exports.pngDataUrl = _chunkWT6ZAWJPcjs.pngDataUrl; exports.readPixel = _chunkCRMAXIUVcjs.readPixel; exports.readRegion = _chunkCRMAXIUVcjs.readRegion; exports.reduceSurface = _chunkWT6ZAWJPcjs.reduceSurface; exports.renderLayerEffects = _chunkWT6ZAWJPcjs.renderLayerEffects; exports.scaleLayerEffect = _chunkWT6ZAWJPcjs.scaleLayerEffect; exports.setLum = _chunkCRMAXIUVcjs.setLum; exports.solidSurface = _chunkCRMAXIUVcjs.solidSurface; exports.surfaceBytes = _chunkCRMAXIUVcjs.surfaceBytes; exports.surfaceFromPixels = _chunkCRMAXIUVcjs.surfaceFromPixels; exports.surfacesEqual = _chunkCRMAXIUVcjs.surfacesEqual; exports.tileCoord = _chunkCRMAXIUVcjs.tileCoord; exports.tileKey = _chunkCRMAXIUVcjs.tileKey; exports.tileRect = _chunkCRMAXIUVcjs.tileRect; exports.tilesInRect = _chunkCRMAXIUVcjs.tilesInRect; exports.transformSurface = _chunkWT6ZAWJPcjs.transformSurface; exports.transformedBounds = _chunkWT6ZAWJPcjs.transformedBounds; exports.translateSurface = _chunkCRMAXIUVcjs.translateSurface; exports.uniformTile = _chunkCRMAXIUVcjs.uniformTile; exports.validateEffectGradient = _chunkWT6ZAWJPcjs.validateEffectGradient; exports.validateLayerEffect = _chunkWT6ZAWJPcjs.validateLayerEffect; exports.validateLayerEffects = _chunkWT6ZAWJPcjs.validateLayerEffects; exports.warpSurface = _chunkWT6ZAWJPcjs.warpSurface; exports.writeRegion = _chunkCRMAXIUVcjs.writeRegion;
|
|
201
224
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,ikMAAC","file":"/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"}
|
package/dist/raster/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { B as BlendMode, M as MaskSurface, P as PixelSurface, R as RasterRect, T as TiledSurface, h as TileKey } from '../surface-DIA-XatS.cjs';
|
|
2
2
|
export { a as BLEND_MODES, b as BlendModeInfo, c as Rgb, d as Rgba, S as SurfaceDraft, e as TILE, f as TILE_SHIFT, g as Tile, 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.cjs';
|
|
3
|
+
import { H as Homography, V as Vec2 } from '../types-CwMPoRMU.cjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Layer effects (Photoshop's layer styles) as data: drop and inner shadows, outer and inner
|
|
@@ -396,6 +397,11 @@ interface RasterMask<Source = unknown> {
|
|
|
396
397
|
feather?: number;
|
|
397
398
|
/** `false` keeps the mask but ignores it. */
|
|
398
399
|
enabled?: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* `false` unlinks the mask from its layer (Photoshop's chain icon): moving or transforming the
|
|
402
|
+
* layer's pixels leaves the mask where it is. Missing = linked.
|
|
403
|
+
*/
|
|
404
|
+
linked?: boolean;
|
|
399
405
|
source?: Source;
|
|
400
406
|
}
|
|
401
407
|
interface RasterLayerBase {
|
|
@@ -414,7 +420,7 @@ interface RasterLayerBase {
|
|
|
414
420
|
}
|
|
415
421
|
interface RasterPixelLayer extends RasterLayerBase {
|
|
416
422
|
type: 'pixel';
|
|
417
|
-
/** Pixels in layer space; document position = layer position + `offset`. A mask moves with it. */
|
|
423
|
+
/** Pixels in layer space; document position = layer position + `offset`. A linked mask moves with it. */
|
|
418
424
|
surface: PixelSurface;
|
|
419
425
|
/** Integer move without re-tiling. */
|
|
420
426
|
offset: {
|
|
@@ -485,6 +491,8 @@ declare function isLayerLocked(layer: {
|
|
|
485
491
|
* - Layer effects: a layer's effect maps (shadow, glow, bevel, stroke distance fields) are built
|
|
486
492
|
* once over the layer's region (its bounds grown by the effects' margin, within the canvas grown
|
|
487
493
|
* the same) and cached by the identity of every surface tile the shape reads; tiles crop them.
|
|
494
|
+
* When only some of those tiles changed and every effect is local, the maps are rebuilt only
|
|
495
|
+
* within the margin of the change (narrowed by `dirty` when it covers the change) and patched in.
|
|
488
496
|
* A tile's signature then reads the layer within the margin around it (or the whole region when
|
|
489
497
|
* an effect is laid out over the layer's bounds), and `dirty` rectangles grow by the margin.
|
|
490
498
|
*/
|
|
@@ -560,8 +568,9 @@ interface CompositeCallOptions {
|
|
|
560
568
|
checkpointLayerId?: string | null;
|
|
561
569
|
/**
|
|
562
570
|
* Where the layers changed since the previous call, when the caller knows (a stroke's dabs).
|
|
563
|
-
* Changed tiles are then recomposited only inside these rectangles
|
|
564
|
-
*
|
|
571
|
+
* Changed tiles are then recomposited only inside these rectangles (grown by the effects' reach),
|
|
572
|
+
* tiles they miss keep their pixels, and effect maps are rebuilt only around them. Changes outside
|
|
573
|
+
* them would be missed, so pass nothing when unsure.
|
|
565
574
|
*/
|
|
566
575
|
dirty?: RasterRect[];
|
|
567
576
|
}
|
|
@@ -578,6 +587,10 @@ interface CompositeStats {
|
|
|
578
587
|
cached: number;
|
|
579
588
|
/** Steps actually run, summed over tiles. */
|
|
580
589
|
stepsRun: number;
|
|
590
|
+
/** Layers whose effect maps were built over their whole region. */
|
|
591
|
+
effectsBuilt: number;
|
|
592
|
+
/** Layers whose effect maps were rebuilt only around a change and patched in. */
|
|
593
|
+
effectsPatched: number;
|
|
581
594
|
}
|
|
582
595
|
declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S extends RasterSources = RasterSources> {
|
|
583
596
|
private readonly profile;
|
|
@@ -603,6 +616,9 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
603
616
|
private fxContext;
|
|
604
617
|
lastStats: CompositeStats;
|
|
605
618
|
private hint;
|
|
619
|
+
/** The `dirty` rectangles of the current call, as passed. */
|
|
620
|
+
private callDirty;
|
|
621
|
+
private callStats;
|
|
606
622
|
constructor(profile?: CompositorProfile<L, S>, options?: CompositorOptions);
|
|
607
623
|
/** Drops every cached tile and plane. */
|
|
608
624
|
clear(): void;
|
|
@@ -633,6 +649,12 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
633
649
|
/** Properties of a layer that change pixels, minus its surfaces (memoised per object). */
|
|
634
650
|
private propsKey;
|
|
635
651
|
private compositeTile;
|
|
652
|
+
/**
|
|
653
|
+
* Whether a tile with no part in this call's (grown) `dirty` rectangles changed only in what local
|
|
654
|
+
* effects read beyond it: every changed step is a pixel layer with local effects whose changes stay
|
|
655
|
+
* inside `dirty` (and so are farther than its margin), which leaves the tile's pixels as they were.
|
|
656
|
+
*/
|
|
657
|
+
private changedOnlyNearby;
|
|
636
658
|
private entryBytes;
|
|
637
659
|
private evict;
|
|
638
660
|
private stepSig;
|
|
@@ -650,6 +672,8 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
650
672
|
* the effects' margin, within the canvas grown the same.
|
|
651
673
|
*/
|
|
652
674
|
private effectRegion;
|
|
675
|
+
/** The signature of a layer's shape (its surface tiles and mask refs) per tile of `region`. */
|
|
676
|
+
private shapeSigs;
|
|
653
677
|
/** The surface tiles (and mask refs) a layer's shape reads over `region`. */
|
|
654
678
|
private shapeRefs;
|
|
655
679
|
private lightKey;
|
|
@@ -661,6 +685,17 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
661
685
|
private effectSig;
|
|
662
686
|
/** A layer's effect maps over its region (cached; see the module comment). */
|
|
663
687
|
private effectMapsOf;
|
|
688
|
+
/**
|
|
689
|
+
* Where a layer's shape may differ from the one `prev` was built from: the tiles whose signature
|
|
690
|
+
* changed (a tile new to the region that reads nothing did not), narrowed to this call's `dirty`
|
|
691
|
+
* rectangles when `prev` is from the previous call and they cover every change of the shape.
|
|
692
|
+
*/
|
|
693
|
+
private shapeChanges;
|
|
694
|
+
/**
|
|
695
|
+
* Whether a change to a layer stays inside the `dirty` rectangles that name it: a pixel layer
|
|
696
|
+
* without filters or a feathered or parametric mask (those spread a change beyond it).
|
|
697
|
+
*/
|
|
698
|
+
private dirtyCoversShape;
|
|
664
699
|
/** A layer's alpha over `r` after its mask (0..1, quantised to bytes as tiles see it). */
|
|
665
700
|
private layerShape;
|
|
666
701
|
/** A content or group layer's own pixels over `r` with its mask applied to alpha, or `null` when empty. */
|
|
@@ -713,6 +748,96 @@ type Edge = BlurEdge;
|
|
|
713
748
|
*/
|
|
714
749
|
declare function gaussianBlur(src: ArrayLike<number>, w: number, h: number, sigma: number, edge?: Edge): Float32Array;
|
|
715
750
|
|
|
751
|
+
/**
|
|
752
|
+
* Resampling tiled surfaces through geometric maps: Free Transform (scale, rotate, skew, distort,
|
|
753
|
+
* perspective: one projective map) and Warp (any forward map, such as a Bézier mesh).
|
|
754
|
+
*
|
|
755
|
+
* - Inverse mapping per destination tile: each destination tile reads only the source window its
|
|
756
|
+
* pixels map into, so memory stays bounded by one tile's footprint, and the result is a new
|
|
757
|
+
* copy-on-write surface (an identity or a whole-pixel move returns the source, or shares its
|
|
758
|
+
* tiles).
|
|
759
|
+
* - Nearest, bilinear and Photoshop's Bicubic (the Keys cubic at a = −0.75). Colour is sampled
|
|
760
|
+
* premultiplied by alpha, so partially transparent edges don't pick up the colour of the
|
|
761
|
+
* transparent pixels around them; outside the source everything is transparent.
|
|
762
|
+
* - Large reductions with Bicubic are pre-filtered: the source is box-averaged by whole factors
|
|
763
|
+
* first and the cubic widened by the rest, so shrinking a layer doesn't alias. Bilinear and
|
|
764
|
+
* nearest sample the source directly, as Photoshop's do.
|
|
765
|
+
* - Masks (one channel) are warped as "value + inside": outside the source and outside the warped
|
|
766
|
+
* area they read as the surface's default value, so a reveal-all mask stays white around a
|
|
767
|
+
* transformed hole.
|
|
768
|
+
* - A Distort dragged past the horizon draws only the side of the horizon most of the source maps
|
|
769
|
+
* to (no mirrored copy wrapped round infinity).
|
|
770
|
+
*
|
|
771
|
+
* No DOM: runs in Node, tests and workers.
|
|
772
|
+
*/
|
|
773
|
+
|
|
774
|
+
/** Resampling of a transform (Photoshop's interpolation menu). */
|
|
775
|
+
type Interpolation = 'nearest' | 'bilinear' | 'bicubic';
|
|
776
|
+
declare const INTERPOLATIONS: readonly Interpolation[];
|
|
777
|
+
declare function isInterpolation(value: unknown): value is Interpolation;
|
|
778
|
+
/**
|
|
779
|
+
* The largest result (pixels) one resample may build: about 11 600 × 11 600. Only the size of the
|
|
780
|
+
* result counts, not where it lands. A scale past it is refused rather than clipped.
|
|
781
|
+
*/
|
|
782
|
+
declare const MAX_TRANSFORM_PIXELS: number;
|
|
783
|
+
/** A transform whose result would be too large; the message gives the size and the limit. */
|
|
784
|
+
declare class TransformTooLargeError extends Error {
|
|
785
|
+
constructor(message: string);
|
|
786
|
+
}
|
|
787
|
+
interface ResampleOptions {
|
|
788
|
+
/** Default `bicubic`. */
|
|
789
|
+
interpolation?: Interpolation;
|
|
790
|
+
/** The source region to transform (default: the surface's content bounds). Pixels outside it are not moved. */
|
|
791
|
+
source?: RasterRect;
|
|
792
|
+
/** Keep only destination pixels inside this rectangle (a preview of the visible area). */
|
|
793
|
+
clip?: RasterRect;
|
|
794
|
+
/**
|
|
795
|
+
* Preview speed-up: sample once per `step × step` block of destination pixels and fill the
|
|
796
|
+
* block (a power of two, 1..64; default 1, every pixel).
|
|
797
|
+
*/
|
|
798
|
+
step?: number;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Photoshop's Bicubic: the Keys cubic at a = −0.75 (Catmull-Rom is −0.5). Measured on Photoshop
|
|
802
|
+
* 27.11's Free Transform by photocraft: a 200 % step edge matches within 0.5 levels.
|
|
803
|
+
*/
|
|
804
|
+
declare function keysWeight(x: number): number;
|
|
805
|
+
/**
|
|
806
|
+
* The surface box-averaged by `factor` (a whole number ≥ 1) in both directions: reduced pixel
|
|
807
|
+
* (i, j) covers pixels [i·factor, (i+1)·factor) of each axis. For previews: transform the reduced
|
|
808
|
+
* surface through the map composed with a scale by `factor`, so a preview at a low zoom reads a
|
|
809
|
+
* fraction of the pixels.
|
|
810
|
+
*/
|
|
811
|
+
declare function reduceSurface(src: TiledSurface, factor: number): TiledSurface;
|
|
812
|
+
/** The destination rectangle `transformSurface` fills for `source` under `h`, or `null` when it is empty or unbounded. */
|
|
813
|
+
declare function transformedBounds(source: RasterRect, h: Homography): RasterRect | null;
|
|
814
|
+
/**
|
|
815
|
+
* The surface's content inside `options.source` (default: all of it) warped by `h` (source →
|
|
816
|
+
* destination, both in the surface's pixel space). Pixels outside the warped area are the default
|
|
817
|
+
* (transparent for layers). Throws `TransformTooLargeError` past `MAX_TRANSFORM_PIXELS`.
|
|
818
|
+
*/
|
|
819
|
+
declare function transformSurface(src: TiledSurface, h: Homography, options?: ResampleOptions): TiledSurface;
|
|
820
|
+
/**
|
|
821
|
+
* The surface's content inside `options.source` (default: all of it) warped through the forward
|
|
822
|
+
* map `f` (source → destination pixel space; `null` where it is undefined).
|
|
823
|
+
*
|
|
824
|
+
* The source rectangle is subdivided into a fine grid whose vertices are mapped forward; each
|
|
825
|
+
* cell's two triangles are rasterized in destination space with the source position interpolated
|
|
826
|
+
* barycentrically, then the source is sampled there. Cells are a few source pixels across, so the
|
|
827
|
+
* piecewise-affine inverse is within a small fraction of a pixel of the true one; affine maps (the
|
|
828
|
+
* identity included) are reproduced exactly. Where the warp shrinks the source, each pixel instead
|
|
829
|
+
* averages a grid of bilinear subsamples over its source footprint, so thin lines don't alias.
|
|
830
|
+
* Where the warp folds over itself the later (lower-right) cell wins.
|
|
831
|
+
*/
|
|
832
|
+
declare function warpSurface(src: TiledSurface, f: (p: Vec2) => Vec2 | null, options?: ResampleOptions): TiledSurface;
|
|
833
|
+
/**
|
|
834
|
+
* `top` (RGBA, straight alpha) composited over `base` with the Normal blend. A one-channel `base`
|
|
835
|
+
* (a mask) takes `top`'s red channel as the value, weighted by its alpha: that is how a moved part
|
|
836
|
+
* of a mask travels (value and coverage) and lands. Only tiles `top` stores are touched, so every
|
|
837
|
+
* other tile of `base` stays shared.
|
|
838
|
+
*/
|
|
839
|
+
declare function compositeSurfaceOver(base: TiledSurface, top: TiledSurface): TiledSurface;
|
|
840
|
+
|
|
716
841
|
/**
|
|
717
842
|
* Curve lookup tables shared by Curves adjustments and layer-effect contours.
|
|
718
843
|
*/
|
|
@@ -803,6 +928,20 @@ declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
|
|
|
803
928
|
* `rect` should cover the layer's shape plus the effects' margin.
|
|
804
929
|
*/
|
|
805
930
|
declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
|
|
931
|
+
/**
|
|
932
|
+
* `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
|
|
933
|
+
* inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
|
|
934
|
+
* deal (the change covers much of the region) or the effects are not local
|
|
935
|
+
* ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
|
|
936
|
+
* `margin` px, and `shapeOver(r)` returns the new shape over `r`.
|
|
937
|
+
*
|
|
938
|
+
* Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
|
|
939
|
+
* within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
|
|
940
|
+
* is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
|
|
941
|
+
* so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
|
|
942
|
+
* when `rect` is unchanged.
|
|
943
|
+
*/
|
|
944
|
+
declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
|
|
806
945
|
/** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
|
|
807
946
|
declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
|
|
808
947
|
x: number;
|
|
@@ -904,4 +1043,4 @@ declare function deflateRaw(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
|
904
1043
|
/** zlib stream: header, raw deflate, Adler-32. */
|
|
905
1044
|
declare function deflate(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
906
1045
|
|
|
907
|
-
export { type BevelContour, type BevelEmbossEffect, type BevelStyle, type BevelTechnique, type BevelTexture, BlendMode, type BlurEdge, CURVE_LUT_SIZE, type ColorOverlayEffect, type CompositeCallOptions, type CompositeStats, type CompositorLayer, type CompositorOptions, type CompositorProfile, type ContourPoint, DEFAULT_GLOBAL_LIGHT, DIRECT_GAUSSIAN_MAX_SIGMA, type DecodedPng, type DropShadowEffect, type EffectCompositeInput, type EffectContext, type EffectContour, type EffectFill, type EffectGradient, type EffectMaps, type EffectPattern, type EffectPatternRef, type EffectRect, type GlobalLight, type GlowTechnique, type GradientColorStop, type GradientOpacityStop, type GradientOverlayEffect, type GradientStyle, type GroupBlendMode, type GroupIn, type InnerGlowEffect, type InnerShadowEffect, LAYER_EFFECT_KINDS, type LayerEffect, LayerEffectError, type LayerEffectKind, type LayerEffects, type LayerLocation, type LayerLocks, MAX_EFFECT_REACH, MaskSurface, type OuterGlowEffect, type PatternOverlayEffect, PatternPlacement, PatternTile, type PixelFilterSpec, PixelSurface, RasterCompositor, type RasterGroupLayer, type RasterLayer, type RasterLayerBase, type RasterMask, type RasterNode, type RasterPixelLayer, RasterRect, type RasterSources, STROKE_CHAMFER_MAX, type SatinEffect, type StrokeEffect, type StrokePosition, TileKey, TiledSurface, ZlibError, activeEffectItems, adler32, base64ToBytes, blendTile, buildEffectMaps, builtinPattern, builtinPatternIds, bytesToBase64, changedTiles, compositeLayerEffects, contourLut, curveLut, decodePng, defaultEffectGradient, defaultLayerEffect, deflate, deflateRaw, effectColorHex, effectReach, effectsAreLocal, effectsFingerprint, effectsMargin, effectsScale, encodePng, findLayer, flattenLayers, gaussianBlur, gradientT, hasActiveEffects, hashNoise, inflate, inflateRaw, insertLayer, isLayerEffectKind, isLayerLocked, isPng, layerEffectFields, layerEffectLabel, mapLayer, mergeLayerEffect, newEffectId, normalizeLayerEffects, parseDataUrl, parseEffectColor, pngDataUrl, renderLayerEffects, scaleLayerEffect, validateEffectGradient, validateLayerEffect, validateLayerEffects };
|
|
1046
|
+
export { type BevelContour, type BevelEmbossEffect, type BevelStyle, type BevelTechnique, type BevelTexture, BlendMode, type BlurEdge, CURVE_LUT_SIZE, type ColorOverlayEffect, type CompositeCallOptions, type CompositeStats, type CompositorLayer, type CompositorOptions, type CompositorProfile, type ContourPoint, DEFAULT_GLOBAL_LIGHT, DIRECT_GAUSSIAN_MAX_SIGMA, type DecodedPng, type DropShadowEffect, type EffectCompositeInput, type EffectContext, type EffectContour, type EffectFill, type EffectGradient, type EffectMaps, type EffectPattern, type EffectPatternRef, type EffectRect, type GlobalLight, type GlowTechnique, type GradientColorStop, type GradientOpacityStop, type GradientOverlayEffect, type GradientStyle, type GroupBlendMode, type GroupIn, INTERPOLATIONS, type InnerGlowEffect, type InnerShadowEffect, type Interpolation, LAYER_EFFECT_KINDS, type LayerEffect, LayerEffectError, type LayerEffectKind, type LayerEffects, type LayerLocation, type LayerLocks, MAX_EFFECT_REACH, MAX_TRANSFORM_PIXELS, MaskSurface, type OuterGlowEffect, type PatternOverlayEffect, PatternPlacement, PatternTile, type PixelFilterSpec, PixelSurface, RasterCompositor, type RasterGroupLayer, type RasterLayer, type RasterLayerBase, type RasterMask, type RasterNode, type RasterPixelLayer, RasterRect, type RasterSources, type ResampleOptions, STROKE_CHAMFER_MAX, type SatinEffect, type StrokeEffect, type StrokePosition, TileKey, TiledSurface, TransformTooLargeError, ZlibError, activeEffectItems, adler32, base64ToBytes, blendTile, buildEffectMaps, builtinPattern, builtinPatternIds, bytesToBase64, changedTiles, compositeLayerEffects, compositeSurfaceOver, contourLut, curveLut, decodePng, defaultEffectGradient, defaultLayerEffect, deflate, deflateRaw, effectColorHex, effectReach, effectsAreLocal, effectsFingerprint, effectsMargin, effectsScale, encodePng, findLayer, flattenLayers, gaussianBlur, gradientT, hasActiveEffects, hashNoise, inflate, inflateRaw, insertLayer, isInterpolation, isLayerEffectKind, isLayerLocked, isPng, keysWeight, layerEffectFields, layerEffectLabel, mapLayer, mergeLayerEffect, newEffectId, normalizeLayerEffects, parseDataUrl, parseEffectColor, patchEffectMaps, pngDataUrl, reduceSurface, renderLayerEffects, scaleLayerEffect, transformSurface, transformedBounds, validateEffectGradient, validateLayerEffect, validateLayerEffects, warpSurface };
|
package/dist/raster/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { B as BlendMode, M as MaskSurface, P as PixelSurface, R as RasterRect, T as TiledSurface, h as TileKey } from '../surface-DIA-XatS.js';
|
|
2
2
|
export { a as BLEND_MODES, b as BlendModeInfo, c as Rgb, d as Rgba, S as SurfaceDraft, e as TILE, f as TILE_SHIFT, g as Tile, 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';
|
|
3
|
+
import { H as Homography, V as Vec2 } from '../types-CwMPoRMU.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Layer effects (Photoshop's layer styles) as data: drop and inner shadows, outer and inner
|
|
@@ -396,6 +397,11 @@ interface RasterMask<Source = unknown> {
|
|
|
396
397
|
feather?: number;
|
|
397
398
|
/** `false` keeps the mask but ignores it. */
|
|
398
399
|
enabled?: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* `false` unlinks the mask from its layer (Photoshop's chain icon): moving or transforming the
|
|
402
|
+
* layer's pixels leaves the mask where it is. Missing = linked.
|
|
403
|
+
*/
|
|
404
|
+
linked?: boolean;
|
|
399
405
|
source?: Source;
|
|
400
406
|
}
|
|
401
407
|
interface RasterLayerBase {
|
|
@@ -414,7 +420,7 @@ interface RasterLayerBase {
|
|
|
414
420
|
}
|
|
415
421
|
interface RasterPixelLayer extends RasterLayerBase {
|
|
416
422
|
type: 'pixel';
|
|
417
|
-
/** Pixels in layer space; document position = layer position + `offset`. A mask moves with it. */
|
|
423
|
+
/** Pixels in layer space; document position = layer position + `offset`. A linked mask moves with it. */
|
|
418
424
|
surface: PixelSurface;
|
|
419
425
|
/** Integer move without re-tiling. */
|
|
420
426
|
offset: {
|
|
@@ -485,6 +491,8 @@ declare function isLayerLocked(layer: {
|
|
|
485
491
|
* - Layer effects: a layer's effect maps (shadow, glow, bevel, stroke distance fields) are built
|
|
486
492
|
* once over the layer's region (its bounds grown by the effects' margin, within the canvas grown
|
|
487
493
|
* the same) and cached by the identity of every surface tile the shape reads; tiles crop them.
|
|
494
|
+
* When only some of those tiles changed and every effect is local, the maps are rebuilt only
|
|
495
|
+
* within the margin of the change (narrowed by `dirty` when it covers the change) and patched in.
|
|
488
496
|
* A tile's signature then reads the layer within the margin around it (or the whole region when
|
|
489
497
|
* an effect is laid out over the layer's bounds), and `dirty` rectangles grow by the margin.
|
|
490
498
|
*/
|
|
@@ -560,8 +568,9 @@ interface CompositeCallOptions {
|
|
|
560
568
|
checkpointLayerId?: string | null;
|
|
561
569
|
/**
|
|
562
570
|
* Where the layers changed since the previous call, when the caller knows (a stroke's dabs).
|
|
563
|
-
* Changed tiles are then recomposited only inside these rectangles
|
|
564
|
-
*
|
|
571
|
+
* Changed tiles are then recomposited only inside these rectangles (grown by the effects' reach),
|
|
572
|
+
* tiles they miss keep their pixels, and effect maps are rebuilt only around them. Changes outside
|
|
573
|
+
* them would be missed, so pass nothing when unsure.
|
|
565
574
|
*/
|
|
566
575
|
dirty?: RasterRect[];
|
|
567
576
|
}
|
|
@@ -578,6 +587,10 @@ interface CompositeStats {
|
|
|
578
587
|
cached: number;
|
|
579
588
|
/** Steps actually run, summed over tiles. */
|
|
580
589
|
stepsRun: number;
|
|
590
|
+
/** Layers whose effect maps were built over their whole region. */
|
|
591
|
+
effectsBuilt: number;
|
|
592
|
+
/** Layers whose effect maps were rebuilt only around a change and patched in. */
|
|
593
|
+
effectsPatched: number;
|
|
581
594
|
}
|
|
582
595
|
declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S extends RasterSources = RasterSources> {
|
|
583
596
|
private readonly profile;
|
|
@@ -603,6 +616,9 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
603
616
|
private fxContext;
|
|
604
617
|
lastStats: CompositeStats;
|
|
605
618
|
private hint;
|
|
619
|
+
/** The `dirty` rectangles of the current call, as passed. */
|
|
620
|
+
private callDirty;
|
|
621
|
+
private callStats;
|
|
606
622
|
constructor(profile?: CompositorProfile<L, S>, options?: CompositorOptions);
|
|
607
623
|
/** Drops every cached tile and plane. */
|
|
608
624
|
clear(): void;
|
|
@@ -633,6 +649,12 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
633
649
|
/** Properties of a layer that change pixels, minus its surfaces (memoised per object). */
|
|
634
650
|
private propsKey;
|
|
635
651
|
private compositeTile;
|
|
652
|
+
/**
|
|
653
|
+
* Whether a tile with no part in this call's (grown) `dirty` rectangles changed only in what local
|
|
654
|
+
* effects read beyond it: every changed step is a pixel layer with local effects whose changes stay
|
|
655
|
+
* inside `dirty` (and so are farther than its margin), which leaves the tile's pixels as they were.
|
|
656
|
+
*/
|
|
657
|
+
private changedOnlyNearby;
|
|
636
658
|
private entryBytes;
|
|
637
659
|
private evict;
|
|
638
660
|
private stepSig;
|
|
@@ -650,6 +672,8 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
650
672
|
* the effects' margin, within the canvas grown the same.
|
|
651
673
|
*/
|
|
652
674
|
private effectRegion;
|
|
675
|
+
/** The signature of a layer's shape (its surface tiles and mask refs) per tile of `region`. */
|
|
676
|
+
private shapeSigs;
|
|
653
677
|
/** The surface tiles (and mask refs) a layer's shape reads over `region`. */
|
|
654
678
|
private shapeRefs;
|
|
655
679
|
private lightKey;
|
|
@@ -661,6 +685,17 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
661
685
|
private effectSig;
|
|
662
686
|
/** A layer's effect maps over its region (cached; see the module comment). */
|
|
663
687
|
private effectMapsOf;
|
|
688
|
+
/**
|
|
689
|
+
* Where a layer's shape may differ from the one `prev` was built from: the tiles whose signature
|
|
690
|
+
* changed (a tile new to the region that reads nothing did not), narrowed to this call's `dirty`
|
|
691
|
+
* rectangles when `prev` is from the previous call and they cover every change of the shape.
|
|
692
|
+
*/
|
|
693
|
+
private shapeChanges;
|
|
694
|
+
/**
|
|
695
|
+
* Whether a change to a layer stays inside the `dirty` rectangles that name it: a pixel layer
|
|
696
|
+
* without filters or a feathered or parametric mask (those spread a change beyond it).
|
|
697
|
+
*/
|
|
698
|
+
private dirtyCoversShape;
|
|
664
699
|
/** A layer's alpha over `r` after its mask (0..1, quantised to bytes as tiles see it). */
|
|
665
700
|
private layerShape;
|
|
666
701
|
/** A content or group layer's own pixels over `r` with its mask applied to alpha, or `null` when empty. */
|
|
@@ -713,6 +748,96 @@ type Edge = BlurEdge;
|
|
|
713
748
|
*/
|
|
714
749
|
declare function gaussianBlur(src: ArrayLike<number>, w: number, h: number, sigma: number, edge?: Edge): Float32Array;
|
|
715
750
|
|
|
751
|
+
/**
|
|
752
|
+
* Resampling tiled surfaces through geometric maps: Free Transform (scale, rotate, skew, distort,
|
|
753
|
+
* perspective: one projective map) and Warp (any forward map, such as a Bézier mesh).
|
|
754
|
+
*
|
|
755
|
+
* - Inverse mapping per destination tile: each destination tile reads only the source window its
|
|
756
|
+
* pixels map into, so memory stays bounded by one tile's footprint, and the result is a new
|
|
757
|
+
* copy-on-write surface (an identity or a whole-pixel move returns the source, or shares its
|
|
758
|
+
* tiles).
|
|
759
|
+
* - Nearest, bilinear and Photoshop's Bicubic (the Keys cubic at a = −0.75). Colour is sampled
|
|
760
|
+
* premultiplied by alpha, so partially transparent edges don't pick up the colour of the
|
|
761
|
+
* transparent pixels around them; outside the source everything is transparent.
|
|
762
|
+
* - Large reductions with Bicubic are pre-filtered: the source is box-averaged by whole factors
|
|
763
|
+
* first and the cubic widened by the rest, so shrinking a layer doesn't alias. Bilinear and
|
|
764
|
+
* nearest sample the source directly, as Photoshop's do.
|
|
765
|
+
* - Masks (one channel) are warped as "value + inside": outside the source and outside the warped
|
|
766
|
+
* area they read as the surface's default value, so a reveal-all mask stays white around a
|
|
767
|
+
* transformed hole.
|
|
768
|
+
* - A Distort dragged past the horizon draws only the side of the horizon most of the source maps
|
|
769
|
+
* to (no mirrored copy wrapped round infinity).
|
|
770
|
+
*
|
|
771
|
+
* No DOM: runs in Node, tests and workers.
|
|
772
|
+
*/
|
|
773
|
+
|
|
774
|
+
/** Resampling of a transform (Photoshop's interpolation menu). */
|
|
775
|
+
type Interpolation = 'nearest' | 'bilinear' | 'bicubic';
|
|
776
|
+
declare const INTERPOLATIONS: readonly Interpolation[];
|
|
777
|
+
declare function isInterpolation(value: unknown): value is Interpolation;
|
|
778
|
+
/**
|
|
779
|
+
* The largest result (pixels) one resample may build: about 11 600 × 11 600. Only the size of the
|
|
780
|
+
* result counts, not where it lands. A scale past it is refused rather than clipped.
|
|
781
|
+
*/
|
|
782
|
+
declare const MAX_TRANSFORM_PIXELS: number;
|
|
783
|
+
/** A transform whose result would be too large; the message gives the size and the limit. */
|
|
784
|
+
declare class TransformTooLargeError extends Error {
|
|
785
|
+
constructor(message: string);
|
|
786
|
+
}
|
|
787
|
+
interface ResampleOptions {
|
|
788
|
+
/** Default `bicubic`. */
|
|
789
|
+
interpolation?: Interpolation;
|
|
790
|
+
/** The source region to transform (default: the surface's content bounds). Pixels outside it are not moved. */
|
|
791
|
+
source?: RasterRect;
|
|
792
|
+
/** Keep only destination pixels inside this rectangle (a preview of the visible area). */
|
|
793
|
+
clip?: RasterRect;
|
|
794
|
+
/**
|
|
795
|
+
* Preview speed-up: sample once per `step × step` block of destination pixels and fill the
|
|
796
|
+
* block (a power of two, 1..64; default 1, every pixel).
|
|
797
|
+
*/
|
|
798
|
+
step?: number;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Photoshop's Bicubic: the Keys cubic at a = −0.75 (Catmull-Rom is −0.5). Measured on Photoshop
|
|
802
|
+
* 27.11's Free Transform by photocraft: a 200 % step edge matches within 0.5 levels.
|
|
803
|
+
*/
|
|
804
|
+
declare function keysWeight(x: number): number;
|
|
805
|
+
/**
|
|
806
|
+
* The surface box-averaged by `factor` (a whole number ≥ 1) in both directions: reduced pixel
|
|
807
|
+
* (i, j) covers pixels [i·factor, (i+1)·factor) of each axis. For previews: transform the reduced
|
|
808
|
+
* surface through the map composed with a scale by `factor`, so a preview at a low zoom reads a
|
|
809
|
+
* fraction of the pixels.
|
|
810
|
+
*/
|
|
811
|
+
declare function reduceSurface(src: TiledSurface, factor: number): TiledSurface;
|
|
812
|
+
/** The destination rectangle `transformSurface` fills for `source` under `h`, or `null` when it is empty or unbounded. */
|
|
813
|
+
declare function transformedBounds(source: RasterRect, h: Homography): RasterRect | null;
|
|
814
|
+
/**
|
|
815
|
+
* The surface's content inside `options.source` (default: all of it) warped by `h` (source →
|
|
816
|
+
* destination, both in the surface's pixel space). Pixels outside the warped area are the default
|
|
817
|
+
* (transparent for layers). Throws `TransformTooLargeError` past `MAX_TRANSFORM_PIXELS`.
|
|
818
|
+
*/
|
|
819
|
+
declare function transformSurface(src: TiledSurface, h: Homography, options?: ResampleOptions): TiledSurface;
|
|
820
|
+
/**
|
|
821
|
+
* The surface's content inside `options.source` (default: all of it) warped through the forward
|
|
822
|
+
* map `f` (source → destination pixel space; `null` where it is undefined).
|
|
823
|
+
*
|
|
824
|
+
* The source rectangle is subdivided into a fine grid whose vertices are mapped forward; each
|
|
825
|
+
* cell's two triangles are rasterized in destination space with the source position interpolated
|
|
826
|
+
* barycentrically, then the source is sampled there. Cells are a few source pixels across, so the
|
|
827
|
+
* piecewise-affine inverse is within a small fraction of a pixel of the true one; affine maps (the
|
|
828
|
+
* identity included) are reproduced exactly. Where the warp shrinks the source, each pixel instead
|
|
829
|
+
* averages a grid of bilinear subsamples over its source footprint, so thin lines don't alias.
|
|
830
|
+
* Where the warp folds over itself the later (lower-right) cell wins.
|
|
831
|
+
*/
|
|
832
|
+
declare function warpSurface(src: TiledSurface, f: (p: Vec2) => Vec2 | null, options?: ResampleOptions): TiledSurface;
|
|
833
|
+
/**
|
|
834
|
+
* `top` (RGBA, straight alpha) composited over `base` with the Normal blend. A one-channel `base`
|
|
835
|
+
* (a mask) takes `top`'s red channel as the value, weighted by its alpha: that is how a moved part
|
|
836
|
+
* of a mask travels (value and coverage) and lands. Only tiles `top` stores are touched, so every
|
|
837
|
+
* other tile of `base` stays shared.
|
|
838
|
+
*/
|
|
839
|
+
declare function compositeSurfaceOver(base: TiledSurface, top: TiledSurface): TiledSurface;
|
|
840
|
+
|
|
716
841
|
/**
|
|
717
842
|
* Curve lookup tables shared by Curves adjustments and layer-effect contours.
|
|
718
843
|
*/
|
|
@@ -803,6 +928,20 @@ declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
|
|
|
803
928
|
* `rect` should cover the layer's shape plus the effects' margin.
|
|
804
929
|
*/
|
|
805
930
|
declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
|
|
931
|
+
/**
|
|
932
|
+
* `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
|
|
933
|
+
* inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
|
|
934
|
+
* deal (the change covers much of the region) or the effects are not local
|
|
935
|
+
* ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
|
|
936
|
+
* `margin` px, and `shapeOver(r)` returns the new shape over `r`.
|
|
937
|
+
*
|
|
938
|
+
* Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
|
|
939
|
+
* within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
|
|
940
|
+
* is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
|
|
941
|
+
* so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
|
|
942
|
+
* when `rect` is unchanged.
|
|
943
|
+
*/
|
|
944
|
+
declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
|
|
806
945
|
/** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
|
|
807
946
|
declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
|
|
808
947
|
x: number;
|
|
@@ -904,4 +1043,4 @@ declare function deflateRaw(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
|
904
1043
|
/** zlib stream: header, raw deflate, Adler-32. */
|
|
905
1044
|
declare function deflate(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
906
1045
|
|
|
907
|
-
export { type BevelContour, type BevelEmbossEffect, type BevelStyle, type BevelTechnique, type BevelTexture, BlendMode, type BlurEdge, CURVE_LUT_SIZE, type ColorOverlayEffect, type CompositeCallOptions, type CompositeStats, type CompositorLayer, type CompositorOptions, type CompositorProfile, type ContourPoint, DEFAULT_GLOBAL_LIGHT, DIRECT_GAUSSIAN_MAX_SIGMA, type DecodedPng, type DropShadowEffect, type EffectCompositeInput, type EffectContext, type EffectContour, type EffectFill, type EffectGradient, type EffectMaps, type EffectPattern, type EffectPatternRef, type EffectRect, type GlobalLight, type GlowTechnique, type GradientColorStop, type GradientOpacityStop, type GradientOverlayEffect, type GradientStyle, type GroupBlendMode, type GroupIn, type InnerGlowEffect, type InnerShadowEffect, LAYER_EFFECT_KINDS, type LayerEffect, LayerEffectError, type LayerEffectKind, type LayerEffects, type LayerLocation, type LayerLocks, MAX_EFFECT_REACH, MaskSurface, type OuterGlowEffect, type PatternOverlayEffect, PatternPlacement, PatternTile, type PixelFilterSpec, PixelSurface, RasterCompositor, type RasterGroupLayer, type RasterLayer, type RasterLayerBase, type RasterMask, type RasterNode, type RasterPixelLayer, RasterRect, type RasterSources, STROKE_CHAMFER_MAX, type SatinEffect, type StrokeEffect, type StrokePosition, TileKey, TiledSurface, ZlibError, activeEffectItems, adler32, base64ToBytes, blendTile, buildEffectMaps, builtinPattern, builtinPatternIds, bytesToBase64, changedTiles, compositeLayerEffects, contourLut, curveLut, decodePng, defaultEffectGradient, defaultLayerEffect, deflate, deflateRaw, effectColorHex, effectReach, effectsAreLocal, effectsFingerprint, effectsMargin, effectsScale, encodePng, findLayer, flattenLayers, gaussianBlur, gradientT, hasActiveEffects, hashNoise, inflate, inflateRaw, insertLayer, isLayerEffectKind, isLayerLocked, isPng, layerEffectFields, layerEffectLabel, mapLayer, mergeLayerEffect, newEffectId, normalizeLayerEffects, parseDataUrl, parseEffectColor, pngDataUrl, renderLayerEffects, scaleLayerEffect, validateEffectGradient, validateLayerEffect, validateLayerEffects };
|
|
1046
|
+
export { type BevelContour, type BevelEmbossEffect, type BevelStyle, type BevelTechnique, type BevelTexture, BlendMode, type BlurEdge, CURVE_LUT_SIZE, type ColorOverlayEffect, type CompositeCallOptions, type CompositeStats, type CompositorLayer, type CompositorOptions, type CompositorProfile, type ContourPoint, DEFAULT_GLOBAL_LIGHT, DIRECT_GAUSSIAN_MAX_SIGMA, type DecodedPng, type DropShadowEffect, type EffectCompositeInput, type EffectContext, type EffectContour, type EffectFill, type EffectGradient, type EffectMaps, type EffectPattern, type EffectPatternRef, type EffectRect, type GlobalLight, type GlowTechnique, type GradientColorStop, type GradientOpacityStop, type GradientOverlayEffect, type GradientStyle, type GroupBlendMode, type GroupIn, INTERPOLATIONS, type InnerGlowEffect, type InnerShadowEffect, type Interpolation, LAYER_EFFECT_KINDS, type LayerEffect, LayerEffectError, type LayerEffectKind, type LayerEffects, type LayerLocation, type LayerLocks, MAX_EFFECT_REACH, MAX_TRANSFORM_PIXELS, MaskSurface, type OuterGlowEffect, type PatternOverlayEffect, PatternPlacement, PatternTile, type PixelFilterSpec, PixelSurface, RasterCompositor, type RasterGroupLayer, type RasterLayer, type RasterLayerBase, type RasterMask, type RasterNode, type RasterPixelLayer, RasterRect, type RasterSources, type ResampleOptions, STROKE_CHAMFER_MAX, type SatinEffect, type StrokeEffect, type StrokePosition, TileKey, TiledSurface, TransformTooLargeError, ZlibError, activeEffectItems, adler32, base64ToBytes, blendTile, buildEffectMaps, builtinPattern, builtinPatternIds, bytesToBase64, changedTiles, compositeLayerEffects, compositeSurfaceOver, contourLut, curveLut, decodePng, defaultEffectGradient, defaultLayerEffect, deflate, deflateRaw, effectColorHex, effectReach, effectsAreLocal, effectsFingerprint, effectsMargin, effectsScale, encodePng, findLayer, flattenLayers, gaussianBlur, gradientT, hasActiveEffects, hashNoise, inflate, inflateRaw, insertLayer, isInterpolation, isLayerEffectKind, isLayerLocked, isPng, keysWeight, layerEffectFields, layerEffectLabel, mapLayer, mergeLayerEffect, newEffectId, normalizeLayerEffects, parseDataUrl, parseEffectColor, patchEffectMaps, pngDataUrl, reduceSurface, renderLayerEffects, scaleLayerEffect, transformSurface, transformedBounds, validateEffectGradient, validateLayerEffect, validateLayerEffects, warpSurface };
|