@pixerate/editor 0.109.0 → 0.111.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 +3 -0
- package/dist/blending-DXl06NSx.d.ts +486 -0
- package/dist/blending-aOE6Y3UE.d.cts +486 -0
- package/dist/chunk-7VOHOPLW.cjs +1136 -0
- package/dist/chunk-7VOHOPLW.cjs.map +1 -0
- package/dist/chunk-FTBZPI77.cjs +1 -0
- package/dist/chunk-FTBZPI77.cjs.map +1 -0
- package/dist/{chunk-RE77QYUF.js → chunk-HHZ6ZJTW.js} +880 -86
- package/dist/chunk-HHZ6ZJTW.js.map +1 -0
- package/dist/{chunk-WMBIJCHA.js → chunk-HNS7UHCM.js} +5 -1
- package/dist/{chunk-WMBIJCHA.js.map → chunk-HNS7UHCM.js.map} +1 -1
- package/dist/{chunk-CFMWALBM.js → chunk-LQEEDHOP.js} +2 -2
- package/dist/{chunk-D37BX2ZA.cjs → chunk-PHUMLSCW.cjs} +1141 -347
- package/dist/chunk-PHUMLSCW.cjs.map +1 -0
- package/dist/{chunk-AZTZRLDI.cjs → chunk-POGBUYWE.cjs} +92 -92
- package/dist/{chunk-AZTZRLDI.cjs.map → chunk-POGBUYWE.cjs.map} +1 -1
- package/dist/chunk-VKK5VS2T.js +1 -0
- package/dist/{chunk-SZ6KMZNM.cjs → chunk-XIOMMGPD.cjs} +6 -2
- package/dist/chunk-XIOMMGPD.cjs.map +1 -0
- package/dist/{chunk-3PHA3UKI.js → chunk-Z4BC6M74.js} +523 -121
- package/dist/chunk-Z4BC6M74.js.map +1 -0
- package/dist/{export-BLPLaE6Z.d.ts → export-DBNVwb6h.d.ts} +521 -12
- package/dist/{export-DSUc4fQD.d.cts → export-DoDhCszr.d.cts} +521 -12
- package/dist/image-editor/index.cjs +1630 -900
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +104 -16
- package/dist/image-editor/index.d.ts +104 -16
- package/dist/image-editor/index.js +776 -46
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +28 -4
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +3 -89
- package/dist/paint/index.d.ts +3 -89
- package/dist/paint/index.js +27 -3
- package/dist/paint-editor/index.cjs +1052 -286
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +302 -23
- package/dist/paint-editor/index.d.ts +302 -23
- package/dist/paint-editor/index.js +848 -82
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +5 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +2 -2
- package/dist/raster/index.d.ts +2 -2
- package/dist/raster/index.js +4 -2
- package/dist/{render-C-fO_mes.d.cts → render-BEriFuqK.d.cts} +1 -1
- package/dist/{render-OLIMk_v0.d.ts → render-tjzKaik-.d.ts} +1 -1
- package/dist/{surface-CkKOHGPm.d.cts → surface-C8RRg_Bh.d.cts} +109 -1
- package/dist/{surface-CkKOHGPm.d.ts → surface-C8RRg_Bh.d.ts} +109 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +27 -30
- package/skills/pixerate-image-editor/references/shapes-and-type.md +60 -0
- package/skills/pixerate-paint-editor/SKILL.md +49 -13
- package/dist/chunk-3PHA3UKI.js.map +0 -1
- package/dist/chunk-6BU5WU4R.cjs +0 -1
- package/dist/chunk-6BU5WU4R.cjs.map +0 -1
- package/dist/chunk-D37BX2ZA.cjs.map +0 -1
- package/dist/chunk-HUFQD4CB.cjs +0 -734
- package/dist/chunk-HUFQD4CB.cjs.map +0 -1
- package/dist/chunk-RE77QYUF.js.map +0 -1
- package/dist/chunk-SZ6KMZNM.cjs.map +0 -1
- package/dist/chunk-XYBJKUAU.js +0 -1
- package/dist/mixer-5ziHU8OS.d.cts +0 -282
- package/dist/mixer-DNqiYXYQ.d.ts +0 -282
- /package/dist/{chunk-CFMWALBM.js.map → chunk-LQEEDHOP.js.map} +0 -0
- /package/dist/{chunk-XYBJKUAU.js.map → chunk-VKK5VS2T.js.map} +0 -0
package/dist/raster/index.cjs
CHANGED
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
var
|
|
75
|
+
var _chunkPOGBUYWEcjs = require('../chunk-POGBUYWE.cjs');
|
|
76
76
|
require('../chunk-MUUXNRU4.cjs');
|
|
77
77
|
|
|
78
78
|
|
|
@@ -115,8 +115,8 @@ require('../chunk-MUUXNRU4.cjs');
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
var _chunkSZ6KMZNMcjs = require('../chunk-SZ6KMZNM.cjs');
|
|
119
118
|
|
|
119
|
+
var _chunkXIOMMGPDcjs = require('../chunk-XIOMMGPD.cjs');
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
|
|
@@ -230,5 +230,7 @@ var _chunkSZ6KMZNMcjs = require('../chunk-SZ6KMZNM.cjs');
|
|
|
230
230
|
|
|
231
231
|
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
exports.BLEND_MODES = _chunkXIOMMGPDcjs.BLEND_MODES; exports.CURVE_LUT_SIZE = _chunkPOGBUYWEcjs.CURVE_LUT_SIZE; exports.DEFAULT_GLOBAL_LIGHT = _chunkPOGBUYWEcjs.DEFAULT_GLOBAL_LIGHT; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkPOGBUYWEcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.INTERPOLATIONS = _chunkPOGBUYWEcjs.INTERPOLATIONS; exports.LAYER_EFFECT_KINDS = _chunkPOGBUYWEcjs.LAYER_EFFECT_KINDS; exports.LayerEffectError = _chunkPOGBUYWEcjs.LayerEffectError; exports.MAX_EFFECT_REACH = _chunkPOGBUYWEcjs.MAX_EFFECT_REACH; exports.MAX_TRANSFORM_PIXELS = _chunkPOGBUYWEcjs.MAX_TRANSFORM_PIXELS; exports.PAINTERLY_BLEND_MODES = _chunkXIOMMGPDcjs.PAINTERLY_BLEND_MODES; exports.PatternPlacement = _chunkPOGBUYWEcjs.PatternPlacement; exports.PatternTile = _chunkPOGBUYWEcjs.PatternTile; exports.RasterCompositor = _chunkPOGBUYWEcjs.RasterCompositor; exports.SHADOW_AMBIENT = _chunkXIOMMGPDcjs.SHADOW_AMBIENT; exports.STROKE_CHAMFER_MAX = _chunkPOGBUYWEcjs.STROKE_CHAMFER_MAX; exports.SurfaceDraft = _chunkXIOMMGPDcjs.SurfaceDraft; exports.TILE = _chunkXIOMMGPDcjs.TILE; exports.TILE_SHIFT = _chunkXIOMMGPDcjs.TILE_SHIFT; exports.TiledSurface = _chunkXIOMMGPDcjs.TiledSurface; exports.TransformTooLargeError = _chunkPOGBUYWEcjs.TransformTooLargeError; exports.ZlibError = _chunkPOGBUYWEcjs.ZlibError; exports.activeEffectItems = _chunkPOGBUYWEcjs.activeEffectItems; exports.adler32 = _chunkPOGBUYWEcjs.adler32; exports.base64ToBytes = _chunkPOGBUYWEcjs.base64ToBytes; exports.blendChannel = _chunkXIOMMGPDcjs.blendChannel; exports.blendImageData = _chunkXIOMMGPDcjs.blendImageData; exports.blendLum = _chunkXIOMMGPDcjs.blendLum; exports.blendPixel = _chunkXIOMMGPDcjs.blendPixel; exports.blendRgb = _chunkXIOMMGPDcjs.blendRgb; exports.blendTile = _chunkPOGBUYWEcjs.blendTile; exports.buildEffectMaps = _chunkPOGBUYWEcjs.buildEffectMaps; exports.builtinPattern = _chunkPOGBUYWEcjs.builtinPattern; exports.builtinPatternIds = _chunkPOGBUYWEcjs.builtinPatternIds; exports.bytesToBase64 = _chunkPOGBUYWEcjs.bytesToBase64; exports.canvasCompositeOperation = _chunkXIOMMGPDcjs.canvasCompositeOperation; exports.changedTiles = _chunkPOGBUYWEcjs.changedTiles; exports.collectTiles = _chunkXIOMMGPDcjs.collectTiles; exports.compositeLayerEffects = _chunkPOGBUYWEcjs.compositeLayerEffects; exports.compositeSurfaceOver = _chunkPOGBUYWEcjs.compositeSurfaceOver; exports.contentBounds = _chunkXIOMMGPDcjs.contentBounds; exports.contourLut = _chunkPOGBUYWEcjs.contourLut; exports.curveLut = _chunkPOGBUYWEcjs.curveLut; exports.decodePng = _chunkPOGBUYWEcjs.decodePng; exports.defaultEffectGradient = _chunkPOGBUYWEcjs.defaultEffectGradient; exports.defaultLayerEffect = _chunkPOGBUYWEcjs.defaultLayerEffect; exports.deflate = _chunkPOGBUYWEcjs.deflate; exports.deflateRaw = _chunkPOGBUYWEcjs.deflateRaw; exports.effectColorHex = _chunkPOGBUYWEcjs.effectColorHex; exports.effectFillColors = _chunkPOGBUYWEcjs.effectFillColors; exports.effectReach = _chunkPOGBUYWEcjs.effectReach; exports.effectsAreLocal = _chunkPOGBUYWEcjs.effectsAreLocal; exports.effectsFingerprint = _chunkPOGBUYWEcjs.effectsFingerprint; exports.effectsMargin = _chunkPOGBUYWEcjs.effectsMargin; exports.effectsScale = _chunkPOGBUYWEcjs.effectsScale; exports.emptySurface = _chunkXIOMMGPDcjs.emptySurface; exports.encodePng = _chunkPOGBUYWEcjs.encodePng; exports.fillRect = _chunkXIOMMGPDcjs.fillRect; exports.findLayer = _chunkPOGBUYWEcjs.findLayer; exports.finishTile = _chunkXIOMMGPDcjs.finishTile; exports.flattenLayers = _chunkPOGBUYWEcjs.flattenLayers; exports.gaussianBlur = _chunkPOGBUYWEcjs.gaussianBlur; exports.gradientT = _chunkPOGBUYWEcjs.gradientT; exports.hasActiveEffects = _chunkPOGBUYWEcjs.hasActiveEffects; exports.hashNoise = _chunkPOGBUYWEcjs.hashNoise; exports.inflate = _chunkPOGBUYWEcjs.inflate; exports.inflateRaw = _chunkPOGBUYWEcjs.inflateRaw; exports.insertLayer = _chunkPOGBUYWEcjs.insertLayer; exports.isBlendMode = _chunkXIOMMGPDcjs.isBlendMode; exports.isInterpolation = _chunkPOGBUYWEcjs.isInterpolation; exports.isLayerEffectKind = _chunkPOGBUYWEcjs.isLayerEffectKind; exports.isLayerLocked = _chunkPOGBUYWEcjs.isLayerLocked; exports.isPainterlyBlendMode = _chunkXIOMMGPDcjs.isPainterlyBlendMode; exports.isPng = _chunkPOGBUYWEcjs.isPng; exports.isSeparableBlendMode = _chunkXIOMMGPDcjs.isSeparableBlendMode; exports.keysWeight = _chunkPOGBUYWEcjs.keysWeight; exports.layerEffectFields = _chunkPOGBUYWEcjs.layerEffectFields; exports.layerEffectLabel = _chunkPOGBUYWEcjs.layerEffectLabel; exports.mapLayer = _chunkPOGBUYWEcjs.mapLayer; exports.mergeLayerEffect = _chunkPOGBUYWEcjs.mergeLayerEffect; exports.mixPigment8 = _chunkXIOMMGPDcjs.mixPigment8; exports.mixPigmentRgb = _chunkXIOMMGPDcjs.mixPigmentRgb; exports.newEffectId = _chunkPOGBUYWEcjs.newEffectId; exports.normalizeBlendMode = _chunkXIOMMGPDcjs.normalizeBlendMode; exports.normalizeLayerEffects = _chunkPOGBUYWEcjs.normalizeLayerEffects; exports.packRgba = _chunkXIOMMGPDcjs.packRgba; exports.parseDataUrl = _chunkPOGBUYWEcjs.parseDataUrl; exports.parseEffectColor = _chunkPOGBUYWEcjs.parseEffectColor; exports.patchEffectMaps = _chunkPOGBUYWEcjs.patchEffectMaps; exports.pigment8 = _chunkXIOMMGPDcjs.pigment8; exports.pngDataUrl = _chunkPOGBUYWEcjs.pngDataUrl; exports.readPixel = _chunkXIOMMGPDcjs.readPixel; exports.readRegion = _chunkXIOMMGPDcjs.readRegion; exports.reduceSurface = _chunkPOGBUYWEcjs.reduceSurface; exports.renderLayerEffects = _chunkPOGBUYWEcjs.renderLayerEffects; exports.scaleLayerEffect = _chunkPOGBUYWEcjs.scaleLayerEffect; exports.setLum = _chunkXIOMMGPDcjs.setLum; exports.solidSurface = _chunkXIOMMGPDcjs.solidSurface; exports.standardBlendMode = _chunkXIOMMGPDcjs.standardBlendMode; exports.surfaceBytes = _chunkXIOMMGPDcjs.surfaceBytes; exports.surfaceFromPixels = _chunkXIOMMGPDcjs.surfaceFromPixels; exports.surfacesEqual = _chunkXIOMMGPDcjs.surfacesEqual; exports.tileCoord = _chunkXIOMMGPDcjs.tileCoord; exports.tileKey = _chunkXIOMMGPDcjs.tileKey; exports.tileRect = _chunkXIOMMGPDcjs.tileRect; exports.tilesInRect = _chunkXIOMMGPDcjs.tilesInRect; exports.transformSurface = _chunkPOGBUYWEcjs.transformSurface; exports.transformedBounds = _chunkPOGBUYWEcjs.transformedBounds; exports.translateSurface = _chunkXIOMMGPDcjs.translateSurface; exports.uniformTile = _chunkXIOMMGPDcjs.uniformTile; exports.validateEffectGradient = _chunkPOGBUYWEcjs.validateEffectGradient; exports.validateLayerEffect = _chunkPOGBUYWEcjs.validateLayerEffect; exports.validateLayerEffects = _chunkPOGBUYWEcjs.validateLayerEffects; exports.warpSurface = _chunkPOGBUYWEcjs.warpSurface; exports.writeRegion = _chunkXIOMMGPDcjs.writeRegion;
|
|
234
236
|
//# 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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,27MAAC","file":"/home/runner/work/editor/editor/packages/core/dist/raster/index.cjs"}
|
package/dist/raster/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { B as BevelContour, o as BevelEmbossEffect, p as BevelStyle, q as BevelTechnique, r as BevelTexture, s as ColorOverlayEffect, t as CompositeCallOptions, u as CompositeStats, C as CompositorLayer, l as CompositorOptions, aD as CompositorProfile, v as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, w as DropShadowEffect, aE as EffectCompositeInput, n as EffectContext, x as EffectContour, E as EffectFill, y as EffectGradient, aF as EffectMaps, h as EffectPattern, z as EffectPatternRef, A as EffectRect, g as GlobalLight, F as GlowTechnique, H as GradientColorStop, J as GradientOpacityStop, K as GradientOverlayEffect, M as GradientStyle, G as GroupBlendMode, aG as GroupIn, N as INTERPOLATIONS, O as InnerGlowEffect, P as InnerShadowEffect, I as Interpolation, Q as LAYER_EFFECT_KINDS, j as LayerEffect, S as LayerEffectError, m as LayerEffectKind, k as LayerEffects, i as LayerLocation, L as LayerLocks, T as MAX_EFFECT_REACH, U as MAX_TRANSFORM_PIXELS, V as OuterGlowEffect, W as PatternOverlayEffect, X as PatternPlacement, Y as PatternTile, aH as PixelFilterSpec, c as RasterCompositor, a as RasterGroupLayer, R as RasterLayer, e as RasterLayerBase, f as RasterMask, aI as RasterNode, b as RasterPixelLayer, d as RasterSources, Z as ResampleOptions, aJ as STROKE_CHAMFER_MAX, _ as SatinEffect, $ as StrokeEffect, a0 as StrokePosition, a1 as TransformTooLargeError, aK as activeEffectItems, a2 as blendTile, aL as buildEffectMaps, a3 as builtinPattern, a4 as builtinPatternIds, a5 as changedTiles, aM as compositeLayerEffects, a6 as compositeSurfaceOver, aN as contourLut, a7 as defaultEffectGradient, a8 as defaultLayerEffect, a9 as effectColorHex, aO as effectFillColors, aa as effectReach, aP as effectsAreLocal, ab as effectsFingerprint, ac as effectsMargin, ad as effectsScale, ae as findLayer, af as flattenLayers, aQ as gradientT, ag as hasActiveEffects, ah as hashNoise, ai as insertLayer, aj as isInterpolation, ak as isLayerEffectKind, al as isLayerLocked, am as keysWeight, an as layerEffectFields, ao as layerEffectLabel, ap as mapLayer, aq as mergeLayerEffect, ar as newEffectId, as as normalizeLayerEffects, at as parseEffectColor, aR as patchEffectMaps, au as reduceSurface, av as renderLayerEffects, aw as scaleLayerEffect, ax as transformSurface, ay as transformedBounds, az as validateEffectGradient, aA as validateLayerEffect, aB as validateLayerEffects, aC as warpSurface } from '../render-
|
|
1
|
+
export { d as BLEND_MODES, B as BlendMode, c as BlendModeInfo, M as MaskSurface, e as PAINTERLY_BLEND_MODES, b as PixelSurface, R as RasterRect, o as Rgb, p as Rgba, S as SHADOW_AMBIENT, q as SurfaceDraft, r as TILE, t as TILE_SHIFT, f as Tile, T as TileKey, a as TiledSurface, u as blendChannel, v as blendImageData, w as blendLum, x as blendPixel, y as blendRgb, z as canvasCompositeOperation, A as collectTiles, C as contentBounds, E as emptySurface, F as fillRect, G as finishTile, i as isBlendMode, g as isPainterlyBlendMode, H as isSeparableBlendMode, K as mixPigment8, L as mixPigmentRgb, O as normalizeBlendMode, Q as packRgba, U as pigment8, V as readPixel, W as readRegion, Z as setLum, $ as solidSurface, s as standardBlendMode, a0 as surfaceBytes, a1 as surfaceFromPixels, a2 as surfacesEqual, a3 as tileCoord, a4 as tileKey, a5 as tileRect, a6 as tilesInRect, a7 as translateSurface, a8 as uniformTile, a9 as writeRegion } from '../surface-C8RRg_Bh.cjs';
|
|
2
|
+
export { B as BevelContour, o as BevelEmbossEffect, p as BevelStyle, q as BevelTechnique, r as BevelTexture, s as ColorOverlayEffect, t as CompositeCallOptions, u as CompositeStats, C as CompositorLayer, l as CompositorOptions, aD as CompositorProfile, v as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, w as DropShadowEffect, aE as EffectCompositeInput, n as EffectContext, x as EffectContour, E as EffectFill, y as EffectGradient, aF as EffectMaps, h as EffectPattern, z as EffectPatternRef, A as EffectRect, g as GlobalLight, F as GlowTechnique, H as GradientColorStop, J as GradientOpacityStop, K as GradientOverlayEffect, M as GradientStyle, G as GroupBlendMode, aG as GroupIn, N as INTERPOLATIONS, O as InnerGlowEffect, P as InnerShadowEffect, I as Interpolation, Q as LAYER_EFFECT_KINDS, j as LayerEffect, S as LayerEffectError, m as LayerEffectKind, k as LayerEffects, i as LayerLocation, L as LayerLocks, T as MAX_EFFECT_REACH, U as MAX_TRANSFORM_PIXELS, V as OuterGlowEffect, W as PatternOverlayEffect, X as PatternPlacement, Y as PatternTile, aH as PixelFilterSpec, c as RasterCompositor, a as RasterGroupLayer, R as RasterLayer, e as RasterLayerBase, f as RasterMask, aI as RasterNode, b as RasterPixelLayer, d as RasterSources, Z as ResampleOptions, aJ as STROKE_CHAMFER_MAX, _ as SatinEffect, $ as StrokeEffect, a0 as StrokePosition, a1 as TransformTooLargeError, aK as activeEffectItems, a2 as blendTile, aL as buildEffectMaps, a3 as builtinPattern, a4 as builtinPatternIds, a5 as changedTiles, aM as compositeLayerEffects, a6 as compositeSurfaceOver, aN as contourLut, a7 as defaultEffectGradient, a8 as defaultLayerEffect, a9 as effectColorHex, aO as effectFillColors, aa as effectReach, aP as effectsAreLocal, ab as effectsFingerprint, ac as effectsMargin, ad as effectsScale, ae as findLayer, af as flattenLayers, aQ as gradientT, ag as hasActiveEffects, ah as hashNoise, ai as insertLayer, aj as isInterpolation, ak as isLayerEffectKind, al as isLayerLocked, am as keysWeight, an as layerEffectFields, ao as layerEffectLabel, ap as mapLayer, aq as mergeLayerEffect, ar as newEffectId, as as normalizeLayerEffects, at as parseEffectColor, aR as patchEffectMaps, au as reduceSurface, av as renderLayerEffects, aw as scaleLayerEffect, ax as transformSurface, ay as transformedBounds, az as validateEffectGradient, aA as validateLayerEffect, aB as validateLayerEffects, aC as warpSurface } from '../render-BEriFuqK.cjs';
|
|
3
3
|
import '../types-CwMPoRMU.cjs';
|
|
4
4
|
|
|
5
5
|
/** Above this σ a Gaussian is approximated by three box passes (cost independent of σ). */
|
package/dist/raster/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { B as BevelContour, o as BevelEmbossEffect, p as BevelStyle, q as BevelTechnique, r as BevelTexture, s as ColorOverlayEffect, t as CompositeCallOptions, u as CompositeStats, C as CompositorLayer, l as CompositorOptions, aD as CompositorProfile, v as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, w as DropShadowEffect, aE as EffectCompositeInput, n as EffectContext, x as EffectContour, E as EffectFill, y as EffectGradient, aF as EffectMaps, h as EffectPattern, z as EffectPatternRef, A as EffectRect, g as GlobalLight, F as GlowTechnique, H as GradientColorStop, J as GradientOpacityStop, K as GradientOverlayEffect, M as GradientStyle, G as GroupBlendMode, aG as GroupIn, N as INTERPOLATIONS, O as InnerGlowEffect, P as InnerShadowEffect, I as Interpolation, Q as LAYER_EFFECT_KINDS, j as LayerEffect, S as LayerEffectError, m as LayerEffectKind, k as LayerEffects, i as LayerLocation, L as LayerLocks, T as MAX_EFFECT_REACH, U as MAX_TRANSFORM_PIXELS, V as OuterGlowEffect, W as PatternOverlayEffect, X as PatternPlacement, Y as PatternTile, aH as PixelFilterSpec, c as RasterCompositor, a as RasterGroupLayer, R as RasterLayer, e as RasterLayerBase, f as RasterMask, aI as RasterNode, b as RasterPixelLayer, d as RasterSources, Z as ResampleOptions, aJ as STROKE_CHAMFER_MAX, _ as SatinEffect, $ as StrokeEffect, a0 as StrokePosition, a1 as TransformTooLargeError, aK as activeEffectItems, a2 as blendTile, aL as buildEffectMaps, a3 as builtinPattern, a4 as builtinPatternIds, a5 as changedTiles, aM as compositeLayerEffects, a6 as compositeSurfaceOver, aN as contourLut, a7 as defaultEffectGradient, a8 as defaultLayerEffect, a9 as effectColorHex, aO as effectFillColors, aa as effectReach, aP as effectsAreLocal, ab as effectsFingerprint, ac as effectsMargin, ad as effectsScale, ae as findLayer, af as flattenLayers, aQ as gradientT, ag as hasActiveEffects, ah as hashNoise, ai as insertLayer, aj as isInterpolation, ak as isLayerEffectKind, al as isLayerLocked, am as keysWeight, an as layerEffectFields, ao as layerEffectLabel, ap as mapLayer, aq as mergeLayerEffect, ar as newEffectId, as as normalizeLayerEffects, at as parseEffectColor, aR as patchEffectMaps, au as reduceSurface, av as renderLayerEffects, aw as scaleLayerEffect, ax as transformSurface, ay as transformedBounds, az as validateEffectGradient, aA as validateLayerEffect, aB as validateLayerEffects, aC as warpSurface } from '../render-
|
|
1
|
+
export { d as BLEND_MODES, B as BlendMode, c as BlendModeInfo, M as MaskSurface, e as PAINTERLY_BLEND_MODES, b as PixelSurface, R as RasterRect, o as Rgb, p as Rgba, S as SHADOW_AMBIENT, q as SurfaceDraft, r as TILE, t as TILE_SHIFT, f as Tile, T as TileKey, a as TiledSurface, u as blendChannel, v as blendImageData, w as blendLum, x as blendPixel, y as blendRgb, z as canvasCompositeOperation, A as collectTiles, C as contentBounds, E as emptySurface, F as fillRect, G as finishTile, i as isBlendMode, g as isPainterlyBlendMode, H as isSeparableBlendMode, K as mixPigment8, L as mixPigmentRgb, O as normalizeBlendMode, Q as packRgba, U as pigment8, V as readPixel, W as readRegion, Z as setLum, $ as solidSurface, s as standardBlendMode, a0 as surfaceBytes, a1 as surfaceFromPixels, a2 as surfacesEqual, a3 as tileCoord, a4 as tileKey, a5 as tileRect, a6 as tilesInRect, a7 as translateSurface, a8 as uniformTile, a9 as writeRegion } from '../surface-C8RRg_Bh.js';
|
|
2
|
+
export { B as BevelContour, o as BevelEmbossEffect, p as BevelStyle, q as BevelTechnique, r as BevelTexture, s as ColorOverlayEffect, t as CompositeCallOptions, u as CompositeStats, C as CompositorLayer, l as CompositorOptions, aD as CompositorProfile, v as ContourPoint, D as DEFAULT_GLOBAL_LIGHT, w as DropShadowEffect, aE as EffectCompositeInput, n as EffectContext, x as EffectContour, E as EffectFill, y as EffectGradient, aF as EffectMaps, h as EffectPattern, z as EffectPatternRef, A as EffectRect, g as GlobalLight, F as GlowTechnique, H as GradientColorStop, J as GradientOpacityStop, K as GradientOverlayEffect, M as GradientStyle, G as GroupBlendMode, aG as GroupIn, N as INTERPOLATIONS, O as InnerGlowEffect, P as InnerShadowEffect, I as Interpolation, Q as LAYER_EFFECT_KINDS, j as LayerEffect, S as LayerEffectError, m as LayerEffectKind, k as LayerEffects, i as LayerLocation, L as LayerLocks, T as MAX_EFFECT_REACH, U as MAX_TRANSFORM_PIXELS, V as OuterGlowEffect, W as PatternOverlayEffect, X as PatternPlacement, Y as PatternTile, aH as PixelFilterSpec, c as RasterCompositor, a as RasterGroupLayer, R as RasterLayer, e as RasterLayerBase, f as RasterMask, aI as RasterNode, b as RasterPixelLayer, d as RasterSources, Z as ResampleOptions, aJ as STROKE_CHAMFER_MAX, _ as SatinEffect, $ as StrokeEffect, a0 as StrokePosition, a1 as TransformTooLargeError, aK as activeEffectItems, a2 as blendTile, aL as buildEffectMaps, a3 as builtinPattern, a4 as builtinPatternIds, a5 as changedTiles, aM as compositeLayerEffects, a6 as compositeSurfaceOver, aN as contourLut, a7 as defaultEffectGradient, a8 as defaultLayerEffect, a9 as effectColorHex, aO as effectFillColors, aa as effectReach, aP as effectsAreLocal, ab as effectsFingerprint, ac as effectsMargin, ad as effectsScale, ae as findLayer, af as flattenLayers, aQ as gradientT, ag as hasActiveEffects, ah as hashNoise, ai as insertLayer, aj as isInterpolation, ak as isLayerEffectKind, al as isLayerLocked, am as keysWeight, an as layerEffectFields, ao as layerEffectLabel, ap as mapLayer, aq as mergeLayerEffect, ar as newEffectId, as as normalizeLayerEffects, at as parseEffectColor, aR as patchEffectMaps, au as reduceSurface, av as renderLayerEffects, aw as scaleLayerEffect, ax as transformSurface, ay as transformedBounds, az as validateEffectGradient, aA as validateLayerEffect, aB as validateLayerEffects, aC as warpSurface } from '../render-tjzKaik-.js';
|
|
3
3
|
import '../types-CwMPoRMU.js';
|
|
4
4
|
|
|
5
5
|
/** Above this σ a Gaussian is approximated by three box passes (cost independent of σ). */
|
package/dist/raster/index.js
CHANGED
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
validateLayerEffect,
|
|
73
73
|
validateLayerEffects,
|
|
74
74
|
warpSurface
|
|
75
|
-
} from "../chunk-
|
|
75
|
+
} from "../chunk-LQEEDHOP.js";
|
|
76
76
|
import "../chunk-GX332W2C.js";
|
|
77
77
|
import {
|
|
78
78
|
BLEND_MODES,
|
|
@@ -100,6 +100,7 @@ import {
|
|
|
100
100
|
mixPigmentRgb,
|
|
101
101
|
normalizeBlendMode,
|
|
102
102
|
packRgba,
|
|
103
|
+
pigment8,
|
|
103
104
|
readPixel,
|
|
104
105
|
readRegion,
|
|
105
106
|
setLum,
|
|
@@ -115,7 +116,7 @@ import {
|
|
|
115
116
|
translateSurface,
|
|
116
117
|
uniformTile,
|
|
117
118
|
writeRegion
|
|
118
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-HNS7UHCM.js";
|
|
119
120
|
export {
|
|
120
121
|
BLEND_MODES,
|
|
121
122
|
CURVE_LUT_SIZE,
|
|
@@ -205,6 +206,7 @@ export {
|
|
|
205
206
|
parseDataUrl,
|
|
206
207
|
parseEffectColor,
|
|
207
208
|
patchEffectMaps,
|
|
209
|
+
pigment8,
|
|
208
210
|
pngDataUrl,
|
|
209
211
|
readPixel,
|
|
210
212
|
readRegion,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BlendMode, R as RasterRect, a as TiledSurface, M as MaskSurface,
|
|
1
|
+
import { B as BlendMode, R as RasterRect, a as TiledSurface, M as MaskSurface, b as PixelSurface, T as TileKey } from './surface-C8RRg_Bh.cjs';
|
|
2
2
|
import { H as Homography, V as Vec2 } from './types-CwMPoRMU.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BlendMode, R as RasterRect, a as TiledSurface, M as MaskSurface,
|
|
1
|
+
import { B as BlendMode, R as RasterRect, a as TiledSurface, M as MaskSurface, b as PixelSurface, T as TileKey } from './surface-C8RRg_Bh.js';
|
|
2
2
|
import { H as Homography, V as Vec2 } from './types-CwMPoRMU.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,3 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pigment-like colour mixing: blue and yellow make green, red and white make pink, as paint does.
|
|
3
|
+
*
|
|
4
|
+
* Each sRGB colour is lifted to a smooth reflectance spectrum, the spectra are mixed with the
|
|
5
|
+
* Kubelka-Munk two-flux model, and the mixed spectrum is turned back into sRGB. Written from the
|
|
6
|
+
* published literature; no third-party code or data:
|
|
7
|
+
*
|
|
8
|
+
* 1. **Spectral uplift.** A colour's reflectance is a sigmoid of a quadratic in wavelength,
|
|
9
|
+
* `R(λ) = s(c₀λ² + c₁λ + c₂)` with `s(z) = ½ + z / 2√(1 + z²)` (Jakob & Hanika, "A
|
|
10
|
+
* Low-Dimensional Function Space for Efficient Spectral Upsampling", Eurographics 2019). The
|
|
11
|
+
* three coefficients are solved per colour with Newton's method so the spectrum reproduces the
|
|
12
|
+
* colour. Spectra are precomputed lazily on a 17³ lattice over sRGB and interpolated
|
|
13
|
+
* trilinearly in *linear* RGB: colour is linear in reflectance, so an interpolated spectrum
|
|
14
|
+
* still reproduces its colour exactly while staying smooth and inside 0..1.
|
|
15
|
+
* 2. **Mixing.** Each spectrum becomes `K/S = (1 − R)² / 2R` per band. Colours mix with the
|
|
16
|
+
* two-constant form `K/S = Σ cᵢSᵢ(K/S)ᵢ / Σ cᵢSᵢ`, where `cᵢ` is the weight times the colour's
|
|
17
|
+
* tinting strength and `Sᵢ` its scattering, taken from its luminance (light paints such as
|
|
18
|
+
* titanium white scatter strongly, dark ones barely). Back to reflectance with
|
|
19
|
+
* `R = 1 + K/S − √((K/S)² + 2·K/S)`.
|
|
20
|
+
* 3. **Back to sRGB.** The spectrum is weighted by the CIE 1931 2° colour-matching functions
|
|
21
|
+
* (the analytic multi-lobe fit of Wyman, Sloan & Shirley, JCGT 2013) under a 6504 K Planckian
|
|
22
|
+
* illuminant, converted to linear sRGB and normalised so a perfect white reflector is exactly
|
|
23
|
+
* white. Analytic curves keep the CIE's own (CC BY-SA) tables out of the package.
|
|
24
|
+
*
|
|
25
|
+
* Everything is plain TypeScript on typed arrays with no DOM: it runs in Node and Workers and is
|
|
26
|
+
* deterministic. Colours are straight sRGB triples in 0..1, as in `@pixerate/editor/raster`.
|
|
27
|
+
*/
|
|
28
|
+
/** An sRGB colour, each channel 0..1 (gamma-encoded, as in CSS). */
|
|
29
|
+
type PigmentRgb = readonly [number, number, number];
|
|
30
|
+
/** Number of spectral bands. */
|
|
31
|
+
declare const PIGMENT_BANDS = 36;
|
|
32
|
+
/** First band's wavelength in nm; bands are 10 nm apart (380..730 nm). */
|
|
33
|
+
declare const PIGMENT_LAMBDA_MIN = 380;
|
|
34
|
+
declare const PIGMENT_LAMBDA_STEP = 10;
|
|
35
|
+
/** Band centre wavelengths in nm. */
|
|
36
|
+
declare const PIGMENT_WAVELENGTHS: Float32Array;
|
|
37
|
+
/**
|
|
38
|
+
* The smooth reflectance spectrum (0..1 per band, `PIGMENT_BANDS` bands from 380 nm in 10 nm
|
|
39
|
+
* steps) of an sRGB colour. `reflectanceToRgb` of the result gives the colour back.
|
|
40
|
+
*/
|
|
41
|
+
declare function rgbToReflectance(r: number, g: number, b: number, out?: Float32Array): Float32Array;
|
|
42
|
+
/** The sRGB colour (0..1, clipped to the gamut) of a reflectance spectrum. */
|
|
43
|
+
declare function reflectanceToRgb(reflectance: ArrayLike<number>, out?: number[]): number[];
|
|
44
|
+
/**
|
|
45
|
+
* A colour prepared for mixing: its K/S spectrum and its weight in a mix. Make one per brush or
|
|
46
|
+
* palette colour with `createPigment` and reuse it (`setPigmentColor`) on hot paths.
|
|
47
|
+
*/
|
|
48
|
+
interface Pigment {
|
|
49
|
+
/** The sRGB colour it was made from (0..1). */
|
|
50
|
+
readonly rgb: [number, number, number];
|
|
51
|
+
/** Tinting strength (default 1): how strongly it colours a mix, relative to its weight. */
|
|
52
|
+
strength: number;
|
|
53
|
+
/** K/S per band. */
|
|
54
|
+
readonly ks: Float32Array;
|
|
55
|
+
/** Scattering from the colour's luminance (floored), before strength. */
|
|
56
|
+
scatter: number;
|
|
57
|
+
}
|
|
58
|
+
interface PigmentOptions {
|
|
59
|
+
/**
|
|
60
|
+
* Tinting strength, > 0 (default 1). A strength of 4 counts each part as four, so a little of
|
|
61
|
+
* a strong dark pigment tints a lot of white. A colour mixed only with itself is unchanged
|
|
62
|
+
* whatever its strength.
|
|
63
|
+
*/
|
|
64
|
+
strength?: number;
|
|
65
|
+
}
|
|
66
|
+
/** Prepares a colour for mixing. */
|
|
67
|
+
declare function createPigment(color: PigmentRgb, options?: PigmentOptions): Pigment;
|
|
68
|
+
/** Re-targets a pigment to another colour without allocating (the per-pixel fast path). */
|
|
69
|
+
declare function setPigmentColor(pigment: Pigment, r: number, g: number, b: number, strength?: number): Pigment;
|
|
70
|
+
/**
|
|
71
|
+
* Mixes colours like paint. `weights` are parts by amount (any non-negative scale; at least one
|
|
72
|
+
* positive). Colours may be sRGB triples (0..1) or prepared pigments (which carry a tinting
|
|
73
|
+
* strength). Returns the mixed sRGB colour (0..1).
|
|
74
|
+
*/
|
|
75
|
+
declare function mixPigments(colors: readonly (PigmentRgb | Pigment)[], weights: readonly number[]): [number, number, number];
|
|
76
|
+
/** Mixes `a` towards `b` like paint: `t = 0` is `a`, `t = 1` is `b`. */
|
|
77
|
+
declare function lerpPigment(a: PigmentRgb | Pigment, b: PigmentRgb | Pigment, t: number): [number, number, number];
|
|
78
|
+
/**
|
|
79
|
+
* The per-dab fast path: mixes two prepared pigments (`t` of `b` into `a`) and writes the sRGB
|
|
80
|
+
* result to `out[offset..offset + 2]`, without allocating. Pair it with `setPigmentColor` for the
|
|
81
|
+
* colour under the brush.
|
|
82
|
+
*/
|
|
83
|
+
declare function lerpPigmentInto(a: Pigment, b: Pigment, t: number, out: {
|
|
84
|
+
[i: number]: number;
|
|
85
|
+
}, offset?: number): void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Photoshop blend modes on straight (non-premultiplied) 0..1 colours.
|
|
89
|
+
*
|
|
90
|
+
* Formulas follow the W3C Compositing / ISO 32000 definitions, with Photoshop's variants where
|
|
91
|
+
* they differ (Soft Light, Vivid / Linear / Pin Light, Hard Mix, Linear Burn / Dodge, Subtract,
|
|
92
|
+
* Divide, Darker / Lighter Color), and the hardened `ClipColor` for the non-separable modes.
|
|
93
|
+
*
|
|
94
|
+
* Plus `pigment`, which is not a `B(Cb, Cs)` mode: it replaces the alpha interpolation
|
|
95
|
+
* `(1 − α)·Cb + α·B` with a Kubelka-Munk paint mix of the two colours (see `lerpPigment`).
|
|
96
|
+
*
|
|
97
|
+
* Plus four painterly modes of our own design, which are ordinary `B(Cb, Cs)` modes, so every
|
|
98
|
+
* caller of `blendRgb` / `blendChannel` (the compositor, adjustment layers, effects, brushes) gets
|
|
99
|
+
* them for free: `watercolor` (transparent washes, multiplied per wavelength), `tint` (the source's
|
|
100
|
+
* colour on the backdrop's lightness, gently at the extremes), `highlight` (light added with a
|
|
101
|
+
* soft shoulder) and `shadow` (light taken away, with ambient fill). See `painterlyRgb`.
|
|
102
|
+
*/
|
|
103
|
+
|
|
1
104
|
type BlendMode = 'normal' | 'darken' | 'multiply' | 'color-burn' | 'linear-burn' | 'darker-color' | 'lighten' | 'screen' | 'color-dodge' | 'linear-dodge' | 'lighter-color' | 'overlay' | 'soft-light' | 'hard-light' | 'vivid-light' | 'linear-light' | 'pin-light' | 'hard-mix' | 'difference' | 'exclusion' | 'subtract' | 'divide' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'pigment' | 'watercolor' | 'tint' | 'highlight' | 'shadow';
|
|
2
105
|
interface BlendModeInfo {
|
|
3
106
|
id: BlendMode;
|
|
@@ -56,6 +159,11 @@ declare const SHADOW_AMBIENT = 0.2;
|
|
|
56
159
|
* `out[0..2]`. `t ≥ 1` (or equal colours) is `cs` exactly. Colours are 0..1.
|
|
57
160
|
*/
|
|
58
161
|
declare function mixPigmentRgb(cb: readonly number[], cs: readonly number[], t: number, out?: number[]): number[];
|
|
162
|
+
/**
|
|
163
|
+
* The prepared pigment (K/S spectrum) of an 8-bit colour, from the cache every 8-bit pigment
|
|
164
|
+
* composite shares. Read-only: do not retarget it with `setPigmentColor`.
|
|
165
|
+
*/
|
|
166
|
+
declare function pigment8(r: number, g: number, b: number): Pigment;
|
|
59
167
|
/**
|
|
60
168
|
* {@link mixPigmentRgb} on 8-bit channels, with each colour's spectrum cached: writes the 0..1
|
|
61
169
|
* result to `out[0..2]`. The compositor's and {@link blendImageData}'s per-pixel path.
|
|
@@ -208,4 +316,4 @@ declare function collectTiles(surface: TiledSurface, into: Set<Tile>): void;
|
|
|
208
316
|
/** True when two surfaces hold the same pixels (cheap when they share tiles). */
|
|
209
317
|
declare function surfacesEqual(a: TiledSurface, b: TiledSurface): boolean;
|
|
210
318
|
|
|
211
|
-
export {
|
|
319
|
+
export { solidSurface as $, collectTiles as A, type BlendMode as B, contentBounds as C, createPigment as D, emptySurface as E, fillRect as F, finishTile as G, isSeparableBlendMode as H, lerpPigment as I, lerpPigmentInto as J, mixPigment8 as K, mixPigmentRgb as L, type MaskSurface as M, mixPigments as N, normalizeBlendMode as O, type Pigment as P, packRgba as Q, type RasterRect as R, SHADOW_AMBIENT as S, type TileKey as T, pigment8 as U, readPixel as V, readRegion as W, reflectanceToRgb as X, rgbToReflectance as Y, setLum as Z, setPigmentColor as _, TiledSurface as a, surfaceBytes as a0, surfaceFromPixels as a1, surfacesEqual as a2, tileCoord as a3, tileKey as a4, tileRect as a5, tilesInRect as a6, translateSurface as a7, uniformTile as a8, writeRegion as a9, type PixelSurface as b, type BlendModeInfo as c, BLEND_MODES as d, PAINTERLY_BLEND_MODES as e, type Tile as f, isPainterlyBlendMode as g, PIGMENT_BANDS as h, isBlendMode as i, PIGMENT_LAMBDA_MIN as j, PIGMENT_LAMBDA_STEP as k, PIGMENT_WAVELENGTHS as l, type PigmentOptions as m, type PigmentRgb as n, type Rgb as o, type Rgba as p, SurfaceDraft as q, TILE as r, standardBlendMode as s, TILE_SHIFT as t, blendChannel as u, blendImageData as v, blendLum as w, blendPixel as x, blendRgb as y, canvasCompositeOperation as z };
|
|
@@ -1,3 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pigment-like colour mixing: blue and yellow make green, red and white make pink, as paint does.
|
|
3
|
+
*
|
|
4
|
+
* Each sRGB colour is lifted to a smooth reflectance spectrum, the spectra are mixed with the
|
|
5
|
+
* Kubelka-Munk two-flux model, and the mixed spectrum is turned back into sRGB. Written from the
|
|
6
|
+
* published literature; no third-party code or data:
|
|
7
|
+
*
|
|
8
|
+
* 1. **Spectral uplift.** A colour's reflectance is a sigmoid of a quadratic in wavelength,
|
|
9
|
+
* `R(λ) = s(c₀λ² + c₁λ + c₂)` with `s(z) = ½ + z / 2√(1 + z²)` (Jakob & Hanika, "A
|
|
10
|
+
* Low-Dimensional Function Space for Efficient Spectral Upsampling", Eurographics 2019). The
|
|
11
|
+
* three coefficients are solved per colour with Newton's method so the spectrum reproduces the
|
|
12
|
+
* colour. Spectra are precomputed lazily on a 17³ lattice over sRGB and interpolated
|
|
13
|
+
* trilinearly in *linear* RGB: colour is linear in reflectance, so an interpolated spectrum
|
|
14
|
+
* still reproduces its colour exactly while staying smooth and inside 0..1.
|
|
15
|
+
* 2. **Mixing.** Each spectrum becomes `K/S = (1 − R)² / 2R` per band. Colours mix with the
|
|
16
|
+
* two-constant form `K/S = Σ cᵢSᵢ(K/S)ᵢ / Σ cᵢSᵢ`, where `cᵢ` is the weight times the colour's
|
|
17
|
+
* tinting strength and `Sᵢ` its scattering, taken from its luminance (light paints such as
|
|
18
|
+
* titanium white scatter strongly, dark ones barely). Back to reflectance with
|
|
19
|
+
* `R = 1 + K/S − √((K/S)² + 2·K/S)`.
|
|
20
|
+
* 3. **Back to sRGB.** The spectrum is weighted by the CIE 1931 2° colour-matching functions
|
|
21
|
+
* (the analytic multi-lobe fit of Wyman, Sloan & Shirley, JCGT 2013) under a 6504 K Planckian
|
|
22
|
+
* illuminant, converted to linear sRGB and normalised so a perfect white reflector is exactly
|
|
23
|
+
* white. Analytic curves keep the CIE's own (CC BY-SA) tables out of the package.
|
|
24
|
+
*
|
|
25
|
+
* Everything is plain TypeScript on typed arrays with no DOM: it runs in Node and Workers and is
|
|
26
|
+
* deterministic. Colours are straight sRGB triples in 0..1, as in `@pixerate/editor/raster`.
|
|
27
|
+
*/
|
|
28
|
+
/** An sRGB colour, each channel 0..1 (gamma-encoded, as in CSS). */
|
|
29
|
+
type PigmentRgb = readonly [number, number, number];
|
|
30
|
+
/** Number of spectral bands. */
|
|
31
|
+
declare const PIGMENT_BANDS = 36;
|
|
32
|
+
/** First band's wavelength in nm; bands are 10 nm apart (380..730 nm). */
|
|
33
|
+
declare const PIGMENT_LAMBDA_MIN = 380;
|
|
34
|
+
declare const PIGMENT_LAMBDA_STEP = 10;
|
|
35
|
+
/** Band centre wavelengths in nm. */
|
|
36
|
+
declare const PIGMENT_WAVELENGTHS: Float32Array;
|
|
37
|
+
/**
|
|
38
|
+
* The smooth reflectance spectrum (0..1 per band, `PIGMENT_BANDS` bands from 380 nm in 10 nm
|
|
39
|
+
* steps) of an sRGB colour. `reflectanceToRgb` of the result gives the colour back.
|
|
40
|
+
*/
|
|
41
|
+
declare function rgbToReflectance(r: number, g: number, b: number, out?: Float32Array): Float32Array;
|
|
42
|
+
/** The sRGB colour (0..1, clipped to the gamut) of a reflectance spectrum. */
|
|
43
|
+
declare function reflectanceToRgb(reflectance: ArrayLike<number>, out?: number[]): number[];
|
|
44
|
+
/**
|
|
45
|
+
* A colour prepared for mixing: its K/S spectrum and its weight in a mix. Make one per brush or
|
|
46
|
+
* palette colour with `createPigment` and reuse it (`setPigmentColor`) on hot paths.
|
|
47
|
+
*/
|
|
48
|
+
interface Pigment {
|
|
49
|
+
/** The sRGB colour it was made from (0..1). */
|
|
50
|
+
readonly rgb: [number, number, number];
|
|
51
|
+
/** Tinting strength (default 1): how strongly it colours a mix, relative to its weight. */
|
|
52
|
+
strength: number;
|
|
53
|
+
/** K/S per band. */
|
|
54
|
+
readonly ks: Float32Array;
|
|
55
|
+
/** Scattering from the colour's luminance (floored), before strength. */
|
|
56
|
+
scatter: number;
|
|
57
|
+
}
|
|
58
|
+
interface PigmentOptions {
|
|
59
|
+
/**
|
|
60
|
+
* Tinting strength, > 0 (default 1). A strength of 4 counts each part as four, so a little of
|
|
61
|
+
* a strong dark pigment tints a lot of white. A colour mixed only with itself is unchanged
|
|
62
|
+
* whatever its strength.
|
|
63
|
+
*/
|
|
64
|
+
strength?: number;
|
|
65
|
+
}
|
|
66
|
+
/** Prepares a colour for mixing. */
|
|
67
|
+
declare function createPigment(color: PigmentRgb, options?: PigmentOptions): Pigment;
|
|
68
|
+
/** Re-targets a pigment to another colour without allocating (the per-pixel fast path). */
|
|
69
|
+
declare function setPigmentColor(pigment: Pigment, r: number, g: number, b: number, strength?: number): Pigment;
|
|
70
|
+
/**
|
|
71
|
+
* Mixes colours like paint. `weights` are parts by amount (any non-negative scale; at least one
|
|
72
|
+
* positive). Colours may be sRGB triples (0..1) or prepared pigments (which carry a tinting
|
|
73
|
+
* strength). Returns the mixed sRGB colour (0..1).
|
|
74
|
+
*/
|
|
75
|
+
declare function mixPigments(colors: readonly (PigmentRgb | Pigment)[], weights: readonly number[]): [number, number, number];
|
|
76
|
+
/** Mixes `a` towards `b` like paint: `t = 0` is `a`, `t = 1` is `b`. */
|
|
77
|
+
declare function lerpPigment(a: PigmentRgb | Pigment, b: PigmentRgb | Pigment, t: number): [number, number, number];
|
|
78
|
+
/**
|
|
79
|
+
* The per-dab fast path: mixes two prepared pigments (`t` of `b` into `a`) and writes the sRGB
|
|
80
|
+
* result to `out[offset..offset + 2]`, without allocating. Pair it with `setPigmentColor` for the
|
|
81
|
+
* colour under the brush.
|
|
82
|
+
*/
|
|
83
|
+
declare function lerpPigmentInto(a: Pigment, b: Pigment, t: number, out: {
|
|
84
|
+
[i: number]: number;
|
|
85
|
+
}, offset?: number): void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Photoshop blend modes on straight (non-premultiplied) 0..1 colours.
|
|
89
|
+
*
|
|
90
|
+
* Formulas follow the W3C Compositing / ISO 32000 definitions, with Photoshop's variants where
|
|
91
|
+
* they differ (Soft Light, Vivid / Linear / Pin Light, Hard Mix, Linear Burn / Dodge, Subtract,
|
|
92
|
+
* Divide, Darker / Lighter Color), and the hardened `ClipColor` for the non-separable modes.
|
|
93
|
+
*
|
|
94
|
+
* Plus `pigment`, which is not a `B(Cb, Cs)` mode: it replaces the alpha interpolation
|
|
95
|
+
* `(1 − α)·Cb + α·B` with a Kubelka-Munk paint mix of the two colours (see `lerpPigment`).
|
|
96
|
+
*
|
|
97
|
+
* Plus four painterly modes of our own design, which are ordinary `B(Cb, Cs)` modes, so every
|
|
98
|
+
* caller of `blendRgb` / `blendChannel` (the compositor, adjustment layers, effects, brushes) gets
|
|
99
|
+
* them for free: `watercolor` (transparent washes, multiplied per wavelength), `tint` (the source's
|
|
100
|
+
* colour on the backdrop's lightness, gently at the extremes), `highlight` (light added with a
|
|
101
|
+
* soft shoulder) and `shadow` (light taken away, with ambient fill). See `painterlyRgb`.
|
|
102
|
+
*/
|
|
103
|
+
|
|
1
104
|
type BlendMode = 'normal' | 'darken' | 'multiply' | 'color-burn' | 'linear-burn' | 'darker-color' | 'lighten' | 'screen' | 'color-dodge' | 'linear-dodge' | 'lighter-color' | 'overlay' | 'soft-light' | 'hard-light' | 'vivid-light' | 'linear-light' | 'pin-light' | 'hard-mix' | 'difference' | 'exclusion' | 'subtract' | 'divide' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'pigment' | 'watercolor' | 'tint' | 'highlight' | 'shadow';
|
|
2
105
|
interface BlendModeInfo {
|
|
3
106
|
id: BlendMode;
|
|
@@ -56,6 +159,11 @@ declare const SHADOW_AMBIENT = 0.2;
|
|
|
56
159
|
* `out[0..2]`. `t ≥ 1` (or equal colours) is `cs` exactly. Colours are 0..1.
|
|
57
160
|
*/
|
|
58
161
|
declare function mixPigmentRgb(cb: readonly number[], cs: readonly number[], t: number, out?: number[]): number[];
|
|
162
|
+
/**
|
|
163
|
+
* The prepared pigment (K/S spectrum) of an 8-bit colour, from the cache every 8-bit pigment
|
|
164
|
+
* composite shares. Read-only: do not retarget it with `setPigmentColor`.
|
|
165
|
+
*/
|
|
166
|
+
declare function pigment8(r: number, g: number, b: number): Pigment;
|
|
59
167
|
/**
|
|
60
168
|
* {@link mixPigmentRgb} on 8-bit channels, with each colour's spectrum cached: writes the 0..1
|
|
61
169
|
* result to `out[0..2]`. The compositor's and {@link blendImageData}'s per-pixel path.
|
|
@@ -208,4 +316,4 @@ declare function collectTiles(surface: TiledSurface, into: Set<Tile>): void;
|
|
|
208
316
|
/** True when two surfaces hold the same pixels (cheap when they share tiles). */
|
|
209
317
|
declare function surfacesEqual(a: TiledSurface, b: TiledSurface): boolean;
|
|
210
318
|
|
|
211
|
-
export {
|
|
319
|
+
export { solidSurface as $, collectTiles as A, type BlendMode as B, contentBounds as C, createPigment as D, emptySurface as E, fillRect as F, finishTile as G, isSeparableBlendMode as H, lerpPigment as I, lerpPigmentInto as J, mixPigment8 as K, mixPigmentRgb as L, type MaskSurface as M, mixPigments as N, normalizeBlendMode as O, type Pigment as P, packRgba as Q, type RasterRect as R, SHADOW_AMBIENT as S, type TileKey as T, pigment8 as U, readPixel as V, readRegion as W, reflectanceToRgb as X, rgbToReflectance as Y, setLum as Z, setPigmentColor as _, TiledSurface as a, surfaceBytes as a0, surfaceFromPixels as a1, surfacesEqual as a2, tileCoord as a3, tileKey as a4, tileRect as a5, tilesInRect as a6, translateSurface as a7, uniformTile as a8, writeRegion as a9, type PixelSurface as b, type BlendModeInfo as c, BLEND_MODES as d, PAINTERLY_BLEND_MODES as e, type Tile as f, isPainterlyBlendMode as g, PIGMENT_BANDS as h, isBlendMode as i, PIGMENT_LAMBDA_MIN as j, PIGMENT_LAMBDA_STEP as k, PIGMENT_WAVELENGTHS as l, type PigmentOptions as m, type PigmentRgb as n, type Rgb as o, type Rgba as p, SurfaceDraft as q, TILE as r, standardBlendMode as s, TILE_SHIFT as t, blendChannel as u, blendImageData as v, blendLum as w, blendPixel as x, blendRgb as y, canvasCompositeOperation as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pixerate-image-editor
|
|
3
|
-
description: How to colour-correct, composite and retouch a photo in the Pixerate image editor through its agent tools - layers (pixel, adjustment, group, shape, annotation and smart object layers with masks, clipping, blend modes, opacity and fill; merge, flatten, filters), smart objects (non-destructive transforms, smart filters, linked contents), vector shape layers (live
|
|
3
|
+
description: How to colour-correct, composite and retouch a photo in the Pixerate image editor through its agent tools - layers (pixel, adjustment, group, shape, type, annotation and smart object layers with masks, clipping, blend modes, opacity and fill; merge, flatten, filters), smart objects (non-destructive transforms, smart filters, linked contents), vector shape layers (live shapes, arrows, paths, path operations, fills and strokes), live type layers, live layer effects, base adjustments, adjustment layers, selections and masks, Free Transform, crop, rotate, flip, Mixer Brush, undo, PSD, histogram and previews. Use when asked to edit, grade, correct, crop, straighten or mask an image, add a shadow, glow or outline, transform or warp a layer, draw a shape or arrow, add or edit text, make a smart object, or open or save a PSD, or when list_layers, set_adjustments, add_layer_effect, transform_layer, add_shape_layer, add_text_layer, convert_to_smart_object, paint_stroke, import_psd or render_preview are available.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Image editor
|
|
@@ -9,7 +9,8 @@ The image editor holds a layer stack over a canvas the size of the source image.
|
|
|
9
9
|
image gives one pixel layer, **Background**, whose pixels are the source and whose `develop`
|
|
10
10
|
filter holds the base adjustments; adjustment layers sit above it (bottom to top, each through
|
|
11
11
|
its mask, opacity and blend mode) and every annotation is its own layer on top (pen, rectangle,
|
|
12
|
-
ellipse, line and arrow annotations are shape layers that remember
|
|
12
|
+
ellipse, line and arrow annotations are shape layers, text annotations type layers, that remember
|
|
13
|
+
them). `list_layers`
|
|
13
14
|
shows the whole stack. Edits never touch the source pixels. The base controls edit the develop
|
|
14
15
|
filter of the active pixel layer (the Background unless another pixel layer is active); base
|
|
15
16
|
`blur` blurs that layer (or, in documents saved before layers with blur and adjustment layers,
|
|
@@ -17,7 +18,8 @@ the output after the layers), and base `opacity` is the output's alpha. Pixel, a
|
|
|
17
18
|
and smart object layers can carry live effects (shadows, glows, bevels, overlays, strokes). A smart
|
|
18
19
|
object places contents (pixels or a nested layer document) through a transform and smart filters,
|
|
19
20
|
re-rendered from the contents on every change. A shape layer holds vector paths with a fill and a
|
|
20
|
-
stroke, rendered again from the paths on every change, so it stays sharp through any transform.
|
|
21
|
+
stroke, rendered again from the paths on every change, so it stays sharp through any transform. A
|
|
22
|
+
type layer holds live, styled text (point or paragraph) drawn with the editor's fonts.
|
|
21
23
|
Also an optional selection and crop/rotate/flip. See `pixerate-agent-tools` for errors, namespacing and command
|
|
22
24
|
batching.
|
|
23
25
|
|
|
@@ -119,31 +121,14 @@ batching.
|
|
|
119
121
|
6. **Finish**: `rasterize_smart_object` only when the user wants plain pixels to paint on; the
|
|
120
122
|
placement and filters are then gone.
|
|
121
123
|
|
|
122
|
-
###
|
|
124
|
+
### Shapes and text
|
|
123
125
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
(dashes in multiples of the width). It returns the layer id and `shape` (components with
|
|
131
|
-
index, op and live parameters, bounds).
|
|
132
|
-
2. **Combine paths**: `add_shape_component` with `op` `combine`, `subtract`, `intersect` or
|
|
133
|
-
`exclude` (Photoshop's path operations; the bottom component always combines). The stroke
|
|
134
|
-
follows the outline of the combined area. `merge_shape_components` turns the result into one
|
|
135
|
-
plain path (same look).
|
|
136
|
-
3. **Edit, don't redraw**: `set_shape_component` changes a live shape's fields (only `radii`, only
|
|
137
|
-
`x2` / `y2`, …; the rest stay), replaces a component's `subpaths` (ending its live shape) or
|
|
138
|
-
changes its `op`. `update_shape` restyles the fill, the stroke (only the settings given) or the
|
|
139
|
-
fill rule. Read `get_shape_layer` first for the component indices.
|
|
140
|
-
4. **Place it**: `offset_layer`, `transform_layer`, `flip_layer`, `rotate_layer_90` and `warp_layer`
|
|
141
|
-
map the paths, never resample pixels; live shapes stay live under moves, scales, rotations and
|
|
142
|
-
skews (perspective and warps turn them into plain paths). Stroke widths do not scale.
|
|
143
|
-
5. **Style it like any layer**: masks, clipping, blend modes, opacity, fill opacity and layer
|
|
144
|
-
effects (`add_layer_effect`) all work on shape layers.
|
|
145
|
-
6. **Pixels only when needed**: painting a shape's pixels is refused; `rasterize_layer` turns it
|
|
146
|
-
into a pixel layer (paths gone) when the user wants to paint on it.
|
|
126
|
+
Draw boxes, badges, arrows and callouts as shape layers (`add_shape_layer` with a live `shape`,
|
|
127
|
+
then `set_shape_component` / `update_shape` / `add_shape_component`), and text as type layers
|
|
128
|
+
(`add_text_layer`, then `set_text`, `set_text_style`, `set_paragraph_style` by `start` / `end`
|
|
129
|
+
range). Both stay sharp through transforms and take effects, masks and blend modes; rasterize only
|
|
130
|
+
to paint on them. Read [references/shapes-and-type.md](references/shapes-and-type.md) before
|
|
131
|
+
drawing or editing either.
|
|
147
132
|
|
|
148
133
|
### Layer effects
|
|
149
134
|
|
|
@@ -315,10 +300,12 @@ batching.
|
|
|
315
300
|
| `get_image_info` | Read the geometry: source `image` size, `crop` box (source pixels, or null), `rotation` degrees, `flipH` / `flipV`, the `output` size after crop and rotation, the layer count and `canUndo` / `canRedo`. Call before cropping or selecting so coordinates are right. |
|
|
316
301
|
| `get_histogram` | Judge exposure numerically: per channel and luminance `mean`, `p1` and `p99` (0..255), and `clipping` percent at pure black and white per channel. Reads the last render, so call `render_preview` first. `bins` (16, 32, 64 or 256) adds the counts. Cheaper than another image for checking a tonal change. |
|
|
317
302
|
| `render_preview` | See the edited image (crop, adjustments, layers, annotations) as a PNG, or with `layerId` one layer alone. `maxSide` 16..2048 px, default 512. Images cost tokens: render after a group of edits, use 512 for overall look and 1024+ to judge clipping, edges and masks. Fails in environments without rendering. |
|
|
318
|
-
| `inspect_psd` | Read a PSD / PSB (`data` base64) without opening it: size, `depth`, `colorMode`, `resolution`, every layer bottom first with `psdKind`, the `type` it would become (`smart` for smart objects) and `status` (`mapped`, `approximated`, `dropped`) with `notes`, and the import `warnings`. Call before `import_psd`. |
|
|
319
|
-
| `export_psd` | Save the document as an 8-bit RGB PSD (PSB above 30000 px) with layers, groups, adjustment layers and masks. Returns `data` (base64), `size` in bytes, `psb` and `warnings` (crop or rotation not applied, filters and depth masks baked,
|
|
303
|
+
| `inspect_psd` | Read a PSD / PSB (`data` base64) without opening it: size, `depth`, `colorMode`, `resolution`, every layer bottom first with `psdKind`, the `type` it would become (`smart`, `shape` and `type` for Photoshop smart objects, shapes and text) and `status` (`mapped`, `approximated`, `dropped`) with `notes`, and the import `warnings`. Call before `import_psd`. |
|
|
304
|
+
| `export_psd` | Save the document as an 8-bit RGB PSD (PSB above 30000 px) with layers, groups, adjustment layers and masks. Returns `data` (base64), `size` in bytes, `psb` and `warnings` (crop or rotation not applied, filters and depth masks baked, annotations rasterized or left out, Pigment blends written as Normal). Shape and type layers are written as real Photoshop shape and type layers. Changes nothing. |
|
|
320
305
|
| `get_transform_frame` | Before a transform: what it would move (`content`, `moved`: pixels, mask, selection), its `frame` (document bounds of the content), `corners` (top-left, top-right, bottom-right, bottom-left) and `center`. `meshColumns` / `meshRows` also return an identity warp `mesh` over the frame to edit for `warp_layer`. Changes nothing. |
|
|
321
306
|
| `get_smart_object` | Read a smart object: `contents` (`id` shared by linked instances, `name`, `kind` raster or document, `width` / `height`, `decoded`, `fileType`, `linkedPath`, `instances`), `placement` (`corners`, `warp` in contents px, `interpolation`, and when `affine` the `scaleX` / `scaleY` in percent of the contents, `rotate`, `skewX`, `center`, `bounds`) and `smartFilters` (`enabled`, `filters` bottom to top with ids, settings, `blend`, `opacity`; kind `psd` is a Photoshop filter kept but not drawn; the filter `mask`). Call before changing a smart object. |
|
|
307
|
+
| `list_fonts` | Read the font families type layers can use here (generic families always work) and which shaper draws them. Call before choosing a font. |
|
|
308
|
+
| `get_text_layer` | Read a type layer: `text`, character `runs` and `paragraphs` as `start` / `end` ranges (UTF-16 code units, end exclusive) with their styles, the `frame` (point, or box with its size), the text-to-document `transform`, laid-out `lines` (range, baseline, width), `bounds`, `missingFonts`, and `rendering` (`live`, or `stored` pixels from a file until the next edit). Call before editing text you did not write. |
|
|
322
309
|
| `get_shape_layer` | Read a shape layer: `components` bottom to top (`index`, `op`, `live` shape parameters or null, `subpaths` with absolute anchors and handles, `bounds`), `fillRule`, `fill` and `stroke` (paint and settings), `geometryBounds` (the paths) and `bounds` (rendered pixels, stroke included), and `annotationId` while it is still a migrated annotation. Call before editing a shape you did not draw. |
|
|
323
310
|
| `export_smart_object_contents` | Export Contents: the contents as a file (`name`, `mimeType`, `byteLength`, `base64`): the file they came from while unedited, else a PNG (raster) or PSD / PSB (nested document). Changes nothing. |
|
|
324
311
|
| `capture_view` | Inspect detail in natural image pixels (the space of `get_selection` and `select_region`, before crop and rotation): `region` `content` (whole image, default), `selection` or `rect`; small regions are enlarged up to 8× with hard pixel edges, so a 64 px rect shows real pixels. `includeOverlays: true` shades unselected pixels and outlines the crop: use it to check a mask's edge before `apply_selection_as_mask`. Returns the `rect` and `scale`. Use `render_preview` for the final framed result. |
|
|
@@ -366,6 +353,12 @@ batching.
|
|
|
366
353
|
| `remove_layer_mask` | Delete a mask without applying it; disable it instead to keep it. |
|
|
367
354
|
| `layer_via_copy` | Copy the selected pixels of a pixel layer (default the active one) to a new layer above it; `cut: true` removes them from the source. Needs a selection. Returns the new layer. |
|
|
368
355
|
| `rasterize_layer` | Turn a shape layer into a pixel layer showing the same pixels (same id, mask, effects, opacity, blend; the paths are gone), an annotation layer into pixels (browser only), a smart object into a pixel layer (as `rasterize_smart_object`), or bake a pixel layer's develop / blur filters into its pixels. Do it before painting over a shape or annotation, or when the user wants the filters fixed. Destructive. |
|
|
356
|
+
| `add_text_layer` | Add live type above the active layer and make it active: `text`, `x`, `y`, optional `box` (paragraph text), `style`, `paragraph`, `rotation`, `name`, `opacity`, `blend`, placement. Returns the `layer` and `text` (with `lines` and `missingFonts`). One undo step. |
|
|
357
|
+
| `set_text` | Replace text `start`..`end` (default all) with `text`; start = end inserts. New text takes the style at `start`. Returns the text layer. |
|
|
358
|
+
| `set_text_style` | Set character style fields over `start`..`end` (default all): `fontFamily`, `fontWeight`, `italic`, `fontSize`, `color`, `opacity`, `tracking`, `leading`, `baselineShift`, `underline`, `strikethrough` (`null` resets optional ones). Returns the runs. |
|
|
359
|
+
| `set_paragraph_style` | Set `align`, `autoLeading`, indents, `spaceBefore` / `spaceAfter` on every paragraph `start`..`end` touches (default all). Returns the text layer. |
|
|
360
|
+
| `set_text_frame` | `kind: point` (one line per paragraph) or `kind: box` with `width` and `height` (wrapping paragraph text), or resize a box; the first line stays put. Returns the text layer and its lines. |
|
|
361
|
+
| `convert_text_to_shape` | Type › Convert to Shape: glyph outlines become a shape layer with the same id (text no longer editable; fill from the first run's colour; `warnings` lists losses). Needs an outline font shaper. Destructive. |
|
|
369
362
|
| `add_shape_layer` | Add a vector shape layer above the active layer (or placed with `aboveId` / `belowId` / `parentId` / `index`) and make it active: `shape` (live rect, ellipse, polygon, star or line, document px), `subpaths` (SVG path data or anchors) or several `components` with path ops; `fill` (colour, gradient or pattern, default the foreground colour; `null` none), `stroke` (`width`, `paint`, `align`, `cap`, `join`, `miterLimit`, `dashes` in widths), `fillRule`, `name`, `opacity`, `blend`. Returns the `layer` and the `shape`. One undo step. |
|
|
370
363
|
| `update_shape` | Restyle a shape: `fill` (replace, `null` removes), `stroke` (only the settings given change; `null` removes; a new stroke needs `width` and `paint`), `fillRule`. Geometry is unchanged. Returns the shape. |
|
|
371
364
|
| `set_shape_component` | Change component `componentIndex` (from `get_shape_layer`): `shape` fields (without `kind`, or with the same kind, unset fields keep their values), new `subpaths` (ends the live shape), or `op`. Returns the shape. |
|
|
@@ -421,10 +414,14 @@ batching.
|
|
|
421
414
|
- `merge_down`, `merge_visible` and `flatten_image` merge annotation layers only in a browser
|
|
422
415
|
(they need a canvas); elsewhere they fail and say so.
|
|
423
416
|
- `paint_stroke`, `fill_pixels` and `clear_pixels` need a visible pixel layer (or a layer with a
|
|
424
|
-
raster mask and `channel: "mask"`); adjustment, group, shape, annotation and smart object layers can
|
|
417
|
+
raster mask and `channel: "mask"`); adjustment, group, shape, type, annotation and smart object layers can
|
|
425
418
|
only be painted through their masks (and a smart object through `channel: "filter-mask"`).
|
|
426
419
|
To paint a smart object's pixels, `edit_smart_object_contents` or rasterize it. A layer with
|
|
427
420
|
`locks.pixels` refuses paint.
|
|
421
|
+
- Text ranges count UTF-16 code units (an emoji is two). Point text grows from its origin: centred
|
|
422
|
+
text is centred on `x`. Type cannot be distorted, put in perspective or warped; it can be scaled,
|
|
423
|
+
rotated and skewed. Where no font shaper exists (a server without one), type layers keep their
|
|
424
|
+
stored pixels and edits are refused with a reason.
|
|
428
425
|
- Shape strokes are not layer-effect strokes: `stroke` on `add_shape_layer` / `update_shape`
|
|
429
426
|
follows the path (and its dashes and caps); `add_layer_effect` `stroke` outlines the rendered
|
|
430
427
|
pixels. Arrowheads belong to `line` live shapes (their `width` and `length` are pixels), not to
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Shape and type layers
|
|
2
|
+
|
|
3
|
+
Detail for the `pixerate-image-editor` skill: how to draw and edit vector shapes and live text.
|
|
4
|
+
|
|
5
|
+
## Shape layers
|
|
6
|
+
|
|
7
|
+
1. **Draw it as a live shape**: `add_shape_layer` with `shape` `{ kind: 'rect', x, y, width,
|
|
8
|
+
height, radius | radii }`, `ellipse`, `polygon` (`sides`), `star` (`points`, `innerRatio`) or
|
|
9
|
+
`line` (`x1`…`y2`, `weight`, `startArrow` / `endArrow` `{ width, length, concavity }`), all in
|
|
10
|
+
document pixels. A free path takes `subpaths` (SVG path data, or anchors with absolute `in` /
|
|
11
|
+
`out` handles). `fill` is a colour string or `{ type: 'gradient' | 'pattern', … }` (default the
|
|
12
|
+
foreground colour; `null` for none); `stroke` is `{ width, paint, align, cap, join, dashes }`
|
|
13
|
+
(dashes in multiples of the width). It returns the layer id and `shape` (components with
|
|
14
|
+
index, op and live parameters, bounds).
|
|
15
|
+
2. **Combine paths**: `add_shape_component` with `op` `combine`, `subtract`, `intersect` or
|
|
16
|
+
`exclude` (Photoshop's path operations; the bottom component always combines). The stroke
|
|
17
|
+
follows the outline of the combined area. `merge_shape_components` turns the result into one
|
|
18
|
+
plain path (same look).
|
|
19
|
+
3. **Edit, don't redraw**: `set_shape_component` changes a live shape's fields (only `radii`, only
|
|
20
|
+
`x2` / `y2`, …; the rest stay), replaces a component's `subpaths` (ending its live shape) or
|
|
21
|
+
changes its `op`. `update_shape` restyles the fill, the stroke (only the settings given) or the
|
|
22
|
+
fill rule. Read `get_shape_layer` first for the component indices.
|
|
23
|
+
4. **Place it**: `offset_layer`, `transform_layer`, `flip_layer`, `rotate_layer_90` and `warp_layer`
|
|
24
|
+
map the paths, never resample pixels; live shapes stay live under moves, scales, rotations and
|
|
25
|
+
skews (perspective and warps turn them into plain paths). Stroke widths do not scale.
|
|
26
|
+
5. **Style it like any layer**: masks, clipping, blend modes, opacity, fill opacity and layer
|
|
27
|
+
effects (`add_layer_effect`) all work on shape layers.
|
|
28
|
+
6. **Pixels only when needed**: painting a shape's pixels is refused; `rasterize_layer` turns it
|
|
29
|
+
into a pixel layer (paths gone) when the user wants to paint on it.
|
|
30
|
+
|
|
31
|
+
## Type layers
|
|
32
|
+
|
|
33
|
+
1. **Add it**: `add_text_layer` with `text` (`\n` starts a paragraph), `x`, `y` (point text: the
|
|
34
|
+
first line's baseline at its alignment edge) or a `box` `{ width, height }` for paragraph text
|
|
35
|
+
that wraps (then `x`, `y` is the box's top-left), a `style` (`fontFamily`, `fontWeight`,
|
|
36
|
+
`italic`, `fontSize` in px, `color`, `tracking` in 1/1000 em, `leading` in px, `baselineShift`,
|
|
37
|
+
`underline`, `strikethrough`) and a `paragraph` style (`align`, `autoLeading`, indents,
|
|
38
|
+
`spaceBefore` / `spaceAfter`). Call `list_fonts` first when the font matters: a missing family
|
|
39
|
+
draws with a fallback and comes back in `missingFonts`.
|
|
40
|
+
2. **Edit by range**: ranges are `start` / `end` in UTF-16 code units, `end` exclusive, as
|
|
41
|
+
`get_text_layer` reports runs and lines. `set_text` replaces a range (start = end inserts; new
|
|
42
|
+
text takes the style at `start`), `set_text_style` styles a range (only the fields given),
|
|
43
|
+
`set_paragraph_style` styles the paragraphs a range touches. Re-read the runs after an edit
|
|
44
|
+
that changes the length before using old ranges.
|
|
45
|
+
3. **Shape the block**: `set_text_frame` switches between point text and a wrapping box (or
|
|
46
|
+
resizes the box) with the first line kept in place.
|
|
47
|
+
4. **Place it**: `offset_layer`, `transform_layer`, `flip_layer` and `rotate_layer_90` change the
|
|
48
|
+
text's matrix and draw it again (scale, rotate, skew, flips). Distort, perspective and warp are
|
|
49
|
+
refused: rasterize first. Masks, clipping, blend modes and effects work as on any layer.
|
|
50
|
+
5. **Outlines and pixels**: `convert_text_to_shape` makes glyph outlines a shape layer (needs an
|
|
51
|
+
outline font shaper; the browser canvas cannot); `rasterize_layer` makes it pixels.
|
|
52
|
+
|
|
53
|
+
## Photoshop files
|
|
54
|
+
|
|
55
|
+
`import_psd` brings Photoshop shape layers in as live shapes (paths with their path operations, fill,
|
|
56
|
+
stroke, and live rectangles, rounded rectangles, ellipses and lines) and type layers as live text
|
|
57
|
+
that shows Photoshop's pixels until it is edited. `get_text_layer` reports `rendering: "stored"`
|
|
58
|
+
and `missingFonts` for those: if a font is missing, edits draw with a fallback, so tell the user
|
|
59
|
+
before editing such text, or pick an available font with `set_text_style`. `export_psd` writes both
|
|
60
|
+
kinds back as Photoshop layers; unchanged ones are written byte for byte as they were read.
|