From: Peter Hancock Date: Tue, 3 Jul 2012 16:01:48 +0000 (+0000) Subject: Merged trunk@1356765 X-Git-Tag: fop-2_0~276^2~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fb48ed8bc5d5d14b7a1086486378c640cd8b56f8;p=xmlgraphics-fop.git Merged trunk@1356765 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1356804 13f79535-47bb-0310-9956-ffa450edef68 --- fb48ed8bc5d5d14b7a1086486378c640cd8b56f8 diff --cc src/java/org/apache/fop/render/afp/AFPDocumentHandler.java index d427f9d7f,a0b1e99db..9c786acf5 --- a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java +++ b/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java @@@ -23,7 -23,7 +23,8 @@@ import java.awt.Color import java.awt.Dimension; import java.awt.geom.AffineTransform; import java.io.IOException; +import java.util.HashMap; + import java.net.URI; import java.util.Iterator; import java.util.List; import java.util.Map; diff --cc src/java/org/apache/fop/render/afp/AFPPainter.java index 5d8c1a93f,7d659a8b4..47ff5dba1 --- a/src/java/org/apache/fop/render/afp/AFPPainter.java +++ b/src/java/org/apache/fop/render/afp/AFPPainter.java @@@ -38,22 -32,12 +38,23 @@@ import java.util.Map import org.w3c.dom.Document; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.xmlgraphics.image.loader.Image; +import org.apache.xmlgraphics.image.loader.ImageException; +import org.apache.xmlgraphics.image.loader.ImageInfo; import org.apache.xmlgraphics.image.loader.ImageProcessingHints; import org.apache.xmlgraphics.image.loader.ImageSessionContext; +import org.apache.xmlgraphics.image.loader.ImageSize; +import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D; +import org.apache.xmlgraphics.java2d.Graphics2DImagePainter; import org.apache.fop.afp.AFPBorderPainter; + import org.apache.fop.afp.AFPEventProducer; +import org.apache.fop.afp.AFPObjectAreaInfo; import org.apache.fop.afp.AFPPaintingState; +import org.apache.fop.afp.AFPResourceInfo; import org.apache.fop.afp.AFPUnitConverter; import org.apache.fop.afp.AbstractAFPPainter; import org.apache.fop.afp.BorderPaintingInfo; @@@ -67,13 -51,10 +68,11 @@@ import org.apache.fop.afp.modca.Abstrac import org.apache.fop.afp.modca.PresentationTextObject; import org.apache.fop.afp.ptoca.PtocaBuilder; import org.apache.fop.afp.ptoca.PtocaProducer; - import org.apache.fop.afp.util.DefaultFOPResourceAccessor; - import org.apache.fop.afp.util.ResourceAccessor; + import org.apache.fop.afp.util.AFPResourceAccessor; import org.apache.fop.fonts.Font; - import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontTriplet; import org.apache.fop.fonts.Typeface; +import org.apache.fop.render.ImageHandlerUtil; import org.apache.fop.render.RenderingContext; import org.apache.fop.render.intermediate.AbstractIFPainter; import org.apache.fop.render.intermediate.BorderPainter; @@@ -88,13 -68,10 +86,13 @@@ import org.apache.fop.util.CharUtilitie /** * IFPainter implementation that produces AFP (MO:DCA). */ - public class AFPPainter extends AbstractIFPainter { + public class AFPPainter extends AbstractIFPainter { + + + //** logging instance */ - //private static Log log = LogFactory.getLog(AFPPainter.class); + private static Log log = LogFactory.getLog(AFPPainter.class); private static final int X = 0; private static final int Y = 1; @@@ -114,32 -91,31 +112,32 @@@ * @param documentHandler the parent document handler */ public AFPPainter(AFPDocumentHandler documentHandler) { - super(); - this.documentHandler = documentHandler; + super(documentHandler); this.state = IFState.create(); + this.borderPainter = new AFPBorderPainterAdapter( - new AFPBorderPainter(getPaintingState(), getDataStream())); + new AFPBorderPainter(getPaintingState(), getDataStream()), this, documentHandler); this.rectanglePainter = documentHandler.createRectanglePainter(); this.unitConv = getPaintingState().getUnitConverter(); + this.eventProducer = AFPEventProducer.Provider.get(getUserAgent().getEventBroadcaster()); } - /** {@inheritDoc} */ - @Override - protected IFContext getContext() { - return this.documentHandler.getContext(); - } - - FontInfo getFontInfo() { - return this.documentHandler.getFontInfo(); + private AFPPaintingState getPaintingState() { + return getDocumentHandler().getPaintingState(); } - AFPPaintingState getPaintingState() { - return this.documentHandler.getPaintingState(); + private DataStream getDataStream() { + return getDocumentHandler().getDataStream(); } - DataStream getDataStream() { - return this.documentHandler.getDataStream(); + @Override + public String getFontKey(FontTriplet triplet) throws IFException { + try { + return super.getFontKey(triplet); + } catch (IFException e) { + eventProducer.invalidConfiguration(null, e); + return super.getFontKey(FontTriplet.DEFAULT_FONT_TRIPLET); + } } /** {@inheritDoc} */ @@@ -203,9 -179,9 +201,9 @@@ /** {@inheritDoc} */ @Override protected RenderingContext createRenderingContext() { - AFPRenderingContext psContext = new AFPRenderingContext( + AFPRenderingContext renderingContext = new AFPRenderingContext( getUserAgent(), - documentHandler.getResourceManager(), + getDocumentHandler().getResourceManager(), getPaintingState(), getFontInfo(), getContext().getForeignAttributes()); diff --cc src/java/org/apache/fop/render/ps/PSPainter.java index 9d16cb428,63e947e55..b8947ff60 --- a/src/java/org/apache/fop/render/ps/PSPainter.java +++ b/src/java/org/apache/fop/render/ps/PSPainter.java @@@ -260,11 -229,11 +243,11 @@@ public class PSPainter extends Abstract if (top != null || bottom != null || left != null || right != null) { try { endTextObject(); - if (getPSUtil().getRenderingMode() == PSRenderingMode.SIZE + if (getDocumentHandler().getPSUtil().getRenderingMode() == PSRenderingMode.SIZE && hasOnlySolidBorders(top, bottom, left, right)) { - super.drawBorderRect(rect, top, bottom, left, right); + super.drawBorderRect(rect, top, bottom, left, right, innerBackgroundColor); } else { - this.borderPainter.drawBorders(rect, top, bottom, left, right); + this.borderPainter.drawBorders(rect, top, bottom, left, right, innerBackgroundColor); } } catch (IOException ioe) { throw new IFException("I/O error in drawBorderRect()", ioe);