List of usage examples for java.awt.geom Rectangle2D setFrame
public void setFrame(Point2D loc, Dimension2D size)
From source file:org.apache.fop.render.ps.PSImageHandlerEPS.java
/** {@inheritDoc} */ public void handleImage(RenderingContext context, Image image, Rectangle pos) throws IOException { PSRenderingContext psContext = (PSRenderingContext) context; PSGenerator gen = psContext.getGenerator(); ImageRawEPS eps = (ImageRawEPS) image; float x = (float) pos.getX() / 1000f; float y = (float) pos.getY() / 1000f; float w = (float) pos.getWidth() / 1000f; float h = (float) pos.getHeight() / 1000f; ImageInfo info = image.getInfo();// ww w.j a va 2 s . c om Rectangle2D bbox = eps.getBoundingBox(); if (bbox == null) { bbox = new Rectangle2D.Double(); bbox.setFrame(new Point2D.Double(), info.getSize().getDimensionPt()); } InputStream in = eps.createInputStream(); try { String resourceName = info.getOriginalURI(); if (resourceName == null) { resourceName = "inline image"; } PSImageUtils.renderEPS(in, resourceName, new Rectangle2D.Float(x, y, w, h), bbox, gen); } finally { IOUtils.closeQuietly(in); } }