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
  */
@@ -556,10 +556,10 @@ function requireSharedStore () {
556
556
  var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
557
557
 
558
558
  (store.versions || (store.versions = [])).push({
559
- version: '3.40.0',
559
+ version: '3.41.0',
560
560
  mode: IS_PURE ? 'pure' : 'global',
561
561
  copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
562
- license: 'https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE',
562
+ license: 'https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE',
563
563
  source: 'https://github.com/zloirock/core-js'
564
564
  });
565
565
  return sharedStore.exports;
@@ -4215,7 +4215,7 @@ function styleInject(css, ref) {
4215
4215
  }
4216
4216
  }
4217
4217
 
4218
- 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}}";
4218
+ 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%}}";
4219
4219
  styleInject(css_248z);
4220
4220
 
4221
4221
  /******************************************************************************
@@ -4232,7 +4232,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4232
4232
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4233
4233
  PERFORMANCE OF THIS SOFTWARE.
4234
4234
  ***************************************************************************** */
4235
- /* global Reflect, Promise */
4235
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
4236
4236
 
4237
4237
  var extendStatics = function(d, b) {
4238
4238
  extendStatics = Object.setPrototypeOf ||
@@ -4271,8 +4271,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
4271
4271
  }
4272
4272
 
4273
4273
  function __generator(thisArg, body) {
4274
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4275
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4274
+ 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);
4275
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4276
4276
  function verb(n) { return function (v) { return step([n, v]); }; }
4277
4277
  function step(op) {
4278
4278
  if (f) throw new TypeError("Generator is already executing.");
@@ -4296,7 +4296,12 @@ function __generator(thisArg, body) {
4296
4296
  } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
4297
4297
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4298
4298
  }
4299
- }
4299
+ }
4300
+
4301
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
4302
+ var e = new Error(message);
4303
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
4304
+ };
4300
4305
 
4301
4306
  var convertImage = function (canvas) {
4302
4307
  return canvas.toDataURL('image/png', 1);
@@ -4347,7 +4352,7 @@ var createCustomContentSVG = function (ctx, options) { return __awaiter(void 0,
4347
4352
  switch (_b.label) {
4348
4353
  case 0:
4349
4354
  svgElement = createSVGElement('svg', {
4350
- xmlns: 'http://www.w3.org/2000/svg'
4355
+ xmlns: 'http://www.w3.org/2000/svg',
4351
4356
  });
4352
4357
  bodyElement = document.createElement('div');
4353
4358
  bodyElement.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
@@ -4369,14 +4374,14 @@ var createCustomContentSVG = function (ctx, options) { return __awaiter(void 0,
4369
4374
  svgElement.setAttribute('height', height.toString());
4370
4375
  foreignObjectElement = createSVGElement('foreignObject', {
4371
4376
  width: width.toString(),
4372
- height: height.toString()
4377
+ height: height.toString(),
4373
4378
  });
4374
4379
  foreignObjectElement.appendChild(bodyElement);
4375
4380
  svgElement.appendChild(foreignObjectElement);
4376
4381
  return [2 /*return*/, {
4377
4382
  element: svgElement,
4378
4383
  width: width,
4379
- height: height
4384
+ height: height,
4380
4385
  }];
4381
4386
  }
4382
4387
  });
@@ -4444,7 +4449,8 @@ function convertImgToBase64(bodyElement) {
4444
4449
  var convertSVGToImage = function (svg) {
4445
4450
  var richContent = svg.outerHTML
4446
4451
  .replace(/<(img|br|input|hr|embed)(.*?)>/g, '<$1$2/>')
4447
- .replace(/\n/g, '').replace(/\t/g, '')
4452
+ .replace(/\n/g, '')
4453
+ .replace(/\t/g, '')
4448
4454
  .replace(/#/g, '%23');
4449
4455
  return "data:image/svg+xml;charset=utf-8,".concat(richContent);
4450
4456
  };
@@ -4460,7 +4466,7 @@ var loadImage = function (url, width, height) {
4460
4466
  if (width === void 0) { width = undefined; }
4461
4467
  if (height === void 0) { height = undefined; }
4462
4468
  var image = new Image();
4463
- image.setAttribute('crossOrigin', 'Anonymous');
4469
+ image.setAttribute('crossOrigin', 'anonymous');
4464
4470
  !isUndefined(width) && (image.width = width);
4465
4471
  !isUndefined(height) && (image.height = height);
4466
4472
  image.src = url;
@@ -4473,6 +4479,25 @@ var loadImage = function (url, width, height) {
4473
4479
  var generateMatrix = function (rows, columns, value) {
4474
4480
  return Array.from({ length: rows }, function () { return new Array(columns).fill(value); });
4475
4481
  };
4482
+ var generateAnimationStyle = function (movable, backgroundRepeat) {
4483
+ if (!movable) {
4484
+ return '';
4485
+ }
4486
+ var horizontalDuration = Math.random() * (8 - 2) + 2;
4487
+ var verticalDuration = Math.random() * (4 - 2) + 2;
4488
+ switch (backgroundRepeat) {
4489
+ case 'repeat':
4490
+ return 'animation: 200s linear 0s infinite alternate watermark !important;';
4491
+ case 'repeat-x':
4492
+ return "animation: ".concat(horizontalDuration, "s ease-in 0s infinite alternate watermark-vertical !important;'");
4493
+ case 'repeat-y':
4494
+ return "animation: ".concat(verticalDuration, "s ease-out 0s infinite alternate watermark-horizontal !important;'");
4495
+ case 'no-repeat':
4496
+ return "animation: ".concat(horizontalDuration, "s ease-in 0s infinite alternate watermark-horizontal, ").concat(verticalDuration, "s ease-out 0s infinite alternate watermark-vertical !important;");
4497
+ default:
4498
+ return '';
4499
+ }
4500
+ };
4476
4501
 
4477
4502
  var initialOptions = {
4478
4503
  width: 300,
@@ -4508,7 +4533,7 @@ var initialOptions = {
4508
4533
  onSuccess: function () { },
4509
4534
  onBeforeDestroy: function () { },
4510
4535
  onDestroyed: function () { },
4511
- onObserveError: function () { }
4536
+ onObserveError: function () { },
4512
4537
  };
4513
4538
  var generateRecommendOptions = function (canvas, options, args) {
4514
4539
  var ctx = canvas.getContext('2d');
@@ -4521,7 +4546,7 @@ var generateRecommendOptions = function (canvas, options, args) {
4521
4546
  ctx.letterSpacing = options.letterSpacing;
4522
4547
  ctx.wordSpacing = options.wordSpacing;
4523
4548
  if (options === null || options === void 0 ? void 0 : options.rotate) {
4524
- options.rotate = (360 - options.rotate % 360) * (Math.PI / 180);
4549
+ options.rotate = (360 - (options.rotate % 360)) * (Math.PI / 180);
4525
4550
  }
4526
4551
  if (isUndefined(args.textRowMaxWidth)) {
4527
4552
  options.textRowMaxWidth = options.width;
@@ -4530,21 +4555,21 @@ var generateRecommendOptions = function (canvas, options, args) {
4530
4555
  image: {
4531
4556
  rect: {
4532
4557
  width: options.imageWidth,
4533
- height: options.imageHeight
4558
+ height: options.imageHeight,
4534
4559
  },
4535
4560
  position: {
4536
4561
  x: 0,
4537
- y: 0
4538
- }
4562
+ y: 0,
4563
+ },
4539
4564
  },
4540
4565
  textLine: {
4541
4566
  data: [],
4542
- yOffsetValue: 0
4567
+ yOffsetValue: 0,
4543
4568
  },
4544
4569
  advancedStyleParams: {
4545
4570
  linear: {
4546
4571
  x0: 0,
4547
- x1: 0
4572
+ x1: 0,
4548
4573
  },
4549
4574
  radial: {
4550
4575
  x0: 0,
@@ -4552,15 +4577,15 @@ var generateRecommendOptions = function (canvas, options, args) {
4552
4577
  r0: 0,
4553
4578
  x1: 0,
4554
4579
  y1: 0,
4555
- r1: 0
4580
+ r1: 0,
4556
4581
  },
4557
4582
  conic: {
4558
4583
  x: 0,
4559
4584
  y: 0,
4560
- startAngle: 0
4585
+ startAngle: 0,
4561
4586
  },
4562
- pattern: {}
4563
- }
4587
+ pattern: {},
4588
+ },
4564
4589
  };
4565
4590
  switch (options.contentType) {
4566
4591
  case 'text':
@@ -4610,14 +4635,14 @@ var generateRecommendOptions = function (canvas, options, args) {
4610
4635
  result.advancedStyleParams.linear.x0 = -options.width / 2;
4611
4636
  result.advancedStyleParams.linear.x1 = options.width / 2;
4612
4637
  // result.advancedStyleParams.radial.x0 = 0
4613
- result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
4638
+ result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
4614
4639
  // result.advancedStyleParams.radial.r0 = 0
4615
4640
  // result.advancedStyleParams.radial.x1 = 0
4616
4641
  // result.advancedStyleParams.radial.y1 = 0
4617
- result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
4642
+ result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
4618
4643
  // result.advancedStyleParams.radial.r1 = options.width / 2
4619
4644
  // result.advancedStyleParams.conic.x = 0
4620
- result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
4645
+ result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
4621
4646
  break;
4622
4647
  case 'top-start':
4623
4648
  translateX = 0;
@@ -4627,13 +4652,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4627
4652
  result.advancedStyleParams.linear.x0 = 0;
4628
4653
  result.advancedStyleParams.linear.x1 = options.width;
4629
4654
  result.advancedStyleParams.radial.x0 = options.width / 2;
4630
- result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
4655
+ result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
4631
4656
  // result.advancedStyleParams.radial.r0 = 0
4632
4657
  result.advancedStyleParams.radial.x1 = options.width / 2;
4633
- result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
4658
+ result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
4634
4659
  // result.advancedStyleParams.radial.r1 = options.width / 2
4635
4660
  result.advancedStyleParams.conic.x = options.width / 2;
4636
- result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
4661
+ result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
4637
4662
  break;
4638
4663
  case 'top-end':
4639
4664
  translateX = options.width;
@@ -4643,13 +4668,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4643
4668
  result.advancedStyleParams.linear.x0 = 0;
4644
4669
  result.advancedStyleParams.linear.x1 = -options.width;
4645
4670
  result.advancedStyleParams.radial.x0 = -options.width / 2;
4646
- result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
4671
+ result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
4647
4672
  // result.advancedStyleParams.radial.r0 = 0
4648
4673
  result.advancedStyleParams.radial.x1 = -options.width / 2;
4649
- result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
4674
+ result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
4650
4675
  // result.advancedStyleParams.radial.r1 = options.width / 2
4651
4676
  result.advancedStyleParams.conic.x = -options.width / 2;
4652
- result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
4677
+ result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
4653
4678
  break;
4654
4679
  case 'bottom':
4655
4680
  translateX = options.width / 2;
@@ -4659,13 +4684,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4659
4684
  result.advancedStyleParams.linear.x0 = -options.width / 2;
4660
4685
  result.advancedStyleParams.linear.x1 = options.width / 2;
4661
4686
  // result.advancedStyleParams.radial.x0 = 0
4662
- result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
4687
+ result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
4663
4688
  // result.advancedStyleParams.radial.r0 = 0
4664
4689
  // result.advancedStyleParams.radial.x1 = 0
4665
- result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
4690
+ result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
4666
4691
  // result.advancedStyleParams.radial.r1 = options.width / 2
4667
4692
  result.advancedStyleParams.conic.x = 0;
4668
- result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
4693
+ result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
4669
4694
  break;
4670
4695
  case 'bottom-start':
4671
4696
  translateX = 0;
@@ -4675,13 +4700,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4675
4700
  result.advancedStyleParams.linear.x0 = 0;
4676
4701
  result.advancedStyleParams.linear.x1 = options.width;
4677
4702
  result.advancedStyleParams.radial.x0 = options.width / 2;
4678
- result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
4703
+ result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
4679
4704
  // result.advancedStyleParams.radial.r0 = 0
4680
4705
  result.advancedStyleParams.radial.x1 = options.width / 2;
4681
- result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
4706
+ result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
4682
4707
  // result.advancedStyleParams.radial.r1 = options.width / 2
4683
4708
  result.advancedStyleParams.conic.x = options.width / 2;
4684
- result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
4709
+ result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
4685
4710
  break;
4686
4711
  case 'bottom-end':
4687
4712
  translateX = options.width;
@@ -4691,13 +4716,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4691
4716
  result.advancedStyleParams.linear.x0 = 0;
4692
4717
  result.advancedStyleParams.linear.x1 = -options.width;
4693
4718
  result.advancedStyleParams.radial.x0 = -options.width / 2;
4694
- result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
4719
+ result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
4695
4720
  // result.advancedStyleParams.radial.r0 = 0
4696
4721
  result.advancedStyleParams.radial.x1 = -options.width / 2;
4697
- result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
4722
+ result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
4698
4723
  // result.advancedStyleParams.radial.r1 = options.width / 2
4699
4724
  result.advancedStyleParams.conic.x = -options.width / 2;
4700
- result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
4725
+ result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
4701
4726
  break;
4702
4727
  case 'left':
4703
4728
  translateX = 0;
@@ -4739,12 +4764,13 @@ var generateRecommendOptions = function (canvas, options, args) {
4739
4764
  if (['text', 'multi-line-text'].includes(options.contentType)) {
4740
4765
  switch (options.textBaseline) {
4741
4766
  case 'middle':
4742
- result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight / 2;
4767
+ result.textLine.yOffsetValue = ((result.textLine.data.length - 1) * options.lineHeight) / 2;
4743
4768
  break;
4744
4769
  case 'bottom':
4745
4770
  case 'alphabetic':
4746
4771
  case 'ideographic':
4747
- result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
4772
+ result.textLine.yOffsetValue =
4773
+ (result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
4748
4774
  break;
4749
4775
  case 'top':
4750
4776
  case 'hanging':
@@ -4762,11 +4788,11 @@ var protection = (function (need) {
4762
4788
  if (need) {
4763
4789
  Object.defineProperty(window, 'MutationObserver', {
4764
4790
  writable: false,
4765
- configurable: false
4791
+ configurable: false,
4766
4792
  });
4767
4793
  Object.defineProperty(window, 'requestAnimationFrame', {
4768
4794
  writable: false,
4769
- configurable: false
4795
+ configurable: false,
4770
4796
  });
4771
4797
  }
4772
4798
  });
@@ -4895,7 +4921,7 @@ var WatermarkCanvas = /** @class */ (function () {
4895
4921
  };
4896
4922
  WatermarkCanvas.prototype.createLinearGradient = function (ctx) {
4897
4923
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
4898
- 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));
4924
+ 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));
4899
4925
  (_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) {
4900
4926
  gradient.addColorStop(item.offset, item.color);
4901
4927
  });
@@ -4903,7 +4929,7 @@ var WatermarkCanvas = /** @class */ (function () {
4903
4929
  };
4904
4930
  WatermarkCanvas.prototype.createConicGradient = function (ctx) {
4905
4931
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
4906
- 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));
4932
+ 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)));
4907
4933
  (_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) {
4908
4934
  gradient.addColorStop(item.offset, item.color);
4909
4935
  });
@@ -4911,7 +4937,7 @@ var WatermarkCanvas = /** @class */ (function () {
4911
4937
  };
4912
4938
  WatermarkCanvas.prototype.createRadialGradient = function (ctx) {
4913
4939
  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;
4914
- 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));
4940
+ 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)));
4915
4941
  (_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) {
4916
4942
  gradient.addColorStop(item.offset, item.color);
4917
4943
  });
@@ -4919,7 +4945,7 @@ var WatermarkCanvas = /** @class */ (function () {
4919
4945
  };
4920
4946
  WatermarkCanvas.prototype.createPattern = function (ctx) {
4921
4947
  var _a, _b, _c, _d, _e, _f, _g, _h;
4922
- 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) || '');
4948
+ 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) || '');
4923
4949
  };
4924
4950
  WatermarkCanvas.prototype.setText = function (ctx, params) {
4925
4951
  var methodName = 'fillText';
@@ -4933,7 +4959,7 @@ var WatermarkCanvas = /** @class */ (function () {
4933
4959
  text: this.options.content,
4934
4960
  x: 0,
4935
4961
  y: 0 - this.recommendOptions.textLine.yOffsetValue,
4936
- maxWidth: this.options.textRowMaxWidth || this.options.width
4962
+ maxWidth: this.options.textRowMaxWidth || this.options.width,
4937
4963
  });
4938
4964
  resolve(ctx.canvas);
4939
4965
  };
@@ -4967,7 +4993,12 @@ var WatermarkCanvas = /** @class */ (function () {
4967
4993
  var lines = this.recommendOptions.textLine.data;
4968
4994
  var yOffsetValue = this.recommendOptions.textLine.yOffsetValue;
4969
4995
  lines.forEach(function (text, index) {
4970
- _this.setText(ctx, { text: text, x: 0, y: _this.options.lineHeight * index - yOffsetValue, maxWidth: _this.options.textRowMaxWidth || _this.options.width });
4996
+ _this.setText(ctx, {
4997
+ text: text,
4998
+ x: 0,
4999
+ y: _this.options.lineHeight * index - yOffsetValue,
5000
+ maxWidth: _this.options.textRowMaxWidth || _this.options.width,
5001
+ });
4971
5002
  });
4972
5003
  resolve(ctx.canvas);
4973
5004
  };
@@ -4994,10 +5025,10 @@ var WatermarkCanvas = /** @class */ (function () {
4994
5025
  var rect = { width: this.options.imageWidth || 0, height: this.options.imageHeight || 0 };
4995
5026
  switch (true) {
4996
5027
  case rect.width !== 0 && rect.height === 0:
4997
- rect.height = rect.width * image.height / image.width;
5028
+ rect.height = (rect.width * image.height) / image.width;
4998
5029
  break;
4999
5030
  case rect.width === 0 && rect.height !== 0:
5000
- rect.width = rect.height * image.width / image.height;
5031
+ rect.width = (rect.height * image.width) / image.height;
5001
5032
  break;
5002
5033
  case rect.width === 0 && rect.height === 0:
5003
5034
  rect.width = image.width;
@@ -5010,7 +5041,7 @@ var WatermarkCanvas = /** @class */ (function () {
5010
5041
  var _a, _b;
5011
5042
  var result = {
5012
5043
  x: -imageWidth / 2,
5013
- y: -imageHeight / 2
5044
+ y: -imageHeight / 2,
5014
5045
  };
5015
5046
  switch (this.options.translatePlacement) {
5016
5047
  case 'top':
@@ -5067,7 +5098,7 @@ var GridLayout = /** @class */ (function () {
5067
5098
  }
5068
5099
  GridLayout.prototype.draw = function () {
5069
5100
  var _a, _b, _c, _d, _e, _f, _g, _h;
5070
- 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));
5101
+ 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);
5071
5102
  var layoutContext = layoutCanvas.getContext('2d');
5072
5103
  if ((_c = this.options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.backgroundImage) {
5073
5104
  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);
@@ -5096,21 +5127,14 @@ var renderLayout = function (options, partialCanvas) {
5096
5127
  var generateBackgroundSize = function (options) {
5097
5128
  var _a, _b, _c;
5098
5129
  switch (options.layout) {
5099
- case 'grid':
5100
- {
5101
- var cols = ((_a = options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.cols) || 1;
5102
- var rows = ((_b = options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.rows) || 1;
5103
- var gap = ((_c = options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.gap) || [0, 0];
5104
- return [
5105
- options.width * cols + gap[0] * cols,
5106
- options.height * rows + gap[1] * rows
5107
- ];
5108
- }
5130
+ case 'grid': {
5131
+ var cols = ((_a = options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.cols) || 1;
5132
+ var rows = ((_b = options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.rows) || 1;
5133
+ var gap = ((_c = options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.gap) || [0, 0];
5134
+ return [options.width * cols + gap[0] * cols, options.height * rows + gap[1] * rows];
5135
+ }
5109
5136
  default:
5110
- return [
5111
- options.width,
5112
- options.height
5113
- ];
5137
+ return [options.width, options.height];
5114
5138
  }
5115
5139
  };
5116
5140
 
@@ -5195,14 +5219,14 @@ var Watermark = /** @class */ (function () {
5195
5219
  parentElementType = this.checkParentElementType();
5196
5220
  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 ");
5197
5221
  backgroundSize = generateBackgroundSize(this.options);
5198
- 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 ");
5222
+ 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 ");
5199
5223
  this.watermarkDom.appendChild(watermarkInnerDom);
5200
5224
  this.parentElement.appendChild(this.watermarkDom);
5201
5225
  if (this.options.mutationObserve) {
5202
5226
  try {
5203
5227
  this.bindMutationObserve();
5204
5228
  }
5205
- catch (e) {
5229
+ catch (_j) {
5206
5230
  (_e = (_d = this.options).onObserveError) === null || _e === void 0 ? void 0 : _e.call(_d);
5207
5231
  }
5208
5232
  }
@@ -5334,7 +5358,7 @@ var Watermark = /** @class */ (function () {
5334
5358
  attributes: true, // 属性的变动
5335
5359
  childList: true, // 子节点的变动(指新增,删除或者更改)
5336
5360
  subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5337
- characterData: true // 节点内容或节点文本的变动。
5361
+ characterData: true, // 节点内容或节点文本的变动。
5338
5362
  });
5339
5363
  this.parentObserve = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
5340
5364
  var _i, mutationsList_1, item;
@@ -5349,7 +5373,9 @@ var Watermark = /** @class */ (function () {
5349
5373
  item = mutationsList_1[_i];
5350
5374
  if (!((item === null || item === void 0 ? void 0 : item.target) === this.watermarkDom ||
5351
5375
  ((_a = item === null || item === void 0 ? void 0 : item.removedNodes) === null || _a === void 0 ? void 0 : _a[0]) === this.watermarkDom ||
5352
- (item.type === 'childList' && item.target === this.parentElement && item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
5376
+ (item.type === 'childList' &&
5377
+ item.target === this.parentElement &&
5378
+ item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
5353
5379
  this.remove();
5354
5380
  return [4 /*yield*/, this.create()];
5355
5381
  case 2:
@@ -5366,7 +5392,7 @@ var Watermark = /** @class */ (function () {
5366
5392
  attributes: true, // 属性的变动
5367
5393
  childList: true, // 子节点的变动(指新增,删除或者更改)
5368
5394
  subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
5369
- characterData: true // 节点内容或节点文本的变动。
5395
+ characterData: true, // 节点内容或节点文本的变动。
5370
5396
  });
5371
5397
  };
5372
5398
  Watermark.prototype.bindCheckWatermarkElementEvent = function () {
@@ -5394,7 +5420,7 @@ var BlindWatermark = /** @class */ (function (_super) {
5394
5420
  if (props === void 0) { props = {}; }
5395
5421
  var defaultProps = {
5396
5422
  globalAlpha: 0.005,
5397
- mode: 'blind'
5423
+ mode: 'blind',
5398
5424
  };
5399
5425
  return _super.call(this, __assign(__assign({}, props), defaultProps)) || this;
5400
5426
  }
@@ -5466,12 +5492,15 @@ var ImageWatermark = /** @class */ (function () {
5466
5492
  */
5467
5493
  function ImageWatermark(args) {
5468
5494
  if (args === void 0) { args = {}; }
5469
- var _a;
5495
+ var _a, _b;
5470
5496
  this.drew = false;
5471
5497
  this.props = args;
5472
5498
  this.options = __assign(__assign({}, initialOptions), args);
5499
+ if (this.props.crossOrigin) {
5500
+ (_a = this.props.dom) === null || _a === void 0 ? void 0 : _a.setAttribute('crossOrigin', 'anonymous');
5501
+ }
5473
5502
  this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
5474
- this.originalSrc = (_a = this.props.dom) === null || _a === void 0 ? void 0 : _a.src;
5503
+ this.originalSrc = (_b = this.props.dom) === null || _b === void 0 ? void 0 : _b.src;
5475
5504
  this.backgroundImage = this.getBackgroundImage();
5476
5505
  }
5477
5506
  ImageWatermark.prototype.create = function () {