【发布时间】:2014-08-04 15:14:57
【问题描述】:
我不明白这个方法是如何工作的:
public DrawingCanvas(int[][] pixels, int rows, int cols){
image = new BufferedImage(cols, rows, BufferedImage.TYPE_BYTE_GRAY);
int pixel = 0;
for (int r = 0; r < rows; r++){
int col = 0;
for (int c = 0; c < cols; c++){
if(c+11 < cols){
pixel = pixels[r][c+11];
}
else{
pixel = pixels[r][col];
col++;
}
image.setRGB(c, r, ((255<<24) | (pixel << 16) | (pixel << 8) | pixel));
}
}
【问题讨论】:
-
您是在问您是否了解此方法的工作原理?
-
哪一部分你不明白?
-
它被执行了......有一个cpu和一个堆栈和东西......
-
这个方法是什么意思?
-
另外,它是一个构造函数。