Java 类sun.awt.image.ImagingLib 实例源码

项目:OpenJSharp    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:jdk8u-jdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:jdk8u-jdk    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:openjdk-jdk10    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source {@code Raster} to filter
 * @param dst the destination {@code WritableRaster} for the
 *        filtered {@code src}
 * @return the filtered {@code WritableRaster}
 * @throws NullPointerException if {@code src} is {@code null}
 * @throws ImagingOpException if {@code src} and {@code dst}
 *         do not have the same number of bands
 * @throws ImagingOpException if {@code src} cannot be filtered
 * @throws IllegalArgumentException if {@code src} equals
 *         {@code dst}
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:openjdk-jdk10    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:openjdk9    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source {@code Raster} to filter
 * @param dst the destination {@code WritableRaster} for the
 *        filtered {@code src}
 * @return the filtered {@code WritableRaster}
 * @throws NullPointerException if {@code src} is {@code null}
 * @throws ImagingOpException if {@code src} and {@code dst}
 *         do not have the same number of bands
 * @throws ImagingOpException if {@code src} cannot be filtered
 * @throws IllegalArgumentException if {@code src} equals
 *         {@code dst}
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:openjdk9    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:Java8CN    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:jdk8u_jdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:jdk8u_jdk    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:lookaside_java-1.8.0-openjdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:lookaside_java-1.8.0-openjdk    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:VarJ    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the 
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals 
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:jdk-1.7-annotated    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:infobip-open-jdk-8    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:infobip-open-jdk-8    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:jdk8u-dev-jdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:jdk8u-dev-jdk    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:jdk7-jdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:jdk7-jdk    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:openjdk-source-code-learn    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:openjdk-source-code-learn    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:OLD-OpenJDK8    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:OLD-OpenJDK8    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:JAVA_UNIT    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:openjdk-jdk7u-jdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:openjdk-jdk7u-jdk    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:openjdk-icedtea7    文件:ConvolveOp.java   
/**
 * Performs a convolution on Rasters.  Each band of the source Raster
 * will be convolved.
 * The source and destination must have the same number of bands.
 * If the destination Raster is null, a new Raster will be created.
 * The IllegalArgumentException may be thrown if the source is
 * the same as the destination.
 * @param src the source <code>Raster</code> to filter
 * @param dst the destination <code>WritableRaster</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>WritableRaster</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws ImagingOpException if <code>src</code> and <code>dst</code>
 *         do not have the same number of bands
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    else if (src.getNumBands() != dst.getNumBands()) {
        throw new ImagingOpException("Different number of bands in src "+
                                     " and dst Rasters");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    return dst;
}
项目:openjdk-icedtea7    文件:MlibOpsTest.java   
public static void doTest(BufferedImageOp op) {
    BufferedImage src = createSrcImage();
    BufferedImage dst = createImage();
    BufferedImage ret = null;
    try {
        ret = ImagingLib.filter(op, src, dst);
    } catch (Exception e) {
        throw new RuntimeException("Test FAILED.", e);
    }
    if (ret == null) {
        throw new RuntimeException("Test FAILED: null output");
    }

    System.out.println("ret: " + ret);
    System.out.println("Test PASSED for " + op.getClass().getName());
}
项目:OpenJSharp    文件:ConvolveOp.java   
/**
 * Performs a convolution on BufferedImages.  Each component of the
 * source image will be convolved (including the alpha component, if
 * present).
 * If the color model in the source image is not the same as that
 * in the destination image, the pixels will be converted
 * in the destination.  If the destination image is null,
 * a BufferedImage will be created with the source ColorModel.
 * The IllegalArgumentException may be thrown if the source is the
 * same as the destination.
 * @param src the source <code>BufferedImage</code> to filter
 * @param dst the destination <code>BufferedImage</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>BufferedImage</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 */
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }

    boolean needToConvert = false;
    ColorModel srcCM = src.getColorModel();
    ColorModel dstCM;
    BufferedImage origDst = dst;

    // Can't convolve an IndexColorModel.  Need to expand it
    if (srcCM instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) srcCM;
        src = icm.convertToIntDiscrete(src.getRaster(), false);
        srcCM = src.getColorModel();
    }

    if (dst == null) {
        dst = createCompatibleDestImage(src, null);
        dstCM = srcCM;
        origDst = dst;
    }
    else {
        dstCM = dst.getColorModel();
        if (srcCM.getColorSpace().getType() !=
            dstCM.getColorSpace().getType())
        {
            needToConvert = true;
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
        else if (dstCM instanceof IndexColorModel) {
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    if (needToConvert) {
        ColorConvertOp ccop = new ColorConvertOp(hints);
        ccop.filter(dst, origDst);
    }
    else if (origDst != dst) {
        java.awt.Graphics2D g = origDst.createGraphics();
        try {
            g.drawImage(dst, 0, 0, null);
        } finally {
            g.dispose();
        }
    }

    return origDst;
}
项目:OpenJSharp    文件:AffineTransformOp.java   
/**
 * Transforms the source <CODE>Raster</CODE> and stores the results in
 * the destination <CODE>Raster</CODE>.  This operation performs the
 * transform band by band.
 * <p>
 * If the destination <CODE>Raster</CODE> is null, a new
 * <CODE>Raster</CODE> is created.
 * An <CODE>IllegalArgumentException</CODE> may be thrown if the source is
 * the same as the destination or if the number of bands in
 * the source is not equal to the number of bands in the
 * destination.
 * <p>
 * The coordinates of the rectangle returned by
 * <code>getBounds2D(Raster)</code>
 * are not necessarily the same as the coordinates of the
 * <code>WritableRaster</code> returned by this method.  If the
 * upper-left corner coordinates of rectangle are negative then
 * this part of the rectangle is not drawn.  If the coordinates
 * of the rectangle are positive then the filtered image is drawn at
 * that position in the destination <code>Raster</code>.
 * <p>
 * @param src The <CODE>Raster</CODE> to transform.
 * @param dst The <CODE>Raster</CODE> in which to store the results of the
 * transformation.
 *
 * @return The transformed <CODE>Raster</CODE>.
 *
 * @throws ImagingOpException if the raster cannot be transformed
 *         because of a data-processing error that might be
 *         caused by an invalid image format, tile format, or
 *         image-processing operation, or any other unsupported
 *         operation.
 */
public final WritableRaster filter(Raster src, WritableRaster dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    if (src.getNumBands() != dst.getNumBands()) {
        throw new IllegalArgumentException("Number of src bands ("+
                                           src.getNumBands()+
                                           ") does not match number of "+
                                           " dst bands ("+
                                           dst.getNumBands()+")");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to transform src image");
    }
    return dst;
}
项目:jdk8u-jdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on BufferedImages.  Each component of the
 * source image will be convolved (including the alpha component, if
 * present).
 * If the color model in the source image is not the same as that
 * in the destination image, the pixels will be converted
 * in the destination.  If the destination image is null,
 * a BufferedImage will be created with the source ColorModel.
 * The IllegalArgumentException may be thrown if the source is the
 * same as the destination.
 * @param src the source <code>BufferedImage</code> to filter
 * @param dst the destination <code>BufferedImage</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>BufferedImage</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 */
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }

    boolean needToConvert = false;
    ColorModel srcCM = src.getColorModel();
    ColorModel dstCM;
    BufferedImage origDst = dst;

    // Can't convolve an IndexColorModel.  Need to expand it
    if (srcCM instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) srcCM;
        src = icm.convertToIntDiscrete(src.getRaster(), false);
        srcCM = src.getColorModel();
    }

    if (dst == null) {
        dst = createCompatibleDestImage(src, null);
        dstCM = srcCM;
        origDst = dst;
    }
    else {
        dstCM = dst.getColorModel();
        if (srcCM.getColorSpace().getType() !=
            dstCM.getColorSpace().getType())
        {
            needToConvert = true;
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
        else if (dstCM instanceof IndexColorModel) {
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    if (needToConvert) {
        ColorConvertOp ccop = new ColorConvertOp(hints);
        ccop.filter(dst, origDst);
    }
    else if (origDst != dst) {
        java.awt.Graphics2D g = origDst.createGraphics();
        try {
            g.drawImage(dst, 0, 0, null);
        } finally {
            g.dispose();
        }
    }

    return origDst;
}
项目:jdk8u-jdk    文件:AffineTransformOp.java   
/**
 * Transforms the source <CODE>Raster</CODE> and stores the results in
 * the destination <CODE>Raster</CODE>.  This operation performs the
 * transform band by band.
 * <p>
 * If the destination <CODE>Raster</CODE> is null, a new
 * <CODE>Raster</CODE> is created.
 * An <CODE>IllegalArgumentException</CODE> may be thrown if the source is
 * the same as the destination or if the number of bands in
 * the source is not equal to the number of bands in the
 * destination.
 * <p>
 * The coordinates of the rectangle returned by
 * <code>getBounds2D(Raster)</code>
 * are not necessarily the same as the coordinates of the
 * <code>WritableRaster</code> returned by this method.  If the
 * upper-left corner coordinates of rectangle are negative then
 * this part of the rectangle is not drawn.  If the coordinates
 * of the rectangle are positive then the filtered image is drawn at
 * that position in the destination <code>Raster</code>.
 * <p>
 * @param src The <CODE>Raster</CODE> to transform.
 * @param dst The <CODE>Raster</CODE> in which to store the results of the
 * transformation.
 *
 * @return The transformed <CODE>Raster</CODE>.
 *
 * @throws ImagingOpException if the raster cannot be transformed
 *         because of a data-processing error that might be
 *         caused by an invalid image format, tile format, or
 *         image-processing operation, or any other unsupported
 *         operation.
 */
public final WritableRaster filter(Raster src, WritableRaster dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    if (src.getNumBands() != dst.getNumBands()) {
        throw new IllegalArgumentException("Number of src bands ("+
                                           src.getNumBands()+
                                           ") does not match number of "+
                                           " dst bands ("+
                                           dst.getNumBands()+")");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to transform src image");
    }
    return dst;
}
项目:openjdk-jdk10    文件:ConvolveOp.java   
/**
 * Performs a convolution on BufferedImages.  Each component of the
 * source image will be convolved (including the alpha component, if
 * present).
 * If the color model in the source image is not the same as that
 * in the destination image, the pixels will be converted
 * in the destination.  If the destination image is null,
 * a BufferedImage will be created with the source ColorModel.
 * The IllegalArgumentException may be thrown if the source is the
 * same as the destination.
 * @param src the source {@code BufferedImage} to filter
 * @param dst the destination {@code BufferedImage} for the
 *        filtered {@code src}
 * @return the filtered {@code BufferedImage}
 * @throws NullPointerException if {@code src} is {@code null}
 * @throws IllegalArgumentException if {@code src} equals
 *         {@code dst}
 * @throws ImagingOpException if {@code src} cannot be filtered
 */
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }

    boolean needToConvert = false;
    ColorModel srcCM = src.getColorModel();
    ColorModel dstCM;
    BufferedImage origDst = dst;

    // Can't convolve an IndexColorModel.  Need to expand it
    if (srcCM instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) srcCM;
        src = icm.convertToIntDiscrete(src.getRaster(), false);
        srcCM = src.getColorModel();
    }

    if (dst == null) {
        dst = createCompatibleDestImage(src, null);
        dstCM = srcCM;
        origDst = dst;
    }
    else {
        dstCM = dst.getColorModel();
        if (srcCM.getColorSpace().getType() !=
            dstCM.getColorSpace().getType())
        {
            needToConvert = true;
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
        else if (dstCM instanceof IndexColorModel) {
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    if (needToConvert) {
        ColorConvertOp ccop = new ColorConvertOp(hints);
        ccop.filter(dst, origDst);
    }
    else if (origDst != dst) {
        java.awt.Graphics2D g = origDst.createGraphics();
        try {
            g.drawImage(dst, 0, 0, null);
        } finally {
            g.dispose();
        }
    }

    return origDst;
}
项目:openjdk-jdk10    文件:AffineTransformOp.java   
/**
 * Transforms the source {@code Raster} and stores the results in
 * the destination {@code Raster}.  This operation performs the
 * transform band by band.
 * <p>
 * If the destination {@code Raster} is null, a new
 * {@code Raster} is created.
 * An {@code IllegalArgumentException} may be thrown if the source is
 * the same as the destination or if the number of bands in
 * the source is not equal to the number of bands in the
 * destination.
 * <p>
 * The coordinates of the rectangle returned by
 * {@code getBounds2D(Raster)}
 * are not necessarily the same as the coordinates of the
 * {@code WritableRaster} returned by this method.  If the
 * upper-left corner coordinates of rectangle are negative then
 * this part of the rectangle is not drawn.  If the coordinates
 * of the rectangle are positive then the filtered image is drawn at
 * that position in the destination {@code Raster}.
 *
 * @param src The {@code Raster} to transform.
 * @param dst The {@code Raster} in which to store the results of the
 * transformation.
 *
 * @return The transformed {@code Raster}.
 *
 * @throws ImagingOpException if the raster cannot be transformed
 *         because of a data-processing error that might be
 *         caused by an invalid image format, tile format, or
 *         image-processing operation, or any other unsupported
 *         operation.
 */
public final WritableRaster filter(Raster src, WritableRaster dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    if (src.getNumBands() != dst.getNumBands()) {
        throw new IllegalArgumentException("Number of src bands ("+
                                           src.getNumBands()+
                                           ") does not match number of "+
                                           " dst bands ("+
                                           dst.getNumBands()+")");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to transform src image");
    }
    return dst;
}
项目:openjdk9    文件:ConvolveOp.java   
/**
 * Performs a convolution on BufferedImages.  Each component of the
 * source image will be convolved (including the alpha component, if
 * present).
 * If the color model in the source image is not the same as that
 * in the destination image, the pixels will be converted
 * in the destination.  If the destination image is null,
 * a BufferedImage will be created with the source ColorModel.
 * The IllegalArgumentException may be thrown if the source is the
 * same as the destination.
 * @param src the source {@code BufferedImage} to filter
 * @param dst the destination {@code BufferedImage} for the
 *        filtered {@code src}
 * @return the filtered {@code BufferedImage}
 * @throws NullPointerException if {@code src} is {@code null}
 * @throws IllegalArgumentException if {@code src} equals
 *         {@code dst}
 * @throws ImagingOpException if {@code src} cannot be filtered
 */
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }

    boolean needToConvert = false;
    ColorModel srcCM = src.getColorModel();
    ColorModel dstCM;
    BufferedImage origDst = dst;

    // Can't convolve an IndexColorModel.  Need to expand it
    if (srcCM instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) srcCM;
        src = icm.convertToIntDiscrete(src.getRaster(), false);
        srcCM = src.getColorModel();
    }

    if (dst == null) {
        dst = createCompatibleDestImage(src, null);
        dstCM = srcCM;
        origDst = dst;
    }
    else {
        dstCM = dst.getColorModel();
        if (srcCM.getColorSpace().getType() !=
            dstCM.getColorSpace().getType())
        {
            needToConvert = true;
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
        else if (dstCM instanceof IndexColorModel) {
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    if (needToConvert) {
        ColorConvertOp ccop = new ColorConvertOp(hints);
        ccop.filter(dst, origDst);
    }
    else if (origDst != dst) {
        java.awt.Graphics2D g = origDst.createGraphics();
        try {
            g.drawImage(dst, 0, 0, null);
        } finally {
            g.dispose();
        }
    }

    return origDst;
}
项目:openjdk9    文件:AffineTransformOp.java   
/**
 * Transforms the source {@code Raster} and stores the results in
 * the destination {@code Raster}.  This operation performs the
 * transform band by band.
 * <p>
 * If the destination {@code Raster} is null, a new
 * {@code Raster} is created.
 * An {@code IllegalArgumentException} may be thrown if the source is
 * the same as the destination or if the number of bands in
 * the source is not equal to the number of bands in the
 * destination.
 * <p>
 * The coordinates of the rectangle returned by
 * {@code getBounds2D(Raster)}
 * are not necessarily the same as the coordinates of the
 * {@code WritableRaster} returned by this method.  If the
 * upper-left corner coordinates of rectangle are negative then
 * this part of the rectangle is not drawn.  If the coordinates
 * of the rectangle are positive then the filtered image is drawn at
 * that position in the destination {@code Raster}.
 *
 * @param src The {@code Raster} to transform.
 * @param dst The {@code Raster} in which to store the results of the
 * transformation.
 *
 * @return The transformed {@code Raster}.
 *
 * @throws ImagingOpException if the raster cannot be transformed
 *         because of a data-processing error that might be
 *         caused by an invalid image format, tile format, or
 *         image-processing operation, or any other unsupported
 *         operation.
 */
public final WritableRaster filter(Raster src, WritableRaster dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    if (src.getNumBands() != dst.getNumBands()) {
        throw new IllegalArgumentException("Number of src bands ("+
                                           src.getNumBands()+
                                           ") does not match number of "+
                                           " dst bands ("+
                                           dst.getNumBands()+")");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to transform src image");
    }
    return dst;
}
项目:Java8CN    文件:ConvolveOp.java   
/**
 * Performs a convolution on BufferedImages.  Each component of the
 * source image will be convolved (including the alpha component, if
 * present).
 * If the color model in the source image is not the same as that
 * in the destination image, the pixels will be converted
 * in the destination.  If the destination image is null,
 * a BufferedImage will be created with the source ColorModel.
 * The IllegalArgumentException may be thrown if the source is the
 * same as the destination.
 * @param src the source <code>BufferedImage</code> to filter
 * @param dst the destination <code>BufferedImage</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>BufferedImage</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 */
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }

    boolean needToConvert = false;
    ColorModel srcCM = src.getColorModel();
    ColorModel dstCM;
    BufferedImage origDst = dst;

    // Can't convolve an IndexColorModel.  Need to expand it
    if (srcCM instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) srcCM;
        src = icm.convertToIntDiscrete(src.getRaster(), false);
        srcCM = src.getColorModel();
    }

    if (dst == null) {
        dst = createCompatibleDestImage(src, null);
        dstCM = srcCM;
        origDst = dst;
    }
    else {
        dstCM = dst.getColorModel();
        if (srcCM.getColorSpace().getType() !=
            dstCM.getColorSpace().getType())
        {
            needToConvert = true;
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
        else if (dstCM instanceof IndexColorModel) {
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    if (needToConvert) {
        ColorConvertOp ccop = new ColorConvertOp(hints);
        ccop.filter(dst, origDst);
    }
    else if (origDst != dst) {
        java.awt.Graphics2D g = origDst.createGraphics();
        try {
            g.drawImage(dst, 0, 0, null);
        } finally {
            g.dispose();
        }
    }

    return origDst;
}
项目:Java8CN    文件:AffineTransformOp.java   
/**
 * Transforms the source <CODE>Raster</CODE> and stores the results in
 * the destination <CODE>Raster</CODE>.  This operation performs the
 * transform band by band.
 * <p>
 * If the destination <CODE>Raster</CODE> is null, a new
 * <CODE>Raster</CODE> is created.
 * An <CODE>IllegalArgumentException</CODE> may be thrown if the source is
 * the same as the destination or if the number of bands in
 * the source is not equal to the number of bands in the
 * destination.
 * <p>
 * The coordinates of the rectangle returned by
 * <code>getBounds2D(Raster)</code>
 * are not necessarily the same as the coordinates of the
 * <code>WritableRaster</code> returned by this method.  If the
 * upper-left corner coordinates of rectangle are negative then
 * this part of the rectangle is not drawn.  If the coordinates
 * of the rectangle are positive then the filtered image is drawn at
 * that position in the destination <code>Raster</code>.
 * <p>
 * @param src The <CODE>Raster</CODE> to transform.
 * @param dst The <CODE>Raster</CODE> in which to store the results of the
 * transformation.
 *
 * @return The transformed <CODE>Raster</CODE>.
 *
 * @throws ImagingOpException if the raster cannot be transformed
 *         because of a data-processing error that might be
 *         caused by an invalid image format, tile format, or
 *         image-processing operation, or any other unsupported
 *         operation.
 */
public final WritableRaster filter(Raster src, WritableRaster dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }
    if (src.getNumBands() != dst.getNumBands()) {
        throw new IllegalArgumentException("Number of src bands ("+
                                           src.getNumBands()+
                                           ") does not match number of "+
                                           " dst bands ("+
                                           dst.getNumBands()+")");
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to transform src image");
    }
    return dst;
}
项目:jdk8u_jdk    文件:ConvolveOp.java   
/**
 * Performs a convolution on BufferedImages.  Each component of the
 * source image will be convolved (including the alpha component, if
 * present).
 * If the color model in the source image is not the same as that
 * in the destination image, the pixels will be converted
 * in the destination.  If the destination image is null,
 * a BufferedImage will be created with the source ColorModel.
 * The IllegalArgumentException may be thrown if the source is the
 * same as the destination.
 * @param src the source <code>BufferedImage</code> to filter
 * @param dst the destination <code>BufferedImage</code> for the
 *        filtered <code>src</code>
 * @return the filtered <code>BufferedImage</code>
 * @throws NullPointerException if <code>src</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>src</code> equals
 *         <code>dst</code>
 * @throws ImagingOpException if <code>src</code> cannot be filtered
 */
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
    if (src == null) {
        throw new NullPointerException("src image is null");
    }
    if (src == dst) {
        throw new IllegalArgumentException("src image cannot be the "+
                                           "same as the dst image");
    }

    boolean needToConvert = false;
    ColorModel srcCM = src.getColorModel();
    ColorModel dstCM;
    BufferedImage origDst = dst;

    // Can't convolve an IndexColorModel.  Need to expand it
    if (srcCM instanceof IndexColorModel) {
        IndexColorModel icm = (IndexColorModel) srcCM;
        src = icm.convertToIntDiscrete(src.getRaster(), false);
        srcCM = src.getColorModel();
    }

    if (dst == null) {
        dst = createCompatibleDestImage(src, null);
        dstCM = srcCM;
        origDst = dst;
    }
    else {
        dstCM = dst.getColorModel();
        if (srcCM.getColorSpace().getType() !=
            dstCM.getColorSpace().getType())
        {
            needToConvert = true;
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
        else if (dstCM instanceof IndexColorModel) {
            dst = createCompatibleDestImage(src, null);
            dstCM = dst.getColorModel();
        }
    }

    if (ImagingLib.filter(this, src, dst) == null) {
        throw new ImagingOpException ("Unable to convolve src image");
    }

    if (needToConvert) {
        ColorConvertOp ccop = new ColorConvertOp(hints);
        ccop.filter(dst, origDst);
    }
    else if (origDst != dst) {
        java.awt.Graphics2D g = origDst.createGraphics();
        try {
            g.drawImage(dst, 0, 0, null);
        } finally {
            g.dispose();
        }
    }

    return origDst;
}