You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/11/14 15:29:14 UTC
svn commit: r344130 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/svg:
PDFBridgeContext.java PDFGraphics2D.java
Author: jeremias
Date: Mon Nov 14 06:28:59 2005
New Revision: 344130
URL: http://svn.apache.org/viewcvs?rev=344130&view=rev
Log:
Bugzilla #37330:
1) The jpeg registration now includes the hashCode in addition
to the jpegCount as this prevents images being rused when
multiple SVG fragments are included in a single FO.
2) Added a createBridgeContext to PDFBridgeContext so that 'sub contexts'
(image element) inherit the new bridges.
Submitted by: Thomas Deweese <deweese.at.apache.org>
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFBridgeContext.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFBridgeContext.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFBridgeContext.java?rev=344130&r1=344129&r2=344130&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFBridgeContext.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFBridgeContext.java Mon Nov 14 06:28:59 2005
@@ -21,6 +21,7 @@
import java.awt.geom.AffineTransform;
import org.apache.batik.bridge.BridgeContext;
+import org.apache.batik.bridge.DocumentLoader;
import org.apache.batik.bridge.UserAgent;
import org.apache.fop.fonts.FontInfo;
@@ -37,9 +38,28 @@
/**
* Constructs a new bridge context.
* @param userAgent the user agent
- * @param fontInfo the font list for the text painter, may be null in which case text is
- * painted as shapes
- * @param linkTransform AffineTransform to properly place links, may be null
+ * @param loader the Document Loader to use for referenced documents.
+ * @param fontInfo the font list for the text painter, may be null
+ * in which case text is painted as shapes
+ * @param linkTransform AffineTransform to properly place links,
+ * may be null
+ */
+ public PDFBridgeContext(UserAgent userAgent,
+ DocumentLoader loader,
+ FontInfo fontInfo,
+ AffineTransform linkTransform) {
+ super(userAgent, loader);
+ this.fontInfo = fontInfo;
+ this.linkTransform = linkTransform;
+ }
+
+ /**
+ * Constructs a new bridge context.
+ * @param userAgent the user agent
+ * @param fontInfo the font list for the text painter, may be null
+ * in which case text is painted as shapes
+ * @param linkTransform AffineTransform to properly place links,
+ * may be null
*/
public PDFBridgeContext(UserAgent userAgent, FontInfo fontInfo,
AffineTransform linkTransform) {
@@ -51,8 +71,8 @@
/**
* Constructs a new bridge context.
* @param userAgent the user agent
- * @param fontInfo the font list for the text painter, may be null in which case text is
- * painted as shapes
+ * @param fontInfo the font list for the text painter, may be null
+ * in which case text is painted as shapes
*/
public PDFBridgeContext(UserAgent userAgent, FontInfo fontInfo) {
this(userAgent, fontInfo, null);
@@ -76,5 +96,10 @@
putBridge(new PDFImageElementBridge());
}
-
-}
\ No newline at end of file
+
+ // Make sure any 'sub bridge contexts' also have our bridges.
+ public BridgeContext createBridgeContext() {
+ return new PDFBridgeContext(getUserAgent(), getDocumentLoader(),
+ fontInfo, linkTransform);
+ }
+}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=344130&r1=344129&r2=344130&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java Mon Nov 14 06:28:59 2005
@@ -382,7 +382,10 @@
public void addJpegImage(JpegImage jpeg, float x, float y,
float width, float height) {
preparePainting();
- String key = "__AddJPEG_" + jpegCount[0];
+ // Need to include hash code as when invoked from FO you
+ // may have several 'independent' PDFGraphics2D so the
+ // count is not enough.
+ String key = "__AddJPEG_" + hashCode() + "_" + jpegCount[0];
jpegCount[0]++;
FopPDFImage fopimage = new FopPDFImage(jpeg, key);
int xObjectNum = this.pdfDoc.addImage(resourceContext,
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org