@pixerate/editor 0.121.0 → 0.122.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 (36) hide show
  1. package/THIRD_PARTY_NOTICES.md +1 -1
  2. package/dist/{chunk-GLOOH65Y.cjs → chunk-4PUPGALM.cjs} +196 -103
  3. package/dist/chunk-4PUPGALM.cjs.map +1 -0
  4. package/dist/{chunk-4I54JSJ6.js → chunk-CLTTLLWA.js} +1089 -981
  5. package/dist/chunk-CLTTLLWA.js.map +1 -0
  6. package/dist/{chunk-LL3RAN55.cjs → chunk-DFFBJV3U.cjs} +1839 -1731
  7. package/dist/chunk-DFFBJV3U.cjs.map +1 -0
  8. package/dist/{chunk-E6N5KLMA.js → chunk-IX3YKUVK.js} +96 -3
  9. package/dist/chunk-IX3YKUVK.js.map +1 -0
  10. package/dist/{render-B05K68_h.d.ts → deep-DLwKZDFr.d.ts} +143 -134
  11. package/dist/{render-DnAbIKcs.d.cts → deep-QS3ppbMX.d.cts} +143 -134
  12. package/dist/{export-D2D8hb_u.d.ts → export-VmTofKIk.d.ts} +11 -4
  13. package/dist/{export-fP2hZYjm.d.cts → export-jKKj8Fg8.d.cts} +11 -4
  14. package/dist/image-editor/index.cjs +678 -672
  15. package/dist/image-editor/index.cjs.map +1 -1
  16. package/dist/image-editor/index.d.cts +17 -5
  17. package/dist/image-editor/index.d.ts +17 -5
  18. package/dist/image-editor/index.js +8 -2
  19. package/dist/image-editor/index.js.map +1 -1
  20. package/dist/paint-editor/index.cjs +68 -68
  21. package/dist/paint-editor/index.d.cts +2 -2
  22. package/dist/paint-editor/index.d.ts +2 -2
  23. package/dist/paint-editor/index.js +2 -2
  24. package/dist/raster/index.cjs +2 -2
  25. package/dist/raster/index.d.cts +29 -7
  26. package/dist/raster/index.d.ts +29 -7
  27. package/dist/raster/index.js +1 -1
  28. package/package.json +1 -1
  29. package/skills/pixerate-canvas/SKILL.md +23 -1
  30. package/skills/pixerate-image-editor/SKILL.md +7 -1
  31. package/skills/pixerate-image-editor/references/photoshop-files.md +4 -3
  32. package/skills/pixerate-paint-editor/SKILL.md +32 -7
  33. package/dist/chunk-4I54JSJ6.js.map +0 -1
  34. package/dist/chunk-E6N5KLMA.js.map +0 -1
  35. package/dist/chunk-GLOOH65Y.cjs.map +0 -1
  36. package/dist/chunk-LL3RAN55.cjs.map +0 -1
@@ -558,6 +558,143 @@ declare function isLayerLocked(layer: {
558
558
  locks?: LayerLocks;
559
559
  }, what: keyof LayerLocks): boolean;
560
560
 
561
+ /**
562
+ * CPU renderer for layer effects.
563
+ *
564
+ * Render order, bottom to top (Photoshop's layer-style stack read upwards): drop shadows, outer
565
+ * glows, then the layer itself (content at fill opacity) with pattern, gradient and colour
566
+ * overlays, satin, inner glows, inner shadows, the inside part of strokes and inner bevels on
567
+ * top. The outside part of strokes and outer bevels go beneath the layer, onto the backdrop.
568
+ * Exterior effects blend straight into the backdrop with their own modes; the layer blends with
569
+ * its mode and, in a mode other than Normal, is merged into the backdrop before the interior
570
+ * effects paint over it (Photoshop's "Blend Interior Effects as Group" off). Emboss and pillow
571
+ * emboss then shade the composited result. Layer opacity applies to the whole stack; fill
572
+ * opacity only to the layer's own pixels.
573
+ *
574
+ * Every map depends only on the layer's shape (its alpha after the mask), the effect settings
575
+ * and the global light, never on the backdrop. {@link buildEffectMaps} computes them once over the
576
+ * layer's whole region; {@link compositeLayerEffects} paints any part of that region (a tile) from
577
+ * them, pixel by pixel, so a tiled render equals a whole-image render.
578
+ *
579
+ * Distances: a stroke's outer edge uses the 5 × 5 chamfer below 20 px and an exact Euclidean
580
+ * transform from there (the chamfer's octagonal level sets facet wide strokes); inside strokes and
581
+ * spread / choke keep the chamfer; precise glows and chiselled bevels use the exact transform.
582
+ * Soft falloffs are two box blurs (a tent).
583
+ */
584
+
585
+ interface EffectRect {
586
+ x: number;
587
+ y: number;
588
+ width: number;
589
+ height: number;
590
+ }
591
+ /** Outside stroke width from which the outer edge uses the exact Euclidean transform. */
592
+ declare const STROKE_CHAMFER_MAX = 20;
593
+ /** A contour as a 0..1 LUT (corner points split the spline), or `null` for linear. */
594
+ declare function contourLut(c: EffectContour | undefined): Float32Array | null;
595
+ /** Where a bevel paints: inside the shape, outside it, or both (emboss styles). */
596
+ type BevelPaint = 'inner' | 'outer' | 'both';
597
+ interface EffectContext {
598
+ light: GlobalLight;
599
+ /** A pattern tile by id, or `null` when missing (pattern effects then paint nothing). */
600
+ pattern(id: string): PatternTile | null;
601
+ }
602
+ /** Effect maps of one layer over its region: see {@link buildEffectMaps}. */
603
+ interface EffectMaps {
604
+ /** The region the maps cover (document space). */
605
+ rect: EffectRect;
606
+ /** The enabled effects, Scale Effects applied, in list order. */
607
+ items: LayerEffect[];
608
+ /** Pixel bounds of the shape (alpha above half a step), or `null` when the shape is empty. */
609
+ bounds: EffectRect | null;
610
+ shape: Float32Array;
611
+ /** Per item: the maps it paints through. */
612
+ per: Float32Array[][];
613
+ bevelPaint: (BevelPaint | null)[];
614
+ din: Float32Array | null;
615
+ dout: Float32Array | null;
616
+ doutExact: Float32Array | null;
617
+ /** Frames of gradient strokes by item index. */
618
+ frames: Map<number, EffectRect>;
619
+ /** Approximate size in bytes (cache budgeting). */
620
+ bytes: number;
621
+ }
622
+ /** The enabled effects of `effects` with Scale Effects applied (empty when the master switch is off). */
623
+ declare function activeEffectItems(effects: LayerEffects | undefined | null): LayerEffect[];
624
+ /**
625
+ * Whether every map pixel of `items` depends only on the shape within the effects' margin, so a
626
+ * tile is unchanged while the layer is unchanged within its margin. Not local: anything laid out
627
+ * over the layer's bounds (aligned gradient overlays, gradient strokes, linked patterns) and noise
628
+ * (it speckles any coverage above zero, which picks up the blur's float noise from far away).
629
+ */
630
+ declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
631
+ /**
632
+ * Builds every map `items` paints through from the layer's alpha `shape` (0..1) over `rect`.
633
+ * `rect` should cover the layer's shape plus the effects' margin.
634
+ */
635
+ declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
636
+ /**
637
+ * `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
638
+ * inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
639
+ * deal (the change covers much of the region) or the effects are not local
640
+ * ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
641
+ * `margin` px, and `shapeOver(r)` returns the new shape over `r`.
642
+ *
643
+ * Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
644
+ * within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
645
+ * is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
646
+ * so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
647
+ * when `rect` is unchanged.
648
+ */
649
+ declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
650
+ /** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
651
+ declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
652
+ x: number;
653
+ y: number;
654
+ }, frame: EffectRect, x: number, y: number): number;
655
+ /**
656
+ * The colours an effect fill paints over `rect`, as straight float RGBA (0..1, `width × height`
657
+ * pixels, row by row): a solid colour, a gradient laid out in `frame` (when aligned with the layer)
658
+ * or `canvas`, or a pattern tiled from `anchor` (when linked). Shape layers paint with it, so their
659
+ * fills and strokes match the overlays of layer effects.
660
+ */
661
+ declare function effectFillColors(fill: EffectFill, rect: EffectRect, frame: EffectRect, canvas: EffectRect, anchor: {
662
+ x: number;
663
+ y: number;
664
+ }, ctx: EffectContext): Float32Array;
665
+ interface EffectCompositeInput {
666
+ /**
667
+ * The accumulator (straight RGBA over `rect`); receives the layer and its effects. Bytes, or
668
+ * (high bit depth) floats 0..1 sRGB-encoded, written back unrounded.
669
+ */
670
+ backdrop: Uint8ClampedArray | Float32Array;
671
+ /** The layer's pixels over `rect` (straight RGBA, mask applied to alpha, clipped layers applied); bytes or floats 0..1 as `backdrop`. */
672
+ content: Uint8ClampedArray | Float32Array;
673
+ rect: EffectRect;
674
+ maps: EffectMaps;
675
+ blend: BlendMode;
676
+ /** Layer opacity: the whole stack. */
677
+ opacity: number;
678
+ /** Fill opacity: the layer's own pixels only. */
679
+ fillOpacity: number;
680
+ /** The canvas (unaligned gradients span it). */
681
+ canvas: EffectRect;
682
+ ctx: EffectContext;
683
+ }
684
+ /** Composites a layer's content and its effects onto `backdrop` in place (see the module comment for the order). */
685
+ declare function compositeLayerEffects(input: EffectCompositeInput): void;
686
+ /**
687
+ * Renders one layer with its effects over a whole region in one pass (no tiles): the reference
688
+ * the per-tile compositor is checked against, and a convenience for one-off renders.
689
+ */
690
+ declare function renderLayerEffects(effects: LayerEffects, layer: {
691
+ content: Uint8ClampedArray;
692
+ rect: EffectRect;
693
+ blend: BlendMode;
694
+ opacity: number;
695
+ fillOpacity?: number;
696
+ }, backdrop: Uint8ClampedArray, canvas: EffectRect, ctx: EffectContext): void;
697
+
561
698
  /**
562
699
  * The per-tile layer compositor engine. Composites a layer stack (pixel layers and groups with
563
700
  * masks, clipping, blend modes, opacity, fill and pass-through) tile by tile in document space,
@@ -733,6 +870,12 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
733
870
  * over `r` in document space, or `null` when it reveals all of `r`.
734
871
  */
735
872
  maskCoverage(layer: L, r: RasterRect, sources: S): Float32Array | null;
873
+ /**
874
+ * For the float compositor: everything `compositeLayerEffects` needs for `layer` over `r` but
875
+ * the pixels (the area its effects reach inside `r`, the effect maps built from its 8-bit
876
+ * shape, blend, opacities, canvas and context), or `null` when nothing reaches `r`.
877
+ */
878
+ effectsInput(layer: L, r: RasterRect, sources: S): Omit<EffectCompositeInput, 'backdrop' | 'content'> | null;
736
879
  /** Pixel layers, and the layer kinds the profile composites like them. */
737
880
  private isPixel;
738
881
  private isFilter;
@@ -925,138 +1068,4 @@ declare function deepBytes(surface: TiledSurface): number;
925
1068
  */
926
1069
  declare function keepDeepSamples(before: TiledSurface, after: TiledSurface): TiledSurface;
927
1070
 
928
- /**
929
- * CPU renderer for layer effects.
930
- *
931
- * Render order, bottom to top (Photoshop's layer-style stack read upwards): drop shadows, outer
932
- * glows, then the layer itself (content at fill opacity) with pattern, gradient and colour
933
- * overlays, satin, inner glows, inner shadows, the inside part of strokes and inner bevels on
934
- * top. The outside part of strokes and outer bevels go beneath the layer, onto the backdrop.
935
- * Exterior effects blend straight into the backdrop with their own modes; the layer blends with
936
- * its mode and, in a mode other than Normal, is merged into the backdrop before the interior
937
- * effects paint over it (Photoshop's "Blend Interior Effects as Group" off). Emboss and pillow
938
- * emboss then shade the composited result. Layer opacity applies to the whole stack; fill
939
- * opacity only to the layer's own pixels.
940
- *
941
- * Every map depends only on the layer's shape (its alpha after the mask), the effect settings
942
- * and the global light, never on the backdrop. {@link buildEffectMaps} computes them once over the
943
- * layer's whole region; {@link compositeLayerEffects} paints any part of that region (a tile) from
944
- * them, pixel by pixel, so a tiled render equals a whole-image render.
945
- *
946
- * Distances: a stroke's outer edge uses the 5 × 5 chamfer below 20 px and an exact Euclidean
947
- * transform from there (the chamfer's octagonal level sets facet wide strokes); inside strokes and
948
- * spread / choke keep the chamfer; precise glows and chiselled bevels use the exact transform.
949
- * Soft falloffs are two box blurs (a tent).
950
- */
951
-
952
- interface EffectRect {
953
- x: number;
954
- y: number;
955
- width: number;
956
- height: number;
957
- }
958
- /** Outside stroke width from which the outer edge uses the exact Euclidean transform. */
959
- declare const STROKE_CHAMFER_MAX = 20;
960
- /** A contour as a 0..1 LUT (corner points split the spline), or `null` for linear. */
961
- declare function contourLut(c: EffectContour | undefined): Float32Array | null;
962
- /** Where a bevel paints: inside the shape, outside it, or both (emboss styles). */
963
- type BevelPaint = 'inner' | 'outer' | 'both';
964
- interface EffectContext {
965
- light: GlobalLight;
966
- /** A pattern tile by id, or `null` when missing (pattern effects then paint nothing). */
967
- pattern(id: string): PatternTile | null;
968
- }
969
- /** Effect maps of one layer over its region: see {@link buildEffectMaps}. */
970
- interface EffectMaps {
971
- /** The region the maps cover (document space). */
972
- rect: EffectRect;
973
- /** The enabled effects, Scale Effects applied, in list order. */
974
- items: LayerEffect[];
975
- /** Pixel bounds of the shape (alpha above half a step), or `null` when the shape is empty. */
976
- bounds: EffectRect | null;
977
- shape: Float32Array;
978
- /** Per item: the maps it paints through. */
979
- per: Float32Array[][];
980
- bevelPaint: (BevelPaint | null)[];
981
- din: Float32Array | null;
982
- dout: Float32Array | null;
983
- doutExact: Float32Array | null;
984
- /** Frames of gradient strokes by item index. */
985
- frames: Map<number, EffectRect>;
986
- /** Approximate size in bytes (cache budgeting). */
987
- bytes: number;
988
- }
989
- /** The enabled effects of `effects` with Scale Effects applied (empty when the master switch is off). */
990
- declare function activeEffectItems(effects: LayerEffects | undefined | null): LayerEffect[];
991
- /**
992
- * Whether every map pixel of `items` depends only on the shape within the effects' margin, so a
993
- * tile is unchanged while the layer is unchanged within its margin. Not local: anything laid out
994
- * over the layer's bounds (aligned gradient overlays, gradient strokes, linked patterns) and noise
995
- * (it speckles any coverage above zero, which picks up the blur's float noise from far away).
996
- */
997
- declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
998
- /**
999
- * Builds every map `items` paints through from the layer's alpha `shape` (0..1) over `rect`.
1000
- * `rect` should cover the layer's shape plus the effects' margin.
1001
- */
1002
- declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
1003
- /**
1004
- * `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
1005
- * inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
1006
- * deal (the change covers much of the region) or the effects are not local
1007
- * ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
1008
- * `margin` px, and `shapeOver(r)` returns the new shape over `r`.
1009
- *
1010
- * Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
1011
- * within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
1012
- * is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
1013
- * so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
1014
- * when `rect` is unchanged.
1015
- */
1016
- declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
1017
- /** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
1018
- declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
1019
- x: number;
1020
- y: number;
1021
- }, frame: EffectRect, x: number, y: number): number;
1022
- /**
1023
- * The colours an effect fill paints over `rect`, as straight float RGBA (0..1, `width × height`
1024
- * pixels, row by row): a solid colour, a gradient laid out in `frame` (when aligned with the layer)
1025
- * or `canvas`, or a pattern tiled from `anchor` (when linked). Shape layers paint with it, so their
1026
- * fills and strokes match the overlays of layer effects.
1027
- */
1028
- declare function effectFillColors(fill: EffectFill, rect: EffectRect, frame: EffectRect, canvas: EffectRect, anchor: {
1029
- x: number;
1030
- y: number;
1031
- }, ctx: EffectContext): Float32Array;
1032
- interface EffectCompositeInput {
1033
- /** The accumulator (straight RGBA over `rect`); receives the layer and its effects. */
1034
- backdrop: Uint8ClampedArray;
1035
- /** The layer's pixels over `rect` (straight RGBA, mask applied to alpha, clipped layers applied). */
1036
- content: Uint8ClampedArray;
1037
- rect: EffectRect;
1038
- maps: EffectMaps;
1039
- blend: BlendMode;
1040
- /** Layer opacity: the whole stack. */
1041
- opacity: number;
1042
- /** Fill opacity: the layer's own pixels only. */
1043
- fillOpacity: number;
1044
- /** The canvas (unaligned gradients span it). */
1045
- canvas: EffectRect;
1046
- ctx: EffectContext;
1047
- }
1048
- /** Composites a layer's content and its effects onto `backdrop` in place (see the module comment for the order). */
1049
- declare function compositeLayerEffects(input: EffectCompositeInput): void;
1050
- /**
1051
- * Renders one layer with its effects over a whole region in one pass (no tiles): the reference
1052
- * the per-tile compositor is checked against, and a convenience for one-off renders.
1053
- */
1054
- declare function renderLayerEffects(effects: LayerEffects, layer: {
1055
- content: Uint8ClampedArray;
1056
- rect: EffectRect;
1057
- blend: BlendMode;
1058
- opacity: number;
1059
- fillOpacity?: number;
1060
- }, backdrop: Uint8ClampedArray, canvas: EffectRect, ctx: EffectContext): void;
1061
-
1062
1071
  export { type PixelFilterSpec as $, type GradientOverlayEffect as A, BIT_DEPTHS as B, type CompositorLayer as C, DEFAULT_GLOBAL_LIGHT as D, type EffectCompositeInput as E, type GradientStyle as F, type GlobalLight as G, type GroupBlendMode as H, type GroupIn as I, INTERPOLATIONS as J, type InnerGlowEffect as K, type InnerShadowEffect as L, type Interpolation as M, LAYER_EFFECT_KINDS as N, type LayerEffect as O, LayerEffectError as P, type LayerEffectKind as Q, type RasterSources as R, type LayerEffects as S, type LayerLocation as T, type LayerLocks as U, MAX_EFFECT_REACH as V, MAX_TRANSFORM_PIXELS as W, type OuterGlowEffect as X, type PatternOverlayEffect as Y, PatternPlacement as Z, PatternTile as _, RasterCompositor as a, tileSamples as a$, type RasterGroupLayer as a0, type RasterLayer as a1, type RasterLayerBase as a2, type RasterMask as a3, type RasterNode as a4, type RasterPixelLayer as a5, type ResampleOptions as a6, STROKE_CHAMFER_MAX as a7, type SatinEffect as a8, type StrokeEffect as a9, gradientT as aA, hasActiveEffects as aB, hashNoise as aC, insertLayer as aD, isBitDepth as aE, isInterpolation as aF, isLayerEffectKind as aG, isLayerLocked as aH, keepDeepSamples as aI, keysWeight as aJ, layerEffectFields as aK, layerEffectLabel as aL, mapLayer as aM, mergeLayerEffect as aN, newEffectId as aO, normalizeLayerEffects as aP, parseEffectColor as aQ, patchEffectMaps as aR, proxyOf as aS, readDeepRegion as aT, reduceSurface as aU, renderLayerEffects as aV, scaleLayerEffect as aW, srgbDecode as aX, srgbEncode as aY, surfaceDepth as aZ, surfaceFromDeepPixels as a_, type StrokePosition as aa, TransformTooLargeError as ab, activeEffectItems as ac, blendTile as ad, buildEffectMaps as ae, builtinPattern as af, builtinPatternIds as ag, changedTiles as ah, compositeLayerEffects as ai, compositeSurfaceOver as aj, contourLut as ak, convertSurfaceDepth as al, deepBytes as am, deepTile as an, defaultEffectGradient as ao, defaultLayerEffect as ap, depthOf as aq, effectColorHex as ar, effectFillColors as as, effectReach as at, effectsAreLocal as au, effectsFingerprint as av, effectsMargin as aw, effectsScale as ax, findLayer as ay, flattenLayers as az, type CompositorProfile as b, tileSamples16 as b0, tileSamples32 as b1, to16From32 as b2, to16From8 as b3, to32From16 as b4, to32From8 as b5, to8From16 as b6, to8From32 as b7, transformSurface as b8, transformedBounds as b9, validateEffectGradient as ba, validateLayerEffect as bb, validateLayerEffects as bc, warpSurface as bd, writeDeepRegion as be, type BevelContour as c, type BevelEmbossEffect as d, type BevelStyle as e, type BevelTechnique as f, type BevelTexture as g, type BitDepth as h, type ColorOverlayEffect as i, type CompositeCallOptions as j, type CompositeStats as k, type CompositorOptions as l, type ContourPoint as m, type DeepSamples as n, type DropShadowEffect as o, type EffectContext as p, type EffectContour as q, type EffectFill as r, type EffectGradient as s, type EffectMaps as t, type EffectPattern as u, type EffectPatternRef as v, type EffectRect as w, type GlowTechnique as x, type GradientColorStop as y, type GradientOpacityStop as z };
@@ -558,6 +558,143 @@ declare function isLayerLocked(layer: {
558
558
  locks?: LayerLocks;
559
559
  }, what: keyof LayerLocks): boolean;
560
560
 
561
+ /**
562
+ * CPU renderer for layer effects.
563
+ *
564
+ * Render order, bottom to top (Photoshop's layer-style stack read upwards): drop shadows, outer
565
+ * glows, then the layer itself (content at fill opacity) with pattern, gradient and colour
566
+ * overlays, satin, inner glows, inner shadows, the inside part of strokes and inner bevels on
567
+ * top. The outside part of strokes and outer bevels go beneath the layer, onto the backdrop.
568
+ * Exterior effects blend straight into the backdrop with their own modes; the layer blends with
569
+ * its mode and, in a mode other than Normal, is merged into the backdrop before the interior
570
+ * effects paint over it (Photoshop's "Blend Interior Effects as Group" off). Emboss and pillow
571
+ * emboss then shade the composited result. Layer opacity applies to the whole stack; fill
572
+ * opacity only to the layer's own pixels.
573
+ *
574
+ * Every map depends only on the layer's shape (its alpha after the mask), the effect settings
575
+ * and the global light, never on the backdrop. {@link buildEffectMaps} computes them once over the
576
+ * layer's whole region; {@link compositeLayerEffects} paints any part of that region (a tile) from
577
+ * them, pixel by pixel, so a tiled render equals a whole-image render.
578
+ *
579
+ * Distances: a stroke's outer edge uses the 5 × 5 chamfer below 20 px and an exact Euclidean
580
+ * transform from there (the chamfer's octagonal level sets facet wide strokes); inside strokes and
581
+ * spread / choke keep the chamfer; precise glows and chiselled bevels use the exact transform.
582
+ * Soft falloffs are two box blurs (a tent).
583
+ */
584
+
585
+ interface EffectRect {
586
+ x: number;
587
+ y: number;
588
+ width: number;
589
+ height: number;
590
+ }
591
+ /** Outside stroke width from which the outer edge uses the exact Euclidean transform. */
592
+ declare const STROKE_CHAMFER_MAX = 20;
593
+ /** A contour as a 0..1 LUT (corner points split the spline), or `null` for linear. */
594
+ declare function contourLut(c: EffectContour | undefined): Float32Array | null;
595
+ /** Where a bevel paints: inside the shape, outside it, or both (emboss styles). */
596
+ type BevelPaint = 'inner' | 'outer' | 'both';
597
+ interface EffectContext {
598
+ light: GlobalLight;
599
+ /** A pattern tile by id, or `null` when missing (pattern effects then paint nothing). */
600
+ pattern(id: string): PatternTile | null;
601
+ }
602
+ /** Effect maps of one layer over its region: see {@link buildEffectMaps}. */
603
+ interface EffectMaps {
604
+ /** The region the maps cover (document space). */
605
+ rect: EffectRect;
606
+ /** The enabled effects, Scale Effects applied, in list order. */
607
+ items: LayerEffect[];
608
+ /** Pixel bounds of the shape (alpha above half a step), or `null` when the shape is empty. */
609
+ bounds: EffectRect | null;
610
+ shape: Float32Array;
611
+ /** Per item: the maps it paints through. */
612
+ per: Float32Array[][];
613
+ bevelPaint: (BevelPaint | null)[];
614
+ din: Float32Array | null;
615
+ dout: Float32Array | null;
616
+ doutExact: Float32Array | null;
617
+ /** Frames of gradient strokes by item index. */
618
+ frames: Map<number, EffectRect>;
619
+ /** Approximate size in bytes (cache budgeting). */
620
+ bytes: number;
621
+ }
622
+ /** The enabled effects of `effects` with Scale Effects applied (empty when the master switch is off). */
623
+ declare function activeEffectItems(effects: LayerEffects | undefined | null): LayerEffect[];
624
+ /**
625
+ * Whether every map pixel of `items` depends only on the shape within the effects' margin, so a
626
+ * tile is unchanged while the layer is unchanged within its margin. Not local: anything laid out
627
+ * over the layer's bounds (aligned gradient overlays, gradient strokes, linked patterns) and noise
628
+ * (it speckles any coverage above zero, which picks up the blur's float noise from far away).
629
+ */
630
+ declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
631
+ /**
632
+ * Builds every map `items` paints through from the layer's alpha `shape` (0..1) over `rect`.
633
+ * `rect` should cover the layer's shape plus the effects' margin.
634
+ */
635
+ declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
636
+ /**
637
+ * `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
638
+ * inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
639
+ * deal (the change covers much of the region) or the effects are not local
640
+ * ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
641
+ * `margin` px, and `shapeOver(r)` returns the new shape over `r`.
642
+ *
643
+ * Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
644
+ * within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
645
+ * is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
646
+ * so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
647
+ * when `rect` is unchanged.
648
+ */
649
+ declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
650
+ /** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
651
+ declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
652
+ x: number;
653
+ y: number;
654
+ }, frame: EffectRect, x: number, y: number): number;
655
+ /**
656
+ * The colours an effect fill paints over `rect`, as straight float RGBA (0..1, `width × height`
657
+ * pixels, row by row): a solid colour, a gradient laid out in `frame` (when aligned with the layer)
658
+ * or `canvas`, or a pattern tiled from `anchor` (when linked). Shape layers paint with it, so their
659
+ * fills and strokes match the overlays of layer effects.
660
+ */
661
+ declare function effectFillColors(fill: EffectFill, rect: EffectRect, frame: EffectRect, canvas: EffectRect, anchor: {
662
+ x: number;
663
+ y: number;
664
+ }, ctx: EffectContext): Float32Array;
665
+ interface EffectCompositeInput {
666
+ /**
667
+ * The accumulator (straight RGBA over `rect`); receives the layer and its effects. Bytes, or
668
+ * (high bit depth) floats 0..1 sRGB-encoded, written back unrounded.
669
+ */
670
+ backdrop: Uint8ClampedArray | Float32Array;
671
+ /** The layer's pixels over `rect` (straight RGBA, mask applied to alpha, clipped layers applied); bytes or floats 0..1 as `backdrop`. */
672
+ content: Uint8ClampedArray | Float32Array;
673
+ rect: EffectRect;
674
+ maps: EffectMaps;
675
+ blend: BlendMode;
676
+ /** Layer opacity: the whole stack. */
677
+ opacity: number;
678
+ /** Fill opacity: the layer's own pixels only. */
679
+ fillOpacity: number;
680
+ /** The canvas (unaligned gradients span it). */
681
+ canvas: EffectRect;
682
+ ctx: EffectContext;
683
+ }
684
+ /** Composites a layer's content and its effects onto `backdrop` in place (see the module comment for the order). */
685
+ declare function compositeLayerEffects(input: EffectCompositeInput): void;
686
+ /**
687
+ * Renders one layer with its effects over a whole region in one pass (no tiles): the reference
688
+ * the per-tile compositor is checked against, and a convenience for one-off renders.
689
+ */
690
+ declare function renderLayerEffects(effects: LayerEffects, layer: {
691
+ content: Uint8ClampedArray;
692
+ rect: EffectRect;
693
+ blend: BlendMode;
694
+ opacity: number;
695
+ fillOpacity?: number;
696
+ }, backdrop: Uint8ClampedArray, canvas: EffectRect, ctx: EffectContext): void;
697
+
561
698
  /**
562
699
  * The per-tile layer compositor engine. Composites a layer stack (pixel layers and groups with
563
700
  * masks, clipping, blend modes, opacity, fill and pass-through) tile by tile in document space,
@@ -733,6 +870,12 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
733
870
  * over `r` in document space, or `null` when it reveals all of `r`.
734
871
  */
735
872
  maskCoverage(layer: L, r: RasterRect, sources: S): Float32Array | null;
873
+ /**
874
+ * For the float compositor: everything `compositeLayerEffects` needs for `layer` over `r` but
875
+ * the pixels (the area its effects reach inside `r`, the effect maps built from its 8-bit
876
+ * shape, blend, opacities, canvas and context), or `null` when nothing reaches `r`.
877
+ */
878
+ effectsInput(layer: L, r: RasterRect, sources: S): Omit<EffectCompositeInput, 'backdrop' | 'content'> | null;
736
879
  /** Pixel layers, and the layer kinds the profile composites like them. */
737
880
  private isPixel;
738
881
  private isFilter;
@@ -925,138 +1068,4 @@ declare function deepBytes(surface: TiledSurface): number;
925
1068
  */
926
1069
  declare function keepDeepSamples(before: TiledSurface, after: TiledSurface): TiledSurface;
927
1070
 
928
- /**
929
- * CPU renderer for layer effects.
930
- *
931
- * Render order, bottom to top (Photoshop's layer-style stack read upwards): drop shadows, outer
932
- * glows, then the layer itself (content at fill opacity) with pattern, gradient and colour
933
- * overlays, satin, inner glows, inner shadows, the inside part of strokes and inner bevels on
934
- * top. The outside part of strokes and outer bevels go beneath the layer, onto the backdrop.
935
- * Exterior effects blend straight into the backdrop with their own modes; the layer blends with
936
- * its mode and, in a mode other than Normal, is merged into the backdrop before the interior
937
- * effects paint over it (Photoshop's "Blend Interior Effects as Group" off). Emboss and pillow
938
- * emboss then shade the composited result. Layer opacity applies to the whole stack; fill
939
- * opacity only to the layer's own pixels.
940
- *
941
- * Every map depends only on the layer's shape (its alpha after the mask), the effect settings
942
- * and the global light, never on the backdrop. {@link buildEffectMaps} computes them once over the
943
- * layer's whole region; {@link compositeLayerEffects} paints any part of that region (a tile) from
944
- * them, pixel by pixel, so a tiled render equals a whole-image render.
945
- *
946
- * Distances: a stroke's outer edge uses the 5 × 5 chamfer below 20 px and an exact Euclidean
947
- * transform from there (the chamfer's octagonal level sets facet wide strokes); inside strokes and
948
- * spread / choke keep the chamfer; precise glows and chiselled bevels use the exact transform.
949
- * Soft falloffs are two box blurs (a tent).
950
- */
951
-
952
- interface EffectRect {
953
- x: number;
954
- y: number;
955
- width: number;
956
- height: number;
957
- }
958
- /** Outside stroke width from which the outer edge uses the exact Euclidean transform. */
959
- declare const STROKE_CHAMFER_MAX = 20;
960
- /** A contour as a 0..1 LUT (corner points split the spline), or `null` for linear. */
961
- declare function contourLut(c: EffectContour | undefined): Float32Array | null;
962
- /** Where a bevel paints: inside the shape, outside it, or both (emboss styles). */
963
- type BevelPaint = 'inner' | 'outer' | 'both';
964
- interface EffectContext {
965
- light: GlobalLight;
966
- /** A pattern tile by id, or `null` when missing (pattern effects then paint nothing). */
967
- pattern(id: string): PatternTile | null;
968
- }
969
- /** Effect maps of one layer over its region: see {@link buildEffectMaps}. */
970
- interface EffectMaps {
971
- /** The region the maps cover (document space). */
972
- rect: EffectRect;
973
- /** The enabled effects, Scale Effects applied, in list order. */
974
- items: LayerEffect[];
975
- /** Pixel bounds of the shape (alpha above half a step), or `null` when the shape is empty. */
976
- bounds: EffectRect | null;
977
- shape: Float32Array;
978
- /** Per item: the maps it paints through. */
979
- per: Float32Array[][];
980
- bevelPaint: (BevelPaint | null)[];
981
- din: Float32Array | null;
982
- dout: Float32Array | null;
983
- doutExact: Float32Array | null;
984
- /** Frames of gradient strokes by item index. */
985
- frames: Map<number, EffectRect>;
986
- /** Approximate size in bytes (cache budgeting). */
987
- bytes: number;
988
- }
989
- /** The enabled effects of `effects` with Scale Effects applied (empty when the master switch is off). */
990
- declare function activeEffectItems(effects: LayerEffects | undefined | null): LayerEffect[];
991
- /**
992
- * Whether every map pixel of `items` depends only on the shape within the effects' margin, so a
993
- * tile is unchanged while the layer is unchanged within its margin. Not local: anything laid out
994
- * over the layer's bounds (aligned gradient overlays, gradient strokes, linked patterns) and noise
995
- * (it speckles any coverage above zero, which picks up the blur's float noise from far away).
996
- */
997
- declare function effectsAreLocal(items: readonly LayerEffect[]): boolean;
998
- /**
999
- * Builds every map `items` paints through from the layer's alpha `shape` (0..1) over `rect`.
1000
- * `rect` should cover the layer's shape plus the effects' margin.
1001
- */
1002
- declare function buildEffectMaps(items: LayerEffect[], shape: Float32Array, rect: EffectRect, ctx: EffectContext): EffectMaps;
1003
- /**
1004
- * `prev` brought up to date for a shape over `rect` that differs from the one it was built from only
1005
- * inside `changed` (document rects), or `null` when a full {@link buildEffectMaps} is the better
1006
- * deal (the change covers much of the region) or the effects are not local
1007
- * ({@link effectsAreLocal}). `items` must be the ones `prev` was built with, reaching at most
1008
- * `margin` px, and `shapeOver(r)` returns the new shape over `r`.
1009
- *
1010
- * Every map pixel within `margin` of a change, or outside `prev.rect`, is rebuilt from the shape
1011
- * within `margin` of it (a window of the change grown by twice the margin) and pasted in; the rest
1012
- * is kept. A local map pixel depends only on the shape within the margin and the blur sums exactly,
1013
- * so the result paints exactly what a full build over `rect` would. `prev`'s buffers are reused
1014
- * when `rect` is unchanged.
1015
- */
1016
- declare function patchEffectMaps(prev: EffectMaps, items: LayerEffect[], rect: EffectRect, changed: readonly EffectRect[], margin: number, shapeOver: (r: EffectRect) => Float32Array, ctx: EffectContext): EffectMaps | null;
1017
- /** Gradient parameter `t` (0..1) at pixel centre `(x, y)` of a gradient laid out in `frame`. */
1018
- declare function gradientT(style: GradientStyle, angle: number, scale: number, reverse: boolean, offset: {
1019
- x: number;
1020
- y: number;
1021
- }, frame: EffectRect, x: number, y: number): number;
1022
- /**
1023
- * The colours an effect fill paints over `rect`, as straight float RGBA (0..1, `width × height`
1024
- * pixels, row by row): a solid colour, a gradient laid out in `frame` (when aligned with the layer)
1025
- * or `canvas`, or a pattern tiled from `anchor` (when linked). Shape layers paint with it, so their
1026
- * fills and strokes match the overlays of layer effects.
1027
- */
1028
- declare function effectFillColors(fill: EffectFill, rect: EffectRect, frame: EffectRect, canvas: EffectRect, anchor: {
1029
- x: number;
1030
- y: number;
1031
- }, ctx: EffectContext): Float32Array;
1032
- interface EffectCompositeInput {
1033
- /** The accumulator (straight RGBA over `rect`); receives the layer and its effects. */
1034
- backdrop: Uint8ClampedArray;
1035
- /** The layer's pixels over `rect` (straight RGBA, mask applied to alpha, clipped layers applied). */
1036
- content: Uint8ClampedArray;
1037
- rect: EffectRect;
1038
- maps: EffectMaps;
1039
- blend: BlendMode;
1040
- /** Layer opacity: the whole stack. */
1041
- opacity: number;
1042
- /** Fill opacity: the layer's own pixels only. */
1043
- fillOpacity: number;
1044
- /** The canvas (unaligned gradients span it). */
1045
- canvas: EffectRect;
1046
- ctx: EffectContext;
1047
- }
1048
- /** Composites a layer's content and its effects onto `backdrop` in place (see the module comment for the order). */
1049
- declare function compositeLayerEffects(input: EffectCompositeInput): void;
1050
- /**
1051
- * Renders one layer with its effects over a whole region in one pass (no tiles): the reference
1052
- * the per-tile compositor is checked against, and a convenience for one-off renders.
1053
- */
1054
- declare function renderLayerEffects(effects: LayerEffects, layer: {
1055
- content: Uint8ClampedArray;
1056
- rect: EffectRect;
1057
- blend: BlendMode;
1058
- opacity: number;
1059
- fillOpacity?: number;
1060
- }, backdrop: Uint8ClampedArray, canvas: EffectRect, ctx: EffectContext): void;
1061
-
1062
1071
  export { type PixelFilterSpec as $, type GradientOverlayEffect as A, BIT_DEPTHS as B, type CompositorLayer as C, DEFAULT_GLOBAL_LIGHT as D, type EffectCompositeInput as E, type GradientStyle as F, type GlobalLight as G, type GroupBlendMode as H, type GroupIn as I, INTERPOLATIONS as J, type InnerGlowEffect as K, type InnerShadowEffect as L, type Interpolation as M, LAYER_EFFECT_KINDS as N, type LayerEffect as O, LayerEffectError as P, type LayerEffectKind as Q, type RasterSources as R, type LayerEffects as S, type LayerLocation as T, type LayerLocks as U, MAX_EFFECT_REACH as V, MAX_TRANSFORM_PIXELS as W, type OuterGlowEffect as X, type PatternOverlayEffect as Y, PatternPlacement as Z, PatternTile as _, RasterCompositor as a, tileSamples as a$, type RasterGroupLayer as a0, type RasterLayer as a1, type RasterLayerBase as a2, type RasterMask as a3, type RasterNode as a4, type RasterPixelLayer as a5, type ResampleOptions as a6, STROKE_CHAMFER_MAX as a7, type SatinEffect as a8, type StrokeEffect as a9, gradientT as aA, hasActiveEffects as aB, hashNoise as aC, insertLayer as aD, isBitDepth as aE, isInterpolation as aF, isLayerEffectKind as aG, isLayerLocked as aH, keepDeepSamples as aI, keysWeight as aJ, layerEffectFields as aK, layerEffectLabel as aL, mapLayer as aM, mergeLayerEffect as aN, newEffectId as aO, normalizeLayerEffects as aP, parseEffectColor as aQ, patchEffectMaps as aR, proxyOf as aS, readDeepRegion as aT, reduceSurface as aU, renderLayerEffects as aV, scaleLayerEffect as aW, srgbDecode as aX, srgbEncode as aY, surfaceDepth as aZ, surfaceFromDeepPixels as a_, type StrokePosition as aa, TransformTooLargeError as ab, activeEffectItems as ac, blendTile as ad, buildEffectMaps as ae, builtinPattern as af, builtinPatternIds as ag, changedTiles as ah, compositeLayerEffects as ai, compositeSurfaceOver as aj, contourLut as ak, convertSurfaceDepth as al, deepBytes as am, deepTile as an, defaultEffectGradient as ao, defaultLayerEffect as ap, depthOf as aq, effectColorHex as ar, effectFillColors as as, effectReach as at, effectsAreLocal as au, effectsFingerprint as av, effectsMargin as aw, effectsScale as ax, findLayer as ay, flattenLayers as az, type CompositorProfile as b, tileSamples16 as b0, tileSamples32 as b1, to16From32 as b2, to16From8 as b3, to32From16 as b4, to32From8 as b5, to8From16 as b6, to8From32 as b7, transformSurface as b8, transformedBounds as b9, validateEffectGradient as ba, validateLayerEffect as bb, validateLayerEffects as bc, warpSurface as bd, writeDeepRegion as be, type BevelContour as c, type BevelEmbossEffect as d, type BevelStyle as e, type BevelTechnique as f, type BevelTexture as g, type BitDepth as h, type ColorOverlayEffect as i, type CompositeCallOptions as j, type CompositeStats as k, type CompositorOptions as l, type ContourPoint as m, type DeepSamples as n, type DropShadowEffect as o, type EffectContext as p, type EffectContour as q, type EffectFill as r, type EffectGradient as s, type EffectMaps as t, type EffectPattern as u, type EffectPatternRef as v, type EffectRect as w, type GlowTechnique as x, type GradientColorStop as y, type GradientOpacityStop as z };