//11.覆盖filterRGB方法,对图像像素进行过滤
@Override
public int filterRGB(int x, int y, int rgb) {
/*DirectColorModel cm=(DirectColorModel)ColorModel.getRGBdefault();
int alpha=cm.getAlpha(rgb);
int red=cm.getRed(rgb);
int green=cm.getGreen(rgb);
int blue=cm.getBlue(rgb);
alpha=255*y/height;*/
//return alpha<<24|red<<16|green<<8|blue;
//过滤掉像素中的绿色与蓝色
//return rgb & 0xffff0000;
//alpha Red Green Blue
//过滤掉了绿色
//return rgb & 0xffff00ff;
//过滤掉了蓝色
return rgb & 0xffff0000;
//return rgb;
}
rgb是八位的0xffffffff
分别表示alpha,Red,Green,Blue也就是透明度,红色,绿色,蓝色