static BufferedImage bwImageAsAlpha(BWImage bwImage, Color color) { int w = bwImage.w(), h = bwImage.h(), n = w*h; int rgb = colorToInt(color); byte[] in = bwImage.pixels; int[] out = new[n]; for i to n: out[i] = ubyteToInt(in[i]) << 24 | rgb; ret bufferedImage(w, h, out); }