Commit 3f77c54f authored by Alexander.Trofimov's avatar Alexander.Trofimov

CGradient перевел на prototype


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55437 954022d7-b5bf-4e40-9824-e11837661b57
parent c83b4a3d
...@@ -220,32 +220,27 @@ ...@@ -220,32 +220,27 @@
return this; return this;
} }
CGradient.prototype = { CGradient.prototype.init = function (min, max) {
/** @type CGradient */ var distance = max - min;
constructor: CGradient,
this.min = min;
init: function (min, max) { this.max = max;
var distance = max - min; this.koef = this.MaxColorIndex / (2.0 * distance);
this.r1 = this.c1.getR();
this.min = min; this.g1 = this.c1.getG();
this.max = max; this.b1 = this.c1.getB();
this.koef = this.MaxColorIndex / (2.0 * distance); this.r2 = this.c2.getR();
this.r1 = this.c1.getR(); this.g2 = this.c2.getG();
this.g1 = this.c1.getG(); this.b2 = this.c2.getB();
this.b1 = this.c1.getB(); };
this.r2 = this.c2.getR(); CGradient.prototype.calculateColor = function (indexColor) {
this.g2 = this.c2.getG(); indexColor = parseInt((indexColor - this.min) * this.koef);
this.b2 = this.c2.getB();
}, var r = (this.r1 + ((FT_Common.IntToUInt(this.r2 - this.r1) * indexColor) >> this.base_shift)) & 0xFF;
calculateColor: function (indexColor) { var g = (this.g1 + ((FT_Common.IntToUInt(this.g2 - this.g1) * indexColor) >> this.base_shift)) & 0xFF;
indexColor = parseInt((indexColor - this.min) * this.koef); var b = (this.b1 + ((FT_Common.IntToUInt(this.b2 - this.b1) * indexColor) >> this.base_shift)) & 0xFF;
//console.log("index=" + indexColor + ": r=" + r + " g=" + g + " b=" + b);
var r = (this.r1 + ((FT_Common.IntToUInt(this.r2 - this.r1) * indexColor) >> this.base_shift)) & 0xFF; return new RgbColor((r << 16) + (g << 8) + b);
var g = (this.g1 + ((FT_Common.IntToUInt(this.g2 - this.g1) * indexColor) >> this.base_shift)) & 0xFF;
var b = (this.b1 + ((FT_Common.IntToUInt(this.b2 - this.b1) * indexColor) >> this.base_shift)) & 0xFF;
//console.log("index=" + indexColor + ": r=" + r + " g=" + g + " b=" + b);
return new RgbColor((r << 16) + (g << 8) + b);
}
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment