//獲得半透明圖片,透明度從0到10共分為11個等級
public static final Image alfImage(Image img,int alf){
if(img == null){
System.out.println("alfImage");
return null;
}
if(alf < 0)
alf = 0;
else if(alf > 10)
alf = 10;
int imgW = img.getWidth();
int imgH = img.getHeight();
int[] RGBData = new int[imgW*imgH];
img.getRGB(RGBData,0,imgW,0,0,imgW,imgH);
int tmp = ((alf*255/10) << 24)|0x00ffffff;
for(int i=0;i<RGBData.length;i++)
RGBData &= tmp;
Image o_Img = Image.createRGBImage(RGBData,imgW,imgH,true);
return o_Img;
}