You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2006/05/03 09:21:16 UTC

svn commit: r399185 [1/2] - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/area/ src/java/org/apache/fop/datatypes/ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/expr/ src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/fo/pagination/...

Author: jeremias
Date: Wed May  3 00:21:02 2006
New Revision: 399185

URL: http://svn.apache.org/viewcvs?rev=399185&view=rev
Log:
Bugzilla #38946:
First step for improved color handling. FOP's own ColorType was replaced with java.awt.Color throughout the codebase.
Submitted by: Max Berger <max.at.berger.name>

Added:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColorProperty.java   (with props)
    xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorUtil.java   (with props)
Removed:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/datatypes/ColorType.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColorTypeProperty.java
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOText.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NCnameProperty.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NumericProperty.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BidiOverride.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InitialPropertySet.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InlineLevel.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/pagination/ColorProfile.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/NumberProperty.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/Property.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/AWTRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/java2d/RendererState.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/PSRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/traits/BorderProps.java
    xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPFontColor.java
    xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/afp/AFPRenderer.java
    xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/pcl/PCLRenderer.java
    xmlgraphics/fop/trunk/test/fotree/testcases/properties_omitted_propertyname.fo
    xmlgraphics/fop/trunk/test/java/org/apache/fop/traits/BorderPropsTestCase.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/traits/TraitColorTestCase.java
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/region-body_background-image.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Area.java Wed May  3 00:21:02 2006
@@ -26,7 +26,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.traits.BorderProps;
 import org.apache.fop.util.QName;
 
@@ -396,11 +395,7 @@
         if (props == null) {
             props = new java.util.HashMap(20);
         }
-        if (prop instanceof ColorType) {
-            props.put(traitCode, Trait.Color.makeSerializable((ColorType)prop));
-        } else {
-            props.put(traitCode, prop);
-        }
+        props.put(traitCode, prop);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java Wed May  3 00:21:02 2006
@@ -18,6 +18,7 @@
 
 package org.apache.fop.area;
 
+import java.awt.Color;
 import java.awt.geom.Rectangle2D;
 import java.util.List;
 import java.util.Map;
@@ -35,10 +36,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.Trait.Background;
-import org.apache.fop.area.Trait.Color;
 import org.apache.fop.area.inline.AbstractTextArea;
 import org.apache.fop.area.inline.Character;
 import org.apache.fop.area.inline.ForeignObject;
@@ -53,16 +52,17 @@
 import org.apache.fop.area.inline.WordArea;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.ElementMappingRegistry;
+import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.image.FopImage;
 import org.apache.fop.image.ImageFactory;
 import org.apache.fop.traits.BorderProps;
+import org.apache.fop.util.ColorUtil;
 import org.apache.fop.util.ContentHandlerFactory;
 import org.apache.fop.util.ContentHandlerFactoryRegistry;
 import org.apache.fop.util.DefaultErrorListener;
-
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
 import org.xml.sax.Attributes;
@@ -909,68 +909,58 @@
                 if (value != null) {
                     Class cl = Trait.getTraitClass(trait);
                     if (cl == Integer.class) {
-                        //if (value != null) {
-                            area.addTrait(trait, new Integer(value));
-                        //}
+                        area.addTrait(trait, new Integer(value));
                     } else if (cl == Boolean.class) {
-                        //String value = attributes.getValue(Trait.getTraitName(trait));
-                        //if (value != null) {
-                            area.addTrait(trait, Boolean.valueOf(value));
-                        //}
+                        area.addTrait(trait, Boolean.valueOf(value));
                     } else if (cl == String.class) {
-                        //String value = attributes.getValue(Trait.getTraitName(trait));
-                        //if (value != null) {
-                            area.addTrait(trait, value);
-                        //}
+                        area.addTrait(trait, value);
                     } else if (cl == Color.class) {
-                        //String value = attributes.getValue(Trait.getTraitName(trait));
-                        //if (value != null) {
-                            area.addTrait(trait, Color.valueOf(value));
-                        //}
+                        try {
+                            area.addTrait(trait, ColorUtil.parseColorString(value));
+                        } catch (PropertyException e) {
+                            throw new IllegalArgumentException(e.getMessage());
+                        }
                     } else if (cl == Background.class) {
-                        //String value = attributes.getValue(Trait.getTraitName(trait));
-                        //if (value != null) {
-                            Background bkg = new Background();
-                            Color col = Color.valueOf(attributes.getValue("bkg-color"));
-                            if (col != null) {
-                                bkg.setColor(col);
-                            }
-                            String url = attributes.getValue("bkg-img");
-                            if (url != null) {
-                                bkg.setURL(url);
-                                
-                                ImageFactory fact = userAgent.getFactory().getImageFactory();
-                                FopImage img = fact.getImage(url, userAgent);
-                                if (img == null) {
-                                    log.error("Background image not available: " + url);
-                                } else {
-                                    // load dimensions
-                                    if (!img.load(FopImage.DIMENSIONS)) {
-                                        log.error("Cannot read background image dimensions: " 
-                                                + url);
-                                    }
+                        Background bkg = new Background();
+                        try {
+                            Color col = ColorUtil
+                                    .parseColorString(attributes
+                                            .getValue("bkg-color"));
+                            bkg.setColor(col);
+                        } catch (PropertyException e) {
+                            throw new IllegalArgumentException(e.getMessage());
+                        }                            
+                        String url = attributes.getValue("bkg-img");
+                        if (url != null) {
+                            bkg.setURL(url);
+                            
+                            ImageFactory fact = userAgent.getFactory().getImageFactory();
+                            FopImage img = fact.getImage(url, userAgent);
+                            if (img == null) {
+                                log.error("Background image not available: " + url);
+                            } else {
+                                // load dimensions
+                                if (!img.load(FopImage.DIMENSIONS)) {
+                                    log.error("Cannot read background image dimensions: " 
+                                            + url);
                                 }
-                                bkg.setFopImage(img);
-    
-                                String repeat = attributes.getValue("bkg-repeat");
-                                if (repeat != null) {
-                                    bkg.setRepeat(repeat);
-                                }
-                                bkg.setHoriz(getAttributeAsInteger(attributes, 
-                                        "bkg-horz-offset", 0));
-                                bkg.setVertical(getAttributeAsInteger(attributes, 
-                                        "bkg-vert-offset", 0));
                             }
-                            area.addTrait(trait, bkg);
-                        //}
+                            bkg.setFopImage(img);
+
+                            String repeat = attributes.getValue("bkg-repeat");
+                            if (repeat != null) {
+                                bkg.setRepeat(repeat);
+                            }
+                            bkg.setHoriz(getAttributeAsInteger(attributes, 
+                                    "bkg-horz-offset", 0));
+                            bkg.setVertical(getAttributeAsInteger(attributes, 
+                                    "bkg-vert-offset", 0));
+                        }
+                        area.addTrait(trait, bkg);
                     } else if (cl == BorderProps.class) {
-                        //String value = attributes.getValue(Trait.getTraitName(trait));
-                        //if (value != null) {
-                            area.addTrait(trait, BorderProps.valueOf(value));
-                        //}
+                        area.addTrait(trait, BorderProps.valueOf(value));
                     }
                 } else {
-                    //Class cl = Trait.getTraitClass(trait);
                     if (trait == Trait.FONT) {
                         String fontName = attributes.getValue("font-name");
                         if (fontName != null) {

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java Wed May  3 00:21:02 2006
@@ -18,13 +18,14 @@
 
 package org.apache.fop.area;
 
-import org.apache.fop.datatypes.ColorType;
+import java.awt.Color;
+import java.io.Serializable;
+
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.FontTriplet;
 import org.apache.fop.image.FopImage;
 import org.apache.fop.traits.BorderProps;
-
-import java.io.Serializable;
+import org.apache.fop.util.ColorUtil;
 
 // properties should be serialized by the holder
 /**
@@ -61,7 +62,7 @@
     public static final Integer FONT_SIZE = new Integer(4);
 
     /**
-     * The current colour.
+     * The current color.
      */
     public static final Integer COLOR = new Integer(7);
 
@@ -409,154 +410,6 @@
         return null;
     }*/
 
-    /**
-     * Serializable ColorType implementation for the area tree.
-     * @TODO Think about switching to java.awt.Color entirely!
-     */
-    public static class Color implements ColorType, Serializable {
-
-        private float red;
-        private float green;
-        private float blue;
-        private float alpha;
-        
-        /**
-         * Creates a new Color instance
-         * @param r the red component
-         * @param g the green component
-         * @param b the blue component
-         * @param a the alpha component
-         */
-        public Color(float r, float g, float b, float a) {
-            this.red = r;
-            this.green = g;
-            this.blue = b;
-            this.alpha = a;
-        }
-        
-        /**
-         * Copy constructor
-         * @param col the ColorType instance which shall be duplicated
-         */
-        public Color(ColorType col) {
-            this(col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha());
-        }
-        
-        /** @see org.apache.fop.datatypes.ColorType#getRed() */
-        public float getRed() {
-            return this.red;
-        }
-
-        /** @see org.apache.fop.datatypes.ColorType#getGreen() */
-        public float getGreen() {
-            return this.green;
-        }
-
-        /** @see org.apache.fop.datatypes.ColorType#getBlue() */
-        public float getBlue() {
-            return this.blue;
-        }
-
-        /** @see org.apache.fop.datatypes.ColorType#getAlpha() */
-        public float getAlpha() {
-            return this.alpha;
-        }
-
-        /** @see org.apache.fop.datatypes.ColorType#getAWTColor() */
-        public java.awt.Color getAWTColor() {
-            return new java.awt.Color(red, green, blue, alpha);
-        }
-        
-        /**
-         * Converts a given color to a serializable instance if necessary.
-         * @param col the color
-         * @return the serializable color value.
-         */
-        public static ColorType makeSerializable(ColorType col) {
-            if (col == null) {
-                return null;
-            } else if (col instanceof Serializable) {
-                return col;
-            } else {
-                return new Color(col);
-            }
-        }
-        
-        /** @see java.lang.Object#hashCode() */
-        public int hashCode() {
-            return toString().hashCode();
-        }
-
-        /** @see java.lang.Object#equals(java.lang.Object) */
-        public boolean equals(Object obj) {
-            if (obj == null) {
-                return false;
-            } else if (obj == this) {
-                return true;
-            } else {
-                if (obj instanceof ColorType) {
-                    ColorType other = (ColorType)obj;
-                    return getRed() == other.getRed()
-                            && getGreen() == other.getGreen() 
-                            && getBlue() == other.getBlue()
-                            && getAlpha() == other.getAlpha();
-                }
-            }
-            return false;
-        }
-
-        /**
-         * Returns a Color represtation of a string of the format "#RRGGBB".
-         * @param s the string
-         * @return the Color value
-         */
-        public static Color valueOf(String s) {
-            if (s == null) {
-                return null;
-            }
-            if (!s.startsWith("#")) {
-                throw new IllegalArgumentException("Color must start with '#'");
-            }
-            int r = Integer.parseInt(s.substring(1, 3), 16);
-            int g = Integer.parseInt(s.substring(3, 5), 16);
-            int b = Integer.parseInt(s.substring(5, 7), 16);
-            int a = 255;
-            if (s.length() > 7) {
-                a = Integer.parseInt(s.substring(7, 9), 16);
-            }
-            return new Color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
-        }
-        
-        /** @see java.lang.Object#toString() */
-        public String toString() {
-            StringBuffer sbuf = new StringBuffer(8);
-            sbuf.append('#');
-            String s = Integer.toHexString((int)(red * 255.0));
-            if (s.length() == 1) {
-                sbuf.append('0');
-            }
-            sbuf.append(s);
-            s = Integer.toHexString((int)(green * 255.0));
-            if (s.length() == 1) {
-                sbuf.append('0');
-            }
-            sbuf.append(s);
-            s = Integer.toHexString((int)(blue * 255.0));
-            if (s.length() == 1) {
-                sbuf.append('0');
-            }
-            sbuf.append(s);
-            if (alpha != 1) {
-                s = Integer.toHexString((int)(alpha * 255.0));
-                if (s.length() == 1) {
-                    sbuf.append('0');
-                }
-                sbuf.append(s);
-            }
-            return sbuf.toString();
-        }
-
-    }
     
     /**
      * Background trait structure.
@@ -565,7 +418,7 @@
     public static class Background implements Serializable {
 
         /** The background color if any. */
-        private ColorType color = null;
+        private Color color = null;
 
         /** The background image url if any. */
         private String url = null;
@@ -586,7 +439,7 @@
          * Returns the background color.
          * @return background color, null if n/a
          */
-        public ColorType getColor() {
+        public Color getColor() {
             return color;
         }
 
@@ -634,8 +487,8 @@
          * Sets the color.
          * @param color The color to set
          */
-        public void setColor(ColorType color) {
-            this.color = Color.makeSerializable(color);
+        public void setColor(Color color) {
+            this.color = color;
         }
 
         /**
@@ -716,9 +569,14 @@
          */
         public String toString() {
             StringBuffer sb = new StringBuffer();
-            sb.append("color=").append(color);
+            if (color != null) {
+                sb.append("color=").append(ColorUtil.colorTOsRGBString(color));
+            }
             if (url != null) {
-                sb.append(",url=").append(url);
+                if (color != null) {
+                    sb.append(",");
+                }
+                sb.append("url=").append(url);
                 sb.append(",repeat=").append(getRepeatString());
                 sb.append(",horiz=").append(horiz);
                 sb.append(",vertical=").append(vertical);

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java Wed May  3 00:21:02 2006
@@ -28,7 +28,7 @@
 import org.apache.fop.fo.properties.BorderWidthPropertyMaker;
 import org.apache.fop.fo.properties.BoxPropShorthandParser;
 import org.apache.fop.fo.properties.CharacterProperty;
-import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.ColorProperty;
 import org.apache.fop.fo.properties.ColumnNumberPropertyMaker;
 import org.apache.fop.fo.properties.CondLengthProperty;
 import org.apache.fop.fo.properties.CorrespondingPropertyMaker;
@@ -100,154 +100,7 @@
     public void createGenerics() {
         PropertyMaker sub;
 
-        genericColor = new ColorTypeProperty.Maker(0);
-        genericColor.addKeyword("aliceblue", "#f0f8ff");
-        genericColor.addKeyword("antiquewhite", "#faebd7");
-        genericColor.addKeyword("aqua", "#00ffff");
-        genericColor.addKeyword("aquamarine", "#7fffd4");
-        genericColor.addKeyword("azure", "#f0ffff");
-        genericColor.addKeyword("beige", "#f5f5dc");
-        genericColor.addKeyword("bisque", "#ffe4c4");
-        genericColor.addKeyword("black", "#000000");
-        genericColor.addKeyword("blanchedalmond", "#ffebcd");
-        genericColor.addKeyword("blue", "#0000ff");
-        genericColor.addKeyword("blueviolet", "#8a2be2");
-        genericColor.addKeyword("brown", "#a52a2a");
-        genericColor.addKeyword("burlywood", "#deb887");
-        genericColor.addKeyword("cadetblue", "#5f9ea0");
-        genericColor.addKeyword("chartreuse", "#7fff00");
-        genericColor.addKeyword("chocolate", "#d2691e");
-        genericColor.addKeyword("coral", "#ff7f50");
-        genericColor.addKeyword("cornflowerblue", "#6495ed");
-        genericColor.addKeyword("cornsilk", "#fff8dc");
-        genericColor.addKeyword("crimson", "#dc143c");
-        genericColor.addKeyword("cyan", "#00ffff");
-        genericColor.addKeyword("darkblue", "#00008b");
-        genericColor.addKeyword("darkcyan", "#008b8b");
-        genericColor.addKeyword("darkgoldenrod", "#b8860b");
-        genericColor.addKeyword("darkgray", "#a9a9a9");
-        genericColor.addKeyword("darkgreen", "#006400");
-        genericColor.addKeyword("darkgrey", "#a9a9a9");
-        genericColor.addKeyword("darkkhaki", "#bdb76b");
-        genericColor.addKeyword("darkmagenta", "#8b008b");
-        genericColor.addKeyword("darkolivegreen", "#556b2f");
-        genericColor.addKeyword("darkorange", "#ff8c00");
-        genericColor.addKeyword("darkorchid", "#9932cc");
-        genericColor.addKeyword("darkred", "#8b0000");
-        genericColor.addKeyword("darksalmon", "#e9967a");
-        genericColor.addKeyword("darkseagreen", "#8fbc8f");
-        genericColor.addKeyword("darkslateblue", "#483d8b");
-        genericColor.addKeyword("darkslategray", "#2f4f4f");
-        genericColor.addKeyword("darkslategrey", "#2f4f4f");
-        genericColor.addKeyword("darkturquoise", "#00ced1");
-        genericColor.addKeyword("darkviolet", "#9400d3");
-        genericColor.addKeyword("deeppink", "#ff1493");
-        genericColor.addKeyword("deepskyblue", "#00bfff");
-        genericColor.addKeyword("dimgray", "#696969");
-        genericColor.addKeyword("dimgrey", "#696969");
-        genericColor.addKeyword("dodgerblue", "#1e90ff");
-        genericColor.addKeyword("firebrick", "#b22222");
-        genericColor.addKeyword("floralwhite", "#fffaf0");
-        genericColor.addKeyword("forestgreen", "#228b22");
-        genericColor.addKeyword("fuchsia", "#ff00ff");
-        genericColor.addKeyword("gainsboro", "#dcdcdc");
-        genericColor.addKeyword("lightpink", "#ffb6c1");
-        genericColor.addKeyword("lightsalmon", "#ffa07a");
-        genericColor.addKeyword("lightseagreen", "#20b2aa");
-        genericColor.addKeyword("lightskyblue", "#87cefa");
-        genericColor.addKeyword("lightslategray", "#778899");
-        genericColor.addKeyword("lightslategrey", "#778899");
-        genericColor.addKeyword("lightsteelblue", "#b0c4de");
-        genericColor.addKeyword("lightyellow", "#ffffe0");
-        genericColor.addKeyword("lime", "#00ff00");
-        genericColor.addKeyword("limegreen", "#32cd32");
-        genericColor.addKeyword("linen", "#faf0e6");
-        genericColor.addKeyword("magenta", "#ff00ff");
-        genericColor.addKeyword("maroon", "#800000");
-        genericColor.addKeyword("mediumaquamarine", "#66cdaa");
-        genericColor.addKeyword("mediumblue", "#0000cd");
-        genericColor.addKeyword("mediumorchid", "#ba55d3");
-        genericColor.addKeyword("mediumpurple", "#9370db");
-        genericColor.addKeyword("mediumseagreen", "#3cb371");
-        genericColor.addKeyword("mediumslateblue", "#7b68ee");
-        genericColor.addKeyword("mediumspringgreen", "#00fa9a");
-        genericColor.addKeyword("mediumturquoise", "#48d1cc");
-        genericColor.addKeyword("mediumvioletred", "#c71585");
-        genericColor.addKeyword("midnightblue", "#191970");
-        genericColor.addKeyword("mintcream", "#f5fffa");
-        genericColor.addKeyword("mistyrose", "#ffe4e1");
-        genericColor.addKeyword("moccasin", "#ffe4b5");
-        genericColor.addKeyword("navajowhite", "#ffdead");
-        genericColor.addKeyword("navy", "#000080");
-        genericColor.addKeyword("oldlace", "#fdf5e6");
-        genericColor.addKeyword("olive", "#808000");
-        genericColor.addKeyword("olivedrab", "#6b8e23");
-        genericColor.addKeyword("orange", "#ffa500");
-        genericColor.addKeyword("orangered", "#ff4500");
-        genericColor.addKeyword("orchid", "#da70d6");
-        genericColor.addKeyword("palegoldenrod", "#eee8aa");
-        genericColor.addKeyword("palegreen", "#98fb98");
-        genericColor.addKeyword("paleturquoise", "#afeeee");
-        genericColor.addKeyword("palevioletred", "#db7093");
-        genericColor.addKeyword("papayawhip", "#ffefd5");
-        genericColor.addKeyword("peachpuff", "#ffdab9");
-        genericColor.addKeyword("peru", "#cd853f");
-        genericColor.addKeyword("pink", "#ffc0cb");
-        genericColor.addKeyword("plum", "#dda0dd");
-        genericColor.addKeyword("powderblue", "#b0e0e6");
-        genericColor.addKeyword("purple", "#800080");
-        genericColor.addKeyword("red", "#ff0000");
-        genericColor.addKeyword("rosybrown", "#bc8f8f");
-        genericColor.addKeyword("royalblue", "#4169e1");
-        genericColor.addKeyword("saddlebrown", "#8b4513");
-        genericColor.addKeyword("salmon", "#fa8072");
-        genericColor.addKeyword("ghostwhite", "#f8f8ff");
-        genericColor.addKeyword("gold", "#ffd700");
-        genericColor.addKeyword("goldenrod", "#daa520");
-        genericColor.addKeyword("gray", "#808080");
-        genericColor.addKeyword("grey", "#808080");
-        genericColor.addKeyword("green", "#008000");
-        genericColor.addKeyword("greenyellow", "#adff2f");
-        genericColor.addKeyword("honeydew", "#f0fff0");
-        genericColor.addKeyword("hotpink", "#ff69b4");
-        genericColor.addKeyword("indianred", "#cd5c5c");
-        genericColor.addKeyword("indigo", "#4b0082");
-        genericColor.addKeyword("ivory", "#fffff0");
-        genericColor.addKeyword("khaki", "#f0e68c");
-        genericColor.addKeyword("lavender", "#e6e6fa");
-        genericColor.addKeyword("lavenderblush", "#fff0f5");
-        genericColor.addKeyword("lawngreen", "#7cfc00");
-        genericColor.addKeyword("lemonchiffon", "#fffacd");
-        genericColor.addKeyword("lightblue", "#add8e6");
-        genericColor.addKeyword("lightcoral", "#f08080");
-        genericColor.addKeyword("lightcyan", "#e0ffff");
-        genericColor.addKeyword("lightgoldenrodyellow", "#fafad2");
-        genericColor.addKeyword("lightgray", "#d3d3d3");
-        genericColor.addKeyword("lightgreen", "#90ee90");
-        genericColor.addKeyword("lightgrey", "#d3d3d3");
-        genericColor.addKeyword("sandybrown", "#f4a460");
-        genericColor.addKeyword("seagreen", "#2e8b57");
-        genericColor.addKeyword("seashell", "#fff5ee");
-        genericColor.addKeyword("sienna", "#a0522d");
-        genericColor.addKeyword("silver", "#c0c0c0");
-        genericColor.addKeyword("skyblue", "#87ceeb");
-        genericColor.addKeyword("slateblue", "#6a5acd");
-        genericColor.addKeyword("slategray", "#708090");
-        genericColor.addKeyword("slategrey", "#708090");
-        genericColor.addKeyword("snow", "#fffafa");
-        genericColor.addKeyword("springgreen", "#00ff7f");
-        genericColor.addKeyword("steelblue", "#4682b4");
-        genericColor.addKeyword("tan", "#d2b48c");
-        genericColor.addKeyword("teal", "#008080");
-        genericColor.addKeyword("thistle", "#d8bfd8");
-        genericColor.addKeyword("tomato", "#ff6347");
-        genericColor.addKeyword("turquoise", "#40e0d0");
-        genericColor.addKeyword("violet", "#ee82ee");
-        genericColor.addKeyword("wheat", "#f5deb3");
-        genericColor.addKeyword("white", "#ffffff");
-        genericColor.addKeyword("whitesmoke", "#f5f5f5");
-        genericColor.addKeyword("yellow", "#ffff00");
-        genericColor.addKeyword("yellowgreen", "#9acd32");
+        genericColor = new ColorProperty.Maker(0);
 
         // GenericBoolean
         genericBoolean = new EnumProperty.Maker(0);
@@ -689,12 +542,12 @@
         addPropertyMaker("background-attachment", m);
 
         // background-color
-        m  = new ColorTypeProperty.Maker(PR_BACKGROUND_COLOR) {
+        m  = new ColorProperty.Maker(PR_BACKGROUND_COLOR) {
             protected Property convertPropertyDatatype(
                     Property p, PropertyList propertyList, FObj fo) throws PropertyException {
                 String nameval = p.getNCname();
                 if (nameval != null) {
-                    return new ColorTypeProperty(nameval);
+                    return new ColorProperty(nameval);
                 }
                 return super.convertPropertyDatatype(p, propertyList, fo);
             }
@@ -743,7 +596,7 @@
         addPropertyMaker("background-position-vertical", m);
 
         // border-before-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_BEFORE_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_BEFORE_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -773,7 +626,7 @@
         addPropertyMaker("border-before-width", m);
 
         // border-after-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_AFTER_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_AFTER_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -803,7 +656,7 @@
         addPropertyMaker("border-after-width", m);
 
         // border-start-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_START_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_START_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -833,7 +686,7 @@
         addPropertyMaker("border-start-width", m);
 
         // border-end-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_END_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_END_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -863,7 +716,7 @@
         addPropertyMaker("border-end-width", m);
 
         // border-top-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_TOP_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_TOP_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -899,7 +752,7 @@
         addPropertyMaker("border-top-width", bwm);
 
         // border-bottom-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_BOTTOM_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_BOTTOM_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -935,7 +788,7 @@
         addPropertyMaker("border-bottom-width", bwm);
 
         // border-left-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_LEFT_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_LEFT_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -971,7 +824,7 @@
         addPropertyMaker("border-left-width", bwm);
 
         // border-right-color
-        m  = new ColorTypeProperty.Maker(PR_BORDER_RIGHT_COLOR);
+        m  = new ColorProperty.Maker(PR_BORDER_RIGHT_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(false);
         m.setDefault("black");
@@ -1844,7 +1697,7 @@
         PropertyMaker m;
 
         // color
-        m  = new ColorTypeProperty.Maker(PR_COLOR);
+        m  = new ColorProperty.Maker(PR_COLOR);
         m.useGeneric(genericColor);
         m.setInherited(true);
         m.setDefault("black");

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOText.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOText.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOText.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOText.java Wed May  3 00:21:02 2006
@@ -19,11 +19,11 @@
 package org.apache.fop.fo;
 
 // Java
+import java.awt.Color;
 import java.util.NoSuchElementException;
 
 // FOP
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.flow.Block;
 import org.apache.fop.fo.pagination.Root;
@@ -77,7 +77,7 @@
     // The value of properties relevant for character.
     private CommonFont commonFont;
     private CommonHyphenation commonHyphenation;
-    private ColorType color;
+    private Color color;
     private Property letterSpacing;
     private SpaceProperty lineHeight;
     private int whiteSpaceTreatment;
@@ -156,7 +156,7 @@
         commonFont = pList.getFontProps();
         commonHyphenation = pList.getHyphenationProps();
         
-        color = pList.get(Constants.PR_COLOR).getColorType();
+        color = pList.get(Constants.PR_COLOR).getColor();
         lineHeight = pList.get(Constants.PR_LINE_HEIGHT).getSpace();
         letterSpacing = pList.get(Constants.PR_LETTER_SPACING);
         whiteSpaceCollapse = pList.get(Constants.PR_WHITE_SPACE_COLLAPSE).getEnum();
@@ -561,7 +561,7 @@
     /**
      * @return the "color" property.
      */
-    public ColorType getColor() {
+    public Color getColor() {
         return color;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NCnameProperty.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NCnameProperty.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NCnameProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NCnameProperty.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,10 @@
 
 package org.apache.fop.fo.expr;
 
+import java.awt.Color;
+
 import org.apache.fop.fo.properties.Property;
-import org.apache.fop.datatypes.ColorType;
+import org.apache.fop.util.ColorUtil;
 
 /**
  * Class for handling NC Name objects
@@ -37,13 +39,17 @@
     }
 
     /**
-     * If a system color, return the corresponding value (appears to be
-     * unimplemented)
-     * @return ColorType object corresponding to the NCName
-     * @throws PropertyException in all cases currently
+     * If a system color, return the corresponding value.
+     * 
+     * @return Color object corresponding to the NCName
      */
-    public ColorType getColor() throws PropertyException {
-        throw new PropertyException("Not a Color");
+    public Color getColor()  {
+        try { 
+            return ColorUtil.parseColorString(ncName);
+        } catch (PropertyException e) {
+            //TODO: This should probably print an error message?
+            return null;
+        }
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NumericProperty.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NumericProperty.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NumericProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/NumericProperty.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@
  
 package org.apache.fop.fo.expr;
 
+import java.awt.Color;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.Numeric;
-import org.apache.fop.fo.properties.ColorTypeProperty;
 import org.apache.fop.fo.properties.Property;
 
 /**
@@ -75,38 +75,27 @@
         return true;
     }
 
-    /**
-     * Cast this as a Numeric.
-     */
+    /** @see org.apache.fop.fo.properties.Property#getNumeric() */
     public Numeric getNumeric() {
         return this;
     }
 
-    /**
-     * Cast this as a number.
-     */
+    /** @see org.apache.fop.fo.properties.Property#getNumber() */
     public Number getNumber() {
         return new Double(value);
     }
 
-    /**
-     * @see org.apache.fop.datatypes.Numeric#getValue()
-     */
+    /** @see org.apache.fop.datatypes.Numeric#getValue() */
     public int getValue() {
         return (int) value;
     }
 
-    /**
-     * @see org.apache.fop.datatypes.Numeric#getValue(PercentBaseContext)
-     */
+    /** @see org.apache.fop.datatypes.Numeric#getValue(PercentBaseContext) */
     public int getValue(PercentBaseContext context) {
         return (int) value;
     }
 
-    /**
-     * Cast this as a length. That is only possible when the dimension is 
-     * one.
-     */
+    /** @see org.apache.fop.fo.properties.Property#getLength() */
     public Length getLength() {
         if (dim == 1) {
             return this;
@@ -115,25 +104,18 @@
         return null;
     }
 
-    /**
-     * Cast this as a ColorTypeProperty.
-     */
-    public ColorTypeProperty getColorType() {
-        // try converting to numeric number and then to color
+    /** @see org.apache.fop.fo.properties.Property#getColor() */
+    public Color getColor() {
+        // TODO:  try converting to numeric number and then to color
         return null;
     }
 
-    /**
-     * Cast this as an Object.
-     */
+    /** @see org.apache.fop.fo.properties.Property#getObject() */
     public Object getObject() {
         return this;
     }
 
-    /**
-     * Return a string representation of this Numeric. It is only useable for
-     * debugging.
-     */
+    /** @see java.lang.Object#toString() */
     public String toString() {
         if (dim == 1) {
             return (int) value + "mpt";

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/PropertyParser.java Wed May  3 00:21:02 2006
@@ -20,7 +20,7 @@
 
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.datatypes.PercentBase;
-import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.ColorProperty;
 import org.apache.fop.fo.properties.FixedLength;
 import org.apache.fop.fo.properties.ListProperty;
 import org.apache.fop.fo.properties.NumberProperty;
@@ -296,7 +296,7 @@
             break;
 
         case TOK_COLORSPEC:
-            prop = new ColorTypeProperty(currentTokenValue);
+            prop = new ColorProperty(currentTokenValue);
             break;
 
         case TOK_FUNCTION_LPAR:

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/RGBColorFunction.java Wed May  3 00:21:02 2006
@@ -20,7 +20,7 @@
 
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.PercentBase;
-import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.ColorProperty;
 import org.apache.fop.fo.properties.Property;
 
 /**
@@ -45,7 +45,7 @@
     /** @see org.apache.fop.fo.expr.Function */
     public Property eval(Property[] args,
                          PropertyInfo pInfo) throws PropertyException {
-        return new ColorTypeProperty("rgb(" + args[0] + "," + args[1] + "," + args[2] + ")");
+        return new ColorProperty("rgb(" + args[0] + "," + args[1] + "," + args[2] + ")");
 
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/SystemColorFunction.java Wed May  3 00:21:02 2006
@@ -18,7 +18,7 @@
  
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.fo.properties.ColorTypeProperty;
+import org.apache.fop.fo.properties.ColorProperty;
 import org.apache.fop.fo.properties.Property;
 
 /**
@@ -34,7 +34,7 @@
     /** @see org.apache.fop.fo.expr.Function */
     public Property eval(Property[] args,
                          PropertyInfo pInfo) throws PropertyException {
-        return new ColorTypeProperty("system-color(" + args[0] + ")");
+        return new ColorProperty("system-color(" + args[0] + ")");
 
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BidiOverride.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BidiOverride.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BidiOverride.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/BidiOverride.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,18 +18,18 @@
 
 package org.apache.fop.fo.flow;
 
-import org.xml.sax.Locator;
+import java.awt.Color;
 
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObjMixed;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.properties.ColorTypeProperty;
 import org.apache.fop.fo.properties.CommonAural;
 import org.apache.fop.fo.properties.CommonFont;
 import org.apache.fop.fo.properties.CommonRelativePosition;
 import org.apache.fop.fo.properties.SpaceProperty;
+import org.xml.sax.Locator;
 
 /**
  * fo:bidi-override element.
@@ -44,7 +44,7 @@
     private CommonAural commonAural;
     private CommonFont commonFont;
     private CommonRelativePosition commonRelativePosition;
-    private ColorTypeProperty prColor;
+    private Color prColor;
     // private ToBeImplementedProperty prDirection;
     // private ToBeImplementedProperty prLetterSpacing;
     private SpaceProperty lineHeight;
@@ -86,7 +86,7 @@
         commonAural = pList.getAuralProps();
         commonFont = pList.getFontProps();
         commonRelativePosition = pList.getRelativePositionProps();
-        prColor = pList.get(PR_COLOR).getColorType();
+        prColor = pList.get(PR_COLOR).getColor();
         // prDirection = pList.get(PR_DIRECTION);
         // prLetterSpacing = pList.get(PR_LETTER_SPACING);
         lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Block.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,14 +14,15 @@
  * limitations under the License.
  */
 
-/* $Id: Block.java,v 1.14 2004/04/02 13:50:52 cbowditch Exp $ */
+/* $Id$ */
 
 package org.apache.fop.fo.flow;
 
+import java.awt.Color;
+
 import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.fo.CharIterator;
@@ -73,7 +74,7 @@
     private CommonRelativePosition commonRelativePosition;
     private int breakAfter;
     private int breakBefore;
-    private ColorType color;
+    private Color color;
     private Length textDepth;
     private Length textAltitude;
     private int hyphenationKeep;
@@ -100,9 +101,6 @@
     private int wrapOption;
     // End of property values
     
-    // this may be helpful on other FOs too
-    private boolean anythingLaidOut = false;
-
     /**
      * @param parent FONode that is the parent of this object
      *
@@ -125,7 +123,7 @@
 
         breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
         breakBefore = pList.get(PR_BREAK_BEFORE).getEnum();
-        color = pList.get(PR_COLOR).getColorType();
+        color = pList.get(PR_COLOR).getColor();
         textDepth = pList.get(PR_TEXT_DEPTH).getLength();
         textAltitude = pList.get(PR_TEXT_ALTITUDE).getLength();
         hyphenationKeep = pList.get(PR_HYPHENATION_KEEP).getEnum();
@@ -244,7 +242,7 @@
     /**
      * @return the "color" property.
      */
-    public ColorType getColor() {
+    public Color getColor() {
         return color;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Character.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,10 @@
 
 package org.apache.fop.fo.flow;
 
+import java.awt.Color;
+import java.util.NoSuchElementException;
+
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.CharIterator;
 import org.apache.fop.fo.FONode;
@@ -37,11 +39,8 @@
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.util.CharUtilities;
-
 import org.xml.sax.Locator;
 
-import java.util.NoSuchElementException;
-
 /**
  * This class represents the flow object 'fo:character'. Its use is defined by
  * the spec: "The fo:character flow object represents a character that is mapped to
@@ -68,7 +67,7 @@
     private int alignmentBaseline;
     private Length baselineShift;
     private char character;
-    private ColorType color;
+    private Color color;
     private int dominantBaseline;
     private Length textDepth;
     private Length textAltitude;
@@ -117,7 +116,7 @@
         alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE).getEnum();
         baselineShift = pList.get(PR_BASELINE_SHIFT).getLength();
         character = pList.get(PR_CHARACTER).getCharacter();
-        color = pList.get(PR_COLOR).getColorType();
+        color = pList.get(PR_COLOR).getColor();
         dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum();
         textDepth = pList.get(PR_TEXT_DEPTH).getLength();
         textAltitude = pList.get(PR_TEXT_ALTITUDE).getLength();
@@ -192,7 +191,7 @@
     /**
      * @return the "color" property.
      */
-    public ColorType getColor() {
+    public Color getColor() {
         return color;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InitialPropertySet.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InitialPropertySet.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InitialPropertySet.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InitialPropertySet.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,15 +19,15 @@
 package org.apache.fop.fo.flow;
 
 // XML
+import java.awt.Color;
+
 import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.properties.ColorTypeProperty;
 import org.apache.fop.fo.properties.CommonAccessibility;
 import org.apache.fop.fo.properties.CommonAural;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -45,7 +45,7 @@
     private CommonBorderPaddingBackground commonBorderPaddingBackground;
     private CommonFont commonFont;
     private CommonRelativePosition commonRelativePosition;
-    private ColorTypeProperty color;
+    private Color color;
     private String id;
     // private ToBeImplementedProperty letterSpacing;
     private SpaceProperty lineHeight;
@@ -72,7 +72,7 @@
         commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
         commonFont = pList.getFontProps();
         commonRelativePosition = pList.getRelativePositionProps();
-        color = pList.get(PR_COLOR).getColorType();
+        color = pList.get(PR_COLOR).getColor();
         id = pList.get(PR_ID).getString();
         // letterSpacing = pList.get(PR_LETTER_SPACING);
         lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InlineLevel.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InlineLevel.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InlineLevel.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/InlineLevel.java Wed May  3 00:21:02 2006
@@ -18,9 +18,9 @@
 
 package org.apache.fop.fo.flow;
 
+import java.awt.Color;
+
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
-import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObjMixed;
 import org.apache.fop.fo.PropertyList;
@@ -43,7 +43,7 @@
     protected CommonMarginInline commonMarginInline;
     protected CommonAural commonAural;
     protected CommonFont commonFont;
-    protected ColorType color;
+    protected Color color;
     protected SpaceProperty lineHeight;
     protected int visibility;
     // End of property values
@@ -64,7 +64,7 @@
         commonMarginInline = pList.getMarginInlineProps();
         commonAural = pList.getAuralProps();
         commonFont = pList.getFontProps();
-        color = pList.get(PR_COLOR).getColorType();
+        color = pList.get(PR_COLOR).getColor();
         lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
         visibility = pList.get(PR_VISIBILITY).getEnum();
     }
@@ -93,7 +93,7 @@
     /**
      * @return the "color" property.
      */
-    public ColorType getColor() {
+    public Color getColor() {
         return color;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumber.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,10 +18,11 @@
 
 package org.apache.fop.fo.flow;
 
+import java.awt.Color;
+
 import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
@@ -71,7 +72,7 @@
     //  End of property values
 
     // Properties which are not explicitely listed but are still applicable 
-    private ColorType color;
+    private Color color;
     
     /**
      * @param parent FONode that is the parent of this object
@@ -110,7 +111,7 @@
         wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
 
         // implicit properties
-        color = pList.get(Constants.PR_COLOR).getColorType();
+        color = pList.get(Constants.PR_COLOR).getColor();
     }
 
     /**
@@ -143,7 +144,7 @@
     }
 
     /** @return the "color" property. */
-    public ColorType getColor() {
+    public Color getColor() {
         return color;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/PageNumberCitation.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,10 +18,11 @@
 
 package org.apache.fop.fo.flow;
 
+import java.awt.Color;
+
 import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
@@ -75,7 +76,7 @@
     // End of property values
 
     // Properties which are not explicitely listed but are still applicable 
-    private ColorType color;
+    private Color color;
 
     /**
      * @param parent FONode that is the parent of this object
@@ -115,7 +116,7 @@
         wrapOption = pList.get(PR_WRAP_OPTION).getEnum();
         
         // implicit properties
-        color = pList.get(Constants.PR_COLOR).getColorType();
+        color = pList.get(Constants.PR_COLOR).getColor();
     }
 
     /**
@@ -143,7 +144,7 @@
     }
 
     /** @return the "color" property. */
-    public ColorType getColor() {
+    public Color getColor() {
         return color;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/pagination/ColorProfile.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/pagination/ColorProfile.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/pagination/ColorProfile.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/pagination/ColorProfile.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,23 +19,23 @@
 package org.apache.fop.fo.pagination;
 
 // Java
+import java.awt.Color;
 import java.awt.color.ICC_ColorSpace;
 import java.awt.color.ICC_Profile;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 
-import org.xml.sax.Locator;
-
 import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
+import org.xml.sax.Locator;
 
 /**
  * The fo:color-profile formatting object.
+ * TODO: This needs to be implemented properly!
  * This loads the color profile when needed and resolves a requested color.
  */
 public class ColorProfile extends FObj {
@@ -89,7 +89,7 @@
      * @param defB integer value for blue channel (0-255)?
      * @return the ColorType object corresponding to the input
      */
-    public ColorType getColor(int[] colorVals, int defR, int defG, int defB) {
+    public Color getColor(int[] colorVals, int defR, int defG, int defB) {
         // float[] rgbvals = colorSpace.toRGB(colorVals);
         // return new ColorType(rgbvals);
         return null;

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColorProperty.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColorProperty.java?rev=399185&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColorProperty.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColorProperty.java Wed May  3 00:21:02 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 1999-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: ColorTypeProperty.java 377045 2006-02-11 20:23:47Z jeremias $ */
+
+package org.apache.fop.fo.properties;
+
+import java.awt.Color;
+
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.util.ColorUtil;
+
+/**
+ * Superclass for properties that wrap Color values
+ */
+public class ColorProperty extends Property  {
+    
+    /**
+     * The color represented by this property.
+     */
+    protected final Color color;
+
+    
+    /**
+     * Inner class for creating instances of ColorTypeProperty
+     */
+    public static class Maker extends PropertyMaker {
+
+        /**
+         * @param propId the id of the property for which a Maker should be created
+         */
+        public Maker(int propId) {
+            super(propId);
+        }
+
+        /**
+         * Return a ColorProperty object based on the passed Property object.
+         * This method is called if the Property object built by the parser
+         * isn't the right type for this property.
+         * 
+         * @param p
+         *            The Property object return by the expression parser
+         * @param propertyList
+         *            The PropertyList object being built for this FO.
+         * @param fo
+         *            The parent FO for the FO whose property is being made.
+         * @return A Property of the correct type or null if the parsed value
+         *         can't be converted to the correct type.
+         * @throws PropertyException
+         *             for invalid or inconsistent FO input
+         * @see org.apache.fop.fo.properties.PropertyMaker#convertProperty(
+         *          org.apache.fop.fo.properties.Property,
+         *      org.apache.fop.fo.PropertyList, org.apache.fop.fo.FObj)
+         */
+        public Property convertProperty(Property p,
+                                        PropertyList propertyList, FObj fo) 
+                    throws PropertyException {
+            if (p instanceof ColorProperty) {
+                return p;
+            }
+            Color val = p.getColor();
+            if (val != null) {
+                return new ColorProperty(val);
+            }
+            return convertPropertyDatatype(p, propertyList, fo);
+        }
+
+    }
+
+
+    /**
+     * Set the color given a particular String. For a full List of supported
+     * values please see ColorUtil.
+     * 
+     * @param value RGB value as String to be parsed
+     * @throws PropertyException if the value can't be parsed
+     * @see ColorUtil#parseColorString(String)
+     */
+    public ColorProperty(String value) throws PropertyException {
+        this.color = ColorUtil.parseColorString(value);
+    }
+
+    /**
+     * Create a new ColorProperty with a given color.
+     * 
+     * @param value the color to use.
+     */
+    public ColorProperty(Color value) {
+        this.color = value;
+    }
+    
+    /**
+     * Returns an AWT instance of this color
+     * @return float the AWT color represented by this ColorType instance
+     */
+    public Color getColor() {
+        return color;
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return ColorUtil.colorTOsRGBString(color);
+    }
+
+    /**
+     * Can't convert to any other types
+     * @return this.colorType
+     */
+    public ColorProperty getColorProperty() {
+        return this;
+    }
+
+    /**
+     * @return this.colorType cast as an Object
+     */
+    public Object getObject() {
+        return this;
+    }
+}
+

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/ColorProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-2005 The Apache Software Foundation.
+ * Copyright 2004-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,9 @@
 
 package org.apache.fop.fo.properties;
 
+import java.awt.Color;
+
 import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.Constants;
@@ -42,7 +43,7 @@
     /**
      * The "background-color" property.
      */
-    public ColorType backgroundColor;
+    public Color backgroundColor;
 
     /**
      * The "background-image" property.
@@ -79,10 +80,10 @@
     
     public static class BorderInfo implements Cloneable {
         private int mStyle; // Enum for border style
-        private ColorType mColor; // Border color
+        private Color mColor; // Border color
         private CondLengthProperty mWidth;
 
-        BorderInfo(int style, CondLengthProperty width, ColorType color) {
+        BorderInfo(int style, CondLengthProperty width, Color color) {
             mStyle = style;
             mWidth = width;
             mColor = color;
@@ -92,7 +93,7 @@
             return this.mStyle;
         }
         
-        public ColorType getColor() {
+        public Color getColor() {
             return this.mColor;
         }
         
@@ -142,7 +143,7 @@
     public CommonBorderPaddingBackground(PropertyList pList, FObj fobj) throws PropertyException {
         
         backgroundAttachment = pList.get(Constants.PR_BACKGROUND_ATTACHMENT).getEnum();
-        backgroundColor = pList.get(Constants.PR_BACKGROUND_COLOR).getColorType();
+        backgroundColor = pList.get(Constants.PR_BACKGROUND_COLOR).getColor();
         if (backgroundColor.getAlpha() == 0) {
             backgroundColor = null;
         }
@@ -206,7 +207,7 @@
         if (style != Constants.EN_NONE) {
             setBorderInfo(new BorderInfo(style,
                 pList.get(widthProp).getCondLength(),
-                pList.get(colorProp).getColorType()), side);
+                pList.get(colorProp).getColor()), side);
         }
     }
     
@@ -286,7 +287,7 @@
         }
     }
 
-    public ColorType getBorderColor(int side) {
+    public Color getBorderColor(int side) {
         if (borderInfo[side] != null) {
             return borderInfo[side].mColor;
         } else {
@@ -341,18 +342,19 @@
      * @return all the padding and border height.
      */
     public int getBPPaddingAndBorder(boolean bDiscard, PercentBaseContext context) {
-        return getPaddingBefore(bDiscard, context) + getPaddingAfter(bDiscard, context) +
-               getBorderBeforeWidth(bDiscard) + getBorderAfterWidth(bDiscard);        
+        return getPaddingBefore(bDiscard, context) + getPaddingAfter(bDiscard, context)
+               + getBorderBeforeWidth(bDiscard) + getBorderAfterWidth(bDiscard);        
     }
 
+    /** @see java.lang.Object#toString() */
     public String toString() {
-        return "CommonBordersAndPadding (Before, After, Start, End):\n" +
-        "Borders: (" + getBorderBeforeWidth(false) + ", " + getBorderAfterWidth(false) + ", " +
-        getBorderStartWidth(false) + ", " + getBorderEndWidth(false) + ")\n" +
-        "Border Colors: (" + getBorderColor(BEFORE) + ", " + getBorderColor(AFTER) + ", " +
-        getBorderColor(START) + ", " + getBorderColor(END) + ")\n" +
-        "Padding: (" + getPaddingBefore(false, null) + ", " + getPaddingAfter(false, null) + ", " +
-        getPaddingStart(false, null) + ", " + getPaddingEnd(false, null) + ")\n";
+        return "CommonBordersAndPadding (Before, After, Start, End):\n"
+            + "Borders: (" + getBorderBeforeWidth(false) + ", " + getBorderAfterWidth(false) + ", "
+            + getBorderStartWidth(false) + ", " + getBorderEndWidth(false) + ")\n"
+            + "Border Colors: (" + getBorderColor(BEFORE) + ", " + getBorderColor(AFTER) + ", "
+            + getBorderColor(START) + ", " + getBorderColor(END) + ")\n"
+            + "Padding: (" + getPaddingBefore(false, null) + ", " + getPaddingAfter(false, null) 
+            + ", " + getPaddingStart(false, null) + ", " + getPaddingEnd(false, null) + ")\n";
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java Wed May  3 00:21:02 2006
@@ -21,7 +21,7 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.fop.datatypes.ColorType;
+import java.awt.Color;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.expr.PropertyException;
@@ -38,9 +38,9 @@
     private static final int BLINK        = 8;
     
     private int decoration;
-    private ColorType underColor;
-    private ColorType overColor;
-    private ColorType throughColor;
+    private Color underColor;
+    private Color overColor;
+    private Color throughColor;
     
     /**
      * Creates a new CommonTextDecoration object with default values.
@@ -85,33 +85,33 @@
                         deco = new CommonTextDecoration();
                     }
                     deco.decoration |= UNDERLINE;
-                    deco.underColor = pList.get(Constants.PR_COLOR).getColorType();
+                    deco.underColor = pList.get(Constants.PR_COLOR).getColor();
                 } else if (propEnum == Constants.EN_NO_UNDERLINE) {
                     if (deco != null) {
                         deco.decoration &= OVERLINE | LINE_THROUGH | BLINK;
-                        deco.underColor = pList.get(Constants.PR_COLOR).getColorType();
+                        deco.underColor = pList.get(Constants.PR_COLOR).getColor();
                     }
                 } else if (propEnum == Constants.EN_OVERLINE) {
                     if (deco == null) {
                         deco = new CommonTextDecoration();
                     }
                     deco.decoration |= OVERLINE;
-                    deco.overColor = pList.get(Constants.PR_COLOR).getColorType();
+                    deco.overColor = pList.get(Constants.PR_COLOR).getColor();
                 } else if (propEnum == Constants.EN_NO_OVERLINE) {
                     if (deco != null) {
                         deco.decoration &= UNDERLINE | LINE_THROUGH | BLINK;
-                        deco.overColor = pList.get(Constants.PR_COLOR).getColorType();
+                        deco.overColor = pList.get(Constants.PR_COLOR).getColor();
                     }
                 } else if (propEnum == Constants.EN_LINE_THROUGH) {
                     if (deco == null) {
                         deco = new CommonTextDecoration();
                     }
                     deco.decoration |= LINE_THROUGH;
-                    deco.throughColor = pList.get(Constants.PR_COLOR).getColorType();
+                    deco.throughColor = pList.get(Constants.PR_COLOR).getColor();
                 } else if (propEnum == Constants.EN_NO_LINE_THROUGH) {
                     if (deco != null) {
                         deco.decoration &= UNDERLINE | OVERLINE | BLINK;
-                        deco.throughColor = pList.get(Constants.PR_COLOR).getColorType();
+                        deco.throughColor = pList.get(Constants.PR_COLOR).getColor();
                     }
                 } else if (propEnum == Constants.EN_BLINK) {
                     if (deco == null) {
@@ -151,17 +151,17 @@
     }
     
     /** @return the color of the underline mark */
-    public ColorType getUnderlineColor() {
+    public Color getUnderlineColor() {
         return this.underColor;
     }
     
     /** @return the color of the overline mark */
-    public ColorType getOverlineColor() {
+    public Color getOverlineColor() {
         return this.overColor;
     }
 
     /** @return the color of the line-through mark */
-    public ColorType getLineThroughColor() {
+    public Color getLineThroughColor() {
         return this.throughColor;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/NumberProperty.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/NumberProperty.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/NumberProperty.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/NumberProperty.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2004,2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,10 @@
 
 package org.apache.fop.fo.properties;
 
-import org.apache.fop.datatypes.PercentBaseContext;
+import java.awt.Color;
+
 import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.expr.PropertyException;
@@ -118,6 +120,7 @@
         return getNumericValue();
     }
 
+    /** @see org.apache.fop.datatypes.Numeric#getValue() */
     public int getValue() {
         return number.intValue();
     }
@@ -164,13 +167,14 @@
     }
 
     /**
-     * Convert NumberProperty to a ColorType. Not sure why this is needed.
-     * @return ColorType that corresponds to black
+     * Convert NumberProperty to a Color. Not sure why this is needed.
+     * @return Color that corresponds to black
      */
-    public ColorTypeProperty getColorType() {
+    public Color getColor() {
+        // TODO: Implement somehow
         // Convert numeric value to color ???
         // Convert to hexadecimal and then try to make it into a color?
-        return new ColorTypeProperty((float)0.0, (float)0.0, (float)0.0);
+        return Color.black;
     }
 
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/Property.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/Property.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/Property.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/Property.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 package org.apache.fop.fo.properties;
 
 import java.util.List;
+import java.awt.Color;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -29,7 +30,6 @@
 
 /**
  * Base class for all property objects
- * @author unascribed
  */
 public class Property {
     
@@ -44,10 +44,10 @@
 
     /**
      * Set the original value specified for the property attribute.
-     * @param specVal The specified value.
+     * @param value The specified value.
      */
-    public void setSpecifiedValue(String specVal) {
-        this.specVal = specVal;
+    public void setSpecifiedValue(String value) {
+        this.specVal = value;
     }
 
     /**
@@ -75,7 +75,7 @@
      * This method expects to be overridden by subclasses
      * @return ColorType property value
      */
-    public ColorTypeProperty getColorType() {
+    public Color getColor() {
         return null;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/JAIImage.java Wed May  3 00:21:02 2006
@@ -86,6 +86,13 @@
             ColorModel cm = imageOp.getColorModel();
             //this.bitsPerPixel = 8;
             this.bitsPerPixel = cm.getPixelSize();
+            
+            // TODO: the getRGB() function converts the image into the RGB
+            // colorspace. However, here we assume the image colorspace is kept.
+            // It should be either one of them, but not both. Unfortunately
+            // there are other hacks for images in the CMYK colorspace (e.g. in
+            // the PDF output) that would need to be changed as well.
+            
             //this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
             this.colorSpace = cm.getColorSpace();
             

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java Wed May  3 00:21:02 2006
@@ -18,6 +18,7 @@
 
 package org.apache.fop.render;
 
+import java.awt.Color;
 import java.awt.Rectangle;
 import java.awt.geom.Rectangle2D;
 import java.util.List;
@@ -30,7 +31,6 @@
 import org.apache.fop.area.Trait;
 import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.area.inline.Viewport;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.FontMetrics;
 import org.apache.fop.image.FopImage;
@@ -585,21 +585,21 @@
             float halfLineWidth = (descender / -8f) / 2f;
             float endx = (startx + inline.getIPD()) / 1000f;
             if (inline.hasUnderline()) {
-                ColorType ct = (ColorType) inline.getTrait(Trait.UNDERLINE_COLOR);
+                Color ct = (Color) inline.getTrait(Trait.UNDERLINE_COLOR);
                 float y = baseline - descender / 2f;
                 drawBorderLine(startx / 1000f, (y - halfLineWidth) / 1000f, 
                         endx, (y + halfLineWidth) / 1000f, 
                         true, true, Constants.EN_SOLID, ct);
             }
             if (inline.hasOverline()) {
-                ColorType ct = (ColorType) inline.getTrait(Trait.OVERLINE_COLOR);
+                Color ct = (Color) inline.getTrait(Trait.OVERLINE_COLOR);
                 float y = (float)(baseline - (1.1 * capHeight));
                 drawBorderLine(startx / 1000f, (y - halfLineWidth) / 1000f, 
                         endx, (y + halfLineWidth) / 1000f, 
                         true, true, Constants.EN_SOLID, ct);
             }
             if (inline.hasLineThrough()) {
-                ColorType ct = (ColorType) inline.getTrait(Trait.LINETHROUGH_COLOR);
+                Color ct = (Color) inline.getTrait(Trait.LINETHROUGH_COLOR);
                 float y = (float)(baseline - (0.45 * capHeight));
                 drawBorderLine(startx / 1000f, (y - halfLineWidth) / 1000f, 
                         endx, (y + halfLineWidth) / 1000f, 
@@ -655,7 +655,7 @@
      * @param col the color to apply (null skips this operation)
      * @param fill true to set the fill color, false for the foreground color
      */
-    protected abstract void updateColor(ColorType col, boolean fill);
+    protected abstract void updateColor(Color col, boolean fill);
     
     /**
      * Draw an image at the indicated location.
@@ -677,6 +677,6 @@
      * @param col the color for the border segment
      */
     protected abstract void drawBorderLine(float x1, float y1, float x2, float y2, 
-            boolean horz, boolean startOrBefore, int style, ColorType col);
+            boolean horz, boolean startOrBefore, int style, Color col);
     
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractRenderer.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/AbstractRenderer.java Wed May  3 00:21:02 2006
@@ -19,7 +19,6 @@
 package org.apache.fop.render;
 
 // Java
-import java.awt.Color;
 import java.awt.Rectangle;
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
@@ -64,7 +63,6 @@
 import org.apache.fop.area.inline.WordArea;
 import org.apache.fop.area.inline.SpaceArea;
 import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.datatypes.ColorType;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.commons.logging.Log;
@@ -882,13 +880,5 @@
         return null;
     }
 
-    /**
-     * Converts a ColorType to a java.awt.Color (sRGB).
-     * @param col the color
-     * @return the converted color
-     */
-    protected Color toColor(ColorType col) {
-        return new Color(col.getRed(), col.getGreen(), col.getBlue());
-    }
 }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/PrintRenderer.java Wed May  3 00:21:02 2006
@@ -80,8 +80,10 @@
      * @return the modified color
      */
     public static Color lightenColor(Color col, float factor) {
-        float[] cols = new float[3];
-        cols = col.getColorComponents(cols);
+        // TODO: This function converts the color into the sRGB namespace.
+        // This should be avoided if possible.
+        float[] cols = new float[4];
+        cols = col.getRGBComponents(cols);
         if (factor > 0) {
             cols[0] += (1.0 - cols[0]) * factor;
             cols[1] += (1.0 - cols[1]) * factor;
@@ -91,7 +93,7 @@
             cols[1] -= cols[1] * -factor;
             cols[2] -= cols[2] * -factor;
         }
-        return new Color(cols[0], cols[1], cols[2]);
+        return new Color(cols[0], cols[1], cols[2], cols[3]);
     }
 
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/AWTRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/AWTRenderer.java?rev=399185&r1=399184&r2=399185&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/AWTRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/AWTRenderer.java Wed May  3 00:21:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 The Apache Software Foundation.
+ * Copyright 1999-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,11 +26,12 @@
  */
 
 // Java
+import java.awt.Color;
 import java.awt.Dimension;
-import java.awt.geom.Rectangle2D;
 import java.awt.Toolkit;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.awt.geom.Rectangle2D;
 import java.awt.print.PageFormat;
 import java.awt.print.Pageable;
 import java.awt.print.Paper;
@@ -42,8 +43,6 @@
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.PageViewport;
-import org.apache.fop.datatypes.ColorType;
-import org.apache.fop.fo.properties.ColorTypeProperty;
 import org.apache.fop.render.awt.viewer.PreviewDialog;
 import org.apache.fop.render.awt.viewer.Renderable;
 import org.apache.fop.render.awt.viewer.Translator;
@@ -263,8 +262,8 @@
         // saves the graphics state in a stack
         state.push();
 
-        ColorType ct = new ColorTypeProperty(0.7f, 0.7f, 0.7f);
-        state.updateColor(ct);
+        Color col = new Color(0.7f, 0.7f, 0.7f);
+        state.updateColor(col);
         state.updateStroke(0.4f, EN_SOLID);
         state.getGraph().draw(
                 new Rectangle2D.Float(startx, starty, width, height));



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org