watermark-js-plus 1.5.8 → 1.6.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.
Files changed (62) hide show
  1. package/dist/ie/index.cjs.js +107 -78
  2. package/dist/ie/index.cjs.js.map +1 -1
  3. package/dist/ie/index.cjs.min.js +1 -1
  4. package/dist/ie/index.esm.js +107 -78
  5. package/dist/ie/index.esm.js.map +1 -1
  6. package/dist/ie/index.esm.min.js +1 -1
  7. package/dist/ie/index.iife.js +107 -78
  8. package/dist/ie/index.iife.js.map +1 -1
  9. package/dist/ie/index.iife.min.js +1 -1
  10. package/dist/ie/index.umd.js +107 -78
  11. package/dist/ie/index.umd.js.map +1 -1
  12. package/dist/ie/index.umd.min.js +1 -1
  13. package/dist/index.cjs.js +105 -76
  14. package/dist/index.cjs.js.map +1 -1
  15. package/dist/index.cjs.min.js +1 -1
  16. package/dist/index.esm.js +105 -76
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/index.esm.min.js +1 -1
  19. package/dist/index.iife.js +105 -76
  20. package/dist/index.iife.js.map +1 -1
  21. package/dist/index.iife.min.js +1 -1
  22. package/dist/index.umd.js +105 -76
  23. package/dist/index.umd.js.map +1 -1
  24. package/dist/index.umd.min.js +1 -1
  25. package/dist/types/{src/types → types}/index.d.ts +1 -0
  26. package/dist/{ie/types/src → types}/utils/index.d.ts +1 -0
  27. package/package.json +45 -32
  28. package/dist/ie/types/src/types/index.d.ts +0 -128
  29. package/dist/ie/types/tests/core/blind.test.d.ts +0 -1
  30. package/dist/ie/types/tests/core/image.test.d.ts +0 -1
  31. package/dist/ie/types/tests/core/watermark.test.d.ts +0 -1
  32. package/dist/ie/types/tests/utils/index.d.ts +0 -2
  33. package/dist/ie/types/tests/utils/index.test.d.ts +0 -1
  34. package/dist/types/src/core/blind.d.ts +0 -19
  35. package/dist/types/src/core/canvas.d.ts +0 -51
  36. package/dist/types/src/core/image.d.ts +0 -22
  37. package/dist/types/src/core/layout/grid.d.ts +0 -14
  38. package/dist/types/src/core/layout/index.d.ts +0 -4
  39. package/dist/types/src/core/watermark.d.ts +0 -48
  40. package/dist/types/src/index.d.ts +0 -5
  41. package/dist/types/src/index.ie.d.ts +0 -7
  42. package/dist/types/src/style/index.d.ts +0 -1
  43. package/dist/types/src/utils/index.d.ts +0 -14
  44. package/dist/types/src/utils/initialization.d.ts +0 -19
  45. package/dist/types/src/utils/protection.d.ts +0 -2
  46. package/dist/types/tests/core/blind.test.d.ts +0 -1
  47. package/dist/types/tests/core/image.test.d.ts +0 -1
  48. package/dist/types/tests/core/watermark.test.d.ts +0 -1
  49. package/dist/types/tests/utils/index.d.ts +0 -2
  50. package/dist/types/tests/utils/index.test.d.ts +0 -1
  51. /package/dist/{ie/types/src → types}/core/blind.d.ts +0 -0
  52. /package/dist/{ie/types/src → types}/core/canvas.d.ts +0 -0
  53. /package/dist/{ie/types/src → types}/core/image.d.ts +0 -0
  54. /package/dist/{ie/types/src → types}/core/layout/grid.d.ts +0 -0
  55. /package/dist/{ie/types/src → types}/core/layout/index.d.ts +0 -0
  56. /package/dist/{ie/types/src → types}/core/watermark.d.ts +0 -0
  57. /package/dist/{ie/types/src → types}/index.d.ts +0 -0
  58. /package/dist/{ie/types/src → types}/index.ie.d.ts +0 -0
  59. /package/dist/{ie/types/src → types}/style/index.d.ts +0 -0
  60. /package/dist/{ie/types/src → types}/utils/initialization.d.ts +0 -0
  61. /package/dist/types/{src/utils → utils}/polyfill.d.ts +0 -0
  62. /package/dist/{ie/types/src → types}/utils/protection.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * watermark-js-plus v1.5.8
2
+ * watermark-js-plus v1.6.0
3
3
  * (c) 2022-2024 Michael Sun
4
4
  * Released under the MIT License.
5
5
  */
@@ -554,10 +554,10 @@ function requireSharedStore () {
554
554
  var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
555
555
 
556
556
  (store.versions || (store.versions = [])).push({
557
- version: '3.40.0',
557
+ version: '3.41.0',
558
558
  mode: IS_PURE ? 'pure' : 'global',
559
559
  copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
560
- license: 'https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE',
560
+ license: 'https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE',
561
561
  source: 'https://github.com/zloirock/core-js'
562
562
  });
563
563
  return sharedStore.exports;
@@ -4213,7 +4213,7 @@ function styleInject(css, ref) {
4213
4213
  }
4214
4214
  }
4215
4215
 
4216
- var css_248z = "@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:0 0}75%{background-position:100% -100%}to{background-position:0 0}}";
4216
+ var css_248z = "@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}";
4217
4217
  styleInject(css_248z);
4218
4218
 
4219
4219
  /******************************************************************************
@@ -4230,7 +4230,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4230
4230
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4231
4231
  PERFORMANCE OF THIS SOFTWARE.
4232
4232
  ***************************************************************************** */
4233
- /* global Reflect, Promise */
4233
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
4234
4234
 
4235
4235
  var extendStatics = function(d, b) {
4236
4236
  extendStatics = Object.setPrototypeOf ||
@@ -4269,8 +4269,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
4269
4269
  }
4270
4270
 
4271
4271
  function __generator(thisArg, body) {
4272
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4273
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4272
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
4273
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4274
4274
  function verb(n) { return function (v) { return step([n, v]); }; }
4275
4275
  function step(op) {
4276
4276
  if (f) throw new TypeError("Generator is already executing.");
@@ -4294,7 +4294,12 @@ function __generator(thisArg, body) {
4294
4294
  } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
4295
4295
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4296
4296
  }
4297
- }
4297
+ }
4298
+
4299
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
4300
+ var e = new Error(message);
4301
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
4302
+ };
4298
4303
 
4299
4304
  var convertImage = function (canvas) {
4300
4305
  return canvas.toDataURL('image/png', 1);
@@ -4345,7 +4350,7 @@ var createCustomContentSVG = function (ctx, options) { return __awaiter(void 0,
4345
4350
  switch (_b.label) {
4346
4351
  case 0:
4347
4352
  svgElement = createSVGElement('svg', {
4348
- xmlns: 'http://www.w3.org/2000/svg'
4353
+ xmlns: 'http://www.w3.org/2000/svg',
4349
4354
  });
4350
4355
  bodyElement = document.createElement('div');
4351
4356
  bodyElement.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
@@ -4367,14 +4372,14 @@ var createCustomContentSVG = function (ctx, options) { return __awaiter(void 0,
4367
4372
  svgElement.setAttribute('height', height.toString());
4368
4373
  foreignObjectElement = createSVGElement('foreignObject', {
4369
4374
  width: width.toString(),
4370
- height: height.toString()
4375
+ height: height.toString(),
4371
4376
  });
4372
4377
  foreignObjectElement.appendChild(bodyElement);
4373
4378
  svgElement.appendChild(foreignObjectElement);
4374
4379
  return [2 /*return*/, {
4375
4380
  element: svgElement,
4376
4381
  width: width,
4377
- height: height
4382
+ height: height,
4378
4383
  }];
4379
4384
  }
4380
4385
  });
@@ -4442,7 +4447,8 @@ function convertImgToBase64(bodyElement) {
4442
4447
  var convertSVGToImage = function (svg) {
4443
4448
  var richContent = svg.outerHTML
4444
4449
  .replace(/<(img|br|input|hr|embed)(.*?)>/g, '<$1$2/>')
4445
- .replace(/\n/g, '').replace(/\t/g, '')
4450
+ .replace(/\n/g, '')
4451
+ .replace(/\t/g, '')
4446
4452
  .replace(/#/g, '%23');
4447
4453
  return "data:image/svg+xml;charset=utf-8,".concat(richContent);
4448
4454
  };
@@ -4458,7 +4464,7 @@ var loadImage = function (url, width, height) {
4458
4464
  if (width === void 0) { width = undefined; }
4459
4465
  if (height === void 0) { height = undefined; }
4460
4466
  var image = new Image();
4461
- image.setAttribute('crossOrigin', 'Anonymous');
4467
+ image.setAttribute('crossOrigin', 'anonymous');
4462
4468
  !isUndefined(width) && (image.width = width);
4463
4469
  !isUndefined(height) && (image.height = height);
4464
4470
  image.src = url;
@@ -4471,6 +4477,25 @@ var loadImage = function (url, width, height) {
4471
4477
  var generateMatrix = function (rows, columns, value) {
4472
4478
  return Array.from({ length: rows }, function () { return new Array(columns).fill(value); });
4473
4479
  };
4480
+ var generateAnimationStyle = function (movable, backgroundRepeat) {
4481
+ if (!movable) {
4482
+ return '';
4483
+ }
4484
+ var horizontalDuration = Math.random() * (8 - 2) + 2;
4485
+ var verticalDuration = Math.random() * (4 - 2) + 2;
4486
+ switch (backgroundRepeat) {
4487
+ case 'repeat':
4488
+ return 'animation: 200s linear 0s infinite alternate watermark !important;';
4489
+ case 'repeat-x':
4490
+ return "animation: ".concat(horizontalDuration, "s ease-in 0s infinite alternate watermark-vertical !important;'");
4491
+ case 'repeat-y':
4492
+ return "animation: ".concat(verticalDuration, "s ease-out 0s infinite alternate watermark-horizontal !important;'");
4493
+ case 'no-repeat':
4494
+ return "animation: ".concat(horizontalDuration, "s ease-in 0s infinite alternate watermark-horizontal, ").concat(verticalDuration, "s ease-out 0s infinite alternate watermark-vertical !important;");
4495
+ default:
4496
+ return '';
4497
+ }
4498
+ };
4474
4499
 
4475
4500
  var initialOptions = {
4476
4501
  width: 300,
@@ -4506,7 +4531,7 @@ var initialOptions = {
4506
4531
  onSuccess: function () { },
4507
4532
  onBeforeDestroy: function () { },
4508
4533
  onDestroyed: function () { },
4509
- onObserveError: function () { }
4534
+ onObserveError: function () { },
4510
4535
  };
4511
4536
  var generateRecommendOptions = function (canvas, options, args) {
4512
4537
  var ctx = canvas.getContext('2d');
@@ -4519,7 +4544,7 @@ var generateRecommendOptions = function (canvas, options, args) {
4519
4544
  ctx.letterSpacing = options.letterSpacing;
4520
4545
  ctx.wordSpacing = options.wordSpacing;
4521
4546
  if (options === null || options === void 0 ? void 0 : options.rotate) {
4522
- options.rotate = (360 - options.rotate % 360) * (Math.PI / 180);
4547
+ options.rotate = (360 - (options.rotate % 360)) * (Math.PI / 180);
4523
4548
  }
4524
4549
  if (isUndefined(args.textRowMaxWidth)) {
4525
4550
  options.textRowMaxWidth = options.width;
@@ -4528,21 +4553,21 @@ var generateRecommendOptions = function (canvas, options, args) {
4528
4553
  image: {
4529
4554
  rect: {
4530
4555
  width: options.imageWidth,
4531
- height: options.imageHeight
4556
+ height: options.imageHeight,
4532
4557
  },
4533
4558
  position: {
4534
4559
  x: 0,
4535
- y: 0
4536
- }
4560
+ y: 0,
4561
+ },
4537
4562
  },
4538
4563
  textLine: {
4539
4564
  data: [],
4540
- yOffsetValue: 0
4565
+ yOffsetValue: 0,
4541
4566
  },
4542
4567
  advancedStyleParams: {
4543
4568
  linear: {
4544
4569
  x0: 0,
4545
- x1: 0
4570
+ x1: 0,
4546
4571
  },
4547
4572
  radial: {
4548
4573
  x0: 0,
@@ -4550,15 +4575,15 @@ var generateRecommendOptions = function (canvas, options, args) {
4550
4575
  r0: 0,
4551
4576
  x1: 0,
4552
4577
  y1: 0,
4553
- r1: 0
4578
+ r1: 0,
4554
4579
  },
4555
4580
  conic: {
4556
4581
  x: 0,
4557
4582
  y: 0,
4558
- startAngle: 0
4583
+ startAngle: 0,
4559
4584
  },
4560
- pattern: {}
4561
- }
4585
+ pattern: {},
4586
+ },
4562
4587
  };
4563
4588
  switch (options.contentType) {
4564
4589
  case 'text':
@@ -4608,14 +4633,14 @@ var generateRecommendOptions = function (canvas, options, args) {
4608
4633
  result.advancedStyleParams.linear.x0 = -options.width / 2;
4609
4634
  result.advancedStyleParams.linear.x1 = options.width / 2;
4610
4635
  // result.advancedStyleParams.radial.x0 = 0
4611
- result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
4636
+ result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
4612
4637
  // result.advancedStyleParams.radial.r0 = 0
4613
4638
  // result.advancedStyleParams.radial.x1 = 0
4614
4639
  // result.advancedStyleParams.radial.y1 = 0
4615
- result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
4640
+ result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
4616
4641
  // result.advancedStyleParams.radial.r1 = options.width / 2
4617
4642
  // result.advancedStyleParams.conic.x = 0
4618
- result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
4643
+ result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
4619
4644
  break;
4620
4645
  case 'top-start':
4621
4646
  translateX = 0;
@@ -4625,13 +4650,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4625
4650
  result.advancedStyleParams.linear.x0 = 0;
4626
4651
  result.advancedStyleParams.linear.x1 = options.width;
4627
4652
  result.advancedStyleParams.radial.x0 = options.width / 2;
4628
- result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
4653
+ result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
4629
4654
  // result.advancedStyleParams.radial.r0 = 0
4630
4655
  result.advancedStyleParams.radial.x1 = options.width / 2;
4631
- result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
4656
+ result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
4632
4657
  // result.advancedStyleParams.radial.r1 = options.width / 2
4633
4658
  result.advancedStyleParams.conic.x = options.width / 2;
4634
- result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
4659
+ result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
4635
4660
  break;
4636
4661
  case 'top-end':
4637
4662
  translateX = options.width;
@@ -4641,13 +4666,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4641
4666
  result.advancedStyleParams.linear.x0 = 0;
4642
4667
  result.advancedStyleParams.linear.x1 = -options.width;
4643
4668
  result.advancedStyleParams.radial.x0 = -options.width / 2;
4644
- result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
4669
+ result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
4645
4670
  // result.advancedStyleParams.radial.r0 = 0
4646
4671
  result.advancedStyleParams.radial.x1 = -options.width / 2;
4647
- result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
4672
+ result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
4648
4673
  // result.advancedStyleParams.radial.r1 = options.width / 2
4649
4674
  result.advancedStyleParams.conic.x = -options.width / 2;
4650
- result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
4675
+ result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
4651
4676
  break;
4652
4677
  case 'bottom':
4653
4678
  translateX = options.width / 2;
@@ -4657,13 +4682,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4657
4682
  result.advancedStyleParams.linear.x0 = -options.width / 2;
4658
4683
  result.advancedStyleParams.linear.x1 = options.width / 2;
4659
4684
  // result.advancedStyleParams.radial.x0 = 0
4660
- result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
4685
+ result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
4661
4686
  // result.advancedStyleParams.radial.r0 = 0
4662
4687
  // result.advancedStyleParams.radial.x1 = 0
4663
- result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
4688
+ result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
4664
4689
  // result.advancedStyleParams.radial.r1 = options.width / 2
4665
4690
  result.advancedStyleParams.conic.x = 0;
4666
- result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
4691
+ result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
4667
4692
  break;
4668
4693
  case 'bottom-start':
4669
4694
  translateX = 0;
@@ -4673,13 +4698,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4673
4698
  result.advancedStyleParams.linear.x0 = 0;
4674
4699
  result.advancedStyleParams.linear.x1 = options.width;
4675
4700
  result.advancedStyleParams.radial.x0 = options.width / 2;
4676
- result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
4701
+ result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
4677
4702
  // result.advancedStyleParams.radial.r0 = 0
4678
4703
  result.advancedStyleParams.radial.x1 = options.width / 2;
4679
- result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
4704
+ result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
4680
4705
  // result.advancedStyleParams.radial.r1 = options.width / 2
4681
4706
  result.advancedStyleParams.conic.x = options.width / 2;
4682
- result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
4707
+ result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
4683
4708
  break;
4684
4709
  case 'bottom-end':
4685
4710
  translateX = options.width;
@@ -4689,13 +4714,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4689
4714
  result.advancedStyleParams.linear.x0 = 0;
4690
4715
  result.advancedStyleParams.linear.x1 = -options.width;
4691
4716
  result.advancedStyleParams.radial.x0 = -options.width / 2;
4692
- result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
4717
+ result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
4693
4718
  // result.advancedStyleParams.radial.r0 = 0
4694
4719
  result.advancedStyleParams.radial.x1 = -options.width / 2;
4695
- result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
4720
+ result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
4696
4721
  // result.advancedStyleParams.radial.r1 = options.width / 2
4697
4722
  result.advancedStyleParams.conic.x = -options.width / 2;
4698
- result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
4723
+ result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
4699
4724
  break;
4700
4725
  case 'left':
4701
4726
  translateX = 0;
@@ -4737,12 +4762,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4737
4762
  if (['text', 'multi-line-text'].includes(options.contentType)) {
4738
4763
  switch (options.textBaseline) {
4739
4764
  case 'middle':
4740
- result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight / 2;
4765
+ result.textLine.yOffsetValue = ((result.textLine.data.length - 1) * options.lineHeight) / 2;
4741
4766
  break;
4742
4767
  case 'bottom':
4743
4768
  case 'alphabetic':
4744
4769
  case 'ideographic':
4745
- result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
4770
+ result.textLine.yOffsetValue =
4771
+ (result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
4746
4772
  break;
4747
4773
  case 'top':
4748
4774
  case 'hanging':
@@ -4760,11 +4786,11 @@ var protection = (function (need) {
4760
4786
  if (need) {
4761
4787
  Object.defineProperty(window, 'MutationObserver', {
4762
4788
  writable: false,
4763
- configurable: false
4789
+ configurable: false,
4764
4790
  });
4765
4791
  Object.defineProperty(window, 'requestAnimationFrame', {
4766
4792
  writable: false,
4767
- configurable: false
4793
+ configurable: false,
4768
4794
  });
4769
4795
  }
4770
4796
  });
@@ -4893,7 +4919,7 @@ var WatermarkCanvas = /** @class */ (function () {
4893
4919
  };
4894
4920
  WatermarkCanvas.prototype.createLinearGradient = function (ctx) {
4895
4921
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
4896
- var gradient = ctx.createLinearGradient(getValue((_c = (_b = (_a = this.options.advancedStyle) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.linear) === null || _c === void 0 ? void 0 : _c.x0, this.recommendOptions.advancedStyleParams.linear.x0), getValue((_f = (_e = (_d = this.options.advancedStyle) === null || _d === void 0 ? void 0 : _d.params) === null || _e === void 0 ? void 0 : _e.linear) === null || _f === void 0 ? void 0 : _f.y0, 0), getValue((_j = (_h = (_g = this.options.advancedStyle) === null || _g === void 0 ? void 0 : _g.params) === null || _h === void 0 ? void 0 : _h.linear) === null || _j === void 0 ? void 0 : _j.x1, this.recommendOptions.advancedStyleParams.linear.x1), getValue((_m = (_l = (_k = this.options.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.linear) === null || _m === void 0 ? void 0 : _m.y1, 0));
4922
+ var gradient = ctx.createLinearGradient((getValue((_c = (_b = (_a = this.options.advancedStyle) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.linear) === null || _c === void 0 ? void 0 : _c.x0, this.recommendOptions.advancedStyleParams.linear.x0)), getValue((_f = (_e = (_d = this.options.advancedStyle) === null || _d === void 0 ? void 0 : _d.params) === null || _e === void 0 ? void 0 : _e.linear) === null || _f === void 0 ? void 0 : _f.y0, 0), (getValue((_j = (_h = (_g = this.options.advancedStyle) === null || _g === void 0 ? void 0 : _g.params) === null || _h === void 0 ? void 0 : _h.linear) === null || _j === void 0 ? void 0 : _j.x1, this.recommendOptions.advancedStyleParams.linear.x1)), getValue((_m = (_l = (_k = this.options.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.linear) === null || _m === void 0 ? void 0 : _m.y1, 0));
4897
4923
  (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.colorStops) === null || _q === void 0 ? void 0 : _q.forEach(function (item) {
4898
4924
  gradient.addColorStop(item.offset, item.color);
4899
4925
  });
@@ -4901,7 +4927,7 @@ var WatermarkCanvas = /** @class */ (function () {
4901
4927
  };
4902
4928
  WatermarkCanvas.prototype.createConicGradient = function (ctx) {
4903
4929
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
4904
- var gradient = ctx.createConicGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.conic) === null || _d === void 0 ? void 0 : _d.startAngle, 0), getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.conic) === null || _h === void 0 ? void 0 : _h.x, this.recommendOptions.advancedStyleParams.conic.x), getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.conic) === null || _m === void 0 ? void 0 : _m.y, this.recommendOptions.advancedStyleParams.conic.y));
4930
+ var gradient = ctx.createConicGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.conic) === null || _d === void 0 ? void 0 : _d.startAngle, 0), (getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.conic) === null || _h === void 0 ? void 0 : _h.x, this.recommendOptions.advancedStyleParams.conic.x)), (getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.conic) === null || _m === void 0 ? void 0 : _m.y, this.recommendOptions.advancedStyleParams.conic.y)));
4905
4931
  (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.colorStops) === null || _q === void 0 ? void 0 : _q.forEach(function (item) {
4906
4932
  gradient.addColorStop(item.offset, item.color);
4907
4933
  });
@@ -4909,7 +4935,7 @@ var WatermarkCanvas = /** @class */ (function () {
4909
4935
  };
4910
4936
  WatermarkCanvas.prototype.createRadialGradient = function (ctx) {
4911
4937
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
4912
- var gradient = ctx.createRadialGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.radial) === null || _d === void 0 ? void 0 : _d.x0, this.recommendOptions.advancedStyleParams.radial.x0), getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.radial) === null || _h === void 0 ? void 0 : _h.y0, this.recommendOptions.advancedStyleParams.radial.y0), getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.radial) === null || _m === void 0 ? void 0 : _m.r0, this.recommendOptions.advancedStyleParams.radial.r0), getValue((_r = (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.params) === null || _q === void 0 ? void 0 : _q.radial) === null || _r === void 0 ? void 0 : _r.x1, this.recommendOptions.advancedStyleParams.radial.x1), getValue((_v = (_u = (_t = (_s = this.options) === null || _s === void 0 ? void 0 : _s.advancedStyle) === null || _t === void 0 ? void 0 : _t.params) === null || _u === void 0 ? void 0 : _u.radial) === null || _v === void 0 ? void 0 : _v.y1, this.recommendOptions.advancedStyleParams.radial.y1), getValue((_z = (_y = (_x = (_w = this.options) === null || _w === void 0 ? void 0 : _w.advancedStyle) === null || _x === void 0 ? void 0 : _x.params) === null || _y === void 0 ? void 0 : _y.radial) === null || _z === void 0 ? void 0 : _z.r1, this.recommendOptions.advancedStyleParams.radial.r1));
4938
+ var gradient = ctx.createRadialGradient((getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.radial) === null || _d === void 0 ? void 0 : _d.x0, this.recommendOptions.advancedStyleParams.radial.x0)), (getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.radial) === null || _h === void 0 ? void 0 : _h.y0, this.recommendOptions.advancedStyleParams.radial.y0)), (getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.radial) === null || _m === void 0 ? void 0 : _m.r0, this.recommendOptions.advancedStyleParams.radial.r0)), (getValue((_r = (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.params) === null || _q === void 0 ? void 0 : _q.radial) === null || _r === void 0 ? void 0 : _r.x1, this.recommendOptions.advancedStyleParams.radial.x1)), (getValue((_v = (_u = (_t = (_s = this.options) === null || _s === void 0 ? void 0 : _s.advancedStyle) === null || _t === void 0 ? void 0 : _t.params) === null || _u === void 0 ? void 0 : _u.radial) === null || _v === void 0 ? void 0 : _v.y1, this.recommendOptions.advancedStyleParams.radial.y1)), (getValue((_z = (_y = (_x = (_w = this.options) === null || _w === void 0 ? void 0 : _w.advancedStyle) === null || _x === void 0 ? void 0 : _x.params) === null || _y === void 0 ? void 0 : _y.radial) === null || _z === void 0 ? void 0 : _z.r1, this.recommendOptions.advancedStyleParams.radial.r1)));
4913
4939
  (_2 = (_1 = (_0 = this.options) === null || _0 === void 0 ? void 0 : _0.advancedStyle) === null || _1 === void 0 ? void 0 : _1.colorStops) === null || _2 === void 0 ? void 0 : _2.forEach(function (item) {
4914
4940
  gradient.addColorStop(item.offset, item.color);
4915
4941
  });
@@ -4917,7 +4943,7 @@ var WatermarkCanvas = /** @class */ (function () {
4917
4943
  };
4918
4944
  WatermarkCanvas.prototype.createPattern = function (ctx) {
4919
4945
  var _a, _b, _c, _d, _e, _f, _g, _h;
4920
- return ctx.createPattern((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.pattern) === null || _d === void 0 ? void 0 : _d.image, ((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.pattern) === null || _h === void 0 ? void 0 : _h.repetition) || '');
4946
+ return ctx.createPattern(((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.pattern) === null || _d === void 0 ? void 0 : _d.image), ((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.pattern) === null || _h === void 0 ? void 0 : _h.repetition) || '');
4921
4947
  };
4922
4948
  WatermarkCanvas.prototype.setText = function (ctx, params) {
4923
4949
  var methodName = 'fillText';
@@ -4931,7 +4957,7 @@ var WatermarkCanvas = /** @class */ (function () {
4931
4957
  text: this.options.content,
4932
4958
  x: 0,
4933
4959
  y: 0 - this.recommendOptions.textLine.yOffsetValue,
4934
- maxWidth: this.options.textRowMaxWidth || this.options.width
4960
+ maxWidth: this.options.textRowMaxWidth || this.options.width,
4935
4961
  });
4936
4962
  resolve(ctx.canvas);
4937
4963
  };
@@ -4965,7 +4991,12 @@ var WatermarkCanvas = /** @class */ (function () {
4965
4991
  var lines = this.recommendOptions.textLine.data;
4966
4992
  var yOffsetValue = this.recommendOptions.textLine.yOffsetValue;
4967
4993
  lines.forEach(function (text, index) {
4968
- _this.setText(ctx, { text: text, x: 0, y: _this.options.lineHeight * index - yOffsetValue, maxWidth: _this.options.textRowMaxWidth || _this.options.width });
4994
+ _this.setText(ctx, {
4995
+ text: text,
4996
+ x: 0,
4997
+ y: _this.options.lineHeight * index - yOffsetValue,
4998
+ maxWidth: _this.options.textRowMaxWidth || _this.options.width,
4999
+ });
4969
5000
  });
4970
5001
  resolve(ctx.canvas);
4971
5002
  };
@@ -4992,10 +5023,10 @@ var WatermarkCanvas = /** @class */ (function () {
4992
5023
  var rect = { width: this.options.imageWidth || 0, height: this.options.imageHeight || 0 };
4993
5024
  switch (true) {
4994
5025
  case rect.width !== 0 && rect.height === 0:
4995
- rect.height = rect.width * image.height / image.width;
5026
+ rect.height = (rect.width * image.height) / image.width;
4996
5027
  break;
4997
5028
  case rect.width === 0 && rect.height !== 0:
4998
- rect.width = rect.height * image.width / image.height;
5029
+ rect.width = (rect.height * image.width) / image.height;
4999
5030
  break;
5000
5031
  case rect.width === 0 && rect.height === 0:
5001
5032
  rect.width = image.width;
@@ -5008,7 +5039,7 @@ var WatermarkCanvas = /** @class */ (function () {
5008
5039
  var _a, _b;
5009
5040
  var result = {
5010
5041
  x: -imageWidth / 2,
5011
- y: -imageHeight / 2
5042
+ y: -imageHeight / 2,
5012
5043
  };
5013
5044
  switch (this.options.translatePlacement) {
5014
5045
  case 'top':
@@ -5065,7 +5096,7 @@ var GridLayout = /** @class */ (function () {
5065
5096
  }
5066
5097
  GridLayout.prototype.draw = function () {
5067
5098
  var _a, _b, _c, _d, _e, _f, _g, _h;
5068
- var layoutCanvas = WatermarkCanvas.createCanvas(((_a = this.options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.width) || (this.partialWidth * this.cols + this.gap[0] * this.cols), ((_b = this.options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.height) || (this.partialHeight * this.rows + this.gap[1] * this.rows));
5099
+ var layoutCanvas = WatermarkCanvas.createCanvas(((_a = this.options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.width) || this.partialWidth * this.cols + this.gap[0] * this.cols, ((_b = this.options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.height) || this.partialHeight * this.rows + this.gap[1] * this.rows);
5069
5100
  var layoutContext = layoutCanvas.getContext('2d');
5070
5101
  if ((_c = this.options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.backgroundImage) {
5071
5102
  layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.drawImage((_d = this.options.gridLayoutOptions) === null || _d === void 0 ? void 0 : _d.backgroundImage, 0, 0, (_e = this.options.gridLayoutOptions) === null || _e === void 0 ? void 0 : _e.width, (_f = this.options.gridLayoutOptions) === null || _f === void 0 ? void 0 : _f.height);
@@ -5094,21 +5125,14 @@ var renderLayout = function (options, partialCanvas) {
5094
5125
  var generateBackgroundSize = function (options) {
5095
5126
  var _a, _b, _c;
5096
5127
  switch (options.layout) {
5097
- case 'grid':
5098
- {
5099
- var cols = ((_a = options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.cols) || 1;
5100
- var rows = ((_b = options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.rows) || 1;
5101
- var gap = ((_c = options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.gap) || [0, 0];
5102
- return [
5103
- options.width * cols + gap[0] * cols,
5104
- options.height * rows + gap[1] * rows
5105
- ];
5106
- }
5128
+ case 'grid': {
5129
+ var cols = ((_a = options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.cols) || 1;
5130
+ var rows = ((_b = options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.rows) || 1;
5131
+ var gap = ((_c = options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.gap) || [0, 0];
5132
+ return [options.width * cols + gap[0] * cols, options.height * rows + gap[1] * rows];
5133
+ }
5107
5134
  default:
5108
- return [
5109
- options.width,
5110
- options.height
5111
- ];
5135
+ return [options.width, options.height];
5112
5136
  }
5113
5137
  };
5114
5138
 
@@ -5193,14 +5217,14 @@ var Watermark = /** @class */ (function () {
5193
5217
  parentElementType = this.checkParentElementType();
5194
5218
  this.watermarkDom.style.cssText = "\n z-index:".concat(this.options.zIndex, "!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat(parentElementType === 'custom' ? 'top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;' : 'position:relative!important;', "\n ");
5195
5219
  backgroundSize = generateBackgroundSize(this.options);
5196
- watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(this.options.movable ? 'animation: 200s ease 0s infinite normal none running watermark !important;' : '', "\n ");
5220
+ watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(generateAnimationStyle(this.options.movable, this.options.backgroundRepeat), "\n ");
5197
5221
  this.watermarkDom.appendChild(watermarkInnerDom);
5198
5222
  this.parentElement.appendChild(this.watermarkDom);
5199
5223
  if (this.options.mutationObserve) {
5200
5224
  try {
5201
5225
  this.bindMutationObserve();
5202
5226
  }
5203
- catch (e) {
5227
+ catch (_j) {
5204
5228
  (_e = (_d = this.options).onObserveError) === null || _e === void 0 ? void 0 : _e.call(_d);
5205
5229
  }
5206
5230
  }
@@ -5332,7 +5356,7 @@ var Watermark = /** @class */ (function () {
5332
5356
  attributes: true, // 属性的变动
5333
5357
  childList: true, // 子节点的变动(指新增,删除或者更改)
5334
5358
  subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5335
- characterData: true // 节点内容或节点文本的变动。
5359
+ characterData: true, // 节点内容或节点文本的变动。
5336
5360
  });
5337
5361
  this.parentObserve = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
5338
5362
  var _i, mutationsList_1, item;
@@ -5347,7 +5371,9 @@ var Watermark = /** @class */ (function () {
5347
5371
  item = mutationsList_1[_i];
5348
5372
  if (!((item === null || item === void 0 ? void 0 : item.target) === this.watermarkDom ||
5349
5373
  ((_a = item === null || item === void 0 ? void 0 : item.removedNodes) === null || _a === void 0 ? void 0 : _a[0]) === this.watermarkDom ||
5350
- (item.type === 'childList' && item.target === this.parentElement && item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
5374
+ (item.type === 'childList' &&
5375
+ item.target === this.parentElement &&
5376
+ item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
5351
5377
  this.remove();
5352
5378
  return [4 /*yield*/, this.create()];
5353
5379
  case 2:
@@ -5364,7 +5390,7 @@ var Watermark = /** @class */ (function () {
5364
5390
  attributes: true, // 属性的变动
5365
5391
  childList: true, // 子节点的变动(指新增,删除或者更改)
5366
5392
  subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5367
- characterData: true // 节点内容或节点文本的变动。
5393
+ characterData: true, // 节点内容或节点文本的变动。
5368
5394
  });
5369
5395
  };
5370
5396
  Watermark.prototype.bindCheckWatermarkElementEvent = function () {
@@ -5392,7 +5418,7 @@ var BlindWatermark = /** @class */ (function (_super) {
5392
5418
  if (props === void 0) { props = {}; }
5393
5419
  var defaultProps = {
5394
5420
  globalAlpha: 0.005,
5395
- mode: 'blind'
5421
+ mode: 'blind',
5396
5422
  };
5397
5423
  return _super.call(this, __assign(__assign({}, props), defaultProps)) || this;
5398
5424
  }
@@ -5464,12 +5490,15 @@ var ImageWatermark = /** @class */ (function () {
5464
5490
  */
5465
5491
  function ImageWatermark(args) {
5466
5492
  if (args === void 0) { args = {}; }
5467
- var _a;
5493
+ var _a, _b;
5468
5494
  this.drew = false;
5469
5495
  this.props = args;
5470
5496
  this.options = __assign(__assign({}, initialOptions), args);
5497
+ if (this.props.crossOrigin) {
5498
+ (_a = this.props.dom) === null || _a === void 0 ? void 0 : _a.setAttribute('crossOrigin', 'anonymous');
5499
+ }
5471
5500
  this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
5472
- this.originalSrc = (_a = this.props.dom) === null || _a === void 0 ? void 0 : _a.src;
5501
+ this.originalSrc = (_b = this.props.dom) === null || _b === void 0 ? void 0 : _b.src;
5473
5502
  this.backgroundImage = this.getBackgroundImage();
5474
5503
  }
5475
5504
  ImageWatermark.prototype.create = function () {