UNPKG

image-in-browser

Version:

Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)

67 lines 1.58 kB
export class PvrColorRgba { get r() { return this._r; } get g() { return this._g; } get b() { return this._b; } get a() { return this._a; } constructor(r = 0, g = 0, b = 0, a = 0) { this._r = r; this._g = g; this._b = b; this._a = a; } static from(other) { return new PvrColorRgba(other._r, other._g, other._b, other._a); } copy() { return PvrColorRgba.from(this); } setMin(c) { if (c._r < this._r) { this._r = c._r; } if (c._g < this._g) { this._g = c._g; } if (c._b < this._b) { this._b = c._b; } if (c._a < this._a) { this._a = c._a; } } setMax(c) { if (c._r > this._r) { this._r = c._r; } if (c._g > this._g) { this._g = c._g; } if (c._b > this._b) { this._b = c._b; } if (c._a > this._a) { this._a = c._a; } } mul(x) { return new PvrColorRgba(this._r * x, this._g * x, this._b * x, this._a * x); } add(x) { return new PvrColorRgba(this._r + x._r, this._g + x._g, this._b + x._b, this._a + x._a); } sub(x) { return new PvrColorRgba(this._r - x._r, this._g - x._g, this._b - x._b, this._a - x._a); } dotProd(x) { return this._r * x._r + this._g * x._g + this._b * x._b + this._a * x._a; } } //# sourceMappingURL=pvr-color-rgba.js.map