]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
made it so it uses all the css color names
authorKeiron Liddle <keiron@apache.org>
Fri, 15 Sep 2000 00:19:44 +0000 (00:19 +0000)
committerKeiron Liddle <keiron@apache.org>
Fri, 15 Sep 2000 00:19:44 +0000 (00:19 +0000)
there is room for improvement in terms of looking up color names

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193700 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/datatypes/ColorType.java

index 92edee42d7104e70a5520e1a21e5a274afb5c5cb..9f3d8cbb4e51663a6c89b9cb92ef7933dc407e3b 100644 (file)
@@ -140,7 +140,31 @@ public class ColorType {
        } else if (value.startsWith("url(")) {
                // refers to a gradient
        } else {
-           if (value.toLowerCase().equals("black")) {
+           if (value.toLowerCase().equals("transparent")) {
+               this.red = 0;
+               this.green = 0;
+               this.blue = 0;
+               this.alpha = 1;
+               } else {
+               boolean found = false;
+               for(int count = 0; count < names.length; count++) {
+                       if (value.toLowerCase().equals(names[count])) {
+                               this.red = vals[count][0] / 255f;
+                               this.green = vals[count][1] / 255f;
+                               this.blue = vals[count][2] / 255f;
+                               found = true;
+                               break;
+                       }
+               }
+           if(!found) {
+               this.red = 0;
+               this.green = 0;
+               this.blue = 0;
+               MessageHandler.errorln("ERROR: unknown colour name: " + value);
+           }
+           }
+
+/*         if (value.toLowerCase().equals("black")) {
                this.red = 0;
                this.green = 0;
                this.blue = 0;
@@ -219,7 +243,7 @@ public class ColorType {
                this.green = 0;
                this.blue = 0;
                MessageHandler.errorln("ERROR: unknown colour name: " + value);
-           }
+           }*/
        }
     }
        
@@ -238,32 +262,6 @@ public class ColorType {
     public float alpha() {
        return this.alpha;
     }
-}
-/*
-           if (value.toLowerCase().equals("transparent")) {
-               this.red = 0;
-               this.green = 0;
-               this.blue = 0;
-               this.alpha = 1;
-               } else {
-               boolean found = false;
-               for(int count = 0; count < names.length; count++) {
-                       if (value.toLowerCase().equals(names[count])) {
-                               this.red = vals[count][0] / 255f;
-                               this.green = vals[count][1] / 255f;
-                               this.blue = vals[count][2] / 255f;
-                               found = true;
-                               break;
-                       }
-               }
-           if(!found) {
-               this.red = 0;
-               this.green = 0;
-               this.blue = 0;
-               MessageHandler.errorln("ERROR: unknown colour name: " + value);
-           }
-           }
-
 
        final static String[] names = {
                "aliceblue",
@@ -564,7 +562,8 @@ public class ColorType {
                {255, 255, 0},
                {154, 205, 50}
        };
-*/
+}
+
 /*     
 aliceblue rgb(240, 248, 255)
 antiquewhite rgb(250, 235, 215)