日期:2014-05-16  浏览次数:20417 次

问个读取页面上颜色的问题
用html5的canvas在页面上随便画一条很粗的有颜色的线.

鼠标怎样获取这条线的颜色呢?

------解决方案--------------------
var pixel=ctx.getImageData(0, 0, 1, 1).data;
var pixcolor = "rgba(" + pixel[0] + "," + pixel[1] + "," + pixel[2] + "," + pixel[3] + ")";