java.awt.image.RasterOp Java Examples

The following examples show how to use java.awt.image.RasterOp. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageTests.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #2
Source File: ImageTests.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #3
Source File: ImageTests.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #4
Source File: ImageTests.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #5
Source File: ImageTests.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #6
Source File: RasterOpNullDestinationRasterTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {

        byte[][] data = new byte[1][10];
        ByteLookupTable lut = new ByteLookupTable(0, data);
        RasterOp op = new LookupOp(lut, null);

        int[] bandOffsets = {0};
        Point location = new Point(0, 0);
        DataBuffer db = new DataBufferByte(10 * 10);
        SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
                                                         10, 10, 1, 10,
                                                         bandOffsets);

        Raster src = Raster.createRaster(sm, db, location);

        op.filter(src, null); // this used to result in NullPointerException
    }
 
Example #7
Source File: ImageTests.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #8
Source File: ImageTests.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #9
Source File: ImageTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #10
Source File: ImageTests.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #11
Source File: ImageTests.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #12
Source File: ImageTests.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #13
Source File: ImageTests.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #14
Source File: ImageTests.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void runTest(Object ctx, int numReps) {
    ImageOpTests.Context ictx = (ImageOpTests.Context)ctx;
    RasterOp op = ictx.rasterOp;
    Raster src = ictx.rasSrc;
    WritableRaster dst = ictx.rasDst;
    if (ictx.touchSrc) {
        Graphics gSrc = ictx.bufSrc.getGraphics();
        do {
            gSrc.fillRect(0, 0, 1, 1);
            op.filter(src, dst);
        } while (--numReps > 0);
    } else {
        do {
            op.filter(src, dst);
        } while (--numReps > 0);
    }
}
 
Example #15
Source File: ImagingLib.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #16
Source File: ImagingLib.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #17
Source File: ImagingLib.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #18
Source File: ImagingLib.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #19
Source File: ImagingLib.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #20
Source File: ImagingLib.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #21
Source File: ImagingLib.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #22
Source File: ImagingLib.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #23
Source File: ImagingLib.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #24
Source File: ImagingLib.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #25
Source File: ImagingLib.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #26
Source File: ImagingLib.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #27
Source File: ImagingLib.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}
 
Example #28
Source File: ImagingLib.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static WritableRaster filter(RasterOp op, Raster src,
                                    WritableRaster dst) {
    if (useLib == false) {
        return null;
    }

    // Create the destination tile
    if (dst == null) {
        dst = op.createCompatibleDestRaster(src);
    }


    WritableRaster retRaster = null;
    switch (getNativeOpIndex(op.getClass())) {

      case LOOKUP_OP:
        // REMIND: Fix this!
        LookupTable table = ((LookupOp)op).getTable();
        if (table.getOffset() != 0) {
            // Right now the native code doesn't support offsets
            return null;
        }
        if (table instanceof ByteLookupTable) {
            ByteLookupTable bt = (ByteLookupTable) table;
            if (lookupByteRaster(src, dst, bt.getTable()) > 0) {
                retRaster = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        bOp.getTransform().getMatrix(matrix);
        if (transformRaster(src, dst, matrix,
                            bOp.getInterpolationType()) > 0) {
            retRaster =  dst;
        }
        break;

      case CONVOLVE_OP:
        ConvolveOp cOp = (ConvolveOp) op;
        if (convolveRaster(src, dst,
                           cOp.getKernel(), cOp.getEdgeCondition()) > 0) {
            retRaster = dst;
        }
        break;

      default:
        break;
    }

    if (retRaster != null) {
        SunWritableRaster.markDirty(retRaster);
    }

    return retRaster;
}