@pixerate/editor 0.101.0 → 0.102.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 +1 -0
- package/dist/{chunk-WIR377F6.js → chunk-67FRIOPZ.js} +15 -12
- package/dist/chunk-67FRIOPZ.js.map +1 -0
- package/dist/{chunk-WT6ZAWJP.cjs → chunk-WSTEXEKD.cjs} +27 -24
- package/dist/chunk-WSTEXEKD.cjs.map +1 -0
- package/dist/image-editor/index.cjs +2843 -1050
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +644 -16
- package/dist/image-editor/index.d.ts +644 -16
- package/dist/image-editor/index.js +2487 -694
- package/dist/image-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +2 -2
- package/dist/raster/index.d.cts +99 -91
- package/dist/raster/index.d.ts +99 -91
- package/dist/raster/index.js +1 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +69 -11
- package/dist/chunk-WIR377F6.js.map +0 -1
- package/dist/chunk-WT6ZAWJP.cjs.map +0 -1
package/dist/raster/index.cjs
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
var
|
|
74
|
+
var _chunkWSTEXEKDcjs = require('../chunk-WSTEXEKD.cjs');
|
|
75
75
|
require('../chunk-MUUXNRU4.cjs');
|
|
76
76
|
|
|
77
77
|
|
|
@@ -220,5 +220,5 @@ var _chunkCRMAXIUVcjs = require('../chunk-CRMAXIUV.cjs');
|
|
|
220
220
|
|
|
221
221
|
|
|
222
222
|
|
|
223
|
-
exports.BLEND_MODES = _chunkCRMAXIUVcjs.BLEND_MODES; exports.CURVE_LUT_SIZE =
|
|
223
|
+
exports.BLEND_MODES = _chunkCRMAXIUVcjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkWSTEXEKDcjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkWSTEXEKDcjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkWSTEXEKDcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.INTERPOLATIONS = _chunkWSTEXEKDcjs.INTERPOLATIONS; exports.LAYER_EFFECT_KINDS = _chunkWSTEXEKDcjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunkWSTEXEKDcjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkWSTEXEKDcjs.MAX_EFFECT_REACH; exports.MAX_TRANSFORM_PIXELS = _chunkWSTEXEKDcjs.MAX_TRANSFORM_PIXELS; exports.PatternPlacement = _chunkWSTEXEKDcjs.PatternPlacement; exports.PatternTile = _chunkWSTEXEKDcjs.PatternTile; exports.RasterCompositor = _chunkWSTEXEKDcjs.RasterCompositor; exports.STROKE_CHAMFER_MAX = _chunkWSTEXEKDcjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunkCRMAXIUVcjs.SurfaceDraft; exports.TILE = _chunkCRMAXIUVcjs.TILE; exports.TILE_SHIFT = _chunkCRMAXIUVcjs.TILE_SHIFT; exports.TiledSurface = _chunkCRMAXIUVcjs.TiledSurface; exports.TransformTooLargeError = _chunkWSTEXEKDcjs.TransformTooLargeError; exports.ZlibError = _chunkWSTEXEKDcjs.ZlibError; exports.activeEffectItems = _chunkWSTEXEKDcjs.activeEffectItems; exports.adler32 = _chunkWSTEXEKDcjs.adler32; exports.base64ToBytes = _chunkWSTEXEKDcjs.base64ToBytes; exports.blendChannel = _chunkCRMAXIUVcjs.blendChannel; exports.blendImageData = _chunkCRMAXIUVcjs.blendImageData; exports.blendLum = _chunkCRMAXIUVcjs.blendLum; exports.blendPixel = _chunkCRMAXIUVcjs.blendPixel; exports.blendRgb = _chunkCRMAXIUVcjs.blendRgb; exports.blendTile = _chunkWSTEXEKDcjs.blendTile; exports.buildEffectMaps = _chunkWSTEXEKDcjs.buildEffectMaps; exports.builtinPattern = _chunkWSTEXEKDcjs.builtinPattern; exports.builtinPatternIds = _chunkWSTEXEKDcjs.builtinPatternIds; exports.bytesToBase64 = _chunkWSTEXEKDcjs.bytesToBase64; exports.canvasCompositeOperation = _chunkCRMAXIUVcjs.canvasCompositeOperation; exports.changedTiles = _chunkWSTEXEKDcjs.changedTiles; exports.collectTiles = _chunkCRMAXIUVcjs.collectTiles; exports.compositeLayerEffects = _chunkWSTEXEKDcjs.compositeLayerEffects; exports.compositeSurfaceOver = _chunkWSTEXEKDcjs.compositeSurfaceOver; exports.contentBounds = _chunkCRMAXIUVcjs.contentBounds; exports.contourLut = _chunkWSTEXEKDcjs.contourLut; exports.curveLut = _chunkWSTEXEKDcjs.curveLut; exports.decodePng = _chunkWSTEXEKDcjs.decodePng; exports.defaultEffectGradient = _chunkWSTEXEKDcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkWSTEXEKDcjs.defaultLayerEffect; exports.deflate = _chunkWSTEXEKDcjs.deflate; exports.deflateRaw = _chunkWSTEXEKDcjs.deflateRaw; exports.effectColorHex = _chunkWSTEXEKDcjs.effectColorHex; exports.effectReach = _chunkWSTEXEKDcjs.effectReach; exports.effectsAreLocal = _chunkWSTEXEKDcjs.effectsAreLocal; exports.effectsFingerprint = _chunkWSTEXEKDcjs.effectsFingerprint; exports.effectsMargin = _chunkWSTEXEKDcjs.effectsMargin; exports.effectsScale = _chunkWSTEXEKDcjs.effectsScale; exports.emptySurface = _chunkCRMAXIUVcjs.emptySurface; exports.encodePng = _chunkWSTEXEKDcjs.encodePng; exports.fillRect = _chunkCRMAXIUVcjs.fillRect; exports.findLayer = _chunkWSTEXEKDcjs.findLayer; exports.finishTile = _chunkCRMAXIUVcjs.finishTile; exports.flattenLayers = _chunkWSTEXEKDcjs.flattenLayers; exports.gaussianBlur = _chunkWSTEXEKDcjs.gaussianBlur; exports.gradientT = _chunkWSTEXEKDcjs.gradientT; exports.hasActiveEffects = _chunkWSTEXEKDcjs.hasActiveEffects; exports.hashNoise = _chunkWSTEXEKDcjs.hashNoise; exports.inflate = _chunkWSTEXEKDcjs.inflate; exports.inflateRaw = _chunkWSTEXEKDcjs.inflateRaw; exports.insertLayer = _chunkWSTEXEKDcjs.insertLayer; exports.isBlendMode = _chunkCRMAXIUVcjs.isBlendMode; exports.isInterpolation = _chunkWSTEXEKDcjs.isInterpolation; exports.isLayerEffectKind = _chunkWSTEXEKDcjs.isLayerEffectKind; exports.isLayerLocked = _chunkWSTEXEKDcjs.isLayerLocked; exports.isPng = _chunkWSTEXEKDcjs.isPng; exports.isSeparableBlendMode = _chunkCRMAXIUVcjs.isSeparableBlendMode; exports.keysWeight = _chunkWSTEXEKDcjs.keysWeight; exports.layerEffectFields = _chunkWSTEXEKDcjs.layerEffectFields; exports.layerEffectLabel = _chunkWSTEXEKDcjs.layerEffectLabel; exports.mapLayer = _chunkWSTEXEKDcjs.mapLayer; exports.mergeLayerEffect = _chunkWSTEXEKDcjs.mergeLayerEffect; exports.mixPigment8 = _chunkCRMAXIUVcjs.mixPigment8; exports.mixPigmentRgb = _chunkCRMAXIUVcjs.mixPigmentRgb; exports.newEffectId = _chunkWSTEXEKDcjs.newEffectId; exports.normalizeBlendMode = _chunkCRMAXIUVcjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkWSTEXEKDcjs.normalizeLayerEffects; exports.packRgba = _chunkCRMAXIUVcjs.packRgba; exports.parseDataUrl = _chunkWSTEXEKDcjs.parseDataUrl; exports.parseEffectColor = _chunkWSTEXEKDcjs.parseEffectColor; exports.patchEffectMaps = _chunkWSTEXEKDcjs.patchEffectMaps; exports.pngDataUrl = _chunkWSTEXEKDcjs.pngDataUrl; exports.readPixel = _chunkCRMAXIUVcjs.readPixel; exports.readRegion = _chunkCRMAXIUVcjs.readRegion; exports.reduceSurface = _chunkWSTEXEKDcjs.reduceSurface; exports.renderLayerEffects = _chunkWSTEXEKDcjs.renderLayerEffects; exports.scaleLayerEffect = _chunkWSTEXEKDcjs.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 = _chunkWSTEXEKDcjs.transformSurface; exports.transformedBounds = _chunkWSTEXEKDcjs.transformedBounds; exports.translateSurface = _chunkCRMAXIUVcjs.translateSurface; exports.uniformTile = _chunkCRMAXIUVcjs.uniformTile; exports.validateEffectGradient = _chunkWSTEXEKDcjs.validateEffectGradient; exports.validateLayerEffect = _chunkWSTEXEKDcjs.validateLayerEffect; exports.validateLayerEffects = _chunkWSTEXEKDcjs.validateLayerEffects; exports.warpSurface = _chunkWSTEXEKDcjs.warpSurface; exports.writeRegion = _chunkCRMAXIUVcjs.writeRegion;
|
|
224
224
|
//# sourceMappingURL=index.cjs.map
|
package/dist/raster/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BlendMode,
|
|
1
|
+
import { B as BlendMode, R as RasterRect, T as TiledSurface, M as MaskSurface, P as PixelSurface, 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
3
|
import { H as Homography, V as Vec2 } from '../types-CwMPoRMU.cjs';
|
|
4
4
|
|
|
@@ -360,6 +360,96 @@ declare function builtinPattern(id: string): EffectPattern | null;
|
|
|
360
360
|
*/
|
|
361
361
|
declare function hashNoise(x: number, y: number): number;
|
|
362
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Resampling tiled surfaces through geometric maps: Free Transform (scale, rotate, skew, distort,
|
|
365
|
+
* perspective: one projective map) and Warp (any forward map, such as a Bézier mesh).
|
|
366
|
+
*
|
|
367
|
+
* - Inverse mapping per destination tile: each destination tile reads only the source window its
|
|
368
|
+
* pixels map into, so memory stays bounded by one tile's footprint, and the result is a new
|
|
369
|
+
* copy-on-write surface (an identity or a whole-pixel move returns the source, or shares its
|
|
370
|
+
* tiles).
|
|
371
|
+
* - Nearest, bilinear and Photoshop's Bicubic (the Keys cubic at a = −0.75). Colour is sampled
|
|
372
|
+
* premultiplied by alpha, so partially transparent edges don't pick up the colour of the
|
|
373
|
+
* transparent pixels around them; outside the source everything is transparent.
|
|
374
|
+
* - Large reductions with Bicubic are pre-filtered: the source is box-averaged by whole factors
|
|
375
|
+
* first and the cubic widened by the rest, so shrinking a layer doesn't alias. Bilinear and
|
|
376
|
+
* nearest sample the source directly, as Photoshop's do.
|
|
377
|
+
* - Masks (one channel) are warped as "value + inside": outside the source and outside the warped
|
|
378
|
+
* area they read as the surface's default value, so a reveal-all mask stays white around a
|
|
379
|
+
* transformed hole.
|
|
380
|
+
* - A Distort dragged past the horizon draws only the side of the horizon most of the source maps
|
|
381
|
+
* to (no mirrored copy wrapped round infinity).
|
|
382
|
+
*
|
|
383
|
+
* No DOM: runs in Node, tests and workers.
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
/** Resampling of a transform (Photoshop's interpolation menu). */
|
|
387
|
+
type Interpolation = 'nearest' | 'bilinear' | 'bicubic';
|
|
388
|
+
declare const INTERPOLATIONS: readonly Interpolation[];
|
|
389
|
+
declare function isInterpolation(value: unknown): value is Interpolation;
|
|
390
|
+
/**
|
|
391
|
+
* The largest result (pixels) one resample may build: about 11 600 × 11 600. Only the size of the
|
|
392
|
+
* result counts, not where it lands. A scale past it is refused rather than clipped.
|
|
393
|
+
*/
|
|
394
|
+
declare const MAX_TRANSFORM_PIXELS: number;
|
|
395
|
+
/** A transform whose result would be too large; the message gives the size and the limit. */
|
|
396
|
+
declare class TransformTooLargeError extends Error {
|
|
397
|
+
constructor(message: string);
|
|
398
|
+
}
|
|
399
|
+
interface ResampleOptions {
|
|
400
|
+
/** Default `bicubic`. */
|
|
401
|
+
interpolation?: Interpolation;
|
|
402
|
+
/** The source region to transform (default: the surface's content bounds). Pixels outside it are not moved. */
|
|
403
|
+
source?: RasterRect;
|
|
404
|
+
/** Keep only destination pixels inside this rectangle (a preview of the visible area). */
|
|
405
|
+
clip?: RasterRect;
|
|
406
|
+
/**
|
|
407
|
+
* Preview speed-up: sample once per `step × step` block of destination pixels and fill the
|
|
408
|
+
* block (a power of two, 1..64; default 1, every pixel).
|
|
409
|
+
*/
|
|
410
|
+
step?: number;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Photoshop's Bicubic: the Keys cubic at a = −0.75 (Catmull-Rom is −0.5). Measured on Photoshop
|
|
414
|
+
* 27.11's Free Transform by photocraft: a 200 % step edge matches within 0.5 levels.
|
|
415
|
+
*/
|
|
416
|
+
declare function keysWeight(x: number): number;
|
|
417
|
+
/**
|
|
418
|
+
* The surface box-averaged by `factor` (a whole number ≥ 1) in both directions: reduced pixel
|
|
419
|
+
* (i, j) covers pixels [i·factor, (i+1)·factor) of each axis. For previews: transform the reduced
|
|
420
|
+
* surface through the map composed with a scale by `factor`, so a preview at a low zoom reads a
|
|
421
|
+
* fraction of the pixels.
|
|
422
|
+
*/
|
|
423
|
+
declare function reduceSurface(src: TiledSurface, factor: number): TiledSurface;
|
|
424
|
+
/** The destination rectangle `transformSurface` fills for `source` under `h`, or `null` when it is empty or unbounded. */
|
|
425
|
+
declare function transformedBounds(source: RasterRect, h: Homography): RasterRect | null;
|
|
426
|
+
/**
|
|
427
|
+
* The surface's content inside `options.source` (default: all of it) warped by `h` (source →
|
|
428
|
+
* destination, both in the surface's pixel space). Pixels outside the warped area are the default
|
|
429
|
+
* (transparent for layers). Throws `TransformTooLargeError` past `MAX_TRANSFORM_PIXELS`.
|
|
430
|
+
*/
|
|
431
|
+
declare function transformSurface(src: TiledSurface, h: Homography, options?: ResampleOptions): TiledSurface;
|
|
432
|
+
/**
|
|
433
|
+
* The surface's content inside `options.source` (default: all of it) warped through the forward
|
|
434
|
+
* map `f` (source → destination pixel space; `null` where it is undefined).
|
|
435
|
+
*
|
|
436
|
+
* The source rectangle is subdivided into a fine grid whose vertices are mapped forward; each
|
|
437
|
+
* cell's two triangles are rasterized in destination space with the source position interpolated
|
|
438
|
+
* barycentrically, then the source is sampled there. Cells are a few source pixels across, so the
|
|
439
|
+
* piecewise-affine inverse is within a small fraction of a pixel of the true one; affine maps (the
|
|
440
|
+
* identity included) are reproduced exactly. Where the warp shrinks the source, each pixel instead
|
|
441
|
+
* averages a grid of bilinear subsamples over its source footprint, so thin lines don't alias.
|
|
442
|
+
* Where the warp folds over itself the later (lower-right) cell wins.
|
|
443
|
+
*/
|
|
444
|
+
declare function warpSurface(src: TiledSurface, f: (p: Vec2) => Vec2 | null, options?: ResampleOptions): TiledSurface;
|
|
445
|
+
/**
|
|
446
|
+
* `top` (RGBA, straight alpha) composited over `base` with the Normal blend. A one-channel `base`
|
|
447
|
+
* (a mask) takes `top`'s red channel as the value, weighted by its alpha: that is how a moved part
|
|
448
|
+
* of a mask travels (value and coverage) and lands. Only tiles `top` stores are touched, so every
|
|
449
|
+
* other tile of `base` stays shared.
|
|
450
|
+
*/
|
|
451
|
+
declare function compositeSurfaceOver(base: TiledSurface, top: TiledSurface): TiledSurface;
|
|
452
|
+
|
|
363
453
|
/**
|
|
364
454
|
* A layer stack that is not specific to any editor: pixel layers on tiled surfaces, groups (with
|
|
365
455
|
* pass-through), raster masks with density and feather, clipping, locks, opacity, fill and blend
|
|
@@ -555,6 +645,12 @@ interface CompositorProfile<L extends CompositorLayer, S extends RasterSources>
|
|
|
555
645
|
pixelFilters?(layer: L): PixelFilterSpec | null;
|
|
556
646
|
/** Canvas coverage (0..1, `width × height`) of a parametric mask source, or `null` to reveal all. */
|
|
557
647
|
maskSourcePlane?(source: unknown, width: number, height: number, sources: S): Float32Array | null;
|
|
648
|
+
/**
|
|
649
|
+
* Layer kinds besides `pixel` that composite exactly like pixel layers, from their `surface`,
|
|
650
|
+
* `offset` and `fillOpacity` (a smart object's rendered pixels). Their tile signatures, effect
|
|
651
|
+
* regions and `dirty` handling are a pixel layer's.
|
|
652
|
+
*/
|
|
653
|
+
isPixelLike?(layer: L): boolean;
|
|
558
654
|
}
|
|
559
655
|
interface CompositorOptions {
|
|
560
656
|
/** Upper bound for cached tile buffers (default 256 MiB). */
|
|
@@ -638,6 +734,8 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
638
734
|
* over `r` in document space, or `null` when it reveals all of `r`.
|
|
639
735
|
*/
|
|
640
736
|
maskCoverage(layer: L, r: RasterRect, sources: S): Float32Array | null;
|
|
737
|
+
/** Pixel layers, and the layer kinds the profile composites like them. */
|
|
738
|
+
private isPixel;
|
|
641
739
|
private isFilter;
|
|
642
740
|
/**
|
|
643
741
|
* Groups a layer list into compositing steps: clipped layers join the nearest unclipped
|
|
@@ -748,96 +846,6 @@ type Edge = BlurEdge;
|
|
|
748
846
|
*/
|
|
749
847
|
declare function gaussianBlur(src: ArrayLike<number>, w: number, h: number, sigma: number, edge?: Edge): Float32Array;
|
|
750
848
|
|
|
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
|
-
|
|
841
849
|
/**
|
|
842
850
|
* Curve lookup tables shared by Curves adjustments and layer-effect contours.
|
|
843
851
|
*/
|
package/dist/raster/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BlendMode,
|
|
1
|
+
import { B as BlendMode, R as RasterRect, T as TiledSurface, M as MaskSurface, P as PixelSurface, 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
3
|
import { H as Homography, V as Vec2 } from '../types-CwMPoRMU.js';
|
|
4
4
|
|
|
@@ -360,6 +360,96 @@ declare function builtinPattern(id: string): EffectPattern | null;
|
|
|
360
360
|
*/
|
|
361
361
|
declare function hashNoise(x: number, y: number): number;
|
|
362
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Resampling tiled surfaces through geometric maps: Free Transform (scale, rotate, skew, distort,
|
|
365
|
+
* perspective: one projective map) and Warp (any forward map, such as a Bézier mesh).
|
|
366
|
+
*
|
|
367
|
+
* - Inverse mapping per destination tile: each destination tile reads only the source window its
|
|
368
|
+
* pixels map into, so memory stays bounded by one tile's footprint, and the result is a new
|
|
369
|
+
* copy-on-write surface (an identity or a whole-pixel move returns the source, or shares its
|
|
370
|
+
* tiles).
|
|
371
|
+
* - Nearest, bilinear and Photoshop's Bicubic (the Keys cubic at a = −0.75). Colour is sampled
|
|
372
|
+
* premultiplied by alpha, so partially transparent edges don't pick up the colour of the
|
|
373
|
+
* transparent pixels around them; outside the source everything is transparent.
|
|
374
|
+
* - Large reductions with Bicubic are pre-filtered: the source is box-averaged by whole factors
|
|
375
|
+
* first and the cubic widened by the rest, so shrinking a layer doesn't alias. Bilinear and
|
|
376
|
+
* nearest sample the source directly, as Photoshop's do.
|
|
377
|
+
* - Masks (one channel) are warped as "value + inside": outside the source and outside the warped
|
|
378
|
+
* area they read as the surface's default value, so a reveal-all mask stays white around a
|
|
379
|
+
* transformed hole.
|
|
380
|
+
* - A Distort dragged past the horizon draws only the side of the horizon most of the source maps
|
|
381
|
+
* to (no mirrored copy wrapped round infinity).
|
|
382
|
+
*
|
|
383
|
+
* No DOM: runs in Node, tests and workers.
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
/** Resampling of a transform (Photoshop's interpolation menu). */
|
|
387
|
+
type Interpolation = 'nearest' | 'bilinear' | 'bicubic';
|
|
388
|
+
declare const INTERPOLATIONS: readonly Interpolation[];
|
|
389
|
+
declare function isInterpolation(value: unknown): value is Interpolation;
|
|
390
|
+
/**
|
|
391
|
+
* The largest result (pixels) one resample may build: about 11 600 × 11 600. Only the size of the
|
|
392
|
+
* result counts, not where it lands. A scale past it is refused rather than clipped.
|
|
393
|
+
*/
|
|
394
|
+
declare const MAX_TRANSFORM_PIXELS: number;
|
|
395
|
+
/** A transform whose result would be too large; the message gives the size and the limit. */
|
|
396
|
+
declare class TransformTooLargeError extends Error {
|
|
397
|
+
constructor(message: string);
|
|
398
|
+
}
|
|
399
|
+
interface ResampleOptions {
|
|
400
|
+
/** Default `bicubic`. */
|
|
401
|
+
interpolation?: Interpolation;
|
|
402
|
+
/** The source region to transform (default: the surface's content bounds). Pixels outside it are not moved. */
|
|
403
|
+
source?: RasterRect;
|
|
404
|
+
/** Keep only destination pixels inside this rectangle (a preview of the visible area). */
|
|
405
|
+
clip?: RasterRect;
|
|
406
|
+
/**
|
|
407
|
+
* Preview speed-up: sample once per `step × step` block of destination pixels and fill the
|
|
408
|
+
* block (a power of two, 1..64; default 1, every pixel).
|
|
409
|
+
*/
|
|
410
|
+
step?: number;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Photoshop's Bicubic: the Keys cubic at a = −0.75 (Catmull-Rom is −0.5). Measured on Photoshop
|
|
414
|
+
* 27.11's Free Transform by photocraft: a 200 % step edge matches within 0.5 levels.
|
|
415
|
+
*/
|
|
416
|
+
declare function keysWeight(x: number): number;
|
|
417
|
+
/**
|
|
418
|
+
* The surface box-averaged by `factor` (a whole number ≥ 1) in both directions: reduced pixel
|
|
419
|
+
* (i, j) covers pixels [i·factor, (i+1)·factor) of each axis. For previews: transform the reduced
|
|
420
|
+
* surface through the map composed with a scale by `factor`, so a preview at a low zoom reads a
|
|
421
|
+
* fraction of the pixels.
|
|
422
|
+
*/
|
|
423
|
+
declare function reduceSurface(src: TiledSurface, factor: number): TiledSurface;
|
|
424
|
+
/** The destination rectangle `transformSurface` fills for `source` under `h`, or `null` when it is empty or unbounded. */
|
|
425
|
+
declare function transformedBounds(source: RasterRect, h: Homography): RasterRect | null;
|
|
426
|
+
/**
|
|
427
|
+
* The surface's content inside `options.source` (default: all of it) warped by `h` (source →
|
|
428
|
+
* destination, both in the surface's pixel space). Pixels outside the warped area are the default
|
|
429
|
+
* (transparent for layers). Throws `TransformTooLargeError` past `MAX_TRANSFORM_PIXELS`.
|
|
430
|
+
*/
|
|
431
|
+
declare function transformSurface(src: TiledSurface, h: Homography, options?: ResampleOptions): TiledSurface;
|
|
432
|
+
/**
|
|
433
|
+
* The surface's content inside `options.source` (default: all of it) warped through the forward
|
|
434
|
+
* map `f` (source → destination pixel space; `null` where it is undefined).
|
|
435
|
+
*
|
|
436
|
+
* The source rectangle is subdivided into a fine grid whose vertices are mapped forward; each
|
|
437
|
+
* cell's two triangles are rasterized in destination space with the source position interpolated
|
|
438
|
+
* barycentrically, then the source is sampled there. Cells are a few source pixels across, so the
|
|
439
|
+
* piecewise-affine inverse is within a small fraction of a pixel of the true one; affine maps (the
|
|
440
|
+
* identity included) are reproduced exactly. Where the warp shrinks the source, each pixel instead
|
|
441
|
+
* averages a grid of bilinear subsamples over its source footprint, so thin lines don't alias.
|
|
442
|
+
* Where the warp folds over itself the later (lower-right) cell wins.
|
|
443
|
+
*/
|
|
444
|
+
declare function warpSurface(src: TiledSurface, f: (p: Vec2) => Vec2 | null, options?: ResampleOptions): TiledSurface;
|
|
445
|
+
/**
|
|
446
|
+
* `top` (RGBA, straight alpha) composited over `base` with the Normal blend. A one-channel `base`
|
|
447
|
+
* (a mask) takes `top`'s red channel as the value, weighted by its alpha: that is how a moved part
|
|
448
|
+
* of a mask travels (value and coverage) and lands. Only tiles `top` stores are touched, so every
|
|
449
|
+
* other tile of `base` stays shared.
|
|
450
|
+
*/
|
|
451
|
+
declare function compositeSurfaceOver(base: TiledSurface, top: TiledSurface): TiledSurface;
|
|
452
|
+
|
|
363
453
|
/**
|
|
364
454
|
* A layer stack that is not specific to any editor: pixel layers on tiled surfaces, groups (with
|
|
365
455
|
* pass-through), raster masks with density and feather, clipping, locks, opacity, fill and blend
|
|
@@ -555,6 +645,12 @@ interface CompositorProfile<L extends CompositorLayer, S extends RasterSources>
|
|
|
555
645
|
pixelFilters?(layer: L): PixelFilterSpec | null;
|
|
556
646
|
/** Canvas coverage (0..1, `width × height`) of a parametric mask source, or `null` to reveal all. */
|
|
557
647
|
maskSourcePlane?(source: unknown, width: number, height: number, sources: S): Float32Array | null;
|
|
648
|
+
/**
|
|
649
|
+
* Layer kinds besides `pixel` that composite exactly like pixel layers, from their `surface`,
|
|
650
|
+
* `offset` and `fillOpacity` (a smart object's rendered pixels). Their tile signatures, effect
|
|
651
|
+
* regions and `dirty` handling are a pixel layer's.
|
|
652
|
+
*/
|
|
653
|
+
isPixelLike?(layer: L): boolean;
|
|
558
654
|
}
|
|
559
655
|
interface CompositorOptions {
|
|
560
656
|
/** Upper bound for cached tile buffers (default 256 MiB). */
|
|
@@ -638,6 +734,8 @@ declare class RasterCompositor<L extends CompositorLayer = CompositorLayer, S ex
|
|
|
638
734
|
* over `r` in document space, or `null` when it reveals all of `r`.
|
|
639
735
|
*/
|
|
640
736
|
maskCoverage(layer: L, r: RasterRect, sources: S): Float32Array | null;
|
|
737
|
+
/** Pixel layers, and the layer kinds the profile composites like them. */
|
|
738
|
+
private isPixel;
|
|
641
739
|
private isFilter;
|
|
642
740
|
/**
|
|
643
741
|
* Groups a layer list into compositing steps: clipped layers join the nearest unclipped
|
|
@@ -748,96 +846,6 @@ type Edge = BlurEdge;
|
|
|
748
846
|
*/
|
|
749
847
|
declare function gaussianBlur(src: ArrayLike<number>, w: number, h: number, sigma: number, edge?: Edge): Float32Array;
|
|
750
848
|
|
|
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
|
-
|
|
841
849
|
/**
|
|
842
850
|
* Curve lookup tables shared by Curves adjustments and layer-effect contours.
|
|
843
851
|
*/
|
package/dist/raster/index.js
CHANGED