📄 imageprocessing.java
字号:
import acm.program.*;
import acm.graphics.*;
public class ImageProcessing extends GraphicsProgram{
public void run(){
GImage image = new GImage("EmilyW.jpg");
GImage rImage = RImage(image);
image.scale(2.0);
add(image, 10, 50);
rImage.scale(2.0);
add(rImage, 350, 50);
}
private GImage RImage(GImage image) {
int[][] array = image.getPixelArray();
int height = array.length;
int width = array[0].length;
int[][] rArray = new int[height][width];
for(int i = 0; i < height; i++){
for(int j = 0; j < width; j++){
rArray[i][width - j - 1] = array[i][j];
}
}
return new GImage(rArray);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -