qq_快乐小2B_0
2017-05-04 15:08
请问我这个灰色滤镜为什么无效
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)
}
var a = pixelData[i*4+2]
var grey = r*0.3 + g*0.59 + b*0.11
声明a却用b计算
Canvas玩转图像处理
60311 学习 · 124 问题
相似问题