Java Code Examples for java.awt.image.BufferedImageOp#createCompatibleDestImage()

The following examples show how to use java.awt.image.BufferedImageOp#createCompatibleDestImage() . 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: PdfGraphics2D.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @see Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int)
 */
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
    BufferedImage result = img;
    if (op != null) {
        result = op.createCompatibleDestImage(img, img.getColorModel());
        result = op.filter(img, result);
    }
    drawImage(result, x, y, null);
}
 
Example 2
Source File: PdfGraphics2D.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @see Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int)
 */
@Override
public void drawImage( final BufferedImage img, final BufferedImageOp op, final int x, final int y ) {
  BufferedImage result = img;
  if ( op != null ) {
    result = op.createCompatibleDestImage( img, img.getColorModel() );
    result = op.filter( img, result );
  }
  drawImage( result, x, y, null );
}
 
Example 3
Source File: PdfGraphics2D.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * @see Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int)
 */
@Override
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
	BufferedImage result = img;
	if (op != null) {
		result = op.createCompatibleDestImage(img, img.getColorModel());
		result = op.filter(img, result);
	}
	drawImage(result, x, y, null);
}
 
Example 4
Source File: ImagingLib.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 5
Source File: ImagingLib.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 6
Source File: ImagingLib.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 7
Source File: ImagingLib.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 8
Source File: ImagingLib.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 9
Source File: ImagingLib.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 10
Source File: ImagingLib.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 11
Source File: ImagingLib.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 12
Source File: ImagingLib.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 13
Source File: ImagingLib.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 14
Source File: ImagingLib.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 15
Source File: ImagingLib.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 16
Source File: ImagingLib.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 17
Source File: ImagingLib.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static BufferedImage filter(BufferedImageOp op, BufferedImage src,
                                   BufferedImage dst)
{
    if (verbose) {
        System.out.println("in filter and op is "+op
                           + "bufimage is "+src+" and "+dst);
    }

    if (useLib == false) {
        return null;
    }

    // Create the destination image
    if (dst == null) {
        dst = op.createCompatibleDestImage(src, null);
    }

    BufferedImage retBI = 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 (lookupByteBI(src, dst, bt.getTable()) > 0) {
                retBI = dst;
            }
        }
        break;

      case AFFINE_OP:
        AffineTransformOp bOp = (AffineTransformOp) op;
        double[] matrix = new double[6];
        AffineTransform xform = bOp.getTransform();
        bOp.getTransform().getMatrix(matrix);

        if (transformBI(src, dst, matrix,
                        bOp.getInterpolationType())>0) {
            retBI = dst;
        }
        break;

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

      default:
        break;
    }

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

    return retBI;
}
 
Example 18
Source File: PDFGraphics.java    From jpexs-decompiler with GNU General Public License v3.0 votes vote down vote up
/**
   * @see Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int)
   */
  public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
      BufferedImage result = img;
      if (op != null) {
          result = op.createCompatibleDestImage(img, img.getColorModel());
          result = op.filter(img, result);
      }
      drawImage(result, x, y, null);
  }