From 2dd1c3f01d260ac4abce6bcfaebe451538ac8a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 5 Jun 2014 19:59:48 +0200 Subject: [PATCH] Canvas export colortransform fix --- src/com/jpexs/helpers/resource/canvas.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/com/jpexs/helpers/resource/canvas.js b/src/com/jpexs/helpers/resource/canvas.js index ab7699d62..dc00d1983 100644 --- a/src/com/jpexs/helpers/resource/canvas.js +++ b/src/com/jpexs/helpers/resource/canvas.js @@ -840,12 +840,12 @@ var cxform = function(r_add, g_add, b_add, a_add, r_mult, g_mult, b_mult, a_mult v = max; return v; }; - this.apply = function(c) { - var d = c; - d[0] = this._cut(d[0] * this.r_mult / 255 + this.r_add, 0, 255); - d[1] = this._cut(d[1] * this.g_mult / 255 + this.g_add, 0, 255); - d[2] = this._cut(d[2] * this.b_mult / 255 + this.b_add, 0, 255); - d[3] = this._cut(d[3] * this.a_mult / 255 + this.a_add / 255, 0, 1); + this.apply = function(c) { + var d = c; + d[0] = this._cut(Math.round(d[0] * this.r_mult / 255 + this.r_add), 0, 255); + d[1] = this._cut(Math.round(d[1] * this.g_mult / 255 + this.g_add), 0, 255); + d[2] = this._cut(Math.round(d[2] * this.b_mult / 255 + this.b_add), 0, 255); + d[3] = this._cut(Math.round(d[3] * this.a_mult / 255 + this.a_add / 255), 0, 1); return d; }; this.applyToImage = function(fimg) {