var width = 10;
var data = image.data;
var height = 10;
for ( var x = 0; x < width; x++ ) {
for ( var y = 0; y < height; y++ )
var index = 4 * (y * height + x); // 0
var local_variable = ArbitraryClassInstance.getBrightness(x, y); // 0
data[ index ] = ArbitraryClassInstance.getBrightness(x, y); // 0 for both index/call
data[ index + 1 ] = ArbitraryClassInstance.getBrightness(x, y); // 0 for both index/call
}
}
context.putImageData(image, 0, 0);
这两个指数和local_variable当我执行的代码都相当于零。 图像是一个JavaScript图像对象,数据是图像数据,以及宽度和高度的图像的尺寸。 该类收益亮度。