aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/image
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/image')
-rw-r--r--src/java/org/apache/fop/image/AbstractFopImage.java10
-rw-r--r--src/java/org/apache/fop/image/FopImage.java11
-rw-r--r--src/java/org/apache/fop/image/analyser/BMPReader.java5
-rw-r--r--src/java/org/apache/fop/image/analyser/EPSReader.java3
-rw-r--r--src/java/org/apache/fop/image/analyser/GIFReader.java3
-rw-r--r--src/java/org/apache/fop/image/analyser/JPEGReader.java3
-rw-r--r--src/java/org/apache/fop/image/analyser/PNGReader.java3
-rw-r--r--src/java/org/apache/fop/image/analyser/SVGReader.java1
-rw-r--r--src/java/org/apache/fop/image/analyser/TIFFReader.java3
-rw-r--r--src/java/org/apache/fop/image/analyser/XMLReader.java1
10 files changed, 28 insertions, 15 deletions
diff --git a/src/java/org/apache/fop/image/AbstractFopImage.java b/src/java/org/apache/fop/image/AbstractFopImage.java
index e97a0ec68..2a9136f80 100644
--- a/src/java/org/apache/fop/image/AbstractFopImage.java
+++ b/src/java/org/apache/fop/image/AbstractFopImage.java
@@ -24,7 +24,6 @@ import java.awt.color.ICC_Profile;
import java.io.InputStream;
import java.awt.Color;
-// FOP
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -133,11 +132,15 @@ public abstract class AbstractFopImage implements FopImage {
return imageInfo.mimeType;
}
+ /** @see org.apache.fop.image.FopImage#getOriginalURI() */
+ public String getOriginalURI() {
+ return this.imageInfo.originalURI;
+ }
+
/**
* Load image data and initialize its properties.
*
* @param type the type of loading to do
- * @param ua the user agent for handling logging etc.
* @return true if the loading was successful
*/
public synchronized boolean load(int type) {
@@ -173,7 +176,6 @@ public abstract class AbstractFopImage implements FopImage {
* All implementations should override this to get and
* return the dimensions.
*
- * @param ua the user agent
* @return true if the loading was successful
*/
protected boolean loadDimensions() {
@@ -185,7 +187,6 @@ public abstract class AbstractFopImage implements FopImage {
* If the renderer requires a bitmap image then the
* implementations should override this to load the bitmap.
*
- * @param ua the user agent
* @return true if the loading was successful
*/
protected boolean loadBitmap() {
@@ -197,7 +198,6 @@ public abstract class AbstractFopImage implements FopImage {
* In some cases the original data can be used by the renderer.
* This should load the data and any other associated information.
*
- * @param ua the user agent
* @return true if the loading was successful
*/
protected boolean loadOriginalData() {
diff --git a/src/java/org/apache/fop/image/FopImage.java b/src/java/org/apache/fop/image/FopImage.java
index 153947cc9..510a66f05 100644
--- a/src/java/org/apache/fop/image/FopImage.java
+++ b/src/java/org/apache/fop/image/FopImage.java
@@ -32,17 +32,17 @@ public interface FopImage {
/**
* Flag for loading dimensions.
*/
- public static final int DIMENSIONS = 1;
+ int DIMENSIONS = 1;
/**
* Flag for loading original data.
*/
- public static final int ORIGINAL_DATA = 2;
+ int ORIGINAL_DATA = 2;
/**
* Flag for loading bitmap data.
*/
- public static final int BITMAP = 4;
+ int BITMAP = 4;
/**
* Get the mime type of this image.
@@ -53,6 +53,9 @@ public interface FopImage {
*/
String getMimeType();
+ /** @return the original URI used to access this image. */
+ String getOriginalURI();
+
/**
* Load particular inforamtion for this image
* This must be called before attempting to get
@@ -170,6 +173,8 @@ public interface FopImage {
public static class ImageInfo {
/** InputStream to load the image from */
public InputStream inputStream;
+ /** Original URI the image was accessed with */
+ public String originalURI;
/** image width (in pixels) */
public int width;
/** image height (in pixels) */
diff --git a/src/java/org/apache/fop/image/analyser/BMPReader.java b/src/java/org/apache/fop/image/analyser/BMPReader.java
index 077d4f229..12be15dab 100644
--- a/src/java/org/apache/fop/image/analyser/BMPReader.java
+++ b/src/java/org/apache/fop/image/analyser/BMPReader.java
@@ -30,7 +30,7 @@ import org.apache.fop.apps.FOUserAgent;
* ImageReader object for BMP image type.
*
* @author Pankaj Narula
- * @version $Id: BMPReader.java,v 1.8 2003/03/06 21:25:45 jeremias Exp $
+ * @version $Id$
*/
public class BMPReader implements ImageReader {
@@ -54,6 +54,8 @@ public class BMPReader implements ImageReader {
&& (header[1] == (byte) 0x4d));
if (supported) {
FopImage.ImageInfo info = getDimension(header);
+ info.originalURI = uri;
+ info.mimeType = getMimeType();
info.inputStream = bis;
return info;
} else {
@@ -72,7 +74,6 @@ public class BMPReader implements ImageReader {
private FopImage.ImageInfo getDimension(byte[] header) {
FopImage.ImageInfo info = new FopImage.ImageInfo();
- info.mimeType = getMimeType();
// little endian notation
int byte1 = header[WIDTH_OFFSET] & 0xff;
diff --git a/src/java/org/apache/fop/image/analyser/EPSReader.java b/src/java/org/apache/fop/image/analyser/EPSReader.java
index 1d34d702b..8217b6dbd 100644
--- a/src/java/org/apache/fop/image/analyser/EPSReader.java
+++ b/src/java/org/apache/fop/image/analyser/EPSReader.java
@@ -32,7 +32,7 @@ import org.apache.fop.apps.FOUserAgent;
/**
* ImageReader object for EPS document image type.
*
- * @version $Id: EPSReader.java,v 1.9 2003/03/06 21:25:45 jeremias Exp $
+ * @version $Id$
*/
public class EPSReader implements ImageReader {
@@ -80,6 +80,7 @@ public class EPSReader implements ImageReader {
if (isEPS) {
FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.originalURI = uri;
info.mimeType = getMimeType();
info.data = data;
readEPSImage(bis, data);
diff --git a/src/java/org/apache/fop/image/analyser/GIFReader.java b/src/java/org/apache/fop/image/analyser/GIFReader.java
index 8a23ddcc3..ed32d9462 100644
--- a/src/java/org/apache/fop/image/analyser/GIFReader.java
+++ b/src/java/org/apache/fop/image/analyser/GIFReader.java
@@ -30,7 +30,7 @@ import org.apache.fop.apps.FOUserAgent;
* ImageReader object for GIF image type.
*
* @author Pankaj Narula
- * @version $Id: GIFReader.java,v 1.8 2003/03/06 21:25:45 jeremias Exp $
+ * @version $Id$
*/
public class GIFReader implements ImageReader {
@@ -48,6 +48,7 @@ public class GIFReader implements ImageReader {
&& (header[5] == 'a'));
if (supported) {
FopImage.ImageInfo info = getDimension(header);
+ info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = bis;
return info;
diff --git a/src/java/org/apache/fop/image/analyser/JPEGReader.java b/src/java/org/apache/fop/image/analyser/JPEGReader.java
index 71f6f7da1..b4fde1e11 100644
--- a/src/java/org/apache/fop/image/analyser/JPEGReader.java
+++ b/src/java/org/apache/fop/image/analyser/JPEGReader.java
@@ -30,7 +30,7 @@ import org.apache.fop.apps.FOUserAgent;
* ImageReader object for JPEG image type.
*
* @author Pankaj Narula
- * @version $Id: JPEGReader.java,v 1.8 2003/03/06 21:25:45 jeremias Exp $
+ * @version $Id$
*/
public class JPEGReader implements ImageReader {
@@ -61,6 +61,7 @@ public class JPEGReader implements ImageReader {
&& (header[1] == (byte) 0xd8));
if (supported) {
FopImage.ImageInfo info = getDimension(fis);
+ info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = fis;
return info;
diff --git a/src/java/org/apache/fop/image/analyser/PNGReader.java b/src/java/org/apache/fop/image/analyser/PNGReader.java
index c833187a2..08dd9fa19 100644
--- a/src/java/org/apache/fop/image/analyser/PNGReader.java
+++ b/src/java/org/apache/fop/image/analyser/PNGReader.java
@@ -30,7 +30,7 @@ import org.apache.fop.apps.FOUserAgent;
* ImageReader object for PNG image type.
*
* @author Pankaj Narula
- * @version $Id: PNGReader.java,v 1.8 2003/03/06 21:25:45 jeremias Exp $
+ * @version $Id$
*/
public class PNGReader implements ImageReader {
@@ -51,6 +51,7 @@ public class PNGReader implements ImageReader {
if (supported) {
FopImage.ImageInfo info = getDimension(header);
+ info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = bis;
return info;
diff --git a/src/java/org/apache/fop/image/analyser/SVGReader.java b/src/java/org/apache/fop/image/analyser/SVGReader.java
index f5328d04e..d7f433f3c 100644
--- a/src/java/org/apache/fop/image/analyser/SVGReader.java
+++ b/src/java/org/apache/fop/image/analyser/SVGReader.java
@@ -166,6 +166,7 @@ public class SVGReader implements ImageReader {
FopImage.ImageInfo info = new FopImage.ImageInfo();
+ info.originalURI = uri;
info.mimeType = getMimeType();
info.str = SVGDOMImplementation.SVG_NAMESPACE_URI;
diff --git a/src/java/org/apache/fop/image/analyser/TIFFReader.java b/src/java/org/apache/fop/image/analyser/TIFFReader.java
index 3d8a82309..fa79c2e79 100644
--- a/src/java/org/apache/fop/image/analyser/TIFFReader.java
+++ b/src/java/org/apache/fop/image/analyser/TIFFReader.java
@@ -30,7 +30,7 @@ import org.apache.fop.apps.FOUserAgent;
* ImageReader object for TIFF image type.
*
* @author Pankaj Narula, Michael Lee
- * @version $Id: TIFFReader.java,v 1.9 2003/03/06 21:25:45 jeremias Exp $
+ * @version $Id$
*/
public class TIFFReader implements ImageReader {
@@ -62,6 +62,7 @@ public class TIFFReader implements ImageReader {
if (supported) {
FopImage.ImageInfo info = getDimension(header);
+ info.originalURI = uri;
info.mimeType = getMimeType();
info.inputStream = bis;
return info;
diff --git a/src/java/org/apache/fop/image/analyser/XMLReader.java b/src/java/org/apache/fop/image/analyser/XMLReader.java
index 55ebc5dfd..b8d9203ac 100644
--- a/src/java/org/apache/fop/image/analyser/XMLReader.java
+++ b/src/java/org/apache/fop/image/analyser/XMLReader.java
@@ -62,6 +62,7 @@ public class XMLReader implements ImageReader {
FOUserAgent ua)
throws IOException {
FopImage.ImageInfo info = loadImage(uri, fis, ua);
+ info.originalURI = uri;
if (info != null) {
IOUtils.closeQuietly(fis);
}