SBrush.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SBrush = void 0;
  4. var SBrushType_1 = require("./enums/SBrushType");
  5. var _1 = require("./");
  6. var SBrush = (function () {
  7. function SBrush(brush) {
  8. this.type = SBrushType_1.SBrushType.Color;
  9. this._color = _1.SColor.Black;
  10. this._gradient = null;
  11. if (brush == undefined) {
  12. return;
  13. }
  14. if (brush instanceof _1.SGradient) {
  15. this.gradient = brush;
  16. }
  17. else if (brush instanceof SBrush) {
  18. this.type = brush.type;
  19. this.color = new _1.SColor(brush.color);
  20. }
  21. else {
  22. this.color = new _1.SColor(brush);
  23. }
  24. }
  25. Object.defineProperty(SBrush.prototype, "color", {
  26. get: function () {
  27. return this._color;
  28. },
  29. set: function (value) {
  30. this.type = SBrushType_1.SBrushType.Color;
  31. this._color = value;
  32. },
  33. enumerable: false,
  34. configurable: true
  35. });
  36. Object.defineProperty(SBrush.prototype, "gradient", {
  37. get: function () {
  38. return this._gradient;
  39. },
  40. set: function (value) {
  41. this._gradient = value;
  42. this.type = SBrushType_1.SBrushType.Gradient;
  43. },
  44. enumerable: false,
  45. configurable: true
  46. });
  47. return SBrush;
  48. }());
  49. exports.SBrush = SBrush;