diff options
author | Tore Engvig <tore@apache.org> | 2001-11-16 19:36:41 +0000 |
---|---|---|
committer | Tore Engvig <tore@apache.org> | 2001-11-16 19:36:41 +0000 |
commit | b58396ce84883b39d3fc3d6afbcc21d62adde6b9 (patch) | |
tree | d23252a6f34efc6f7530ef4eaa804950b7d05bd3 /src/org/apache/fop/image/EPSImage.java | |
parent | 16a80413e0fbd2b03f2bd26dd2ac52ea00059e5b (diff) | |
download | xmlgraphics-fop-b58396ce84883b39d3fc3d6afbcc21d62adde6b9.tar.gz xmlgraphics-fop-b58396ce84883b39d3fc3d6afbcc21d62adde6b9.zip |
PR:
Obtained from:
Submitted by:
Reviewed by:
Support for CMYK jpeg's and ICC profiles
Initial support for EPS images (only limited support in PDFRenderer)
(need to fix PSRenderer as soon as new area tree and rendering stuff are finished)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194570 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/image/EPSImage.java')
-rw-r--r-- | src/org/apache/fop/image/EPSImage.java | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/org/apache/fop/image/EPSImage.java b/src/org/apache/fop/image/EPSImage.java new file mode 100644 index 000000000..ada6fbfcf --- /dev/null +++ b/src/org/apache/fop/image/EPSImage.java @@ -0,0 +1,94 @@ +/* + * $Id$ + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.image; + +// Java +import java.net.URL; +import java.net.URLConnection; +import java.io.InputStream; +import java.io.IOException; + +// FOP +import org.apache.fop.apps.Driver; +import org.apache.fop.messaging.*; +import org.apache.fop.datatypes.ColorSpace; +import org.apache.fop.pdf.PDFColor; +import org.apache.fop.image.analyser.ImageReader; +import org.apache.fop.image.analyser.EPSReader; + +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + + +/** + * @see AbstractFopImage + * @see FopImage + */ +public class EPSImage extends AbstractFopImage { + private String docName; + private int[] bbox; + + private byte[] epsImage = null; + private EPSReader epsReader = null; + + /** + * Initialize docName and bounding box + */ + private void init(URL href) { + bbox = new int[4]; + bbox[0] = 0; + bbox[1] = 0; + bbox[2] = 0; + bbox[3] = 0; + + docName = href.toString(); + } + + /** + * Return the name of the eps + */ + public String getDocName() { + return docName; + } + + /** + * Return the bounding box + */ + public int[] getBBox() { + return bbox; + } + + public EPSImage(URL href) throws FopImageException { + super(href); + init(href); + } + + public EPSImage(URL href, + ImageReader imgReader) throws FopImageException { + super(href, imgReader); + init(href); + if (imgReader instanceof EPSReader) { + EPSReader eimgReader = (EPSReader)imgReader; + epsReader = eimgReader; + epsImage = eimgReader.getEpsFile(); + m_bitmaps = epsImage; + bbox = eimgReader.getBBox(); + } + } + + protected void loadImage() throws FopImageException { + // Image is loaded in reader + } + + public byte[] getEPSImage() throws FopImageException { + if (epsImage == null) + MessageHandler.errorln("ERROR LOADING EXTERNAL EPS"); + return epsImage; + } + +} |