没有透明度的图像在其他笔记本电脑中是看不到的。
另外,当我创建一个新的 Eclipse 项目时:
- 当我将粘贴代码复制到单独的类文件中时,它在我的机器上运行良好,但在具有相同代码和项目设置的其他机器上运行不佳。
- bin中的图像没有被复制,我必须单独复制图像。
这是用于透明度的代码。
public static class Transparency
{
public static Image makeColorTransparent(Image im, final Color color)
{
ImageFilter filter = new RGBImageFilter()
{
public int markerRGB = color.getRGB() | 0xFF000000;
public final int filterRGB(int x, int y, int rgb)
{
if ( ( rgb | 0xFF000000 ) == markerRGB )
{
// Mark the alpha bits as zero - transparent
return 0x00FFFFFF & rgb;
}
else
{
// nothing to do
return rgb;
}
}
};
ImageProducer ip = new FilteredImageSource(im.getSource(), filter);
return Toolkit.getDefaultToolkit().createImage(ip);
}
}
我想做多人游戏。因此,它应该在其他笔记本电脑上运行至关重要......
通过制作图像 bmp/png 文件格式解决了问题,适用于两种组合,使用
ImageIO.read 获取 bmp imagw
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)