pa7/heatmap.js — pull request #19 by mrosack (2012-03-14 01:52:28+00:00)
Title: Fix android browsers (and other browsers that incorrectly premultiply the alpha channel)

I have an android phone and tablet, and neither renders heatmap.js correctly. I'm working on a project to do some visualization on iPhone/android tablets using Titanium & heatmap.js, and ran into this issue. Basically, I think the problem is caused by a buggy implementation of the "premulitply-alpha" algorithm (see here: http://stackoverflow.com/questions/4309364/why-does-html-canvas-getimagedata-not-return-the-exact-same-values-that-were-j).

Anyway, I've added code to detect when a browser has a buggy premultiply-alpha algorithm, and if detected adjust the RGB values so they're normalized when the browser applies it's buggy algorithm. I'm not sure if this affects anyone but me, but it definitely affects me. :)