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

下面列出了怎么用sun.awt.image.ImagingLib的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk1.8-source-analysis   文件: 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;
}
 
源代码2 项目: dragonwell8_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;
}
 
源代码3 项目: dragonwell8_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());
}
 
源代码4 项目: TencentKona-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;
}
 
源代码5 项目: TencentKona-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());
}
 
源代码6 项目: jdk8u60   文件: 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;
}
 
源代码7 项目: jdk8u60   文件: 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());
}
 
源代码8 项目: JDKSourceCode1.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;
}
 
源代码9 项目: openjdk-jdk8u   文件: 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;
}
 
源代码10 项目: openjdk-jdk8u   文件: 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());
}
 
源代码11 项目: openjdk-jdk8u-backup   文件: 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;
}
 
源代码12 项目: openjdk-jdk8u-backup   文件: 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());
}
 
源代码13 项目: Bytecoder   文件: 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;
}
 
源代码14 项目: openjdk-jdk9   文件: 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;
}
 
源代码15 项目: 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());
}
 
源代码16 项目: openjdk-jdk9   文件: 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());
}
 
源代码17 项目: 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;
}
 
源代码18 项目: 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());
}
 
源代码19 项目: 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;
}
 
源代码20 项目: hottub   文件: 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;
}
 
源代码21 项目: hottub   文件: 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());
}
 
源代码22 项目: openjdk-8-source   文件: 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;
}
 
源代码23 项目: 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;
}
 
源代码24 项目: openjdk-8-source   文件: 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());
}
 
源代码25 项目: openjdk-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;
}
 
源代码26 项目: openjdk-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());
}
 
源代码27 项目: jdk1.8-source-analysis   文件: LookupOp.java
/**
 * Performs a lookup operation on a <code>Raster</code>.
 * If the destination <code>Raster</code> is <code>null</code>,
 * a new <code>Raster</code> will be created.
 * The <code>IllegalArgumentException</code> might be thrown
 * if the source <code>Raster</code> and the destination
 * <code>Raster</code> do not have the same
 * number of bands or if the number of arrays in the
 * <code>LookupTable</code> does not meet the
 * restrictions stated in the class comment above.
 * @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 IllegalArgumentException if the source and destinations
 *         rasters do not have the same number of bands, or the
 *         number of arrays in the <code>LookupTable</code> does
 *         not meet the restrictions described in the class comments.
 *
 */
public final WritableRaster filter (Raster src, WritableRaster dst) {
    int numBands  = src.getNumBands();
    int dstLength = dst.getNumBands();
    int height    = src.getHeight();
    int width     = src.getWidth();
    int srcPix[]  = new int[numBands];

    // Create a new destination Raster, if needed

    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (height != dst.getHeight() || width != dst.getWidth()) {
        throw new
            IllegalArgumentException ("Width or height of Rasters do not "+
                                      "match");
    }
    dstLength = dst.getNumBands();

    if (numBands != dstLength) {
        throw new
            IllegalArgumentException ("Number of channels in the src ("
                                      + numBands +
                                      ") does not match number of channels"
                                      + " in the destination ("
                                      + dstLength + ")");
    }
    int numComponents = ltable.getNumComponents();
    if (numComponents != 1 && numComponents != src.getNumBands()) {
        throw new IllegalArgumentException("Number of arrays in the "+
                                           " lookup table ("+
                                           numComponents+
                                           " is not compatible with the "+
                                           " src Raster: "+src);
    }


    if (ImagingLib.filter(this, src, dst) != null) {
        return dst;
    }

    // Optimize for cases we know about
    if (ltable instanceof ByteLookupTable) {
        byteFilter ((ByteLookupTable) ltable, src, dst,
                    width, height, numBands);
    }
    else if (ltable instanceof ShortLookupTable) {
        shortFilter ((ShortLookupTable) ltable, src, dst, width,
                     height, numBands);
    }
    else {
        // Not one we recognize so do it slowly
        int sminX = src.getMinX();
        int sY = src.getMinY();
        int dminX = dst.getMinX();
        int dY = dst.getMinY();
        for (int y=0; y < height; y++, sY++, dY++) {
            int sX = sminX;
            int dX = dminX;
            for (int x=0; x < width; x++, sX++, dX++) {
                // Find data for all bands at this x,y position
                src.getPixel(sX, sY, srcPix);

                // Lookup the data for all bands at this x,y position
                ltable.lookupPixel(srcPix, srcPix);

                // Put it back for all bands
                dst.setPixel(dX, dY, srcPix);
            }
        }
    }

    return dst;
}
 
源代码28 项目: jdk1.8-source-analysis   文件: 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;
}
 
源代码29 项目: jdk1.8-source-analysis   文件: BandCombineOp.java
/**
 * Transforms the <CODE>Raster</CODE> using the matrix specified in the
 * constructor. An <CODE>IllegalArgumentException</CODE> may be thrown if
 * the number of bands in the source or destination is incompatible with
 * the matrix.  See the class comments for more details.
 * <p>
 * If the destination is null, it will be created with a number of bands
 * equalling the number of rows in the matrix. No exception is thrown
 * if the operation causes a data overflow.
 *
 * @param src The <CODE>Raster</CODE> to be filtered.
 * @param dst The <CODE>Raster</CODE> in which to store the results
 * of the filter operation.
 *
 * @return The filtered <CODE>Raster</CODE>.
 *
 * @throws IllegalArgumentException If the number of bands in the
 * source or destination is incompatible with the matrix.
 */
public WritableRaster filter(Raster src, WritableRaster dst) {
    int nBands = src.getNumBands();
    if (ncols != nBands && ncols != (nBands+1)) {
        throw new IllegalArgumentException("Number of columns in the "+
                                           "matrix ("+ncols+
                                           ") must be equal to the number"+
                                           " of bands ([+1]) in src ("+
                                           nBands+").");
    }
    if (dst == null) {
        dst = createCompatibleDestRaster(src);
    }
    else if (nrows != dst.getNumBands()) {
        throw new IllegalArgumentException("Number of rows in the "+
                                           "matrix ("+nrows+
                                           ") must be equal to the number"+
                                           " of bands ([+1]) in dst ("+
                                           nBands+").");
    }

    if (ImagingLib.filter(this, src, dst) != null) {
        return dst;
    }

    int[] pixel = null;
    int[] dstPixel = new int[dst.getNumBands()];
    float accum;
    int sminX = src.getMinX();
    int sY = src.getMinY();
    int dminX = dst.getMinX();
    int dY = dst.getMinY();
    int sX;
    int dX;
    if (ncols == nBands) {
        for (int y=0; y < src.getHeight(); y++, sY++, dY++) {
            dX = dminX;
            sX = sminX;
            for (int x=0; x < src.getWidth(); x++, sX++, dX++) {
                pixel = src.getPixel(sX, sY, pixel);
                for (int r=0; r < nrows; r++) {
                    accum = 0.f;
                    for (int c=0; c < ncols; c++) {
                        accum += matrix[r][c]*pixel[c];
                    }
                    dstPixel[r] = (int) accum;
                }
                dst.setPixel(dX, dY, dstPixel);
            }
        }
    }
    else {
        // Need to add constant
        for (int y=0; y < src.getHeight(); y++, sY++, dY++) {
            dX = dminX;
            sX = sminX;
            for (int x=0; x < src.getWidth(); x++, sX++, dX++) {
                pixel = src.getPixel(sX, sY, pixel);
                for (int r=0; r < nrows; r++) {
                    accum = 0.f;
                    for (int c=0; c < nBands; c++) {
                        accum += matrix[r][c]*pixel[c];
                    }
                    dstPixel[r] = (int) (accum+matrix[r][nBands]);
                }
                dst.setPixel(dX, dY, dstPixel);
            }
        }
    }

    return dst;
}
 
源代码30 项目: jdk1.8-source-analysis   文件: 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;
}
 
 类所在包
 类方法
 同包方法