int pixels[] = new int[width];
BufferedImage row = new BufferedImage(width, 1, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = row.createGraphics(); int pixels[] = ((DataBufferInt)row.getRaster().getDataBuffer()).getData();
    public BufferedImage filter(BufferedImage src, BufferedImage dst) {        int width = src.getWidth();        int height = src.getHeight();                BufferedImageConsumer consumer = new BufferedImageConsumer(dst);        ImageFilter fltr = filter.getFilterInstance(consumer);        fltr.setDimensions(width, height);                ColorModel cm = src.getColorModel();        /*        if (cm.getPixelSize() == 8) {            // byte. indexed or gray:            WritableRaster raster = src.getRaster();            byte pixels[] = new byte[width];            // calculate scanline by scanline in order to safe memory.            // It also seems to run faster like that            for (int y = 0; y < height; y++) {                raster.getDataElements(0, y, width, 1, pixels);                fltr.setPixels(0, y, width, 1, cm, pixels, 0, width);            }        } else {            // integer, use the simple rgb mode:        }        */        // allways work in integer mode. this is more effective, and most        // filters convert to integer internally anyhow        cm = new SimpleColorModel();        int pixels[] = new int[width];        // calculate scanline by scanline in order to safe memory.        // It also seems to run faster like that        for (int y = 0; y < height; y++) {            src.getRGB(0, y, width, 1, pixels, 0, width);            fltr.setPixels(0, y, width, 1, cm, pixels, 0, width);        }        return consumer.getImage();    }