public BufferedImage filter(BufferedImage src, BufferedImage dest) { if (dest == null) { dest = createCompatibleDestImage(src, null); } int width = src.getWidth(); int height = src.getHeight(); int[] inPixels = new int[width * height]; int[] outPixels = new int[width * height]; src.getRaster().getDataElements(0, 0, width, height, inPixels); filter(inPixels, outPixels, width, height); dest.getRaster().setDataElements(0, 0, width, height, outPixels); return dest; }
public BufferedImage filter(BufferedImage src, BufferedImage dest) { if (dest == null) { dest = createCompatibleDestImage(src, null); } int width = src.getWidth(); int height = src.getHeight(); int[] inPixels = new int[width * height]; int[] outPixels = new int[width * height]; src.getRaster().getDataElements(0, 0, width, height, inPixels); filter(inPixels, outPixels, width, height); dest.getRaster().setDataElements(0, 0, width, height, outPixels); return dest; }