keiron      01/11/15 02:25:27

  Modified:    src/org/apache/fop/fo Declarations.java ColorProfile.java
  Log:
  basic implementation of declarations and color profile
  
  Revision  Changes    Path
  1.6       +45 -5     xml-fop/src/org/apache/fop/fo/Declarations.java
  
  Index: Declarations.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Declarations.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Declarations.java 2001/11/09 11:32:36     1.5
  +++ Declarations.java 2001/11/15 10:25:26     1.6
  @@ -1,5 +1,5 @@
   /*
  - * $Id: Declarations.java,v 1.5 2001/11/09 11:32:36 keiron Exp $
  + * $Id: Declarations.java,v 1.6 2001/11/15 10:25:26 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,18 +8,58 @@
   package org.apache.fop.fo;
   
   // FOP
  -import org.apache.fop.fo.*;
   import org.apache.fop.fo.flow.*;
  -import org.apache.fop.fo.properties.*;
  -import org.apache.fop.layout.AreaTree;
   import org.apache.fop.apps.FOPException;
   
  +import java.util.ArrayList;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +
   /**
  + * Declarations formatting object.
  + * A declarations formatting object holds a set of color-profiles
  + * and optionally additional non-XSL namespace elements.
  + * The color-profiles are held in a hashmap for use with color-profile
  + * references.
    */
  -public class Declarations extends ToBeImplementedElement {
  +public class Declarations extends FObj {
  +    HashMap colorProfiles = null;
  +    ArrayList external = null;
   
       protected Declarations(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * At then end of this element sort out the child into
  +     * a hashmap of color profiles and a list of external xml.
  +     */
  +    public void end() {
  +        for(Iterator iter = children.iterator(); iter.hasNext(); ) {
  +            FONode node = (FONode)iter.next();
  +            if(node.getName().equals("fo:color-profile")) {
  +                ColorProfile cp = (ColorProfile)node;
  +                if(!"".equals(cp.getProfileName())) {
  +                    if(colorProfiles == null) {
  +                        colorProfiles = new HashMap();
  +                    }
  +                    if(colorProfiles.get(cp.getProfileName()) != null) {
  +                        // duplicate names
  +                        log.warn("Duplicate fo:color-profile profile name : " + 
cp.getProfileName());
  +                    }
  +                    colorProfiles.put(cp.getProfileName(), cp);
  +                } else {
  +                    log.warn("color-profile-name required for color profile");
  +                }
  +            } else if(node instanceof XMLObj) {
  +                if(external == null) {
  +                    external = new ArrayList();
  +                }
  +                external.add(node);
  +            } else {
  +                log.warn("invalid element " + node.getName() + "inside 
declarations");
  +            }
  +        }
  +        children = null;
  +    }
   }
  
  
  
  1.7       +35 -10    xml-fop/src/org/apache/fop/fo/ColorProfile.java
  
  Index: ColorProfile.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/ColorProfile.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ColorProfile.java 2001/11/09 11:32:36     1.6
  +++ ColorProfile.java 2001/11/15 10:25:26     1.7
  @@ -1,5 +1,5 @@
   /*
  - * $Id: ColorProfile.java,v 1.6 2001/11/09 11:32:36 keiron Exp $
  + * $Id: ColorProfile.java,v 1.7 2001/11/15 10:25:26 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,23 +8,48 @@
   package org.apache.fop.fo;
   
   // FOP
  -import org.apache.fop.fo.*;
  -import org.apache.fop.fo.flow.*;
  -import org.apache.fop.fo.properties.*;
  -import org.apache.fop.layout.AreaTree;
  -import org.apache.fop.apps.FOPException;
  +import org.apache.fop.datatypes.ColorType;
   
   /**
    * The fo:color-profile formatting object.
  + * This loads the color profile when needed and resolves a requested color.
    */
  -public class ColorProfile extends ToBeImplementedElement {
  +public class ColorProfile extends FObj {
  +    int intent;
  +    String src;
  +    String profileName;
   
       protected ColorProfile(FONode parent) {
           super(parent);
  +    }
  +
  +    public void end() {
  +        src = this.properties.get("src").getString();
  +        profileName = this.properties.get("color-profile-name").getString();
  +        intent = this.properties.get("rendering-intent").getEnum();
  +        this.properties = null;
  +    }
   
  -        // this.properties.get("src");
  -        // this.properties.get("color-profile-name");
  -        // this.properties.get("rendering-intent");
  +    /**
  +     * Get the name of this color profile.
  +     */
  +    public String getProfileName() {
  +        return profileName;
       }
   
  +    /**
  +     * Get the color specified with the color values from the color profile.
  +     * The default values are used if the profile could not be loaded
  +     * or the value is not found.
  +     */
  +    public ColorType getColor(int[] colorVals, int defR, int defG, int defB) {
  +        return null;
  +    }
  +
  +    /**
  +     * Load the color profile.
  +     */
  +    private void load() {
  +        
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to