@pixerate/editor 0.96.0 → 0.97.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/dist/{chunk-T422YCHR.cjs → chunk-4AB5BHYK.cjs} +237 -63
- package/dist/chunk-4AB5BHYK.cjs.map +1 -0
- package/dist/{chunk-KFTQ2PKP.js → chunk-OEVSVA6V.js} +214 -40
- package/dist/chunk-OEVSVA6V.js.map +1 -0
- package/dist/image-editor/index.cjs +413 -235
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +75 -1
- package/dist/image-editor/index.d.ts +75 -1
- package/dist/image-editor/index.js +254 -76
- package/dist/image-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +4 -2
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +46 -3
- package/dist/raster/index.d.ts +46 -3
- package/dist/raster/index.js +3 -1
- package/package.json +1 -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,8 @@
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
var _chunk4AB5BHYKcjs = require('../chunk-4AB5BHYK.cjs');
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
|
|
@@ -197,5 +198,6 @@ var _chunkCRMAXIUVcjs = require('../chunk-CRMAXIUV.cjs');
|
|
|
197
198
|
|
|
198
199
|
|
|
199
200
|
|
|
200
|
-
|
|
201
|
+
|
|
202
|
+
exports.BLEND_MODES = _chunkCRMAXIUVcjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunk4AB5BHYKcjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunk4AB5BHYKcjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunk4AB5BHYKcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.LAYER_EFFECT_KINDS = _chunk4AB5BHYKcjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunk4AB5BHYKcjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunk4AB5BHYKcjs.MAX_EFFECT_REACH; exports.PatternPlacement = _chunk4AB5BHYKcjs.PatternPlacement; exports.PatternTile = _chunk4AB5BHYKcjs.PatternTile; exports.RasterCompositor = _chunk4AB5BHYKcjs.RasterCompositor; exports.STROKE_CHAMFER_MAX = _chunk4AB5BHYKcjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunkCRMAXIUVcjs.SurfaceDraft; exports.TILE = _chunkCRMAXIUVcjs.TILE; exports.TILE_SHIFT = _chunkCRMAXIUVcjs.TILE_SHIFT; exports.TiledSurface = _chunkCRMAXIUVcjs.TiledSurface; exports.ZlibError = _chunk4AB5BHYKcjs.ZlibError; exports.activeEffectItems = _chunk4AB5BHYKcjs.activeEffectItems; exports.adler32 = _chunk4AB5BHYKcjs.adler32; exports.base64ToBytes = _chunk4AB5BHYKcjs.base64ToBytes; exports.blendChannel = _chunkCRMAXIUVcjs.blendChannel; exports.blendImageData = _chunkCRMAXIUVcjs.blendImageData; exports.blendLum = _chunkCRMAXIUVcjs.blendLum; exports.blendPixel = _chunkCRMAXIUVcjs.blendPixel; exports.blendRgb = _chunkCRMAXIUVcjs.blendRgb; exports.blendTile = _chunk4AB5BHYKcjs.blendTile; exports.buildEffectMaps = _chunk4AB5BHYKcjs.buildEffectMaps; exports.builtinPattern = _chunk4AB5BHYKcjs.builtinPattern; exports.builtinPatternIds = _chunk4AB5BHYKcjs.builtinPatternIds; exports.bytesToBase64 = _chunk4AB5BHYKcjs.bytesToBase64; exports.canvasCompositeOperation = _chunkCRMAXIUVcjs.canvasCompositeOperation; exports.changedTiles = _chunk4AB5BHYKcjs.changedTiles; exports.collectTiles = _chunkCRMAXIUVcjs.collectTiles; exports.compositeLayerEffects = _chunk4AB5BHYKcjs.compositeLayerEffects; exports.contentBounds = _chunkCRMAXIUVcjs.contentBounds; exports.contourLut = _chunk4AB5BHYKcjs.contourLut; exports.curveLut = _chunk4AB5BHYKcjs.curveLut; exports.decodePng = _chunk4AB5BHYKcjs.decodePng; exports.defaultEffectGradient = _chunk4AB5BHYKcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunk4AB5BHYKcjs.defaultLayerEffect; exports.deflate = _chunk4AB5BHYKcjs.deflate; exports.deflateRaw = _chunk4AB5BHYKcjs.deflateRaw; exports.effectColorHex = _chunk4AB5BHYKcjs.effectColorHex; exports.effectReach = _chunk4AB5BHYKcjs.effectReach; exports.effectsAreLocal = _chunk4AB5BHYKcjs.effectsAreLocal; exports.effectsFingerprint = _chunk4AB5BHYKcjs.effectsFingerprint; exports.effectsMargin = _chunk4AB5BHYKcjs.effectsMargin; exports.effectsScale = _chunk4AB5BHYKcjs.effectsScale; exports.emptySurface = _chunkCRMAXIUVcjs.emptySurface; exports.encodePng = _chunk4AB5BHYKcjs.encodePng; exports.fillRect = _chunkCRMAXIUVcjs.fillRect; exports.findLayer = _chunk4AB5BHYKcjs.findLayer; exports.finishTile = _chunkCRMAXIUVcjs.finishTile; exports.flattenLayers = _chunk4AB5BHYKcjs.flattenLayers; exports.gaussianBlur = _chunk4AB5BHYKcjs.gaussianBlur; exports.gradientT = _chunk4AB5BHYKcjs.gradientT; exports.hasActiveEffects = _chunk4AB5BHYKcjs.hasActiveEffects; exports.hashNoise = _chunk4AB5BHYKcjs.hashNoise; exports.inflate = _chunk4AB5BHYKcjs.inflate; exports.inflateRaw = _chunk4AB5BHYKcjs.inflateRaw; exports.insertLayer = _chunk4AB5BHYKcjs.insertLayer; exports.isBlendMode = _chunkCRMAXIUVcjs.isBlendMode; exports.isLayerEffectKind = _chunk4AB5BHYKcjs.isLayerEffectKind; exports.isLayerLocked = _chunk4AB5BHYKcjs.isLayerLocked; exports.isPng = _chunk4AB5BHYKcjs.isPng; exports.isSeparableBlendMode = _chunkCRMAXIUVcjs.isSeparableBlendMode; exports.layerEffectFields = _chunk4AB5BHYKcjs.layerEffectFields; exports.layerEffectLabel = _chunk4AB5BHYKcjs.layerEffectLabel; exports.mapLayer = _chunk4AB5BHYKcjs.mapLayer; exports.mergeLayerEffect = _chunk4AB5BHYKcjs.mergeLayerEffect; exports.mixPigment8 = _chunkCRMAXIUVcjs.mixPigment8; exports.mixPigmentRgb = _chunkCRMAXIUVcjs.mixPigmentRgb; exports.newEffectId = _chunk4AB5BHYKcjs.newEffectId; exports.normalizeBlendMode = _chunkCRMAXIUVcjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunk4AB5BHYKcjs.normalizeLayerEffects; exports.packRgba = _chunkCRMAXIUVcjs.packRgba; exports.parseDataUrl = _chunk4AB5BHYKcjs.parseDataUrl; exports.parseEffectColor = _chunk4AB5BHYKcjs.parseEffectColor; exports.patchEffectMaps = _chunk4AB5BHYKcjs.patchEffectMaps; exports.pngDataUrl = _chunk4AB5BHYKcjs.pngDataUrl; exports.readPixel = _chunkCRMAXIUVcjs.readPixel; exports.readRegion = _chunkCRMAXIUVcjs.readRegion; exports.renderLayerEffects = _chunk4AB5BHYKcjs.renderLayerEffects; exports.scaleLayerEffect = _chunk4AB5BHYKcjs.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.translateSurface = _chunkCRMAXIUVcjs.translateSurface; exports.uniformTile = _chunkCRMAXIUVcjs.uniformTile; exports.validateEffectGradient = _chunk4AB5BHYKcjs.validateEffectGradient; exports.validateLayerEffect = _chunk4AB5BHYKcjs.validateLayerEffect; exports.validateLayerEffects = _chunk4AB5BHYKcjs.validateLayerEffects; exports.writeRegion = _chunkCRMAXIUVcjs.writeRegion;
|
|
201
203
|
//# 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;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;AACA;AACF,+8KAAC","file":"/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"}
|
package/dist/raster/index.d.cts
CHANGED
|
@@ -485,6 +485,8 @@ declare function isLayerLocked(layer: {
|
|
|
485
485
|
* - Layer effects: a layer's effect maps (shadow, glow, bevel, stroke distance fields) are built
|
|
486
486
|
* once over the layer's region (its bounds grown by the effects' margin, within the canvas grown
|
|
487
487
|
* the same) and cached by the identity of every surface tile the shape reads; tiles crop them.
|
|
488
|
+
* When only some of those tiles changed and every effect is local, the maps are rebuilt only
|
|
489
|
+
* within the margin of the change (narrowed by `dirty` when it covers the change) and patched in.
|
|
488
490
|
* A tile's signature then reads the layer within the margin around it (or the whole region when
|
|
489
491
|
* an effect is laid out over the layer's bounds), and `dirty` rectangles grow by the margin.
|
|
490
492
|
*/
|
|
@@ -560,8 +562,9 @@ interface CompositeCallOptions {
|
|
|
560
562
|
checkpointLayerId?: string | null;
|
|
561
563
|
/**
|
|
562
564
|
* 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
|
-
*
|
|
565
|
+
* Changed tiles are then recomposited only inside these rectangles (grown by the effects' reach),
|
|
566
|
+
* tiles they miss keep their pixels, and effect maps are rebuilt only around them. Changes outside
|
|
567
|
+
* them would be missed, so pass nothing when unsure.
|
|
565
568
|
*/
|
|
566
569
|
dirty?: RasterRect[];
|
|
567
570
|
}
|
|
@@ -578,6 +581,10 @@ interface CompositeStats {
|
|
|
578
581
|
cached: number;
|
|
579
582
|
/** Steps actually run, summed over tiles. */
|
|
580
583
|
stepsRun: number;
|
|
584
|
+
/** Layers whose effect maps were built over their whole region. */
|
|
585
|
+
effectsBuilt: number;
|
|
586
|
+
/** Layers whose effect maps were rebuilt only around a change and patched in. */
|
|
587
|
+
effectsPatched: number;
|
|
581
588
|
}
|
|
582
589
|
declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S extends RasterSources = RasterSources> {
|
|
583
590
|
private readonly profile;
|
|
@@ -603,6 +610,9 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
603
610
|
private fxContext;
|
|
604
611
|
lastStats: CompositeStats;
|
|
605
612
|
private hint;
|
|
613
|
+
/** The `dirty` rectangles of the current call, as passed. */
|
|
614
|
+
private callDirty;
|
|
615
|
+
private callStats;
|
|
606
616
|
constructor(profile?: CompositorProfile<L, S>, options?: CompositorOptions);
|
|
607
617
|
/** Drops every cached tile and plane. */
|
|
608
618
|
clear(): void;
|
|
@@ -633,6 +643,12 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
633
643
|
/** Properties of a layer that change pixels, minus its surfaces (memoised per object). */
|
|
634
644
|
private propsKey;
|
|
635
645
|
private compositeTile;
|
|
646
|
+
/**
|
|
647
|
+
* Whether a tile with no part in this call's (grown) `dirty` rectangles changed only in what local
|
|
648
|
+
* effects read beyond it: every changed step is a pixel layer with local effects whose changes stay
|
|
649
|
+
* inside `dirty` (and so are farther than its margin), which leaves the tile's pixels as they were.
|
|
650
|
+
*/
|
|
651
|
+
private changedOnlyNearby;
|
|
636
652
|
private entryBytes;
|
|
637
653
|
private evict;
|
|
638
654
|
private stepSig;
|
|
@@ -650,6 +666,8 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
650
666
|
* the effects' margin, within the canvas grown the same.
|
|
651
667
|
*/
|
|
652
668
|
private effectRegion;
|
|
669
|
+
/** The signature of a layer's shape (its surface tiles and mask refs) per tile of `region`. */
|
|
670
|
+
private shapeSigs;
|
|
653
671
|
/** The surface tiles (and mask refs) a layer's shape reads over `region`. */
|
|
654
672
|
private shapeRefs;
|
|
655
673
|
private lightKey;
|
|
@@ -661,6 +679,17 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
661
679
|
private effectSig;
|
|
662
680
|
/** A layer's effect maps over its region (cached; see the module comment). */
|
|
663
681
|
private effectMapsOf;
|
|
682
|
+
/**
|
|
683
|
+
* Where a layer's shape may differ from the one `prev` was built from: the tiles whose signature
|
|
684
|
+
* changed (a tile new to the region that reads nothing did not), narrowed to this call's `dirty`
|
|
685
|
+
* rectangles when `prev` is from the previous call and they cover every change of the shape.
|
|
686
|
+
*/
|
|
687
|
+
private shapeChanges;
|
|
688
|
+
/**
|
|
689
|
+
* Whether a change to a layer stays inside the `dirty` rectangles that name it: a pixel layer
|
|
690
|
+
* without filters or a feathered or parametric mask (those spread a change beyond it).
|
|
691
|
+
*/
|
|
692
|
+
private dirtyCoversShape;
|
|
664
693
|
/** A layer's alpha over `r` after its mask (0..1, quantised to bytes as tiles see it). */
|
|
665
694
|
private layerShape;
|
|
666
695
|
/** A content or group layer's own pixels over `r` with its mask applied to alpha, or `null` when empty. */
|
|
@@ -803,6 +832,20 @@ declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
|
|
|
803
832
|
* `rect` should cover the layer's shape plus the effects' margin.
|
|
804
833
|
*/
|
|
805
834
|
declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
|
|
835
|
+
/**
|
|
836
|
+
* `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
|
|
837
|
+
* inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
|
|
838
|
+
* deal (the change covers much of the region) or the effects are not local
|
|
839
|
+
* ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
|
|
840
|
+
* `margin` px, and `shapeOver(r)` returns the new shape over `r`.
|
|
841
|
+
*
|
|
842
|
+
* Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
|
|
843
|
+
* within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
|
|
844
|
+
* is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
|
|
845
|
+
* so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
|
|
846
|
+
* when `rect` is unchanged.
|
|
847
|
+
*/
|
|
848
|
+
declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
|
|
806
849
|
/** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
|
|
807
850
|
declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
|
|
808
851
|
x: number;
|
|
@@ -904,4 +947,4 @@ declare function deflateRaw(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
|
904
947
|
/** zlib stream: header, raw deflate, Adler-32. */
|
|
905
948
|
declare function deflate(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
906
949
|
|
|
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 };
|
|
950
|
+
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, patchEffectMaps, pngDataUrl, renderLayerEffects, scaleLayerEffect, validateEffectGradient, validateLayerEffect, validateLayerEffects };
|
package/dist/raster/index.d.ts
CHANGED
|
@@ -485,6 +485,8 @@ declare function isLayerLocked(layer: {
|
|
|
485
485
|
* - Layer effects: a layer's effect maps (shadow, glow, bevel, stroke distance fields) are built
|
|
486
486
|
* once over the layer's region (its bounds grown by the effects' margin, within the canvas grown
|
|
487
487
|
* the same) and cached by the identity of every surface tile the shape reads; tiles crop them.
|
|
488
|
+
* When only some of those tiles changed and every effect is local, the maps are rebuilt only
|
|
489
|
+
* within the margin of the change (narrowed by `dirty` when it covers the change) and patched in.
|
|
488
490
|
* A tile's signature then reads the layer within the margin around it (or the whole region when
|
|
489
491
|
* an effect is laid out over the layer's bounds), and `dirty` rectangles grow by the margin.
|
|
490
492
|
*/
|
|
@@ -560,8 +562,9 @@ interface CompositeCallOptions {
|
|
|
560
562
|
checkpointLayerId?: string | null;
|
|
561
563
|
/**
|
|
562
564
|
* 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
|
-
*
|
|
565
|
+
* Changed tiles are then recomposited only inside these rectangles (grown by the effects' reach),
|
|
566
|
+
* tiles they miss keep their pixels, and effect maps are rebuilt only around them. Changes outside
|
|
567
|
+
* them would be missed, so pass nothing when unsure.
|
|
565
568
|
*/
|
|
566
569
|
dirty?: RasterRect[];
|
|
567
570
|
}
|
|
@@ -578,6 +581,10 @@ interface CompositeStats {
|
|
|
578
581
|
cached: number;
|
|
579
582
|
/** Steps actually run, summed over tiles. */
|
|
580
583
|
stepsRun: number;
|
|
584
|
+
/** Layers whose effect maps were built over their whole region. */
|
|
585
|
+
effectsBuilt: number;
|
|
586
|
+
/** Layers whose effect maps were rebuilt only around a change and patched in. */
|
|
587
|
+
effectsPatched: number;
|
|
581
588
|
}
|
|
582
589
|
declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S extends RasterSources = RasterSources> {
|
|
583
590
|
private readonly profile;
|
|
@@ -603,6 +610,9 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
603
610
|
private fxContext;
|
|
604
611
|
lastStats: CompositeStats;
|
|
605
612
|
private hint;
|
|
613
|
+
/** The `dirty` rectangles of the current call, as passed. */
|
|
614
|
+
private callDirty;
|
|
615
|
+
private callStats;
|
|
606
616
|
constructor(profile?: CompositorProfile<L, S>, options?: CompositorOptions);
|
|
607
617
|
/** Drops every cached tile and plane. */
|
|
608
618
|
clear(): void;
|
|
@@ -633,6 +643,12 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
633
643
|
/** Properties of a layer that change pixels, minus its surfaces (memoised per object). */
|
|
634
644
|
private propsKey;
|
|
635
645
|
private compositeTile;
|
|
646
|
+
/**
|
|
647
|
+
* Whether a tile with no part in this call's (grown) `dirty` rectangles changed only in what local
|
|
648
|
+
* effects read beyond it: every changed step is a pixel layer with local effects whose changes stay
|
|
649
|
+
* inside `dirty` (and so are farther than its margin), which leaves the tile's pixels as they were.
|
|
650
|
+
*/
|
|
651
|
+
private changedOnlyNearby;
|
|
636
652
|
private entryBytes;
|
|
637
653
|
private evict;
|
|
638
654
|
private stepSig;
|
|
@@ -650,6 +666,8 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
650
666
|
* the effects' margin, within the canvas grown the same.
|
|
651
667
|
*/
|
|
652
668
|
private effectRegion;
|
|
669
|
+
/** The signature of a layer's shape (its surface tiles and mask refs) per tile of `region`. */
|
|
670
|
+
private shapeSigs;
|
|
653
671
|
/** The surface tiles (and mask refs) a layer's shape reads over `region`. */
|
|
654
672
|
private shapeRefs;
|
|
655
673
|
private lightKey;
|
|
@@ -661,6 +679,17 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
661
679
|
private effectSig;
|
|
662
680
|
/** A layer's effect maps over its region (cached; see the module comment). */
|
|
663
681
|
private effectMapsOf;
|
|
682
|
+
/**
|
|
683
|
+
* Where a layer's shape may differ from the one `prev` was built from: the tiles whose signature
|
|
684
|
+
* changed (a tile new to the region that reads nothing did not), narrowed to this call's `dirty`
|
|
685
|
+
* rectangles when `prev` is from the previous call and they cover every change of the shape.
|
|
686
|
+
*/
|
|
687
|
+
private shapeChanges;
|
|
688
|
+
/**
|
|
689
|
+
* Whether a change to a layer stays inside the `dirty` rectangles that name it: a pixel layer
|
|
690
|
+
* without filters or a feathered or parametric mask (those spread a change beyond it).
|
|
691
|
+
*/
|
|
692
|
+
private dirtyCoversShape;
|
|
664
693
|
/** A layer's alpha over `r` after its mask (0..1, quantised to bytes as tiles see it). */
|
|
665
694
|
private layerShape;
|
|
666
695
|
/** A content or group layer's own pixels over `r` with its mask applied to alpha, or `null` when empty. */
|
|
@@ -803,6 +832,20 @@ declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
|
|
|
803
832
|
* `rect` should cover the layer's shape plus the effects' margin.
|
|
804
833
|
*/
|
|
805
834
|
declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
|
|
835
|
+
/**
|
|
836
|
+
* `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
|
|
837
|
+
* inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
|
|
838
|
+
* deal (the change covers much of the region) or the effects are not local
|
|
839
|
+
* ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
|
|
840
|
+
* `margin` px, and `shapeOver(r)` returns the new shape over `r`.
|
|
841
|
+
*
|
|
842
|
+
* Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
|
|
843
|
+
* within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
|
|
844
|
+
* is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
|
|
845
|
+
* so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
|
|
846
|
+
* when `rect` is unchanged.
|
|
847
|
+
*/
|
|
848
|
+
declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
|
|
806
849
|
/** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
|
|
807
850
|
declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
|
|
808
851
|
x: number;
|
|
@@ -904,4 +947,4 @@ declare function deflateRaw(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
|
904
947
|
/** zlib stream: header, raw deflate, Adler-32. */
|
|
905
948
|
declare function deflate(data: Uint8Array, level?: 0 | 1): Uint8Array;
|
|
906
949
|
|
|
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 };
|
|
950
|
+
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, patchEffectMaps, pngDataUrl, renderLayerEffects, scaleLayerEffect, validateEffectGradient, validateLayerEffect, validateLayerEffects };
|
package/dist/raster/index.js
CHANGED
|
@@ -54,13 +54,14 @@ import {
|
|
|
54
54
|
normalizeLayerEffects,
|
|
55
55
|
parseDataUrl,
|
|
56
56
|
parseEffectColor,
|
|
57
|
+
patchEffectMaps,
|
|
57
58
|
pngDataUrl,
|
|
58
59
|
renderLayerEffects,
|
|
59
60
|
scaleLayerEffect,
|
|
60
61
|
validateEffectGradient,
|
|
61
62
|
validateLayerEffect,
|
|
62
63
|
validateLayerEffects
|
|
63
|
-
} from "../chunk-
|
|
64
|
+
} from "../chunk-OEVSVA6V.js";
|
|
64
65
|
import {
|
|
65
66
|
BLEND_MODES,
|
|
66
67
|
SurfaceDraft,
|
|
@@ -177,6 +178,7 @@ export {
|
|
|
177
178
|
packRgba,
|
|
178
179
|
parseDataUrl,
|
|
179
180
|
parseEffectColor,
|
|
181
|
+
patchEffectMaps,
|
|
180
182
|
pngDataUrl,
|
|
181
183
|
readPixel,
|
|
182
184
|
readRegion,
|