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: * RainbowPalette.java
029: * -------------------
030: * (C) Copyright 2002-2007, by David M. O'Donnell and Contributors.
031: *
032: * Original Author: David M. O'Donnell;
033: * Contributor(s): David Gilbert (for Object Refinery Limited);
034: *
035: * $Id: RainbowPalette.java,v 1.1.2.4 2007/04/04 09:10:18 mungady Exp $
036: *
037: * Changes
038: * -------
039: * 26-Nov-2002 : Version 1 contributed by David M. O'Donnell (DG);
040: * 26-Mar-2003 : Implemented Serializable (DG);
041: * ------------- JFREECHART 1.0.x ---------------------------------------------
042: * 31-Jan-2007 : Deprecated (DG);
043: *
044: */
045:
046: package org.jfree.chart.plot;
047:
048: import java.io.Serializable;
049:
050: import org.jfree.chart.renderer.xy.XYBlockRenderer;
051:
052: /**
053: * Contains the data to construct an 8-bit rainbow palette
054: * This come from an old application which ran on 8-bit graphics device.
055: * Thus indexes 0 and 1 were preserved for rendering white and black
056: * respectively.
057: *
058: * @deprecated This class is no longer supported (as of version 1.0.4). If
059: * you are creating contour plots, please try to use {@link XYPlot} and
060: * {@link XYBlockRenderer}.
061: */
062: public class RainbowPalette extends ColorPalette implements
063: Serializable {
064:
065: /** For serialization. */
066: private static final long serialVersionUID = -1906707320728242478L;
067:
068: /** The red values. */
069: private int[] red = { 255, 0, 120, 115, 111, 106, 102, 97, 93, 88,
070: 84, 79, 75, 70, 66, 61, 57, 52, 48, 43, 39, 34, 30, 25, 21,
071: 16, 12, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
072: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
073: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
074: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
075: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
076: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5,
077: 10, 14, 19, 23, 28, 32, 37, 41, 46, 50, 55, 59, 64, 68, 73,
078: 77, 82, 86, 91, 95, 100, 104, 109, 113, 118, 123, 127, 132,
079: 136, 141, 145, 150, 154, 159, 163, 168, 172, 177, 181, 186,
080: 190, 195, 199, 204, 208, 213, 217, 222, 226, 231, 235, 240,
081: 244, 249, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255,
082: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
083: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
084: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
085: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
086:
087: /** The green values. */
088: private int[] green = { 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
089: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 11, 15,
090: 20, 24, 29, 33, 38, 42, 47, 51, 56, 60, 65, 69, 74, 78, 83,
091: 87, 92, 96, 101, 105, 110, 114, 119, 123, 128, 132, 137,
092: 141, 146, 150, 155, 159, 164, 168, 173, 177, 182, 186, 191,
093: 195, 200, 204, 209, 213, 218, 222, 227, 231, 236, 241, 245,
094: 250, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
095: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
096: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
097: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
098: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
099: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
100: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
101: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
102: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
103: 255, 255, 255, 255, 255, 255, 255, 252, 248, 243, 239, 234,
104: 230, 225, 221, 216, 212, 207, 203, 198, 194, 189, 185, 180,
105: 176, 171, 167, 162, 158, 153, 149, 144, 140, 135, 131, 126,
106: 122, 117, 113, 108, 104, 99, 95, 90, 86, 81, 77, 72, 68,
107: 63, 59, 54, 50, 45, 41, 36, 32, 27, 23, 18, 14, 9, 5, 0 };
108:
109: /** The blue values. */
110: private int[] blue = { 255, 0, 255, 255, 255, 255, 255, 255, 255,
111: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
112: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
113: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
114: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
115: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
116: 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
117: 255, 255, 255, 255, 255, 251, 247, 242, 238, 233, 229, 224,
118: 220, 215, 211, 206, 202, 197, 193, 188, 184, 179, 175, 170,
119: 166, 161, 157, 152, 148, 143, 139, 134, 130, 125, 121, 116,
120: 112, 107, 103, 98, 94, 89, 85, 80, 76, 71, 67, 62, 58, 53,
121: 49, 44, 40, 35, 31, 26, 22, 17, 13, 8, 4, 0, 0, 0, 0, 0, 0,
122: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
124: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
125: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
127: 0, 0, 0, 0, 0, 0, 0, 0 };
128:
129: /**
130: * Default constructor.
131: */
132: public RainbowPalette() {
133: super ();
134: initialize();
135: }
136:
137: /**
138: * Intializes the palettes indexes
139: */
140: public void initialize() {
141:
142: setPaletteName("Rainbow");
143:
144: this .r = new int[this .red.length];
145: this .g = new int[this .green.length];
146: this .b = new int[this .blue.length];
147: System.arraycopy(this .red, 0, this .r, 0, this .red.length);
148: System.arraycopy(this .green, 0, this .g, 0, this .green.length);
149: System.arraycopy(this .blue, 0, this .b, 0, this.blue.length);
150:
151: }
152:
153: }
|