vmote 2003/08/30 10:59:54 Modified: src/java/org/apache/fop/image AbstractFopImage.java FopImage.java GifImage.java JAIImage.java JimiImage.java src/java/org/apache/fop/render/pdf FopPDFImage.java Log: for generic FOP image processing (i.e. not related to rendering), use java.awt.Color instead of pdf.PDFColor Revision Changes Path 1.3 +15 -15 xml-fop/src/java/org/apache/fop/image/AbstractFopImage.java Index: AbstractFopImage.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/AbstractFopImage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AbstractFopImage.java 22 Aug 2003 17:42:41 -0000 1.2 +++ AbstractFopImage.java 30 Aug 2003 17:59:53 -0000 1.3 @@ -3,34 +3,34 @@ * ============================================================================ * 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 * [EMAIL PROTECTED] - * + * * 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 @@ -42,21 +42,21 @@ * (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 <[EMAIL PROTECTED]>. 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; /** @@ -117,9 +117,9 @@ 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. @@ -290,9 +290,9 @@ /** * 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; } 1.4 +2 -2 xml-fop/src/java/org/apache/fop/image/FopImage.java Index: FopImage.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/FopImage.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- FopImage.java 22 Aug 2003 17:42:41 -0000 1.3 +++ FopImage.java 30 Aug 2003 17:59:53 -0000 1.4 @@ -53,8 +53,8 @@ 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; /** @@ -139,7 +139,7 @@ * @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 1.3 +14 -14 xml-fop/src/java/org/apache/fop/image/GifImage.java Index: GifImage.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/GifImage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- GifImage.java 22 Aug 2003 17:42:41 -0000 1.2 +++ GifImage.java 30 Aug 2003 17:59:53 -0000 1.3 @@ -3,34 +3,34 @@ * ============================================================================ * 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 * [EMAIL PROTECTED] - * + * * 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 @@ -42,12 +42,12 @@ * (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 <[EMAIL PROTECTED]>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. - */ + */ package org.apache.fop.image; // Java @@ -55,12 +55,12 @@ 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; /** @@ -128,7 +128,7 @@ 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) { @@ -148,7 +148,7 @@ 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)); @@ -210,7 +210,7 @@ */ protected static class DummyConnection extends URLConnection { private InputStream inputStream; - + DummyConnection(InputStream is) { super(null); inputStream = is; 1.2 +14 -16 xml-fop/src/java/org/apache/fop/image/JAIImage.java Index: JAIImage.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/JAIImage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JAIImage.java 11 Mar 2003 13:05:25 -0000 1.1 +++ JAIImage.java 30 Aug 2003 17:59:53 -0000 1.2 @@ -3,34 +3,34 @@ * ============================================================================ * 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 * [EMAIL PROTECTED] - * + * * 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 @@ -42,12 +42,12 @@ * (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 <[EMAIL PROTECTED]>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. - */ + */ package org.apache.fop.image; // AWT @@ -55,6 +55,7 @@ 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; @@ -62,9 +63,6 @@ // Sun codec import com.sun.media.jai.codec.FileCacheSeekableStream; -// FOP -import org.apache.fop.pdf.PDFColor; - /** * FopImage object using JAI. * @author Eric SCHAEFFER @@ -100,7 +98,7 @@ 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) { @@ -123,7 +121,7 @@ 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)); @@ -137,7 +135,7 @@ * 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; * } 1.3 +13 -13 xml-fop/src/java/org/apache/fop/image/JimiImage.java Index: JimiImage.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/image/JimiImage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JimiImage.java 22 Aug 2003 17:42:41 -0000 1.2 +++ JimiImage.java 30 Aug 2003 17:59:53 -0000 1.3 @@ -3,34 +3,34 @@ * ============================================================================ * 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 * [EMAIL PROTECTED] - * + * * 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 @@ -42,12 +42,12 @@ * (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 <[EMAIL PROTECTED]>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. - */ + */ package org.apache.fop.image; // Java @@ -55,6 +55,7 @@ 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; @@ -63,7 +64,6 @@ import org.apache.avalon.framework.logger.Logger; // FOP -import org.apache.fop.pdf.PDFColor; import org.apache.fop.apps.FOUserAgent; /** @@ -157,7 +157,7 @@ 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)); @@ -171,7 +171,7 @@ * 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; * } 1.3 +17 -15 xml-fop/src/java/org/apache/fop/render/pdf/FopPDFImage.java Index: FopPDFImage.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/FopPDFImage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FopPDFImage.java 27 Mar 2003 11:18:41 -0000 1.2 +++ FopPDFImage.java 30 Aug 2003 17:59:54 -0000 1.3 @@ -3,34 +3,34 @@ * ============================================================================ * 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 * [EMAIL PROTECTED] - * + * * 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 @@ -42,12 +42,12 @@ * (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 <[EMAIL PROTECTED]>. 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; @@ -72,7 +72,7 @@ * PDFImage implementation for the PDF renderer. */ public class FopPDFImage implements PDFImage { - + private FopImage fopImage; private PDFICCStream pdfICCStream = null; private PDFFilter pdfFilter = null; @@ -131,7 +131,7 @@ public boolean isDCT() { return fopImage.getMimeType().equals("image/jpeg"); } - + /** * @see org.apache.fop.pdf.PDFImage#getWidth() */ @@ -172,7 +172,9 @@ * @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()); } /** @@ -229,7 +231,7 @@ 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"); @@ -279,7 +281,7 @@ } return pdfCS; } - + /** * @see org.apache.fop.pdf.PDFImage#getFilterHint() */
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]