igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
181 lines (180 loc) • 5.81 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 { Base, BaseError, markType } from "igniteui-angular-core";
import { truncate, isNaN_ } from "igniteui-angular-core";
/**
* @hidden
*/
export let TriangleRasterizer = /*@__PURE__*/ (() => {
class TriangleRasterizer extends Base {
constructor(a, b, c, d, e, f, g) {
super();
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;
}
get m() {
return this.k;
}
set m(a) {
this.k = a;
}
get l() {
return this.j;
}
set l(a) {
this.j = a;
}
get i() {
return this.g;
}
set i(a) {
this.g = a;
}
get h() {
return this.f;
}
set h(a) {
this.f = a;
}
get c() {
return this.b;
}
set c(a) {
this.b = a;
}
get e() {
return this.d;
}
set e(a) {
this.d = a;
}
p(a, b, c, d, e, f, g, h) {
let i = this.k;
let j = this.j;
let k;
let 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;
}
let m = truncate(Math.round(c.y));
let n = truncate(Math.round(d.y));
let o = truncate(Math.round(e.y));
if (o == m) {
return;
}
if (isNaN_(f) || isNaN_(g) || isNaN_(h)) {
return;
}
let p = (d.x - c.x) * (e.y - c.y) - (e.x - c.x) * (d.y - c.y) >= 0;
let q = Math.max(0, m);
let r = Math.min(j - 1, n);
for (let s = q; s < r; ++s) {
let t = (s - m) / (n - m);
let u = c.x + t * (d.x - c.x);
let v = f + t * (g - f);
let w = (s - m) / (o - m);
let x = c.x + w * (e.x - c.x);
let 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);
}
}
{
let z = Math.min(j - 1, Math.max(0, n));
let aa = Math.min(j - 1, o);
let ab = 0;
let ac = d.x + ab * (e.x - d.x);
let ad = g + ab * (h - g);
let ae = z;
let af = (o - m);
let ag = (ae - m) / af;
let ah = c.x + ag * (e.x - c.x);
let 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);
}
}
o(a, b, c, d, e, f, g) {
let h = this.k;
let i = d > 0 ? d : 0;
let j = e < h - 1 ? e : h - 1;
let k = c * h * 4 + (i * 4);
let l = g - f;
let m = 1 / (e - d);
let n = this.d;
let o = this.g;
let p = this.f;
let q = c * h;
for (let r = i; r <= j; r++) {
let s = f + l * (r - d) * m;
let 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;
}
}
n() {
}
}
TriangleRasterizer.$t = markType(TriangleRasterizer, 'TriangleRasterizer');
return TriangleRasterizer;
})();