灰色滤镜的问题
请问我这个灰色滤镜为什么无效
function greyEffect(){
var ImageData = contexta.getImageData(0,0,canvasa.width,canvasa.height)
var pixelData = ImageData.data
for(var i=0; i< canvasb.width * canvasb.height; i++){
var r = pixelData[i*4+0]
var g = pixelData[i*4+1]
var a = pixelData[i*4+2]
var grey = r*0.3 + g*0.59 + b*0.11
pixelData[i*4+0] = grey
pixelData[i*4+1] = grey
pixelData[i*4+2] = grey
}
contextb.putImageData(ImageData,0,0,0,0,canvasb.width,canvasb.height)
}