aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-11-15 10:25:26 +0000
committerKeiron Liddle <keiron@apache.org>2001-11-15 10:25:26 +0000
commit8d595a6db21c95f7caa3aeb90370638113d844ae (patch)
treecbb860ed15c5a2fe4734ba779be271bcda1e3d51 /src/org/apache/fop
parenta0f30b3d13ee1a3aaf521eed1c0665f1d8fd03b1 (diff)
downloadxmlgraphics-fop-8d595a6db21c95f7caa3aeb90370638113d844ae.tar.gz
xmlgraphics-fop-8d595a6db21c95f7caa3aeb90370638113d844ae.zip
basic implementation of declarations and color profile
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194568 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop')
-rw-r--r--src/org/apache/fop/fo/ColorProfile.java43
-rw-r--r--src/org/apache/fop/fo/Declarations.java48
2 files changed, 78 insertions, 13 deletions
diff --git a/src/org/apache/fop/fo/ColorProfile.java b/src/org/apache/fop/fo/ColorProfile.java
index e58dd18e5..ef8546384 100644
--- a/src/org/apache/fop/fo/ColorProfile.java
+++ b/src/org/apache/fop/fo/ColorProfile.java
@@ -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() {
+
+ }
}
diff --git a/src/org/apache/fop/fo/Declarations.java b/src/org/apache/fop/fo/Declarations.java
index 1c4e783d0..ec52363a2 100644
--- a/src/org/apache/fop/fo/Declarations.java
+++ b/src/org/apache/fop/fo/Declarations.java
@@ -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;
+ }
}