use of java.awt.image.AffineTransformOp in project jdk8u_jdk by JetBrains.
the class DrawImage method transformImage.
public void transformImage(SunGraphics2D sg, BufferedImage img, BufferedImageOp op, int x, int y) {
if (op != null) {
if (op instanceof AffineTransformOp) {
AffineTransformOp atop = (AffineTransformOp) op;
transformImage(sg, img, x, y, atop.getTransform(), atop.getInterpolationType());
return;
} else {
img = op.filter(img, null);
}
}
copyImage(sg, img, x, y, null);
}
use of java.awt.image.AffineTransformOp in project jdk8u_jdk by JetBrains.
the class ImagingLib method filter.
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;
}
use of java.awt.image.AffineTransformOp in project Lucee by lucee.
the class Image method threeBBger.
public void threeBBger() throws ExpressionException {
BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_3BYTE_BGR);
Graphics2D graphics = img.createGraphics();
graphics.drawImage(image(), new AffineTransformOp(AffineTransform.getTranslateInstance(0.0, 0.0), 1), 0, 0);
graphics.dispose();
image(img);
}
use of java.awt.image.AffineTransformOp in project Lucee by lucee.
the class Image method grayscale.
public void grayscale() throws ExpressionException {
BufferedImage img = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_BYTE_GRAY);
Graphics2D graphics = img.createGraphics();
graphics.drawImage(image(), new AffineTransformOp(AffineTransform.getTranslateInstance(0.0, 0.0), 1), 0, 0);
graphics.dispose();
image(img);
}
use of java.awt.image.AffineTransformOp in project Lucee by lucee.
the class Image method paste.
public void paste(Image topImage, int x, int y) throws ExpressionException {
RenderingHints interp = new RenderingHints(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
BorderExtender extender = BorderExtender.createInstance(1);
Graphics2D g = getGraphics();
g.addRenderingHints(new RenderingHints(JAI.KEY_BORDER_EXTENDER, extender));
g.drawImage(topImage.image(), (new AffineTransformOp(AffineTransform.getTranslateInstance(x, y), interp)), 0, 0);
}
Aggregations