@kittl/pdfkit 0.17.5 → 0.17.52

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/js/write_svg.js CHANGED
@@ -725,11 +725,14 @@ function write_svg (doc, svg, x, y, options) {
725
725
  overlay: 'Overlay',
726
726
  darken: 'Darken',
727
727
  lighten: 'Lighten',
728
+ colorburn: 'ColorBurn',
729
+ colordodge: 'ColorDodge',
730
+ hardlight: 'HardLight',
731
+ softlight: 'SoftLight',
728
732
  'color-dodge': 'ColorDodge',
729
733
  'color-burn': 'ColorBurn',
730
734
  'hard-light': 'HardLight',
731
735
  'soft-light': 'SoftLight',
732
- softlight: 'SoftLight',
733
736
  difference: 'Difference',
734
737
  exclusion: 'Exclusion',
735
738
  hue: 'Hue',
@@ -737,6 +740,14 @@ function write_svg (doc, svg, x, y, options) {
737
740
  color: 'Color',
738
741
  luminosity: 'Luminosity'
739
742
  };
743
+ const maskBackdrop = [0, 0, 0];
744
+ if (doc._activeColorProfile) {
745
+ let i = doc._activeColorProfile.channels - 3;
746
+ while (i > 0) {
747
+ maskBackdrop.push(0);
748
+ i--;
749
+ }
750
+ }
740
751
  function docBeginGroup(bbox) {
741
752
  let group = new function PDFGroup() {}();
742
753
  group.name = 'G' + (doc._groupCount = (doc._groupCount || 0) + 1);
@@ -805,9 +816,9 @@ function write_svg (doc, svg, x, y, options) {
805
816
  ca: 1,
806
817
  BM: 'Normal',
807
818
  SMask: {
808
- S: 'Luminosity',
819
+ S: clip ? 'Alpha' : 'Luminosity',
809
820
  G: group.xobj,
810
- BC: clip ? [0, 0, 0] : [1, 1, 1]
821
+ BC: maskBackdrop
811
822
  }
812
823
  });
813
824
  gstate.end();
@@ -1131,7 +1142,7 @@ function write_svg (doc, svg, x, y, options) {
1131
1142
  let newColor = color[0].slice(),
1132
1143
  newOpacity = color[1] * opacity;
1133
1144
  if (isMask) {
1134
- for (let i = 0; i < color.length; i++) {
1145
+ for (let i = 0; i < newColor.length; i++) {
1135
1146
  newColor[i] *= newOpacity;
1136
1147
  }
1137
1148
  return [newColor, 1];
@@ -3141,7 +3152,7 @@ function write_svg (doc, svg, x, y, options) {
3141
3152
  this.drawChildren(false, true);
3142
3153
  doc.restore();
3143
3154
  docEndGroup(group);
3144
- docApplyMask(group, true);
3155
+ docApplyMask(group, false);
3145
3156
  };
3146
3157
  };
3147
3158
  var SvgElemTextContainer = function (obj, inherits) {