Search in sources :

Example 16 with ParameterBlock

use of java.awt.image.renderable.ParameterBlock in project Lucee by lucee.

the class Image method flip.

public void flip(TransposeType transpose) throws ExpressionException {
    ParameterBlock params = new ParameterBlock();
    params.addSource(image());
    params.add(transpose);
    image(JAI.create("transpose", params).getAsBufferedImage());
}
Also used : ParameterBlock(java.awt.image.renderable.ParameterBlock)

Example 17 with ParameterBlock

use of java.awt.image.renderable.ParameterBlock in project Lucee by lucee.

the class Image method shear.

public void shear(float shear, ShearDir direction, Object interpolation) throws ExpressionException {
    ParameterBlock params = new ParameterBlock();
    params.addSource(image());
    params.add(shear);
    params.add(direction);
    params.add(0.0F);
    params.add(0.0F);
    RenderingHints hints = null;
    if (interpolation == RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)
        params.add(Interpolation.getInstance(0));
    else if (interpolation == RenderingHints.VALUE_INTERPOLATION_BILINEAR) {
        params.add(Interpolation.getInstance(1));
        BorderExtender extender = BorderExtender.createInstance(1);
        hints = new RenderingHints(JAI.KEY_BORDER_EXTENDER, extender);
    } else if (interpolation == RenderingHints.VALUE_INTERPOLATION_BICUBIC) {
        params.add(Interpolation.getInstance(2));
        BorderExtender extender = BorderExtender.createInstance(1);
        hints = new RenderingHints(JAI.KEY_BORDER_EXTENDER, extender);
    }
    // TODO
    Color bg = getGraphics().getBackground();
    params.add(new double[] { bg.getRed(), bg.getGreen(), bg.getBlue() });
    image(JAI.create("shear", params, hints).getAsBufferedImage());
}
Also used : ParameterBlock(java.awt.image.renderable.ParameterBlock) BorderExtender(javax.media.jai.BorderExtender) Color(java.awt.Color) RenderingHints(java.awt.RenderingHints)

Example 18 with ParameterBlock

use of java.awt.image.renderable.ParameterBlock in project Lucee by lucee.

the class Image method sharpen.

public void sharpen(float gain) throws ExpressionException {
    ParameterBlock params = new ParameterBlock();
    params.addSource(image());
    params.add((Object) null);
    params.add(new Float(gain));
    image(JAI.create("unsharpmask", params).getAsBufferedImage());
}
Also used : ParameterBlock(java.awt.image.renderable.ParameterBlock)

Example 19 with ParameterBlock

use of java.awt.image.renderable.ParameterBlock in project Lucee by lucee.

the class Image method overlay.

public void overlay(Image topImage) throws ExpressionException {
    ParameterBlock params = new ParameterBlock();
    params.addSource(image());
    params.addSource(topImage.image());
    image(JAI.create("overlay", params).getAsBufferedImage());
}
Also used : ParameterBlock(java.awt.image.renderable.ParameterBlock)

Example 20 with ParameterBlock

use of java.awt.image.renderable.ParameterBlock in project Lucee by lucee.

the class Image method _rotate.

public void _rotate(float x, float y, float angle, String interpolation) throws ExpressionException {
    float radiansAngle = (float) Math.toRadians(angle);
    // rotation center
    float centerX = (float) getWidth() / 2;
    float centerY = (float) getHeight() / 2;
    ParameterBlock pb = new ParameterBlock();
    pb.addSource(image());
    pb.add(centerX);
    pb.add(centerY);
    pb.add(radiansAngle);
    pb.add(new javax.media.jai.InterpolationBicubic(10));
    // create a new, rotated image
    image(JAI.create("rotate", pb).getAsBufferedImage());
}
Also used : ParameterBlock(java.awt.image.renderable.ParameterBlock)

Aggregations

ParameterBlock (java.awt.image.renderable.ParameterBlock)29 RenderingHints (java.awt.RenderingHints)5 RenderedImage (java.awt.image.RenderedImage)5 FileOpException (digilib.io.FileOpException)3 BufferedImage (java.awt.image.BufferedImage)3 Point (java.awt.Point)2 ColorModel (java.awt.image.ColorModel)2 ComponentColorModel (java.awt.image.ComponentColorModel)2 DirectColorModel (java.awt.image.DirectColorModel)2 IndexColorModel (java.awt.image.IndexColorModel)2 PackedColorModel (java.awt.image.PackedColorModel)2 BorderExtender (javax.media.jai.BorderExtender)2 BorderExtenderConstant (javax.media.jai.BorderExtenderConstant)2 PlanarImage (javax.media.jai.PlanarImage)2 TransposeType (javax.media.jai.operator.TransposeType)2 Color (java.awt.Color)1 Graphics2D (java.awt.Graphics2D)1 AffineTransform (java.awt.geom.AffineTransform)1 AffineTransformOp (java.awt.image.AffineTransformOp)1 DataBufferByte (java.awt.image.DataBufferByte)1