aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-06-03 11:12:52 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-06-03 11:12:52 +0000
commit46d76cd4f13d9da7216c4ce15359f6c75c2e00bb (patch)
tree920096acb894779dc021b59600dd7b98cd22e5ab /src
parent62c1b6c60d102e2737c19e58b39b6eccecfdd37e (diff)
downloadxmlgraphics-fop-46d76cd4f13d9da7216c4ce15359f6c75c2e00bb.tar.gz
xmlgraphics-fop-46d76cd4f13d9da7216c4ce15359f6c75c2e00bb.zip
Moved image uri storing from AbstractGenericSVGHandler to AFPState as requested/suggested :).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@662738 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java3
-rw-r--r--src/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java4
-rw-r--r--src/java/org/apache/fop/render/AbstractGenericSVGHandler.java4
-rw-r--r--src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java9
-rw-r--r--src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java7
-rw-r--r--src/java/org/apache/fop/render/afp/AFPRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/afp/AFPState.java40
-rw-r--r--src/java/org/apache/fop/render/pcl/PCLRenderer.java8
8 files changed, 43 insertions, 34 deletions
diff --git a/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java b/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java
index 564eddae6..c8e031405 100644
--- a/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java
+++ b/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java
@@ -105,9 +105,6 @@ public class ImageConverterSVG2G2D extends AbstractImageConverter {
return new Dimension(svg.getSize().getWidthMpt(), svg.getSize().getHeightMpt());
}
- public String getImageUri() {
- return src.getInfo().getOriginalURI();
- }
};
ImageGraphics2D g2dImage = new ImageGraphics2D(src.getInfo(), painter);
diff --git a/src/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java b/src/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java
index 22fe023aa..6babe4523 100644
--- a/src/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java
+++ b/src/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java
@@ -101,10 +101,6 @@ public class ImageConverterWMF2G2D extends AbstractImageConverter {
log.debug("Painting WMF took " + duration + " ms.");
}
}
-
- public String getImageUri() {
- return wmf.getInfo().getOriginalURI();
- }
}
diff --git a/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java b/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
index af3c5ae27..26b63079f 100644
--- a/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
+++ b/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
@@ -113,10 +113,6 @@ public abstract class AbstractGenericSVGHandler implements XMLHandler, RendererC
return new Dimension(wrappedContext.getWidth(), wrappedContext.getHeight());
}
- public String getImageUri() {
- return uri;
- }
-
};
//Let the painter paint the SVG on the Graphics2D instance
diff --git a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java b/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
index cc747f9d9..dd1a4dd7c 100644
--- a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
+++ b/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
@@ -32,11 +32,9 @@ import java.awt.image.ComponentColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
-import java.io.IOException;
import org.apache.fop.render.RendererContext.RendererContextWrapper;
import org.apache.fop.util.UnitConv;
-import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
/**
* Graphics2DAdapter implementation for PCL and HP GL/2.
@@ -136,11 +134,4 @@ public abstract class AbstractGraphics2DAdapter implements Graphics2DAdapter {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
-
-// /** {@inheritDoc} */
-// public void paintImage(Graphics2DImagePainter painter,
-// RendererContext context,
-// int x, int y, int width, int height) throws IOException {
-// paintImage(painter, context, null, x, y, width, height);
-// }
}
diff --git a/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java b/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java
index 1dd6782d8..d4c1ff365 100644
--- a/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java
+++ b/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java
@@ -65,11 +65,10 @@ public class AFPGraphics2DAdapter extends AbstractGraphics2DAdapter {
BufferedImage bi
= paintToBufferedImage(painter, wrappedContext, resolution, gray, false);
ImageManager manager = userAgent.getFactory().getImageManager();
- ImageSessionContext sessionContext = userAgent.getImageSessionContext();
-
+ ImageSessionContext sessionContext = userAgent.getImageSessionContext();
+ AFPState state = (AFPState)context.getProperty(AFPRendererContextConstants.AFP_STATE);
try {
- String uri = painter.getImageUri();
- ImageInfo info = manager.getImageInfo(uri, sessionContext);
+ ImageInfo info = manager.getImageInfo(state.getImageUri(), sessionContext);
java.util.Map foreignAttributes = null;
afp.drawBufferedImage(info, bi, resolution, x, y, width, height, foreignAttributes);
} catch (ImageException e) {
diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java
index 6a628235f..763f9dafb 100644
--- a/src/java/org/apache/fop/render/afp/AFPRenderer.java
+++ b/src/java/org/apache/fop/render/afp/AFPRenderer.java
@@ -52,7 +52,6 @@ import org.apache.xmlgraphics.ps.ImageEncodingHelper;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.BodyRegion;
@@ -912,6 +911,7 @@ public class AFPRenderer extends AbstractPathOrientedRenderer {
/** {@inheritDoc} */
public void drawImage(String uri, Rectangle2D pos, Map foreignAttributes) {
uri = URISpecification.getURL(uri);
+ getState().setImageUri(uri);
Rectangle posInt = new Rectangle((int) pos.getX(), (int) pos.getY(),
(int) pos.getWidth(), (int) pos.getHeight());
Point origin = new Point(currentIPPosition, currentBPPosition);
diff --git a/src/java/org/apache/fop/render/afp/AFPState.java b/src/java/org/apache/fop/render/afp/AFPState.java
index 5977d0de2..7c28e8bf0 100644
--- a/src/java/org/apache/fop/render/afp/AFPState.java
+++ b/src/java/org/apache/fop/render/afp/AFPState.java
@@ -20,7 +20,6 @@
package org.apache.fop.render.afp;
import java.awt.Color;
-import java.awt.geom.AffineTransform;
import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
@@ -188,6 +187,27 @@ public class AFPState {
}
/**
+ * Sets the image uri of the current image being processed
+ * @param uri the image uri of the current image being processed
+ * @return true if the image uri has changed
+ */
+ public boolean setImageUri(String uri) {
+ if (!uri.equals(getData().imageUri)) {
+ getData().imageUri = uri;
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the image uri of the current image being processed
+ * @return the image uri of the current image being processed
+ */
+ protected String getImageUri() {
+ return getData().imageUri;
+ }
+
+ /**
* Push the current state onto the stack.
* This call should be used when the q operator is used
* so that the state is known when popped.
@@ -234,6 +254,7 @@ public class AFPState {
return data;
}
+ /** the state data instance */
public class Data implements Cloneable, Serializable {
private static final long serialVersionUID = -1789481244175275686L;
@@ -261,6 +282,9 @@ public class AFPState {
/** The fonts on the current page */
private AFPPageFonts pageFonts = null;
+ /** The current image uri */
+ private String imageUri = null;
+
/** {@inheritDoc} */
public Object clone() throws CloneNotSupportedException {
Data obj = new Data();
@@ -272,7 +296,21 @@ public class AFPState {
obj.dashArray = this.dashArray;
obj.filled = this.filled;
obj.pageFonts = this.pageFonts;
+ obj.imageUri = this.imageUri;
return obj;
}
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return "color=" + color
+ + ", backColor=" + backColor
+ + ", fontName=" + fontName
+ + ", fontSize=" + fontSize
+ + ", lineWidth=" + lineWidth
+ + ", dashArray=" + dashArray
+ + ", filled=" + filled
+ + ", pageFonts=" + pageFonts
+ + ", imageUri=" + imageUri;
+ }
}
} \ No newline at end of file
diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderer.java b/src/java/org/apache/fop/render/pcl/PCLRenderer.java
index 324c3558d..e1818c84b 100644
--- a/src/java/org/apache/fop/render/pcl/PCLRenderer.java
+++ b/src/java/org/apache/fop/render/pcl/PCLRenderer.java
@@ -701,10 +701,6 @@ public class PCLRenderer extends PrintRenderer {
return paintRect.getSize();
}
- public String getImageUri() {
- return null;
- }
-
};
g2a.paintImage(painter, rc,
paintRect.x, paintRect.y, paintRect.width, paintRect.height);
@@ -1564,10 +1560,6 @@ public class PCLRenderer extends PrintRenderer {
return paintRect.getSize();
}
- public String getImageUri() {
- return null;
- }
-
};
try {
g2a.paintImage(painter, rc,