From: Keiron Liddle Date: Mon, 19 Aug 2002 11:54:53 +0000 (+0000) Subject: load original data properly X-Git-Tag: Alt-Design-integration-base~443 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a3f76e82f9ff8c206c9d4cd41f7064d2355f980a;p=xmlgraphics-fop.git load original data properly git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195097 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/image/AbstractFopImage.java b/src/org/apache/fop/image/AbstractFopImage.java index 6e9e31c07..f9999f4dd 100644 --- a/src/org/apache/fop/image/AbstractFopImage.java +++ b/src/org/apache/fop/image/AbstractFopImage.java @@ -126,6 +126,12 @@ public abstract class AbstractFopImage implements FopImage { loaded = loaded | BITMAP; } } + if(((type & ORIGINAL_DATA) != 0) && ((loaded & ORIGINAL_DATA) == 0)) { + success = success && loadOriginalData(ua); + if(success) { + loaded = loaded | ORIGINAL_DATA; + } + } return success; } @@ -137,6 +143,10 @@ public abstract class AbstractFopImage implements FopImage { return false; } + protected boolean loadOriginalData(FOUserAgent ua) { + return false; + } + /** * Return the image URL. * @return the image URL (as String) diff --git a/src/org/apache/fop/image/EPSImage.java b/src/org/apache/fop/image/EPSImage.java index 3867d2a20..29323c395 100644 --- a/src/org/apache/fop/image/EPSImage.java +++ b/src/org/apache/fop/image/EPSImage.java @@ -71,6 +71,7 @@ public class EPSImage extends AbstractFopImage { bbox[2] = (int) epsData.bbox[2]; bbox[3] = (int) epsData.bbox[3]; + loaded = loaded | ORIGINAL_DATA; } } diff --git a/src/org/apache/fop/image/JpegImage.java b/src/org/apache/fop/image/JpegImage.java index f1f64919e..ee71a86ff 100644 --- a/src/org/apache/fop/image/JpegImage.java +++ b/src/org/apache/fop/image/JpegImage.java @@ -39,7 +39,7 @@ public class JpegImage extends AbstractFopImage { super(href, imgReader); } - protected boolean loadBitmap(FOUserAgent ua) { + protected boolean loadOriginalData(FOUserAgent ua) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream iccStream = new ByteArrayOutputStream(); InputStream inStream; diff --git a/src/org/apache/fop/image/XMLImage.java b/src/org/apache/fop/image/XMLImage.java index a6e47df50..aa74eb0c9 100644 --- a/src/org/apache/fop/image/XMLImage.java +++ b/src/org/apache/fop/image/XMLImage.java @@ -29,6 +29,7 @@ public class XMLImage extends AbstractFopImage { super(href, imgInfo); if(imgInfo.data instanceof Document) { doc = (Document)imgInfo.data; + loaded = loaded | ORIGINAL_DATA; } ns = imgInfo.str; } diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 89ee1d703..d3b0ddccd 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -516,7 +516,7 @@ public class PDFRenderer extends PrintRenderer { FopPDFImage pdfimage = new FopPDFImage(fopimage, url); int xobj = pdfDoc.addImage(null, pdfimage).getXNumber(); fact.releaseImage(url, userAgent); - } else if ("image/jpg".equals(mime)) { + } else if ("image/jpeg".equals(mime)) { if (!fopimage.load(FopImage.ORIGINAL_DATA, userAgent)) { return; }