Drawing a image repeatedly with low globalAlpha values causes a significant difference in the outcome. I added a testcase to the visual tests to show this:
tests["low opacity img"] = function (ctx) {
let canvas = ctx.canvas.constructor;
let c;
if (typeof window !== 'undefined') {
c = document.createElement('canvas');
c.width = 200;
c.height = 200;
} else {
c = new canvas(200, 200);
}
let ctx2 = c.getContext('2d');
ctx2.fillStyle = "rgba(0, 0, 0, 0.5)";
ctx2.fillRect(0, 0, 200, 200);
ctx.globalAlpha = 0.01;
for (var i = 0; i < 50; i++) {
ctx.drawImage(c, 0, 0)
}
}
tests["low opacity drawRect"] = function (ctx) {
ctx.globalAlpha = 0.01 ;
for (var i = 0; i < 50; i++) {
ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
ctx.fillRect(0, 0, 200, 200);
}
}
I know this is a very subtle difference, but a very annoying one since our users often draw with low opacity, causing slight changes in the resulting images.
Drawing a image repeatedly with low globalAlpha values causes a significant difference in the outcome. I added a testcase to the visual tests to show this:![image](https://user-images.githubusercontent.com/8009393/221362480-d387bedc-8346-4981-ad60-416400807f5f.png)
I know this is a very subtle difference, but a very annoying one since our users often draw with low opacity, causing slight changes in the resulting images.