* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.image;
// Java
import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
import java.io.InputStream;
+import java.awt.Color;
// FOP
-import org.apache.fop.pdf.PDFColor;
import org.apache.fop.apps.FOUserAgent;
/**
protected boolean isTransparent = false;
/**
- * Transparent color (org.apache.fop.pdf.PDFColor).
+ * Transparent color (java.awt.Color).
*/
- protected PDFColor transparentColor = null;
+ protected Color transparentColor = null;
/**
* Constructor.
/**
* Return the transparent color.
- * @return the transparent color (org.apache.fop.pdf.PDFColor)
+ * @return the transparent color (java.awt.Color)
*/
- public PDFColor getTransparentColor() {
+ public Color getTransparentColor() {
return this.transparentColor;
}
import java.io.InputStream;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
+import java.awt.Color;
-import org.apache.fop.pdf.PDFColor;
import org.apache.fop.apps.FOUserAgent;
/**
* @return the transparent color
* (todo) Remove the PDF dependency
*/
- PDFColor getTransparentColor();
+ Color getTransparentColor();
/**
* Indicates whether the image has a Soft Mask (See section 7.5.4 in the
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.image;
// Java
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
import java.awt.color.ColorSpace;
+import java.awt.Color;
import java.io.InputStream;
import java.io.IOException;
import java.net.URLConnection;
// FOP
-import org.apache.fop.pdf.PDFColor;
import org.apache.fop.apps.FOUserAgent;
/**
if (cm.hasAlpha()) {
// java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
int transparencyType = cm.getTransparency();
-
+
if (transparencyType == java.awt.Transparency.OPAQUE) {
this.isTransparent = false;
} else if (transparencyType == java.awt.Transparency.BITMASK) {
i++) {
if ((alphas[i] & 0xFF) == 0) {
this.isTransparent = true;
- this.transparentColor = new PDFColor(
+ this.transparentColor = new Color(
(int)(reds[i] & 0xFF),
(int)(greens[i] & 0xFF),
(int)(blues[i] & 0xFF));
*/
protected static class DummyConnection extends URLConnection {
private InputStream inputStream;
-
+
DummyConnection(InputStream is) {
super(null);
inputStream = is;
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.image;
// AWT
import java.awt.image.IndexColorModel;
import java.awt.image.BufferedImage;
import java.awt.color.ColorSpace;
+import java.awt.Color;
// JAI
import javax.media.jai.JAI;
// Sun codec
import com.sun.media.jai.codec.FileCacheSeekableStream;
-// FOP
-import org.apache.fop.pdf.PDFColor;
-
/**
* FopImage object using JAI.
* @author Eric SCHAEFFER
if (cm.hasAlpha()) {
// java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
int transparencyType = cm.getTransparency();
-
+
if (transparencyType == java.awt.Transparency.OPAQUE) {
this.isTransparent = false;
} else if (transparencyType == java.awt.Transparency.BITMASK) {
i++) {
if ((alphas[i] & 0xFF) == 0) {
this.isTransparent = true;
- this.transparentColor = new PDFColor(
+ this.transparentColor = new Color(
(int)(reds[i] & 0xFF),
(int)(greens[i] & 0xFF),
(int)(blues[i] & 0xFF));
* for (int i = 0; i < this.width * this.height; i++) {
* if (cm.getAlpha(tmpMap[i]) == 0) {
* this.isTransparent = true;
- * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]),
+ * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]),
* cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
* break;
* }
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.image;
// Java
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
import java.awt.color.ColorSpace;
+import java.awt.Color;
// Jimi
import com.sun.jimi.core.Jimi;
import org.apache.avalon.framework.logger.Logger;
// FOP
-import org.apache.fop.pdf.PDFColor;
import org.apache.fop.apps.FOUserAgent;
/**
i++) {
if ((alphas[i] & 0xFF) == 0) {
this.isTransparent = true;
- this.transparentColor = new PDFColor(
+ this.transparentColor = new Color(
(int)(reds[i] & 0xFF),
(int)(greens[i] & 0xFF),
(int)(blues[i] & 0xFF));
* for (int i = 0; i < this.width * this.height; i++) {
* if (cm.getAlpha(tmpMap[i]) == 0) {
* this.isTransparent = true;
- * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]),
+ * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]),
* cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
* break;
* }
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.render.pdf;
import org.apache.fop.pdf.PDFFilterList;
* PDFImage implementation for the PDF renderer.
*/
public class FopPDFImage implements PDFImage {
-
+
private FopImage fopImage;
private PDFICCStream pdfICCStream = null;
private PDFFilter pdfFilter = null;
public boolean isDCT() {
return fopImage.getMimeType().equals("image/jpeg");
}
-
+
/**
* @see org.apache.fop.pdf.PDFImage#getWidth()
*/
* @see org.apache.fop.pdf.PDFImage#getTransparentColor()
*/
public PDFColor getTransparentColor() {
- return fopImage.getTransparentColor();
+ return new PDFColor(fopImage.getTransparentColor().getRed(),
+ fopImage.getTransparentColor().getGreen(),
+ fopImage.getTransparentColor().getBlue());
}
/**
preamble.append((double)(1f / (double) bboxw) + " "
+ (double)(1f / (double) bboxh) + " scale\n");
preamble.append(-bbox[0] + " " + (-bbox[1]) + " translate\n");
- preamble.append(bbox[0] + " " + bbox[1] + " "
+ preamble.append(bbox[0] + " " + bbox[1] + " "
+ bboxw + " " + bboxh + " rectclip\n");
preamble.append("newpath\n");
}
return pdfCS;
}
-
+
/**
* @see org.apache.fop.pdf.PDFImage#getFilterHint()
*/