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