c0lor
Version:
Color space conversions
28 lines (24 loc) • 573 B
JavaScript
var O, xyyPrototype;
O = require("ut1l/create/object");
xyyPrototype = {
XYZ: function(T) {
if (T == null) {
T = require("./XYZ")();
}
T.X = this.x * this.Y / this.y;
T.Y = this.Y;
T.Z = (1 - this.x - this.y) * this.Y / this.y;
return T;
},
isDefined: function() {
return (this.x != null) && (this.y != null) && (this.Y != null);
},
toString: function() {
return "x=" + this.x + ", y=" + this.y + ", Y=" + this.Y;
}
};
module.exports = O((function(x, y, Y) {
this.x = x;
this.y = y;
this.Y = Y;
}), xyyPrototype);