aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2002-08-02 08:47:02 +0000
committerKeiron Liddle <keiron@apache.org>2002-08-02 08:47:02 +0000
commit66585b4ebeac6484411dc00d4db9c08f6f5cdf03 (patch)
tree7fc2b9f3ef4086138aa849d1280bd8907ba5e049 /src
parent78fec1593592cc7bfc0078ebaa3e3a0fda780cb6 (diff)
downloadxmlgraphics-fop-66585b4ebeac6484411dc00d4db9c08f6f5cdf03.tar.gz
xmlgraphics-fop-66585b4ebeac6484411dc00d4db9c08f6f5cdf03.zip
get Jimi working again and correctly reporting errors
fixed some eps npe's git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195050 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/image/AbstractFopImage.java4
-rw-r--r--src/org/apache/fop/image/JimiImage.java36
-rw-r--r--src/org/apache/fop/render/pdf/FopPDFImage.java10
3 files changed, 35 insertions, 15 deletions
diff --git a/src/org/apache/fop/image/AbstractFopImage.java b/src/org/apache/fop/image/AbstractFopImage.java
index 7128ea9e4..6e9e31c07 100644
--- a/src/org/apache/fop/image/AbstractFopImage.java
+++ b/src/org/apache/fop/image/AbstractFopImage.java
@@ -49,7 +49,7 @@ public abstract class AbstractFopImage implements FopImage {
protected FopImage.ImageInfo imageInfo = null;
/**
- * Image color space (org.apache.fop.datatypes.ColorSpace).
+ * Image color space (java.awt.color.ColorSpace).
*/
protected ColorSpace m_colorSpace = null;
@@ -163,7 +163,7 @@ public abstract class AbstractFopImage implements FopImage {
/**
* Return the image color space.
- * @return the image color space (org.apache.fop.datatypes.ColorSpace)
+ * @return the image color space (java.awt.color.ColorSpace)
*/
public ColorSpace getColorSpace() {
return this.m_colorSpace;
diff --git a/src/org/apache/fop/image/JimiImage.java b/src/org/apache/fop/image/JimiImage.java
index 80bdb609b..44c3335d5 100644
--- a/src/org/apache/fop/image/JimiImage.java
+++ b/src/org/apache/fop/image/JimiImage.java
@@ -20,6 +20,9 @@ import com.sun.jimi.core.*;
// FOP
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.image.analyser.ImageReader;
+import org.apache.fop.fo.FOUserAgent;
+
+import org.apache.avalon.framework.logger.Logger;
/**
* FopImage object for several images types, using Jimi.
@@ -38,7 +41,23 @@ public class JimiImage extends AbstractFopImage {
}
}
- protected void loadImage() {
+ protected boolean loadDimensions(FOUserAgent ua) {
+ if(this.m_bitmaps == null) {
+ loadImage(ua.getLogger());
+ }
+
+ return this.m_bitmaps != null;
+ }
+
+ protected boolean loadBitmap(FOUserAgent ua) {
+ if(this.m_bitmaps == null) {
+ loadImage(ua.getLogger());
+ }
+
+ return this.m_bitmaps != null;
+ }
+
+ protected void loadImage(Logger log) {
int[] tmpMap = null;
try {
ImageProducer ip =
@@ -56,9 +75,9 @@ public class JimiImage extends AbstractFopImage {
try {
tmpMap = consumer.getImage();
} catch (Exception ex) {
- /*throw new FopImageException("Image grabbing interrupted : "
- + ex.getMessage());
- */}
+ log.error("Image grabbing interrupted", ex);
+ return;
+ }
ColorModel cm = consumer.getColorModel();
this.m_bitsPerPixel = 8;
@@ -118,11 +137,10 @@ public class JimiImage extends AbstractFopImage {
this.m_isTransparent = false;
}
} catch (Exception ex) {
- /*throw new FopImageException("Error while loading image "
- + this.m_href.toString() + " : "
- + ex.getClass() + " - "
- + ex.getMessage());
- */}
+ log.error("Error while loading image "
+ + this.m_href.toString(), ex);
+ return;
+ }
// Should take care of the ColorSpace and bitsPerPixel
diff --git a/src/org/apache/fop/render/pdf/FopPDFImage.java b/src/org/apache/fop/render/pdf/FopPDFImage.java
index bbfb83f6c..bf869b70f 100644
--- a/src/org/apache/fop/render/pdf/FopPDFImage.java
+++ b/src/org/apache/fop/render/pdf/FopPDFImage.java
@@ -162,14 +162,16 @@ public class FopPDFImage implements PDFImage {
byte[] preBytes = preamble.toString().getBytes();
byte[] postBytes = post.toString().getBytes();
+ byte[] epsBytes = ((EPSImage)fopImage).getEPSImage();
+ int epsLength = epsBytes.length;
byte[] imgData = new byte[preBytes.length + postBytes.length +
- fopImage.getBitmaps().length];
+ epsLength];
System.arraycopy (preBytes, 0, imgData, 0, preBytes.length);
- System.arraycopy (fopImage.getBitmaps(), 0, imgData,
- preBytes.length, fopImage.getBitmaps().length);
+ System.arraycopy (epsBytes, 0, imgData,
+ preBytes.length, epsBytes.length);
System.arraycopy (postBytes, 0, imgData,
- preBytes.length + fopImage.getBitmaps().length,
+ preBytes.length + epsBytes.length,
postBytes.length);