igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
207 lines (206 loc) • 6.49 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends } from "tslib";
import { Base, BaseError, markType } from "igniteui-angular-core";
import { truncate, isNaN_ } from "igniteui-angular-core";
/**
* @hidden
*/
var TriangleRasterizer = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(TriangleRasterizer, _super);
function TriangleRasterizer(a, b, c, d, e, f, g) {
var _this = _super.call(this) || this;
_this.a = null;
_this.k = 0;
_this.j = 0;
_this.g = 0;
_this.f = 0;
_this.b = null;
_this.d = null;
if (a == null || b == null || e == null) {
throw new BaseError(0);
}
_this.a = a;
_this.c = b;
_this.e = e;
_this.m = f;
_this.l = g;
_this.g = c;
_this.f = d;
return _this;
}
Object.defineProperty(TriangleRasterizer.prototype, "m", {
get: function () {
return this.k;
},
set: function (a) {
this.k = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TriangleRasterizer.prototype, "l", {
get: function () {
return this.j;
},
set: function (a) {
this.j = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TriangleRasterizer.prototype, "i", {
get: function () {
return this.g;
},
set: function (a) {
this.g = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TriangleRasterizer.prototype, "h", {
get: function () {
return this.f;
},
set: function (a) {
this.f = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TriangleRasterizer.prototype, "c", {
get: function () {
return this.b;
},
set: function (a) {
this.b = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(TriangleRasterizer.prototype, "e", {
get: function () {
return this.d;
},
set: function (a) {
this.d = a;
},
enumerable: false,
configurable: true
});
TriangleRasterizer.prototype.p = function (a, b, c, d, e, f, g, h) {
var i = this.k;
var j = this.j;
var k;
var l;
if (d.y > e.y) {
k = d;
d = e;
e = k;
l = g;
g = h;
h = l;
}
if (c.y > e.y) {
k = c;
c = e;
e = k;
l = f;
f = h;
h = l;
}
if (c.y > d.y) {
k = c;
c = d;
d = k;
l = f;
f = g;
g = l;
}
var m = truncate(Math.round(c.y));
var n = truncate(Math.round(d.y));
var o = truncate(Math.round(e.y));
if (o == m) {
return;
}
if (isNaN_(f) || isNaN_(g) || isNaN_(h)) {
return;
}
var p = (d.x - c.x) * (e.y - c.y) - (e.x - c.x) * (d.y - c.y) >= 0;
var q = Math.max(0, m);
var r = Math.min(j - 1, n);
for (var s = q; s < r; ++s) {
var t = (s - m) / (n - m);
var u = c.x + t * (d.x - c.x);
var v = f + t * (g - f);
var w = (s - m) / (o - m);
var x = c.x + w * (e.x - c.x);
var y = f + w * (h - f);
if (p) {
this.o(a, b, s, truncate(Math.floor(x)), truncate(Math.ceil(u)), y, v);
}
else {
this.o(a, b, s, truncate(Math.floor(u)), truncate(Math.ceil(x)), v, y);
}
}
{
var z = Math.min(j - 1, Math.max(0, n));
var aa = Math.min(j - 1, o);
var ab = 0;
var ac = d.x + ab * (e.x - d.x);
var ad = g + ab * (h - g);
var ae = z;
var af = (o - m);
var ag = (ae - m) / af;
var ah = c.x + ag * (e.x - c.x);
var ai = f + ag * (h - f);
do {
if (p) {
this.o(a, b, ae, truncate(Math.floor(ah)), truncate(Math.ceil(ac)), ai, ad);
}
else {
this.o(a, b, ae, truncate(Math.floor(ac)), truncate(Math.ceil(ah)), ad, ai);
}
++ae;
ab = (ae - n) / (o - n);
ac = d.x + ab * (e.x - d.x);
ad = g + ab * (h - g);
ag = (ae - m) / af;
ah = c.x + ag * (e.x - c.x);
ai = f + ag * (h - f);
} while (ae < aa);
}
};
TriangleRasterizer.prototype.o = function (a, b, c, d, e, f, g) {
var h = this.k;
var i = d > 0 ? d : 0;
var j = e < h - 1 ? e : h - 1;
var k = c * h * 4 + (i * 4);
var l = g - f;
var m = 1 / (e - d);
var n = this.d;
var o = this.g;
var p = this.f;
var q = c * h;
for (var r = i; r <= j; r++) {
var s = f + l * (r - d) * m;
var color_ = this.b.getColor(s, o, p, n);
this.a[k] = (color_._r);
this.a[k + 1] = (color_._g);
this.a[k + 2] = (color_._b);
this.a[k + 3] = (color_._a);
b[q + r] = a + 1;
k += 4;
}
};
TriangleRasterizer.prototype.n = function () {
};
TriangleRasterizer.$t = markType(TriangleRasterizer, 'TriangleRasterizer');
return TriangleRasterizer;
}(Base));
export { TriangleRasterizer };