static BWImage getAlphaChannel(BufferedImage src) { if (src.getType() != BufferedImage.TYPE_INT_ARGB) throw new RuntimeException("Wrong image type."); int w = src.getWidth(); int h = src.getHeight(); int[] srcBuffer = src.getData().getPixels(0, 0, w, h, null); BWImage alpha = new BWImage(w, h); for (int i=0; i> 24) & 0xff); ret alpha; }