@pixerate/editor 0.95.0 → 0.96.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.
@@ -10,6 +10,7 @@
10
10
 
11
11
 
12
12
 
13
+
13
14
  var _chunkCRMAXIUVcjs = require('./chunk-CRMAXIUV.cjs');
14
15
 
15
16
  // src/raster/blur.ts
@@ -372,6 +373,7 @@ function oneOf(r, key, path, values) {
372
373
  }
373
374
  function blend(r, key, path) {
374
375
  if (!_chunkCRMAXIUVcjs.isBlendMode.call(void 0, r[key])) fail(`${path}.${key}`, `must be a blend mode such as normal, multiply or screen (got ${JSON.stringify(r[key])}).`);
376
+ if (r[key] === "pigment") fail(`${path}.${key}`, "pigment is a layer blend mode only; effects cannot use it.");
375
377
  }
376
378
  function contour(v, path) {
377
379
  if (v === void 0) return;
@@ -1452,6 +1454,7 @@ function buildEffectMaps(items, shape, rect, ctx) {
1452
1454
  }
1453
1455
  var rgbScratchB = [0, 0, 0];
1454
1456
  var rgbScratchS = [0, 0, 0];
1457
+ var rgbScratchM = [0, 0, 0];
1455
1458
  function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
1456
1459
  if (!(sa > 0)) return;
1457
1460
  const ab = dst[i + 3];
@@ -1463,6 +1466,20 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
1463
1466
  const b0 = dst[i];
1464
1467
  const b1 = dst[i + 1];
1465
1468
  const b2 = dst[i + 2];
1469
+ if (mode === "pigment") {
1470
+ rgbScratchB[0] = b0;
1471
+ rgbScratchB[1] = b1;
1472
+ rgbScratchB[2] = b2;
1473
+ rgbScratchS[0] = sr;
1474
+ rgbScratchS[1] = sg;
1475
+ rgbScratchS[2] = sb;
1476
+ _chunkCRMAXIUVcjs.mixPigmentRgb.call(void 0, rgbScratchB, rgbScratchS, sa / ao, rgbScratchM);
1477
+ dst[i] = rgbScratchM[0];
1478
+ dst[i + 1] = rgbScratchM[1];
1479
+ dst[i + 2] = rgbScratchM[2];
1480
+ dst[i + 3] = ao;
1481
+ return;
1482
+ }
1466
1483
  let m0;
1467
1484
  let m1;
1468
1485
  let m2;
@@ -3692,4 +3709,4 @@ function pngDataUrl(width, height, data, channels = 4) {
3692
3709
 
3693
3710
 
3694
3711
  exports.DIRECT_GAUSSIAN_MAX_SIGMA = DIRECT_GAUSSIAN_MAX_SIGMA; exports.gaussianBlur = gaussianBlur; exports.flattenLayers = flattenLayers; exports.findLayer = findLayer; exports.mapLayer = mapLayer; exports.insertLayer = insertLayer; exports.isLayerLocked = isLayerLocked; exports.DEFAULT_GLOBAL_LIGHT = DEFAULT_GLOBAL_LIGHT; exports.LAYER_EFFECT_KINDS = LAYER_EFFECT_KINDS; exports.layerEffectLabel = layerEffectLabel; exports.isLayerEffectKind = isLayerEffectKind; exports.defaultEffectGradient = defaultEffectGradient; exports.newEffectId = newEffectId; exports.defaultLayerEffect = defaultLayerEffect; exports.hasActiveEffects = hasActiveEffects; exports.MAX_EFFECT_REACH = MAX_EFFECT_REACH; exports.effectReach = effectReach; exports.effectsMargin = effectsMargin; exports.effectsScale = effectsScale; exports.scaleLayerEffect = scaleLayerEffect; exports.parseEffectColor = parseEffectColor; exports.effectColorHex = effectColorHex; exports.LayerEffectError = LayerEffectError; exports.validateEffectGradient = validateEffectGradient; exports.layerEffectFields = layerEffectFields; exports.validateLayerEffect = validateLayerEffect; exports.mergeLayerEffect = mergeLayerEffect; exports.validateLayerEffects = validateLayerEffects; exports.normalizeLayerEffects = normalizeLayerEffects; exports.effectsFingerprint = effectsFingerprint; exports.PatternTile = PatternTile; exports.PatternPlacement = PatternPlacement; exports.builtinPatternIds = builtinPatternIds; exports.builtinPattern = builtinPattern; exports.hashNoise = hashNoise; exports.CURVE_LUT_SIZE = CURVE_LUT_SIZE; exports.curveLut = curveLut; exports.STROKE_CHAMFER_MAX = STROKE_CHAMFER_MAX; exports.contourLut = contourLut; exports.activeEffectItems = activeEffectItems; exports.effectsAreLocal = effectsAreLocal; exports.buildEffectMaps = buildEffectMaps; exports.gradientT = gradientT; exports.compositeLayerEffects = compositeLayerEffects; exports.renderLayerEffects = renderLayerEffects; exports.blendTile = blendTile; exports.RasterCompositor = RasterCompositor; exports.changedTiles = changedTiles; exports.ZlibError = ZlibError; exports.inflateRaw = inflateRaw; exports.adler32 = adler32; exports.inflate = inflate; exports.deflateRaw = deflateRaw; exports.deflate = deflate; exports.encodePng = encodePng; exports.isPng = isPng; exports.decodePng = decodePng; exports.bytesToBase64 = bytesToBase64; exports.base64ToBytes = base64ToBytes; exports.parseDataUrl = parseDataUrl; exports.pngDataUrl = pngDataUrl;
3695
- //# sourceMappingURL=chunk-T6H3JDGA.cjs.map
3712
+ //# sourceMappingURL=chunk-T422YCHR.cjs.map