我想将不同的像素改为不同的颜色.基本上,将像素的一部分更改为透明.
for(int i = 0; i < image.getWidth();i++)
for(int j = 0; j < image.getHeight(); j ++)
{
image.setRGB(i,j , 0);
}
Run Code Online (Sandbox Code Playgroud)
//我还将第三个参数0更改为另一个属性.但它仍然无效.它都显示黑色.你有什么想法吗?
阴.谢谢
class ImagePanel extends JPanel {
private BufferedImage image;
public ImagePanel(int width, int height, BufferedImage image) {
this.image = image;
image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
repaint();
}
/**
* Draws the image.
*/
public void paintComponent(Graphics g) {
super.paintComponent(g);
for (int i = 0; i < image.getWidth(); i++) {
for (int j = 0; j < …Run Code Online (Sandbox Code Playgroud)