我正在尝试绘制一个采用缓冲图像的方法,使其半透明,然后返回生成的缓冲图像。从那里我可以稍后画它。但是我的代码无法绘制任何东西。认为我很接近...
public BufferedImage ApplyTransparency(BufferedImage image)
{
BufferedImage dest = new BufferedImage(overlay1.getWidth(), overlay1.getHeight(),
BufferedImage.TYPE_INT_ARGB);
Graphics2D g3 = dest.createGraphics();
AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.DST_IN, 0.9F);
g3.setComposite(ac);
g3.drawImage(overlay1, 0, 0, null);
return dest;
}