From de6e3984aa643cc55384f73d1b358ba40e2ca1de Mon Sep 17 00:00:00 2001 From: Adrian Cumiskey Date: Thu, 16 Oct 2008 13:49:11 +0000 Subject: [PATCH] Removed debug code git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@705242 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/afp/AFPGraphics2D.java | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/java/org/apache/fop/render/afp/AFPGraphics2D.java b/src/java/org/apache/fop/render/afp/AFPGraphics2D.java index e389afb52..2699cfa6b 100644 --- a/src/java/org/apache/fop/render/afp/AFPGraphics2D.java +++ b/src/java/org/apache/fop/render/afp/AFPGraphics2D.java @@ -215,6 +215,7 @@ public class AFPGraphics2D extends AbstractGraphics2D { graphicsObj.beginArea(); } AffineTransform trans = super.getTransform(); + PathIterator iter = shape.getPathIterator(trans); double[] vals = new double[6]; int[] coords = null; @@ -295,7 +296,8 @@ public class AFPGraphics2D extends AbstractGraphics2D { graphicsObj.addBox(coords); } else if (shape instanceof Ellipse2D) { Ellipse2D elip = (Ellipse2D) shape; - final double factor = info.getResolution() / 100f; + int resolution = info.getResolution(); + final double factor = resolution / 100f; graphicsObj.setArcParams( (int)Math.round(elip.getWidth() * factor), (int)Math.round(elip.getHeight() * factor), @@ -404,13 +406,19 @@ public class AFPGraphics2D extends AbstractGraphics2D { // create image object info AFPImageObjectInfo imageObjectInfo = new AFPImageObjectInfo(); + imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45); + + imageObjectInfo.setBitsPerPixel(state.getBitsPerPixel()); + + imageObjectInfo.setResourceInfo(info.getResourceInfo()); + int dataHeight = renderedImage.getHeight(); imageObjectInfo.setDataHeight(dataHeight); int dataWidth = renderedImage.getWidth(); imageObjectInfo.setDataWidth(dataWidth); - boolean colorImages = true;//state.isColorImages(); + boolean colorImages = state.isColorImages(); imageObjectInfo.setColor(colorImages); ByteArrayOutputStream boas = new ByteArrayOutputStream(); @@ -432,11 +440,6 @@ public class AFPGraphics2D extends AbstractGraphics2D { imageObjectInfo.setUri(imageInfo.getOriginalURI()); } - imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45); - imageObjectInfo.setBitsPerPixel(state.getBitsPerPixel()); - imageObjectInfo.setResourceInfo(info.getResourceInfo()); - - // create object area info AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo(); @@ -488,21 +491,21 @@ public class AFPGraphics2D extends AbstractGraphics2D { g2d.setComposite(gc.getComposite()); - if (!g2d.drawImage(img, 0, 0, bufferedWidth, bufferedHeight, observer)) { - return false; - } + boolean drawn = g2d.drawImage(img, 0, 0, bufferedWidth, bufferedHeight, observer); g2d.dispose(); - try { - // get image object info - AFPImageObjectInfo imageObjectInfo = getImageObjectInfo(bufferedImage, x, y, width, height); - - // create image resource - AFPResourceManager resourceManager = info.getResourceManager(); - resourceManager.createObject(imageObjectInfo); - return true; - } catch (IOException ioe) { - handleIOException(ioe); + if (drawn) { + try { + // get image object info + AFPImageObjectInfo imageObjectInfo = getImageObjectInfo(bufferedImage, x, y, width, height); + + // create image resource + AFPResourceManager resourceManager = info.getResourceManager(); + resourceManager.createObject(imageObjectInfo); + return true; + } catch (IOException ioe) { + handleIOException(ioe); + } } return false; } -- 2.39.5