Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
for(int x=0;x<20;x++) { for(int y=0;y<20;y++) { img.setRGB(x, y,0); } }
我正在尝试将 20*20 区域中的所有像素转换为黑色。但这不适用于上面的代码。我还需要添加什么吗?
尝试这个
int rgb=new Color(0,0,0).getRGB(); // i believe rgb for black is 0,0,0 but cross check for(int x=0;x<20;x++){ for(int y=0;y<20;y++){ img.setRGB(x, y,rgb); } }