@kittl/pdfkit 0.17.5 → 0.17.51

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.
@@ -735,6 +735,14 @@ function write_svg (doc, svg, x, y, options) {
735
735
  color: 'Color',
736
736
  luminosity: 'Luminosity'
737
737
  };
738
+ const maskBackdrop = [0, 0, 0];
739
+ if (doc._activeColorProfile) {
740
+ let i = doc._activeColorProfile.channels - 3;
741
+ while (i > 0) {
742
+ maskBackdrop.push(0);
743
+ i--;
744
+ }
745
+ }
738
746
  function docBeginGroup(bbox) {
739
747
  let group = new function PDFGroup() {}();
740
748
  group.name = 'G' + (doc._groupCount = (doc._groupCount || 0) + 1);
@@ -803,9 +811,9 @@ function write_svg (doc, svg, x, y, options) {
803
811
  ca: 1,
804
812
  BM: 'Normal',
805
813
  SMask: {
806
- S: 'Luminosity',
814
+ S: clip ? 'Alpha' : 'Luminosity',
807
815
  G: group.xobj,
808
- BC: clip ? [0, 0, 0] : [1, 1, 1]
816
+ BC: maskBackdrop
809
817
  }
810
818
  });
811
819
  gstate.end();
@@ -1129,7 +1137,7 @@ function write_svg (doc, svg, x, y, options) {
1129
1137
  let newColor = color[0].slice(),
1130
1138
  newOpacity = color[1] * opacity;
1131
1139
  if (isMask) {
1132
- for (let i = 0; i < color.length; i++) {
1140
+ for (let i = 0; i < newColor.length; i++) {
1133
1141
  newColor[i] *= newOpacity;
1134
1142
  }
1135
1143
  return [newColor, 1];
@@ -3139,7 +3147,7 @@ function write_svg (doc, svg, x, y, options) {
3139
3147
  this.drawChildren(false, true);
3140
3148
  doc.restore();
3141
3149
  docEndGroup(group);
3142
- docApplyMask(group, true);
3150
+ docApplyMask(group, false);
3143
3151
  };
3144
3152
  };
3145
3153
  var SvgElemTextContainer = function (obj, inherits) {