public class SNTColor
extends java.lang.Object
| Constructor and Description |
|---|
SNTColor(java.awt.Color color)
Instantiates a new SNT color without SWC type association
|
SNTColor(java.awt.Color color,
int swcType)
Instantiates a new SNT color.
|
| Modifier and Type | Method and Description |
|---|---|
static java.awt.Color |
alphaColor(java.awt.Color c,
double percent)
Adds an alpha component to a AWT color.
|
static java.awt.Color |
average(java.util.Collection<java.awt.Color> colors)
Averages a collection of colors
|
java.awt.Color |
color()
Retrieves the AWT color
|
static java.lang.String |
colorToString(java.awt.Color color)
Returns the color encoded as hex string with the format #rrggbbaa.
|
static java.awt.Color |
contrastColor(java.awt.Color c)
Returns a suitable 'contrast' color.
|
boolean |
equals(java.lang.Object obj) |
static org.scijava.util.ColorRGB[] |
getDistinctColors(int nColors)
Returns distinct colors based on Kenneth Kelly's 22 colors of maximum
contrast (black and white excluded).
|
int |
hashCode() |
boolean |
isTypeDefined()
Checks if an SWC type has been defined.
|
void |
setAWTColor(java.awt.Color color)
Re-assigns a AWT color.
|
void |
setSWCType(int swcType)
Re-assigns a SWC type integer flag
|
static java.awt.Color |
stringToColor(java.lang.String hex)
Returns an AWT Color from a (#)RRGGBB(AA) hex string.
|
int |
type()
Retrieves the SWC type
|
public SNTColor(java.awt.Color color,
int swcType)
color - the AWT colorswcType - the SWC type integer flag to be associated with colorpublic SNTColor(java.awt.Color color)
color - the AWT colorpublic java.awt.Color color()
public int type()
public boolean isTypeDefined()
public void setAWTColor(java.awt.Color color)
color - the new colorpublic void setSWCType(int swcType)
swcType - the new SWC typepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic static java.lang.String colorToString(java.awt.Color color)
color - the input AWT colorpublic static java.awt.Color stringToColor(java.lang.String hex)
hex - the input stringpublic static java.awt.Color average(java.util.Collection<java.awt.Color> colors)
colors - the colors to be averagedpublic static java.awt.Color alphaColor(java.awt.Color c,
double percent)
c - the input colorpercent - alpha value in percentagepublic static java.awt.Color contrastColor(java.awt.Color c)
c - the input colorpublic static org.scijava.util.ColorRGB[] getDistinctColors(int nColors)
nColors - the number of colors to be retrieved.