Package org.jzy3d.colors
Class Color
- java.lang.Object
-
- org.jzy3d.colors.Color
-
public class Color extends Object
Color interface.The Color interface provide a representation of a color, independant from the target Window Toolkit (AWT, SWT, etc).
- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description float
a
float
b
static Color
BLACK
static Color
BLUE
static Color[]
COLORS
static Color
CYAN
float
g
static Color
GRAY
static Color
GREEN
static Color
MAGENTA
static Color
ORANGE
float
r
static Color
RED
static Random
rng
static Color
WHITE
static Color
YELLOW
-
Constructor Summary
Constructors Constructor Description Color(double r, double g, double b)
Color(double r, double g, double b, double a)
Color(float r, float g, float b)
Initialize a color with an alpha channel set to 1, using input values between 0.0 and 1.0.Color(float r, float g, float b, float a)
Initialize a color with input values between 0.0 and 1.0.Color(int r, int g, int b)
Initialize a color with an alpha channel set to 1, using input values between 0 and 255.Color(int r, int g, int b, int a)
Initialize a color with values between 0 and 255.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Color
add(Color color)
Color
alpha(float alpha)
Color
alphaSelf(float alpha)
Color
clone()
static Color
color(int c)
Returns one of the main color based on id.double
distance(Color c)
Compute the distance between two colors.double
distanceSq(Color c)
Compute the square distance between two colors.Color
div(Color factor)
Color
divSelf(float ratio)
Color
divSelfWithAlpha(float ratio)
Color
mul(Color factor)
Color
mulSelf(float ratio)
Color
mulSelfWithAlpha(float ratio)
Color
negative()
Color
negativeSelf()
static Color
random()
Deprecated.float[]
toArray()
String
toHex()
Return the hexadecimal representation of this color.String
toString()
-
-
-
Field Detail
-
BLACK
public static final Color BLACK
-
WHITE
public static final Color WHITE
-
GRAY
public static final Color GRAY
-
RED
public static final Color RED
-
GREEN
public static final Color GREEN
-
BLUE
public static final Color BLUE
-
YELLOW
public static final Color YELLOW
-
MAGENTA
public static final Color MAGENTA
-
CYAN
public static final Color CYAN
-
ORANGE
public static final Color ORANGE
-
COLORS
public static final Color[] COLORS
-
r
public float r
-
g
public float g
-
b
public float b
-
a
public float a
-
rng
public static Random rng
-
-
Constructor Detail
-
Color
public Color(float r, float g, float b)
Initialize a color with an alpha channel set to 1, using input values between 0.0 and 1.0.
-
Color
public Color(int r, int g, int b)
Initialize a color with an alpha channel set to 1, using input values between 0 and 255.
-
Color
public Color(float r, float g, float b, float a)
Initialize a color with input values between 0.0 and 1.0.
-
Color
public Color(int r, int g, int b, int a)
Initialize a color with values between 0 and 255.
-
Color
public Color(double r, double g, double b)
-
Color
public Color(double r, double g, double b, double a)
-
-
Method Detail
-
mulSelf
public Color mulSelf(float ratio)
-
mulSelfWithAlpha
public Color mulSelfWithAlpha(float ratio)
-
divSelf
public Color divSelf(float ratio)
-
divSelfWithAlpha
public Color divSelfWithAlpha(float ratio)
-
alphaSelf
public Color alphaSelf(float alpha)
-
alpha
public Color alpha(float alpha)
-
toHex
public String toHex()
Return the hexadecimal representation of this color.
-
toArray
public float[] toArray()
-
negative
public Color negative()
-
negativeSelf
public Color negativeSelf()
-
random
@Deprecated public static Color random()
Deprecated.UseRandomGeom.color()
instead.
-
color
public static Color color(int c)
Returns one of the main color based on id. Use id%(#colors)
-
distance
public double distance(Color c)
Compute the distance between two colors.
-
distanceSq
public double distanceSq(Color c)
Compute the square distance between two colors.
-
-