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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations