public BufferedImage filter(BufferedImage src, BufferedImage dst)
public final BufferedImage filter(BufferedImage src, BufferedImage dst)
  public BufferedImage filter(BufferedImage src, BufferedImage dst)  {    if (src.getColorModel() instanceof IndexColorModel)      throw new IllegalArgumentException("LookupOp.filter: IndexColorModel "					 + "not allowed");    if (dst == null)      dst = createCompatibleDestImage(src, src.getColorModel());    // Set up for potential colormodel mismatch    BufferedImage tgt;    if (dst.getColorModel().equals(src.getColorModel()))      tgt = dst;    else      tgt = createCompatibleDestImage(src, src.getColorModel());    Raster sr = src.getRaster();    WritableRaster dr = tgt.getRaster();    if (src.getColorModel().hasAlpha() &&        (lut.getNumComponents() == 1 ||         lut.getNumComponents() == src.getColorModel().getNumColorComponents()))    {      // Need to ignore alpha for lookup      int[] dbuf = new int[src.getColorModel().getNumComponents()];      int tmpBands = src.getColorModel().getNumColorComponents();      int[] tmp = new int[tmpBands];              // Filter the pixels      for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)        for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)        {	          // Filter only color components, but also copy alpha          sr.getPixel(x, y, dbuf);          System.arraycopy(dbuf, 0, tmp, 0, tmpBands);          dr.setPixel(x, y, lut.lookupPixel(tmp, dbuf));        }    }    else if (lut.getNumComponents() != 1	     &&	     lut.getNumComponents() != src.getColorModel().getNumComponents())      throw new IllegalArgumentException("LookupOp.filter: "					 + "Incompatible lookup "					 + "table and source image");    // No alpha to ignore    int[] dbuf = new int[src.getColorModel().getNumComponents()];            // Filter the pixels    for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)      for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)        dr.setPixel(x, y, lut.lookupPixel(sr.getPixel(x, y, dbuf), dbuf));    if (tgt != dst)    {      // Convert between color models.      // TODO Check that premultiplied alpha is handled correctly here.      Graphics2D gg = dst.createGraphics();      gg.setRenderingHints(hints);      gg.drawImage(tgt, 0, 0, null);      gg.dispose();    }        return dst;  }