2017-07-04 11:01:27 +00:00
|
|
|
|
|
|
|
var GetColor = function (value)
|
|
|
|
{
|
|
|
|
return (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);
|
|
|
|
};
|
|
|
|
|
|
|
|
var Tint = {
|
|
|
|
|
|
|
|
// 0: topLeft, 1: topRight, 2: bottomLeft, 3: bottomRight
|
2017-07-05 00:21:47 +00:00
|
|
|
_tintTL: 16777215,
|
|
|
|
_tintTR: 16777215,
|
|
|
|
_tintBL: 16777215,
|
|
|
|
_tintBR: 16777215,
|
2017-07-04 11:01:27 +00:00
|
|
|
|
|
|
|
clearTint: function ()
|
|
|
|
{
|
|
|
|
this.setTint(0xffffff);
|
2017-07-05 00:21:47 +00:00
|
|
|
|
|
|
|
return this;
|
2017-07-04 11:01:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setTint: function (topLeft, topRight, bottomLeft, bottomRight)
|
|
|
|
{
|
2017-07-11 08:38:19 +00:00
|
|
|
if (topLeft === undefined) { topLeft = 0xffffff; }
|
|
|
|
|
2017-07-04 11:01:27 +00:00
|
|
|
if (topRight === undefined)
|
|
|
|
{
|
|
|
|
topRight = topLeft;
|
|
|
|
bottomLeft = topLeft;
|
|
|
|
bottomRight = topLeft;
|
|
|
|
}
|
|
|
|
|
2017-07-05 00:21:47 +00:00
|
|
|
this._tintTL = GetColor(topLeft);
|
|
|
|
this._tintTR = GetColor(topRight);
|
|
|
|
this._tintBL = GetColor(bottomLeft);
|
|
|
|
this._tintBR = GetColor(bottomRight);
|
|
|
|
|
|
|
|
return this;
|
2017-07-04 11:01:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
tintTopLeft: {
|
|
|
|
|
|
|
|
get: function ()
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
return this._tintTL;
|
2017-07-04 11:01:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
this._tintTL = GetColor(value);
|
2017-07-04 11:01:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
tintTopRight: {
|
|
|
|
|
|
|
|
get: function ()
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
return this._tintTR;
|
2017-07-04 11:01:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
this._tintTR = GetColor(value);
|
2017-07-04 11:01:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
tintBottomLeft: {
|
|
|
|
|
|
|
|
get: function ()
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
return this._tintBL;
|
2017-07-04 11:01:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
this._tintBL = GetColor(value);
|
2017-07-04 11:01:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
tintBottomRight: {
|
|
|
|
|
|
|
|
get: function ()
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
return this._tintBR;
|
2017-07-04 11:01:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
2017-07-05 00:21:47 +00:00
|
|
|
this._tintBR = GetColor(value);
|
2017-07-04 11:01:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
tint: {
|
|
|
|
|
|
|
|
set: function (value)
|
|
|
|
{
|
|
|
|
this.setTint(value, value, value, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Tint;
|