Last Updated: February 25, 2016
·
865
· rbgrouleff

context.putImageData darkening semi transparent pixels

Updating a canvas repeatedly using context.getImageData/putImageData will result in darkening of semi transparent pixels.

Instead of reading the image data from the context again and again, keep the original image data and do the transformation on that and draw it on the canvas with putImageData.