Source Code Cross Referenced for ColorUtil.java in  » Graphic-Library » fop » org » apache » fop » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Graphic Library » fop » org.apache.fop.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /* $Id$ */
019:
020:        package org.apache.fop.util;
021:
022:        import java.awt.Color;
023:        import java.awt.color.ColorSpace;
024:        import java.util.Collections;
025:        import java.util.LinkedList;
026:        import java.util.List;
027:        import java.util.Map;
028:        import java.util.StringTokenizer;
029:
030:        import org.apache.commons.logging.Log;
031:        import org.apache.commons.logging.LogFactory;
032:        import org.apache.fop.apps.FOUserAgent;
033:        import org.apache.fop.fo.expr.PropertyException;
034:
035:        /**
036:         * Generic Color helper class.
037:         * <p>
038:         * This class supports parsing string values into color values and creating
039:         * color values for strings. It provides a list of standard color names.
040:         */
041:        public final class ColorUtil {
042:
043:            /**
044:             * 
045:             * keeps all the predefined and parsed colors.
046:             * <p>
047:             * This map is used to predefine given colors, as well as speeding up
048:             * parsing of already parsed colors.
049:             */
050:            private static Map colorMap = null;
051:
052:            /** Logger instance */
053:            protected static Log log = LogFactory.getLog(ColorUtil.class);
054:
055:            static {
056:                initializeColorMap();
057:            }
058:
059:            /**
060:             * Private constructor since this is an utility class.
061:             */
062:            private ColorUtil() {
063:            }
064:
065:            /**
066:             * Creates a color from a given string.
067:             * <p>
068:             * This function supports a wide variety of inputs.
069:             * <ul>
070:             * <li>#RGB (hex 0..f)</li>
071:             * <li>#RGBA (hex 0..f)</li>
072:             * <li>#RRGGBB (hex 00..ff)</li>
073:             * <li>#RRGGBBAA (hex 00..ff)</li>
074:             * <li>rgb(r,g,b) (0..255 or 0%..100%)</li>
075:             * <li>java.awt.Color[r=r,g=g,b=b] (0..255)</li>
076:             * <li>system-color(colorname)</li>
077:             * <li>transparent</li>
078:             * <li>colorname</li>
079:             * <li>fop-rgb-icc</li>
080:             * <li>cmyk</li>
081:             * </ul>
082:             * 
083:             * @param foUserAgent FOUserAgent object  
084:             * @param value
085:             *            the string to parse.
086:             * @return a Color representing the string if possible
087:             * @throws PropertyException
088:             *             if the string is not parsable or does not follow any of the
089:             *             given formats.
090:             */
091:            public static Color parseColorString(FOUserAgent foUserAgent,
092:                    String value) throws PropertyException {
093:                if (value == null) {
094:                    return null;
095:                }
096:
097:                Color parsedColor = (Color) colorMap.get(value.toLowerCase());
098:
099:                if (parsedColor == null) {
100:                    if (value.startsWith("#")) {
101:                        parsedColor = parseWithHash(value);
102:                    } else if (value.startsWith("rgb(")) {
103:                        parsedColor = parseAsRGB(value);
104:                    } else if (value.startsWith("url(")) {
105:                        throw new PropertyException(
106:                                "Colors starting with url( are not yet supported!");
107:                    } else if (value.startsWith("java.awt.Color")) {
108:                        parsedColor = parseAsJavaAWTColor(value);
109:                    } else if (value.startsWith("system-color(")) {
110:                        parsedColor = parseAsSystemColor(value);
111:                    } else if (value.startsWith("fop-rgb-icc")) {
112:                        parsedColor = parseAsFopRgbIcc(foUserAgent, value);
113:                    } else if (value.startsWith("cmyk")) {
114:                        parsedColor = parseAsCMYK(value);
115:                    }
116:
117:                    if (parsedColor == null) {
118:                        throw new PropertyException("Unknown Color: " + value);
119:                    }
120:
121:                    colorMap.put(value, parsedColor);
122:                }
123:
124:                // TODO - Returned Color object can be one from the static colorMap cache.
125:                //        That means it should be treated as read only for the rest of its lifetime.
126:                //        Not sure that is the case though.
127:                return parsedColor;
128:            }
129:
130:            /**
131:             * Tries to parse a color given with the system-color() function.
132:             * 
133:             * @param value
134:             *            the complete line
135:             * @return a color if possible
136:             * @throws PropertyException
137:             *             if the format is wrong.
138:             */
139:            private static Color parseAsSystemColor(String value)
140:                    throws PropertyException {
141:                int poss = value.indexOf("(");
142:                int pose = value.indexOf(")");
143:                if (poss != -1 && pose != -1) {
144:                    value = value.substring(poss + 1, pose);
145:                } else {
146:                    throw new PropertyException("Unknown color format: "
147:                            + value + ". Must be system-color(x)");
148:                }
149:                return (Color) colorMap.get(value);
150:            }
151:
152:            /**
153:             * Tries to parse the standard java.awt.Color toString output.
154:             * 
155:             * @param value
156:             *            the complete line
157:             * @return a color if possible
158:             * @throws PropertyException
159:             *             if the format is wrong.
160:             * @see java.awt.Color#toString()
161:             */
162:            private static Color parseAsJavaAWTColor(String value)
163:                    throws PropertyException {
164:                float red = 0.0f, green = 0.0f, blue = 0.0f;
165:                int poss = value.indexOf("[");
166:                int pose = value.indexOf("]");
167:                try {
168:                    if (poss != -1 && pose != -1) {
169:                        value = value.substring(poss + 1, pose);
170:                        StringTokenizer st = new StringTokenizer(value, ",");
171:                        if (st.hasMoreTokens()) {
172:                            String str = st.nextToken().trim();
173:                            red = Float.parseFloat(str.substring(2)) / 255f;
174:                        }
175:                        if (st.hasMoreTokens()) {
176:                            String str = st.nextToken().trim();
177:                            green = Float.parseFloat(str.substring(2)) / 255f;
178:                        }
179:                        if (st.hasMoreTokens()) {
180:                            String str = st.nextToken().trim();
181:                            blue = Float.parseFloat(str.substring(2)) / 255f;
182:                        } else {
183:                            throw new NumberFormatException();
184:                        }
185:                        if ((red < 0.0 || red > 1.0)
186:                                || (green < 0.0 || green > 1.0)
187:                                || (blue < 0.0 || blue > 1.0)) {
188:                            throw new PropertyException(
189:                                    "Color values out of range");
190:                        }
191:                    } else {
192:                        throw new NullPointerException();
193:                    }
194:                } catch (Exception e) {
195:                    throw new PropertyException("Unknown color format: "
196:                            + value);
197:                }
198:                return new Color(red, green, blue);
199:            }
200:
201:            /**
202:             * Parse a color given with the rgb() function.
203:             * 
204:             * @param value
205:             *            the complete line
206:             * @return a color if possible
207:             * @throws PropertyException
208:             *             if the format is wrong.
209:             */
210:            private static Color parseAsRGB(String value)
211:                    throws PropertyException {
212:                Color parsedColor;
213:                int poss = value.indexOf("(");
214:                int pose = value.indexOf(")");
215:                if (poss != -1 && pose != -1) {
216:                    value = value.substring(poss + 1, pose);
217:                    StringTokenizer st = new StringTokenizer(value, ",");
218:                    try {
219:                        float red = 0.0f, green = 0.0f, blue = 0.0f;
220:                        if (st.hasMoreTokens()) {
221:                            String str = st.nextToken().trim();
222:                            if (str.endsWith("%")) {
223:                                red = Float.parseFloat(str.substring(0, str
224:                                        .length() - 1)) / 100.0f;
225:                            } else {
226:                                red = Float.parseFloat(str) / 255f;
227:                            }
228:                        }
229:                        if (st.hasMoreTokens()) {
230:                            String str = st.nextToken().trim();
231:                            if (str.endsWith("%")) {
232:                                green = Float.parseFloat(str.substring(0, str
233:                                        .length() - 1)) / 100.0f;
234:                            } else {
235:                                green = Float.parseFloat(str) / 255f;
236:                            }
237:                        }
238:                        if (st.hasMoreTokens()) {
239:                            String str = st.nextToken().trim();
240:                            if (str.endsWith("%")) {
241:                                blue = Float.parseFloat(str.substring(0, str
242:                                        .length() - 1)) / 100.0f;
243:                            } else {
244:                                blue = Float.parseFloat(str) / 255f;
245:                            }
246:                        }
247:                        if ((red < 0.0 || red > 1.0)
248:                                || (green < 0.0 || green > 1.0)
249:                                || (blue < 0.0 || blue > 1.0)) {
250:                            throw new PropertyException(
251:                                    "Color values out of range");
252:                        }
253:                        parsedColor = new Color(red, green, blue);
254:                    } catch (Exception e) {
255:                        throw new PropertyException(
256:                                "Arguments to rgb() must be [0..255] or [0%..100%]");
257:                    }
258:                } else {
259:                    throw new PropertyException("Unknown color format: "
260:                            + value + ". Must be rgb(r,g,b)");
261:                }
262:                return parsedColor;
263:            }
264:
265:            /**
266:             * parse a color given in the #.... format.
267:             * 
268:             * @param value
269:             *            the complete line
270:             * @return a color if possible
271:             * @throws PropertyException
272:             *             if the format is wrong.
273:             */
274:            private static Color parseWithHash(String value)
275:                    throws PropertyException {
276:                Color parsedColor = null;
277:                try {
278:                    int len = value.length();
279:                    if ((len >= 4) && (len <= 5)) {
280:                        // note: divide by 15 so F = FF = 1 and so on
281:                        float red = Integer.parseInt(value.substring(1, 2), 16) / 15f;
282:                        float green = Integer.parseInt(value.substring(2, 3),
283:                                16) / 15f;
284:                        float blue = Integer
285:                                .parseInt(value.substring(3, 4), 16) / 15f;
286:                        float alpha = 1.0f;
287:                        if (len == 5) {
288:                            alpha = Integer.parseInt(value.substring(4), 16) / 15f;
289:                        }
290:                        parsedColor = new Color(red, green, blue, alpha);
291:                    } else if ((len == 7) || (len == 9)) {
292:                        int red = Integer.parseInt(value.substring(1, 3), 16);
293:                        int green = Integer.parseInt(value.substring(3, 5), 16);
294:                        int blue = Integer.parseInt(value.substring(5, 7), 16);
295:                        int alpha = 255;
296:                        if (len == 9) {
297:                            alpha = Integer.parseInt(value.substring(7), 16);
298:                        }
299:                        parsedColor = new Color(red, green, blue, alpha);
300:                    } else {
301:                        throw new NumberFormatException();
302:                    }
303:                } catch (NumberFormatException e) {
304:                    throw new PropertyException("Unknown color format: "
305:                            + value
306:                            + ". Must be #RGB. #RGBA, #RRGGBB, or #RRGGBBAA");
307:                }
308:                return parsedColor;
309:            }
310:
311:            /**
312:             * Parse a color specified using the fop-rgb-icc() function.
313:             * 
314:             * @param value the function call
315:             * @return a color if possible
316:             * @throws PropertyException if the format is wrong.
317:             */
318:            private static Color parseAsFopRgbIcc(FOUserAgent foUserAgent,
319:                    String value) throws PropertyException {
320:                Color parsedColor;
321:                int poss = value.indexOf("(");
322:                int pose = value.indexOf(")");
323:                if (poss != -1 && pose != -1) {
324:                    value = value.substring(poss + 1, pose);
325:                    StringTokenizer st = new StringTokenizer(value, ",");
326:                    try {
327:                        float red = 0.0f, green = 0.0f, blue = 0.0f;
328:                        if (st.hasMoreTokens()) {
329:                            String str = st.nextToken().trim();
330:                            red = Float.parseFloat(str);
331:                        }
332:                        if (st.hasMoreTokens()) {
333:                            String str = st.nextToken().trim();
334:                            green = Float.parseFloat(str);
335:                        }
336:                        if (st.hasMoreTokens()) {
337:                            String str = st.nextToken().trim();
338:                            blue = Float.parseFloat(str);
339:                        }
340:                        /* Verify rgb replacement arguments */
341:                        if ((red < 0.0 || red > 1.0)
342:                                || (green < 0.0 || green > 1.0)
343:                                || (blue < 0.0 || blue > 1.0)) {
344:                            throw new PropertyException(
345:                                    "Color values out of range");
346:                        }
347:                        /* Get and verify ICC profile name */
348:                        String iccProfileName = null;
349:                        if (st.hasMoreTokens()) {
350:                            iccProfileName = st.nextToken().trim();
351:                        }
352:                        if (iccProfileName == null
353:                                || iccProfileName.length() == 0) {
354:                            throw new PropertyException(
355:                                    "ICC profile name missing");
356:                        }
357:                        /* Get and verify ICC profile source */
358:                        String iccProfileSrc = null;
359:                        if (st.hasMoreTokens()) {
360:                            iccProfileSrc = st.nextToken().trim();
361:                            // Strip quotes
362:                            iccProfileSrc = iccProfileSrc.substring(1,
363:                                    iccProfileSrc.length() - 1);
364:                        }
365:                        if (iccProfileSrc == null
366:                                || iccProfileSrc.length() == 0) {
367:                            throw new PropertyException(
368:                                    "ICC profile source missing");
369:                        }
370:                        /* ICC profile arguments */
371:                        List iccArgList = new LinkedList();
372:                        while (st.hasMoreTokens()) {
373:                            String str = st.nextToken().trim();
374:                            iccArgList.add(new Float(str));
375:                        }
376:                        /* Copy ICC profile arguments from list to array */
377:                        float[] iccComponents = new float[iccArgList.size()];
378:                        for (int ix = 0; ix < iccArgList.size(); ix++) {
379:                            iccComponents[ix] = ((Float) iccArgList.get(ix))
380:                                    .floatValue();
381:                        }
382:                        /* Ask FOP factory to get ColorSpace for the specified ICC profile source */
383:                        ColorSpace colorSpace = (foUserAgent != null ? foUserAgent
384:                                .getFactory()
385:                                .getColorSpace(foUserAgent.getBaseURL(),
386:                                        iccProfileSrc)
387:                                : null);
388:                        if (colorSpace != null) {
389:                            // ColorSpace available - create ColorExt (keeps track of replacement rgb 
390:                            // values for possible later colorTOsRGBString call
391:                            parsedColor = ColorExt.createFromFoRgbIcc(red,
392:                                    green, blue, iccProfileName, iccProfileSrc,
393:                                    colorSpace, iccComponents);
394:                        } else {
395:                            // ICC profile could not be loaded - use rgb replacement values */
396:                            log
397:                                    .warn("Color profile '"
398:                                            + iccProfileSrc
399:                                            + "' not found. Using rgb replacement values.");
400:                            parsedColor = new Color(red, green, blue);
401:                        }
402:                    } catch (Exception e) {
403:                        throw new PropertyException(
404:                                "Arguments to rgb-icc() must be [0..255] or [0%..100%]");
405:                    }
406:                } else {
407:                    throw new PropertyException(
408:                            "Unknown color format: "
409:                                    + value
410:                                    + ". Must be fop-rgb-icc(r,g,b,NCNAME,\"src\",....)");
411:                }
412:                return parsedColor;
413:            }
414:
415:            /**
416:             * Parse a color given with the cmyk() function.
417:             * 
418:             * @param value
419:             *            the complete line
420:             * @return a color if possible
421:             * @throws PropertyException
422:             *             if the format is wrong.
423:             */
424:            private static Color parseAsCMYK(String value)
425:                    throws PropertyException {
426:                Color parsedColor;
427:                int poss = value.indexOf("(");
428:                int pose = value.indexOf(")");
429:                if (poss != -1 && pose != -1) {
430:                    value = value.substring(poss + 1, pose);
431:                    StringTokenizer st = new StringTokenizer(value, ",");
432:                    try {
433:                        float cyan = 0.0f, magenta = 0.0f, yellow = 0.0f, black = 0.0f;
434:                        if (st.hasMoreTokens()) {
435:                            String str = st.nextToken().trim();
436:                            if (str.endsWith("%")) {
437:                                cyan = Float.parseFloat(str.substring(0, str
438:                                        .length() - 1)) / 100.0f;
439:                            } else {
440:                                cyan = Float.parseFloat(str);
441:                            }
442:                        }
443:                        if (st.hasMoreTokens()) {
444:                            String str = st.nextToken().trim();
445:                            if (str.endsWith("%")) {
446:                                magenta = Float.parseFloat(str.substring(0, str
447:                                        .length() - 1)) / 100.0f;
448:                            } else {
449:                                magenta = Float.parseFloat(str);
450:                            }
451:                        }
452:                        if (st.hasMoreTokens()) {
453:                            String str = st.nextToken().trim();
454:                            if (str.endsWith("%")) {
455:                                yellow = Float.parseFloat(str.substring(0, str
456:                                        .length() - 1)) / 100.0f;
457:                            } else {
458:                                yellow = Float.parseFloat(str);
459:                            }
460:                        }
461:                        if (st.hasMoreTokens()) {
462:                            String str = st.nextToken().trim();
463:                            if (str.endsWith("%")) {
464:                                black = Float.parseFloat(str.substring(0, str
465:                                        .length() - 1)) / 100.0f;
466:                            } else {
467:                                black = Float.parseFloat(str);
468:                            }
469:                        }
470:                        if ((cyan < 0.0 || cyan > 1.0)
471:                                || (magenta < 0.0 || magenta > 1.0)
472:                                || (yellow < 0.0 || yellow > 1.0)
473:                                || (black < 0.0 || black > 1.0)) {
474:                            throw new PropertyException(
475:                                    "Color values out of range");
476:                        }
477:                        float[] cmyk = new float[] { cyan, magenta, yellow,
478:                                black };
479:                        CMYKColorSpace cmykCs = CMYKColorSpace.getInstance();
480:                        float[] rgb = cmykCs.toRGB(cmyk);
481:                        parsedColor = ColorExt.createFromFoRgbIcc(rgb[0],
482:                                rgb[1], rgb[2], null, "#CMYK", cmykCs, cmyk);
483:
484:                    } catch (Exception e) {
485:                        throw new PropertyException(
486:                                "Arguments to cmyk() must be in the range [0%-100%] or [0.0-1.0]");
487:                    }
488:                } else {
489:                    throw new PropertyException("Unknown color format: "
490:                            + value + ". Must be cmyk(c,m,y,k)");
491:                }
492:                return parsedColor;
493:            }
494:
495:            /**
496:             * Creates a re-parsable string representation of the given color.
497:             * <p>
498:             * First, the color will be converted into the sRGB colorspace. It will then
499:             * be printed as #rrggbb, or as #rrrggbbaa if an alpha value is present.
500:             * 
501:             * @param color
502:             *            the color to represent.
503:             * @return a re-parsable string representadion.
504:             */
505:            public static String colorToString(Color color) {
506:                ColorSpace cs = color.getColorSpace();
507:                if (cs != null && cs.getType() == ColorSpace.TYPE_CMYK) {
508:                    StringBuffer sbuf = new StringBuffer(24);
509:                    float[] cmyk = color.getColorComponents(null);
510:                    sbuf.append("cmyk(" + cmyk[0] + "," + cmyk[1] + ","
511:                            + cmyk[2] + "," + cmyk[3] + ")");
512:                    return sbuf.toString();
513:                } else if (color instanceof  ColorExt) {
514:                    return ((ColorExt) color).toFunctionCall();
515:                } else {
516:                    StringBuffer sbuf = new StringBuffer();
517:                    sbuf.append('#');
518:                    String s = Integer.toHexString(color.getRed());
519:                    if (s.length() == 1) {
520:                        sbuf.append('0');
521:                    }
522:                    sbuf.append(s);
523:                    s = Integer.toHexString(color.getGreen());
524:                    if (s.length() == 1) {
525:                        sbuf.append('0');
526:                    }
527:                    sbuf.append(s);
528:                    s = Integer.toHexString(color.getBlue());
529:                    if (s.length() == 1) {
530:                        sbuf.append('0');
531:                    }
532:                    sbuf.append(s);
533:                    if (color.getAlpha() != 255) {
534:                        s = Integer.toHexString(color.getAlpha());
535:                        if (s.length() == 1) {
536:                            sbuf.append('0');
537:                        }
538:                        sbuf.append(s);
539:                    }
540:                    return sbuf.toString();
541:                }
542:            }
543:
544:            /**
545:             * Initializes the colorMap with some predefined values.
546:             */
547:            private static void initializeColorMap() {
548:                colorMap = Collections.synchronizedMap(new java.util.HashMap());
549:
550:                colorMap.put("aliceblue", new Color(240, 248, 255));
551:                colorMap.put("antiquewhite", new Color(250, 235, 215));
552:                colorMap.put("aqua", new Color(0, 255, 255));
553:                colorMap.put("aquamarine", new Color(127, 255, 212));
554:                colorMap.put("azure", new Color(240, 255, 255));
555:                colorMap.put("beige", new Color(245, 245, 220));
556:                colorMap.put("bisque", new Color(255, 228, 196));
557:                colorMap.put("black", new Color(0, 0, 0));
558:                colorMap.put("blanchedalmond", new Color(255, 235, 205));
559:                colorMap.put("blue", new Color(0, 0, 255));
560:                colorMap.put("blueviolet", new Color(138, 43, 226));
561:                colorMap.put("brown", new Color(165, 42, 42));
562:                colorMap.put("burlywood", new Color(222, 184, 135));
563:                colorMap.put("cadetblue", new Color(95, 158, 160));
564:                colorMap.put("chartreuse", new Color(127, 255, 0));
565:                colorMap.put("chocolate", new Color(210, 105, 30));
566:                colorMap.put("coral", new Color(255, 127, 80));
567:                colorMap.put("cornflowerblue", new Color(100, 149, 237));
568:                colorMap.put("cornsilk", new Color(255, 248, 220));
569:                colorMap.put("crimson", new Color(220, 20, 60));
570:                colorMap.put("cyan", new Color(0, 255, 255));
571:                colorMap.put("darkblue", new Color(0, 0, 139));
572:                colorMap.put("darkcyan", new Color(0, 139, 139));
573:                colorMap.put("darkgoldenrod", new Color(184, 134, 11));
574:                colorMap.put("darkgray", new Color(169, 169, 169));
575:                colorMap.put("darkgreen", new Color(0, 100, 0));
576:                colorMap.put("darkgrey", new Color(169, 169, 169));
577:                colorMap.put("darkkhaki", new Color(189, 183, 107));
578:                colorMap.put("darkmagenta", new Color(139, 0, 139));
579:                colorMap.put("darkolivegreen", new Color(85, 107, 47));
580:                colorMap.put("darkorange", new Color(255, 140, 0));
581:                colorMap.put("darkorchid", new Color(153, 50, 204));
582:                colorMap.put("darkred", new Color(139, 0, 0));
583:                colorMap.put("darksalmon", new Color(233, 150, 122));
584:                colorMap.put("darkseagreen", new Color(143, 188, 143));
585:                colorMap.put("darkslateblue", new Color(72, 61, 139));
586:                colorMap.put("darkslategray", new Color(47, 79, 79));
587:                colorMap.put("darkslategrey", new Color(47, 79, 79));
588:                colorMap.put("darkturquoise", new Color(0, 206, 209));
589:                colorMap.put("darkviolet", new Color(148, 0, 211));
590:                colorMap.put("deeppink", new Color(255, 20, 147));
591:                colorMap.put("deepskyblue", new Color(0, 191, 255));
592:                colorMap.put("dimgray", new Color(105, 105, 105));
593:                colorMap.put("dimgrey", new Color(105, 105, 105));
594:                colorMap.put("dodgerblue", new Color(30, 144, 255));
595:                colorMap.put("firebrick", new Color(178, 34, 34));
596:                colorMap.put("floralwhite", new Color(255, 250, 240));
597:                colorMap.put("forestgreen", new Color(34, 139, 34));
598:                colorMap.put("fuchsia", new Color(255, 0, 255));
599:                colorMap.put("gainsboro", new Color(220, 220, 220));
600:                colorMap.put("ghostwhite", new Color(248, 248, 255));
601:                colorMap.put("gold", new Color(255, 215, 0));
602:                colorMap.put("goldenrod", new Color(218, 165, 32));
603:                colorMap.put("gray", new Color(128, 128, 128));
604:                colorMap.put("green", new Color(0, 128, 0));
605:                colorMap.put("greenyellow", new Color(173, 255, 47));
606:                colorMap.put("grey", new Color(128, 128, 128));
607:                colorMap.put("honeydew", new Color(240, 255, 240));
608:                colorMap.put("hotpink", new Color(255, 105, 180));
609:                colorMap.put("indianred", new Color(205, 92, 92));
610:                colorMap.put("indigo", new Color(75, 0, 130));
611:                colorMap.put("ivory", new Color(255, 255, 240));
612:                colorMap.put("khaki", new Color(240, 230, 140));
613:                colorMap.put("lavender", new Color(230, 230, 250));
614:                colorMap.put("lavenderblush", new Color(255, 240, 245));
615:                colorMap.put("lawngreen", new Color(124, 252, 0));
616:                colorMap.put("lemonchiffon", new Color(255, 250, 205));
617:                colorMap.put("lightblue", new Color(173, 216, 230));
618:                colorMap.put("lightcoral", new Color(240, 128, 128));
619:                colorMap.put("lightcyan", new Color(224, 255, 255));
620:                colorMap.put("lightgoldenrodyellow", new Color(250, 250, 210));
621:                colorMap.put("lightgray", new Color(211, 211, 211));
622:                colorMap.put("lightgreen", new Color(144, 238, 144));
623:                colorMap.put("lightgrey", new Color(211, 211, 211));
624:                colorMap.put("lightpink", new Color(255, 182, 193));
625:                colorMap.put("lightsalmon", new Color(255, 160, 122));
626:                colorMap.put("lightseagreen", new Color(32, 178, 170));
627:                colorMap.put("lightskyblue", new Color(135, 206, 250));
628:                colorMap.put("lightslategray", new Color(119, 136, 153));
629:                colorMap.put("lightslategrey", new Color(119, 136, 153));
630:                colorMap.put("lightsteelblue", new Color(176, 196, 222));
631:                colorMap.put("lightyellow", new Color(255, 255, 224));
632:                colorMap.put("lime", new Color(0, 255, 0));
633:                colorMap.put("limegreen", new Color(50, 205, 50));
634:                colorMap.put("linen", new Color(250, 240, 230));
635:                colorMap.put("magenta", new Color(255, 0, 255));
636:                colorMap.put("maroon", new Color(128, 0, 0));
637:                colorMap.put("mediumaquamarine", new Color(102, 205, 170));
638:                colorMap.put("mediumblue", new Color(0, 0, 205));
639:                colorMap.put("mediumorchid", new Color(186, 85, 211));
640:                colorMap.put("mediumpurple", new Color(147, 112, 219));
641:                colorMap.put("mediumseagreen", new Color(60, 179, 113));
642:                colorMap.put("mediumslateblue", new Color(123, 104, 238));
643:                colorMap.put("mediumspringgreen", new Color(0, 250, 154));
644:                colorMap.put("mediumturquoise", new Color(72, 209, 204));
645:                colorMap.put("mediumvioletred", new Color(199, 21, 133));
646:                colorMap.put("midnightblue", new Color(25, 25, 112));
647:                colorMap.put("mintcream", new Color(245, 255, 250));
648:                colorMap.put("mistyrose", new Color(255, 228, 225));
649:                colorMap.put("moccasin", new Color(255, 228, 181));
650:                colorMap.put("navajowhite", new Color(255, 222, 173));
651:                colorMap.put("navy", new Color(0, 0, 128));
652:                colorMap.put("oldlace", new Color(253, 245, 230));
653:                colorMap.put("olive", new Color(128, 128, 0));
654:                colorMap.put("olivedrab", new Color(107, 142, 35));
655:                colorMap.put("orange", new Color(255, 165, 0));
656:                colorMap.put("orangered", new Color(255, 69, 0));
657:                colorMap.put("orchid", new Color(218, 112, 214));
658:                colorMap.put("palegoldenrod", new Color(238, 232, 170));
659:                colorMap.put("palegreen", new Color(152, 251, 152));
660:                colorMap.put("paleturquoise", new Color(175, 238, 238));
661:                colorMap.put("palevioletred", new Color(219, 112, 147));
662:                colorMap.put("papayawhip", new Color(255, 239, 213));
663:                colorMap.put("peachpuff", new Color(255, 218, 185));
664:                colorMap.put("peru", new Color(205, 133, 63));
665:                colorMap.put("pink", new Color(255, 192, 203));
666:                colorMap.put("plum ", new Color(221, 160, 221));
667:                colorMap.put("plum", new Color(221, 160, 221));
668:                colorMap.put("powderblue", new Color(176, 224, 230));
669:                colorMap.put("purple", new Color(128, 0, 128));
670:                colorMap.put("red", new Color(255, 0, 0));
671:                colorMap.put("rosybrown", new Color(188, 143, 143));
672:                colorMap.put("royalblue", new Color(65, 105, 225));
673:                colorMap.put("saddlebrown", new Color(139, 69, 19));
674:                colorMap.put("salmon", new Color(250, 128, 114));
675:                colorMap.put("sandybrown", new Color(244, 164, 96));
676:                colorMap.put("seagreen", new Color(46, 139, 87));
677:                colorMap.put("seashell", new Color(255, 245, 238));
678:                colorMap.put("sienna", new Color(160, 82, 45));
679:                colorMap.put("silver", new Color(192, 192, 192));
680:                colorMap.put("skyblue", new Color(135, 206, 235));
681:                colorMap.put("slateblue", new Color(106, 90, 205));
682:                colorMap.put("slategray", new Color(112, 128, 144));
683:                colorMap.put("slategrey", new Color(112, 128, 144));
684:                colorMap.put("snow", new Color(255, 250, 250));
685:                colorMap.put("springgreen", new Color(0, 255, 127));
686:                colorMap.put("steelblue", new Color(70, 130, 180));
687:                colorMap.put("tan", new Color(210, 180, 140));
688:                colorMap.put("teal", new Color(0, 128, 128));
689:                colorMap.put("thistle", new Color(216, 191, 216));
690:                colorMap.put("tomato", new Color(255, 99, 71));
691:                colorMap.put("turquoise", new Color(64, 224, 208));
692:                colorMap.put("violet", new Color(238, 130, 238));
693:                colorMap.put("wheat", new Color(245, 222, 179));
694:                colorMap.put("white", new Color(255, 255, 255));
695:                colorMap.put("whitesmoke", new Color(245, 245, 245));
696:                colorMap.put("yellow", new Color(255, 255, 0));
697:                colorMap.put("yellowgreen", new Color(154, 205, 50));
698:
699:                colorMap.put("transparent", new Color(0, 0, 0, 0));
700:            }
701:
702:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.