UNPKG

@aurigma/design-atoms-model

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

85 lines 3.17 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { ColorSpace } from "./ColorSpace"; import { ProcessColor } from "./ProcessColor"; import { validateComponent } from "./ValidationUtils"; var CmykColor = /** @class */ (function (_super) { __extends(CmykColor, _super); function CmykColor(c, m, y, k, alpha, profile) { if (profile === void 0) { profile = null; } var _this = _super.call(this, alpha, profile) || this; _this._colorSpace = ColorSpace.Cmyk; _this._c = validateComponent(c); _this._m = validateComponent(m); _this._y = validateComponent(y); _this._k = validateComponent(k); return _this; } Object.defineProperty(CmykColor.prototype, "c", { get: function () { return this._c; }, enumerable: true, configurable: true }); Object.defineProperty(CmykColor.prototype, "m", { get: function () { return this._m; }, enumerable: true, configurable: true }); Object.defineProperty(CmykColor.prototype, "y", { get: function () { return this._y; }, enumerable: true, configurable: true }); Object.defineProperty(CmykColor.prototype, "k", { get: function () { return this._k; }, enumerable: true, configurable: true }); CmykColor.prototype.equals = function (other) { var cmykOther = other; return _super.prototype.equals.call(this, other) && this.c === cmykOther.c && this.m === cmykOther.m && this.y === cmykOther.y && this.k === cmykOther.k; }; CmykColor.prototype.clone = function () { return new CmykColor(this.c, this.m, this.y, this.k, this.alpha, this.profile); }; CmykColor.prototype.getData = function () { var data = _super.prototype.getData.call(this); data.c = this.c; data.m = this.m; data.y = this.y; data.k = this.k; return data; }; CmykColor.prototype.toString = function () { return "cmyk(".concat(this._toRelative(this.c) + ",", this._toRelative(this.m) + ",", this._toRelative(this.y) + ",", this._toRelative(this.k) + ",", this._toRelative(this.alpha) + ")"); }; CmykColor.prototype._toRelative = function (component) { return (component / 255).toFixed(7); }; return CmykColor; }(ProcessColor)); export { CmykColor }; //# sourceMappingURL=CmykColor.js.map