public class SnapColor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static SnapColor |
BLACK |
static SnapColor |
BLUE |
static SnapColor |
CLEAR |
static SnapColor |
CLEARWHITE |
static SnapColor |
CYAN |
static SnapColor |
DARKGRAY |
static SnapColor |
GRAY |
static SnapColor |
GREEN |
static SnapColor |
LIGHTBLUE |
static SnapColor |
LIGHTGRAY |
static SnapColor |
MAGENTA |
static SnapColor |
ORANGE |
static SnapColor |
PINK |
static SnapColor |
RED |
static SnapColor |
WHITE |
static SnapColor |
YELLOW |
Constructor and Description |
---|
SnapColor()
Creates a plain black opaque color.
|
SnapColor(double g)
Creates a color with the given gray value (0-1).
|
SnapColor(double g,
double a)
Creates a color with the given gray and alpha values (0-1).
|
SnapColor(double r,
double g,
double b)
Creates a color with the given red, green blue values (0-1).
|
SnapColor(double r,
double g,
double b,
double a)
Creates a color with the given red, green, blue values (0-1).
|
SnapColor(float c,
float m,
float y,
float k,
float a)
Creates a color with the given cyan, magenta, yellow, black and alpha values (0-1).
|
SnapColor(int r,
int g,
int b)
Creates a color with the given red, green blue values (0-1).
|
SnapColor(java.lang.String aHexString)
Creates a new color from the given hex string.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
awt()
Returns an AWT version of this color.
|
SnapColor |
blend(SnapColor aColor,
double aFraction)
Returns a color darker than this color (by this given fraction).
|
SnapColor |
brighter()
Returns a color brighter than this color (blended with white).
|
static SnapColor |
colorValue(java.lang.Object anObj)
Returns a color value for a given object.
|
SnapColor |
darker()
Returns a color darker than this color (blended with black).
|
boolean |
equals(java.lang.Object anObj)
Standard equals implementation.
|
double |
getAlpha2D()
Returns the alpha component in the range 0-1.
|
int |
getAlphaInt()
Returns the alpha component in the range 0-255.
|
double |
getBlue2D()
Returns the blue component in the range 0-1.
|
int |
getBlueInt()
Returns the blue component in the range 0-255.
|
double |
getGreen2D()
Returns the green component in the range 0-1.
|
int |
getGreenInt()
Returns the green component in the range 0-255.
|
static SnapColor |
getRandom()
Returns a random color.
|
double |
getRed2D()
Returns the red component in the range 0-1.
|
int |
getRedInt()
Returns the red component in the range 0-255.
|
int |
getRGBA()
Returns the color as an int.
|
int |
hashCode()
Standard Hashcode implementation.
|
java.lang.String |
toHexString()
Returns a hex string representation of this color.
|
java.lang.String |
toString()
Returns a string representation of this color.
|
public static SnapColor BLACK
public static SnapColor BLUE
public static SnapColor CYAN
public static SnapColor DARKGRAY
public static SnapColor GRAY
public static SnapColor GREEN
public static SnapColor LIGHTGRAY
public static SnapColor MAGENTA
public static SnapColor ORANGE
public static SnapColor PINK
public static SnapColor RED
public static SnapColor WHITE
public static SnapColor YELLOW
public static SnapColor CLEAR
public static SnapColor LIGHTBLUE
public static SnapColor CLEARWHITE
public SnapColor()
public SnapColor(double g)
public SnapColor(double g, double a)
public SnapColor(double r, double g, double b)
public SnapColor(int r, int g, int b)
public SnapColor(double r, double g, double b, double a)
public SnapColor(float c, float m, float y, float k, float a)
public SnapColor(java.lang.String aHexString)
public double getRed2D()
public double getGreen2D()
public double getBlue2D()
public double getAlpha2D()
public int getRedInt()
public int getGreenInt()
public int getBlueInt()
public int getAlphaInt()
public int getRGBA()
public SnapColor brighter()
public SnapColor darker()
public SnapColor blend(SnapColor aColor, double aFraction)
public boolean equals(java.lang.Object anObj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toHexString()
public static SnapColor colorValue(java.lang.Object anObj)
public static SnapColor getRandom()
public java.awt.Color awt()