public class Gradient
extends java.lang.Object
There are a number of defined gradient types (look at the static fields), but you can create any gradient you like by using either of the following functions:
myHeatMap.updateGradient(Gradient.createMultiGradient(new Color[] {Color.red, Color.white, Color.blue}, 256));
Copyright: Copyright (c) 2007, 2008
HeatMap is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
HeatMap is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with HeatMap; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modifier and Type | Field and Description |
---|---|
static java.awt.Color[] |
GRADIENT_ALPHA |
static java.awt.Color[] |
GRADIENT_BLACK_TO_WHITE
Produces a gradient from black (low) to white (high)
|
static java.awt.Color[] |
GRADIENT_BLUE_TO_RED
Produces a gradient from blue (low) to red (high)
|
static java.awt.Color[] |
GRADIENT_GREEN_YELLOW_ORANGE_RED
Produces a gradient through green, yellow, orange, red
|
static java.awt.Color[] |
GRADIENT_HEAT
Produces a different gradient for hot things (black, brown, orange, white)
|
static java.awt.Color[] |
GRADIENT_HOT
Produces a gradient for hot things (black, red, orange, yellow, white)
|
static java.awt.Color[] |
GRADIENT_MAROON_TO_GOLD
Produces a gradient using the University of Minnesota's school colors, from maroon (low) to gold (high)
|
static java.awt.Color[] |
GRADIENT_PLASMA
From https://revolution-computing.typepad.com/.a/6a010534b1db25970b01bb0931cd68970d-pi
|
static java.awt.Color[] |
GRADIENT_RAINBOW
Produces a gradient through the rainbow: violet, blue, green, yellow, orange, red
|
static java.awt.Color[] |
GRADIENT_RED_TO_GREEN
Produces a gradient from red (low) to green (high)
|
static java.awt.Color[] |
GRADIENT_ROY
Produces a gradient through red, orange, yellow
|
Constructor and Description |
---|
Gradient() |
Modifier and Type | Method and Description |
---|---|
static java.awt.Color[] |
createGradient(java.awt.Color one,
java.awt.Color two,
int numSteps)
Creates an array of Color objects for use as a gradient, using a linear
interpolation between the two specified colors.
|
static java.awt.Color[] |
createMultiGradient(java.awt.Color[] colors,
int numSteps)
Creates an array of Color objects for use as a gradient, using an array of Color objects.
|
public static final java.awt.Color[] GRADIENT_MAROON_TO_GOLD
public static final java.awt.Color[] GRADIENT_BLUE_TO_RED
public static final java.awt.Color[] GRADIENT_BLACK_TO_WHITE
public static final java.awt.Color[] GRADIENT_RED_TO_GREEN
public static final java.awt.Color[] GRADIENT_GREEN_YELLOW_ORANGE_RED
public static final java.awt.Color[] GRADIENT_PLASMA
public static final java.awt.Color[] GRADIENT_ALPHA
public static final java.awt.Color[] GRADIENT_RAINBOW
public static final java.awt.Color[] GRADIENT_HOT
public static final java.awt.Color[] GRADIENT_HEAT
public static final java.awt.Color[] GRADIENT_ROY
public static java.awt.Color[] createGradient(java.awt.Color one, java.awt.Color two, int numSteps)
one
- Color used for the bottom of the gradienttwo
- Color used for the top of the gradientnumSteps
- The number of steps in the gradient. 250 is a good number.public static java.awt.Color[] createMultiGradient(java.awt.Color[] colors, int numSteps)
colors
- An array of Color objects used for the gradient. The Color at index 0 will be the lowest color.numSteps
- The number of steps in the gradient. 250 is a good number.