001: /* ===========================================================
002: * JFreeChart : a free chart library for the Java(tm) platform
003: * ===========================================================
004: *
005: * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
006: *
007: * Project Info: http://www.jfree.org/jfreechart/index.html
008: *
009: * This library is free software; you can redistribute it and/or modify it
010: * under the terms of the GNU Lesser General Public License as published by
011: * the Free Software Foundation; either version 2.1 of the License, or
012: * (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but
015: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017: * License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
022: * USA.
023: *
024: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025: * in the United States and other countries.]
026: *
027: * ---------------
028: * ChartColor.java
029: * ---------------
030: * (C) Copyright 2003-2007, by Cameron Riley and Contributors.
031: *
032: * Original Author: Cameron Riley;
033: * Contributor(s): David Gilbert (for Object Refinery Limited);
034: *
035: * $Id: ChartColor.java,v 1.3.2.3 2007/02/02 15:53:36 mungady Exp $
036: *
037: * Changes
038: * -------
039: * 23-Jan-2003 : Version 1, contributed by Cameron Riley (DG);
040: * 25-Nov-2004 : Changed first 7 colors to softer shades (DG);
041: * 03-Nov-2005 : Removed orange color, too close to yellow - see bug
042: * report 1328408 (DG);
043: * ------------- JFREECHART 1.0.x ---------------------------------------------
044: * 02-Feb-2007 : Removed author tags all over JFreeChart sources (DG);
045: *
046: */
047:
048: package org.jfree.chart;
049:
050: import java.awt.Color;
051: import java.awt.Paint;
052:
053: /**
054: * Class to extend the number of Colors available to the charts. This
055: * extends the java.awt.Color object and extends the number of final
056: * Colors publically accessible.
057: */
058: public class ChartColor extends Color {
059:
060: /** A very dark red color. */
061: public static final Color VERY_DARK_RED = new Color(0x80, 0x00,
062: 0x00);
063:
064: /** A dark red color. */
065: public static final Color DARK_RED = new Color(0xc0, 0x00, 0x00);
066:
067: /** A light red color. */
068: public static final Color LIGHT_RED = new Color(0xFF, 0x40, 0x40);
069:
070: /** A very light red color. */
071: public static final Color VERY_LIGHT_RED = new Color(0xFF, 0x80,
072: 0x80);
073:
074: /** A very dark yellow color. */
075: public static final Color VERY_DARK_YELLOW = new Color(0x80, 0x80,
076: 0x00);
077:
078: /** A dark yellow color. */
079: public static final Color DARK_YELLOW = new Color(0xC0, 0xC0, 0x00);
080:
081: /** A light yellow color. */
082: public static final Color LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x40);
083:
084: /** A very light yellow color. */
085: public static final Color VERY_LIGHT_YELLOW = new Color(0xFF, 0xFF,
086: 0x80);
087:
088: /** A very dark green color. */
089: public static final Color VERY_DARK_GREEN = new Color(0x00, 0x80,
090: 0x00);
091:
092: /** A dark green color. */
093: public static final Color DARK_GREEN = new Color(0x00, 0xC0, 0x00);
094:
095: /** A light green color. */
096: public static final Color LIGHT_GREEN = new Color(0x40, 0xFF, 0x40);
097:
098: /** A very light green color. */
099: public static final Color VERY_LIGHT_GREEN = new Color(0x80, 0xFF,
100: 0x80);
101:
102: /** A very dark cyan color. */
103: public static final Color VERY_DARK_CYAN = new Color(0x00, 0x80,
104: 0x80);
105:
106: /** A dark cyan color. */
107: public static final Color DARK_CYAN = new Color(0x00, 0xC0, 0xC0);
108:
109: /** A light cyan color. */
110: public static final Color LIGHT_CYAN = new Color(0x40, 0xFF, 0xFF);
111:
112: /** Aa very light cyan color. */
113: public static final Color VERY_LIGHT_CYAN = new Color(0x80, 0xFF,
114: 0xFF);
115:
116: /** A very dark blue color. */
117: public static final Color VERY_DARK_BLUE = new Color(0x00, 0x00,
118: 0x80);
119:
120: /** A dark blue color. */
121: public static final Color DARK_BLUE = new Color(0x00, 0x00, 0xC0);
122:
123: /** A light blue color. */
124: public static final Color LIGHT_BLUE = new Color(0x40, 0x40, 0xFF);
125:
126: /** A very light blue color. */
127: public static final Color VERY_LIGHT_BLUE = new Color(0x80, 0x80,
128: 0xFF);
129:
130: /** A very dark magenta/purple color. */
131: public static final Color VERY_DARK_MAGENTA = new Color(0x80, 0x00,
132: 0x80);
133:
134: /** A dark magenta color. */
135: public static final Color DARK_MAGENTA = new Color(0xC0, 0x00, 0xC0);
136:
137: /** A light magenta color. */
138: public static final Color LIGHT_MAGENTA = new Color(0xFF, 0x40,
139: 0xFF);
140:
141: /** A very light magenta color. */
142: public static final Color VERY_LIGHT_MAGENTA = new Color(0xFF,
143: 0x80, 0xFF);
144:
145: /**
146: * Creates a Color with an opaque sRGB with red, green and blue values in
147: * range 0-255.
148: *
149: * @param r the red component in range 0x00-0xFF.
150: * @param g the green component in range 0x00-0xFF.
151: * @param b the blue component in range 0x00-0xFF.
152: */
153: public ChartColor(int r, int g, int b) {
154: super (r, g, b);
155: }
156:
157: /**
158: * Convenience method to return an array of <code>Paint</code> objects that
159: * represent the pre-defined colors in the <code>Color<code> and
160: * <code>ChartColor</code> objects.
161: *
162: * @return An array of objects with the <code>Paint</code> interface.
163: */
164: public static Paint[] createDefaultPaintArray() {
165:
166: return new Paint[] { new Color(0xFF, 0x55, 0x55),
167: new Color(0x55, 0x55, 0xFF),
168: new Color(0x55, 0xFF, 0x55),
169: new Color(0xFF, 0xFF, 0x55),
170: new Color(0xFF, 0x55, 0xFF),
171: new Color(0x55, 0xFF, 0xFF), Color.pink, Color.gray,
172: ChartColor.DARK_RED, ChartColor.DARK_BLUE,
173: ChartColor.DARK_GREEN, ChartColor.DARK_YELLOW,
174: ChartColor.DARK_MAGENTA, ChartColor.DARK_CYAN,
175: Color.darkGray, ChartColor.LIGHT_RED,
176: ChartColor.LIGHT_BLUE, ChartColor.LIGHT_GREEN,
177: ChartColor.LIGHT_YELLOW, ChartColor.LIGHT_MAGENTA,
178: ChartColor.LIGHT_CYAN, Color.lightGray,
179: ChartColor.VERY_DARK_RED, ChartColor.VERY_DARK_BLUE,
180: ChartColor.VERY_DARK_GREEN,
181: ChartColor.VERY_DARK_YELLOW,
182: ChartColor.VERY_DARK_MAGENTA,
183: ChartColor.VERY_DARK_CYAN, ChartColor.VERY_LIGHT_RED,
184: ChartColor.VERY_LIGHT_BLUE,
185: ChartColor.VERY_LIGHT_GREEN,
186: ChartColor.VERY_LIGHT_YELLOW,
187: ChartColor.VERY_LIGHT_MAGENTA,
188: ChartColor.VERY_LIGHT_CYAN };
189: }
190:
191: }
|