Frames | No Frames |
1: /* =========================================================== 2: * JFreeChart : a free chart library for the Java(tm) platform 3: * =========================================================== 4: * 5: * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors. 6: * 7: * Project Info: http://www.jfree.org/jfreechart/index.html 8: * 9: * This library is free software; you can redistribute it and/or modify it 10: * under the terms of the GNU Lesser General Public License as published by 11: * the Free Software Foundation; either version 2.1 of the License, or 12: * (at your option) any later version. 13: * 14: * This library is distributed in the hope that it will be useful, but 15: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17: * License for more details. 18: * 19: * You should have received a copy of the GNU Lesser General Public 20: * License along with this library; if not, write to the Free Software 21: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 22: * USA. 23: * 24: * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 25: * in the United States and other countries.] 26: * 27: * --------------- 28: * ChartColor.java 29: * --------------- 30: * (C) Copyright 2003-2007, by Cameron Riley and Contributors. 31: * 32: * Original Author: Cameron Riley; 33: * Contributor(s): David Gilbert (for Object Refinery Limited); 34: * 35: * Changes 36: * ------- 37: * 23-Jan-2003 : Version 1, contributed by Cameron Riley (DG); 38: * 25-Nov-2004 : Changed first 7 colors to softer shades (DG); 39: * 03-Nov-2005 : Removed orange color, too close to yellow - see bug 40: * report 1328408 (DG); 41: * ------------- JFREECHART 1.0.x --------------------------------------------- 42: * 02-Feb-2007 : Removed author tags all over JFreeChart sources (DG); 43: * 44: */ 45: 46: package org.jfree.chart; 47: 48: import java.awt.Color; 49: import java.awt.Paint; 50: 51: /** 52: * Class to extend the number of Colors available to the charts. This 53: * extends the java.awt.Color object and extends the number of final 54: * Colors publically accessible. 55: */ 56: public class ChartColor extends Color { 57: 58: /** A very dark red color. */ 59: public static final Color VERY_DARK_RED = new Color(0x80, 0x00, 0x00); 60: 61: /** A dark red color. */ 62: public static final Color DARK_RED = new Color(0xc0, 0x00, 0x00); 63: 64: /** A light red color. */ 65: public static final Color LIGHT_RED = new Color(0xFF, 0x40, 0x40); 66: 67: /** A very light red color. */ 68: public static final Color VERY_LIGHT_RED = new Color(0xFF, 0x80, 0x80); 69: 70: /** A very dark yellow color. */ 71: public static final Color VERY_DARK_YELLOW = new Color(0x80, 0x80, 0x00); 72: 73: /** A dark yellow color. */ 74: public static final Color DARK_YELLOW = new Color(0xC0, 0xC0, 0x00); 75: 76: /** A light yellow color. */ 77: public static final Color LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x40); 78: 79: /** A very light yellow color. */ 80: public static final Color VERY_LIGHT_YELLOW = new Color(0xFF, 0xFF, 0x80); 81: 82: /** A very dark green color. */ 83: public static final Color VERY_DARK_GREEN = new Color(0x00, 0x80, 0x00); 84: 85: /** A dark green color. */ 86: public static final Color DARK_GREEN = new Color(0x00, 0xC0, 0x00); 87: 88: /** A light green color. */ 89: public static final Color LIGHT_GREEN = new Color(0x40, 0xFF, 0x40); 90: 91: /** A very light green color. */ 92: public static final Color VERY_LIGHT_GREEN = new Color(0x80, 0xFF, 0x80); 93: 94: /** A very dark cyan color. */ 95: public static final Color VERY_DARK_CYAN = new Color(0x00, 0x80, 0x80); 96: 97: /** A dark cyan color. */ 98: public static final Color DARK_CYAN = new Color(0x00, 0xC0, 0xC0); 99: 100: /** A light cyan color. */ 101: public static final Color LIGHT_CYAN = new Color(0x40, 0xFF, 0xFF); 102: 103: /** Aa very light cyan color. */ 104: public static final Color VERY_LIGHT_CYAN = new Color(0x80, 0xFF, 0xFF); 105: 106: /** A very dark blue color. */ 107: public static final Color VERY_DARK_BLUE = new Color(0x00, 0x00, 0x80); 108: 109: /** A dark blue color. */ 110: public static final Color DARK_BLUE = new Color(0x00, 0x00, 0xC0); 111: 112: /** A light blue color. */ 113: public static final Color LIGHT_BLUE = new Color(0x40, 0x40, 0xFF); 114: 115: /** A very light blue color. */ 116: public static final Color VERY_LIGHT_BLUE = new Color(0x80, 0x80, 0xFF); 117: 118: /** A very dark magenta/purple color. */ 119: public static final Color VERY_DARK_MAGENTA = new Color(0x80, 0x00, 0x80); 120: 121: /** A dark magenta color. */ 122: public static final Color DARK_MAGENTA = new Color(0xC0, 0x00, 0xC0); 123: 124: /** A light magenta color. */ 125: public static final Color LIGHT_MAGENTA = new Color(0xFF, 0x40, 0xFF); 126: 127: /** A very light magenta color. */ 128: public static final Color VERY_LIGHT_MAGENTA = new Color(0xFF, 0x80, 0xFF); 129: 130: /** 131: * Creates a Color with an opaque sRGB with red, green and blue values in 132: * range 0-255. 133: * 134: * @param r the red component in range 0x00-0xFF. 135: * @param g the green component in range 0x00-0xFF. 136: * @param b the blue component in range 0x00-0xFF. 137: */ 138: public ChartColor(int r, int g, int b) { 139: super(r, g, b); 140: } 141: 142: /** 143: * Convenience method to return an array of <code>Paint</code> objects that 144: * represent the pre-defined colors in the <code>Color<code> and 145: * <code>ChartColor</code> objects. 146: * 147: * @return An array of objects with the <code>Paint</code> interface. 148: */ 149: public static Paint[] createDefaultPaintArray() { 150: 151: return new Paint[] { 152: new Color(0xFF, 0x55, 0x55), 153: new Color(0x55, 0x55, 0xFF), 154: new Color(0x55, 0xFF, 0x55), 155: new Color(0xFF, 0xFF, 0x55), 156: new Color(0xFF, 0x55, 0xFF), 157: new Color(0x55, 0xFF, 0xFF), 158: Color.pink, 159: Color.gray, 160: ChartColor.DARK_RED, 161: ChartColor.DARK_BLUE, 162: ChartColor.DARK_GREEN, 163: ChartColor.DARK_YELLOW, 164: ChartColor.DARK_MAGENTA, 165: ChartColor.DARK_CYAN, 166: Color.darkGray, 167: ChartColor.LIGHT_RED, 168: ChartColor.LIGHT_BLUE, 169: ChartColor.LIGHT_GREEN, 170: ChartColor.LIGHT_YELLOW, 171: ChartColor.LIGHT_MAGENTA, 172: ChartColor.LIGHT_CYAN, 173: Color.lightGray, 174: ChartColor.VERY_DARK_RED, 175: ChartColor.VERY_DARK_BLUE, 176: ChartColor.VERY_DARK_GREEN, 177: ChartColor.VERY_DARK_YELLOW, 178: ChartColor.VERY_DARK_MAGENTA, 179: ChartColor.VERY_DARK_CYAN, 180: ChartColor.VERY_LIGHT_RED, 181: ChartColor.VERY_LIGHT_BLUE, 182: ChartColor.VERY_LIGHT_GREEN, 183: ChartColor.VERY_LIGHT_YELLOW, 184: ChartColor.VERY_LIGHT_MAGENTA, 185: ChartColor.VERY_LIGHT_CYAN 186: }; 187: } 188: 189: }