本文整理汇总了Java中javax.media.jai.RenderedOp.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java RenderedOp.dispose方法的具体用法?Java RenderedOp.dispose怎么用?Java RenderedOp.dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.jai.RenderedOp
的用法示例。
在下文中一共展示了RenderedOp.dispose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: graphicFillLineString
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
private static void graphicFillLineString(final LineSymbolizer symbolizer, final Shape shape, final Image image, final float size, final double opacity) {
Double width = new Double(Math.max(1, shape.getBounds2D().getWidth()));
Double height = new Double(Math.max(1, shape.getBounds2D().getHeight()));
Double shapeHeight = new Double(size);
double factor = shapeHeight.doubleValue() / image.getHeight(null);
Double shapeWidth = new Double(image.getWidth(null) * factor);
AffineTransform transform = AffineTransform.getTranslateInstance(shape.getBounds2D().getMinX(), shape.getBounds2D().getMinY());
Image scaledImage = image.getScaledInstance(shapeWidth.intValue(), shapeHeight.intValue(), Image.SCALE_FAST);
BufferedImage buff = new BufferedImage(shapeWidth.intValue(), shapeHeight.intValue(), BufferedImage.TYPE_INT_ARGB);
buff.getGraphics().drawImage(scaledImage, 0, 0, null);
ParameterBlock p = new ParameterBlock();
p.addSource(buff);
p.add(width.intValue());
p.add(height.intValue());
RenderedOp im = JAI.create("pattern", p);//$NON-NLS-1$
BufferedImage bufferedImage = im.getAsBufferedImage();
glDrawImage(bufferedImage, transform, null);
bufferedImage.flush();
im.dispose();
scaledImage.flush();
buff.flush();
}
示例2: drawGraphicFillPolygon
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
private static void drawGraphicFillPolygon(Image image, float size, Graphics2D graphics, double opacity, double widthSymbol, double heightSymbol, double offsetYSymbol, double offsetXSymbol) {
Double shapeHeight = new Double(size);
double factor = shapeHeight / image.getHeight(null);
Double shapeWidth = new Double(Math.max(image.getWidth(null) * factor, 1));
AffineTransform transform = AffineTransform.getTranslateInstance(offsetXSymbol, offsetYSymbol);
Image scaledImage = image.getScaledInstance(shapeWidth.intValue(), shapeHeight.intValue(), Image.SCALE_FAST);
BufferedImage buff = new BufferedImage(shapeWidth.intValue(), shapeHeight.intValue(), BufferedImage.TYPE_INT_ARGB);
buff.getGraphics().drawImage(scaledImage, 0, 0, null);
ParameterBlock p = new ParameterBlock();
p.addSource(buff);
p.add((int) widthSymbol);
p.add((int) heightSymbol);
RenderedOp im = JAI.create("pattern", p);//$NON-NLS-1$
BufferedImage bufferedImage = im.getAsBufferedImage();
graphics.drawImage(bufferedImage, transform, null);
bufferedImage.flush();
im.dispose();
scaledImage.flush();
buff.flush();
}
示例3: scale
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
public BufferedImage scale(final URL resource, final float factor) throws IOException {
final IResourceReference resourceReference = this.factory.create(resource);
try (InputStream stream = this.handler.openInputStream(resourceReference)) {
final RenderedOp scaledRenderedOp = ImageContainerUtilities.scale(createRenderOp(stream), factor);
try {
final BufferedImage image = scaledRenderedOp.getAsBufferedImage();
return image;
} finally {
scaledRenderedOp.dispose();
}
}
}
示例4: readBufferedImage
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
public BufferedImage readBufferedImage(final InputStream inputStream) throws IOException {
try {
final RenderedOp renderedOp = createRenderOp(inputStream);
try {
return renderedOp.getAsBufferedImage();
} finally {
renderedOp.dispose();
}
} catch (final RuntimeException exception) {
throw new IOException(exception);
}
}
示例5: graphicFillLineString
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
private static void graphicFillLineString(Shape shape, Image image,
float size, Graphics2D graphics, double opacity) {
Double width = new Double(Math.max(1, shape.getBounds2D().getWidth()));
Double height = new Double(
Math.max(1, shape.getBounds2D().getHeight()));
Double shapeHeight = new Double(size);
double factor = shapeHeight.doubleValue() / image.getHeight(null);
Double shapeWidth = new Double(image.getWidth(null) * factor);
AffineTransform transform = AffineTransform.getTranslateInstance(
shape.getBounds2D().getMinX(), shape.getBounds2D().getMinY());
Image scaledImage = image.getScaledInstance(shapeWidth.intValue(),
shapeHeight.intValue(), Image.SCALE_FAST);
BufferedImage buff = new BufferedImage(shapeWidth.intValue(),
shapeHeight.intValue(), BufferedImage.TYPE_INT_ARGB);
buff.getGraphics().drawImage(scaledImage, 0, 0, null);
ParameterBlock p = new ParameterBlock();
p.addSource(buff);
p.add(width.intValue());
p.add(height.intValue());
RenderedOp im = JAI.create("pattern", p);//$NON-NLS-1$
BufferedImage bufferedImage = im.getAsBufferedImage();
graphics.drawImage(bufferedImage, transform, null);
bufferedImage.flush();
im.dispose();
scaledImage.flush();
buff.flush();
}
示例6: graphicFillPolygon
import javax.media.jai.RenderedOp; //导入方法依赖的package包/类
private static void graphicFillPolygon(Shape shape, Image image, float size,
Graphics2D graphics, double opacity) {
Double width = new Double(Math.max(1, shape.getBounds2D().getWidth()));
Double height = new Double(
Math.max(1, shape.getBounds2D().getHeight()));
Double shapeHeight = new Double(size);
double factor = shapeHeight / image.getHeight(null);
Double shapeWidth = new Double(
Math.max(image.getWidth(null) * factor, 1));
AffineTransform transform = AffineTransform.getTranslateInstance(
shape.getBounds2D().getMinX(), shape.getBounds2D().getMinY());
Image scaledImage = image.getScaledInstance(shapeWidth.intValue(),
shapeHeight.intValue(), Image.SCALE_FAST);
BufferedImage buff = new BufferedImage(shapeWidth.intValue(),
shapeHeight.intValue(), BufferedImage.TYPE_INT_ARGB);
buff.getGraphics().drawImage(scaledImage, 0, 0, null);
ParameterBlock p = new ParameterBlock();
p.addSource(buff);
p.add(width.intValue());
p.add(height.intValue());
RenderedOp im = JAI.create("pattern", p);//$NON-NLS-1$
BufferedImage bufferedImage = im.getAsBufferedImage();
graphics.setComposite(AlphaComposite
.getInstance(AlphaComposite.SRC_OVER, (float) opacity));
graphics.drawImage(bufferedImage, transform, null);
bufferedImage.flush();
im.dispose();
scaledImage.flush();
buff.flush();
}