public class XYZColor extends java.lang.Object implements RColor
fill(myXYZObject.getColor());The difference between multiple color objects can be calculated with the methods of ColorDifference class.
| Modifier and Type | Field and Description |
|---|---|
static ColorSpace |
NAME
The ColorSpace of RGB colors.
|
static float |
REFERENCE_X
X Value for the specific illuminants and observers (2° [CIE 1931] - D65 -
Daylight, sRGB, Adobe-RGB conversion)
|
static float |
REFERENCE_Y
Y Value for the specific illuminants and observers (2° [CIE 1931] - D65 -
Daylight, sRGB, Adobe-RGB conversion)
|
static float |
REFERENCE_Z
Z Value for the specific illuminants and observers (2° [CIE 1931] - D65 -
Daylight, sRGB, Adobe-RGB conversion)
|
| Constructor and Description |
|---|
XYZColor(float... channels)
Creates a new XYZColor object.
|
XYZColor(java.lang.Float x,
java.lang.Float y,
java.lang.Float z)
Creates a new opaque XYZColor object.
|
XYZColor(java.lang.Float x,
java.lang.Float y,
java.lang.Float z,
java.lang.Float alpha)
Creates a new XYZColor object.
|
| Modifier and Type | Method and Description |
|---|---|
XYZColor |
copy()
Creates a deep copy of the object.
|
boolean |
equals(RColor other)
Checks if the input color is equal to this object.
|
java.lang.Float |
getAlpha()
Returns the value of alpha / transparency.
|
int |
getColor()
Returns a int representation of the current color.
|
ColorSpace |
getColorSpace()
Returns the color space of the color.
|
java.lang.String |
getHexString()
Returns a String representation of the current color using hexadecimal
numbers.
|
static java.lang.Float |
getLoss(RColor rvMean,
java.util.ArrayList<RColor> lColors,
ColorDifferenceMeasure m)
Calculates the loss - the mean distance of all members of colors to
rvMean.
|
static java.lang.Float |
getLoss(RColor rvMean,
java.util.ArrayList<RColor> lColors,
ColorDifferenceMeasure m,
int start,
int end)
Calculates the loss - the mean distance of all members of colors to
rvMean.
|
static java.lang.Float |
getLoss(RColor rvMean,
RColor[] colors,
ColorDifferenceMeasure m)
Calculates the loss - the mean distance of all members of colors to
rvMean.
|
static java.lang.Float |
getLoss(RColor rvMean,
RColor[] colors,
ColorDifferenceMeasure m,
int start,
int end)
Calculates the loss - the mean distance of all members of colors to
rvMean.
|
static XYZColor |
getMeanColor(java.util.ArrayList<RColor> colors)
Calculates the mean color of the input colors
|
static XYZColor |
getMeanColor(int start,
int end,
java.util.ArrayList<RColor> colors)
Calculates the mean color of the input colors.
|
static XYZColor |
getMeanColor(int start,
int end,
RColor... colors)
Calculates the mean color of the input colors.
|
static XYZColor |
getMeanColor(RColor... colors)
Calculates the mean color of the input colors
|
java.lang.String |
getName()
Returns the name of the color space e.g.
|
int |
getOpColor()
Returns a int representation of the current color - but ignoring the
alpha value.
|
java.lang.String |
getOpHexString()
Returns a String representation of the current color using hexadecimal
numbers.
|
static XYZColor |
getRandomXYZ()
Creates a new opaque XYZColor with random values.
|
float[] |
getValues()
Returns the color values of the current object.
|
float[] |
getValuesNormalized()
Returns the normalized color values of the current object.
|
java.lang.Float |
getX()
Returns the current value of x of this color.
|
java.lang.Float |
getY()
Returns the current value of y of this color.
|
java.lang.Float |
getZ()
Returns the current value of z of this color.
|
static XYZColor |
lerpColors(RColor input1,
RColor input2,
float amt)
Lerps the two input colors and creates a new color.
|
XYZColor |
setAlpha(java.lang.Float alpha)
Sets the value of alpha / transparency.
|
XYZColor |
setAlpha(int alpha)
Sets the value of alpha / transparency.
|
XYZColor |
setX(java.lang.Float x)
Sets the x value.
|
XYZColor |
setX(int x)
Sets the x value.
|
XYZColor |
setY(java.lang.Float y)
Sets the y value.
|
XYZColor |
setY(int y)
Sets the y value.
|
XYZColor |
setZ(java.lang.Float z)
Sets the z value.
|
XYZColor |
setZ(int z)
Sets the z value.
|
HSBColor |
toHSB()
Returns a HSBColor representation of the current color.
|
LabColor |
toLab()
Returns a LabColor representation of the current color.
|
LCHColor |
toLCH()
Returns a LCHColor representation of the current color.
|
RGBColor |
toRGB()
Returns a RGBColor representation of the current color.
|
java.lang.String |
toString() |
XYZColor |
toXYZ()
Returns a XYZColor representation of the current color.
|
public static final ColorSpace NAME
public static final float REFERENCE_X
public static final float REFERENCE_Y
public static final float REFERENCE_Z
public XYZColor(java.lang.Float x,
java.lang.Float y,
java.lang.Float z)
x - The x value [0, REFERENCE_X] = [0, 95.047]y - The y value [0, REFERENCE_Y] = [0, 100]z - The z value [0, REFERENCE_Z] = [0, 108.883]public XYZColor(java.lang.Float x,
java.lang.Float y,
java.lang.Float z,
java.lang.Float alpha)
x - The x value [0, REFERENCE_X] = [0, 95.047]y - The y value [0, REFERENCE_Y] = [0, 100]z - The z value [0, REFERENCE_Z] = [0, 108.883]alpha - THe alpha value [0, 100]public XYZColor(float... channels)
channels - Either [x, y, z] or [x, y, z, alpha].public int getColor()
RColorHSBColor hsb = new HSBColor(244, 100, 100); fill(hsb.getColor());
public XYZColor setAlpha(java.lang.Float alpha)
RColorpublic XYZColor setAlpha(int alpha)
alpha - The value of the colors transparency.public java.lang.Float getAlpha()
RColorpublic XYZColor setX(java.lang.Float x)
x - The new x value [0, REFERENCE_X] = [0, 95.047].public XYZColor setX(int x)
x - The new x value [0, REFERENCE_X] = [0, 95.047].public XYZColor setY(java.lang.Float y)
y - The new y value [0, REFERENCE_Y] = [0, 100].public XYZColor setY(int y)
y - The new y value [0, REFERENCE_Y] = [0, 100].public XYZColor setZ(java.lang.Float z)
z - The new z value [0, REFERENCE_Z] = [0, 108.883].public XYZColor setZ(int z)
z - The new z value [0, REFERENCE_Z] = [0, 108.883].public java.lang.Float getX()
public java.lang.Float getY()
public java.lang.Float getZ()
public java.lang.String getHexString()
RColorRGBColor rgb = new RGBColor(255, 0, 128, 0); rgb.getHexString(); // "00FF0080"
getHexString in interface RColorpublic int getOpColor()
RColorHSBColor hsb = new HSBColor(244, 100, 100, 50); fill(hsb.getOpColor());
getOpColor in interface RColorpublic java.lang.String getOpHexString()
RColorRGBColor rgb = new RGBColor(255, 0, 128, 0); rgb.getOpHexString(); // "FF0080"
getOpHexString in interface RColorpublic float[] getValues()
RColorpublic float[] getValuesNormalized()
RColorgetValuesNormalized in interface RColorpublic java.lang.String getName()
RColorpublic ColorSpace getColorSpace()
RColorgetColorSpace in interface RColorpublic XYZColor copy()
RColorpublic boolean equals(RColor other)
public java.lang.String toString()
toString in class java.lang.Objectpublic static XYZColor getMeanColor(RColor... colors)
colors - Colors (1 or more).public static XYZColor getMeanColor(java.util.ArrayList<RColor> colors)
colors - Colors.public static XYZColor getMeanColor(int start, int end, RColor... colors)
start - Start index of the subset of the input colors (start < end).
start will be member of the subset.end - End index of the subset of the input colors (start < end). end
will not be member of the subset.colors - Colors (1 or more).public static XYZColor getMeanColor(int start, int end, java.util.ArrayList<RColor> colors)
start - Start index of the subset of the input colors (start < end).
start will be member of the subset.end - End index of the subset of the input colors (start < end). end
will not be member of the subset.colors - Colors.public static java.lang.Float getLoss(RColor rvMean, RColor[] colors, ColorDifferenceMeasure m)
rvMean - A base color which will be used to calculate the distance to.colors - Colors.m - The measure which defines how the loss is calculated and which
color model will be used. This should be an RGB color
difference measure.public static java.lang.Float getLoss(RColor rvMean, RColor[] colors, ColorDifferenceMeasure m, int start, int end)
rvMean - A base color which will be used to calculate the distance to.colors - Colors.m - The measure which defines how the loss is calculated and which
color model will be used. This should be an RGB color
difference measure.start - Start index of the subset of the input colors (start < end).
start will be member of the subset.end - End index of the subset of the input colors (start < end). end
will not be member of the subset.public static java.lang.Float getLoss(RColor rvMean, java.util.ArrayList<RColor> lColors, ColorDifferenceMeasure m)
rvMean - A base color which will be used to calculate the distance to.lColors - Colors.m - The measure which defines how the loss is calculated and which
color model will be used. This should be an RGB color
difference measure.public static java.lang.Float getLoss(RColor rvMean, java.util.ArrayList<RColor> lColors, ColorDifferenceMeasure m, int start, int end)
rvMean - A base color which will be used to calculate the distance to.lColors - Colors.m - The measure which defines how the loss is calculated and which
color model will be used. This should be an RGB color
difference measure.start - Start index of the subset of the input colors (start < end).
start will be member of the subset.end - End index of the subset of the input colors (start < end). end
will not be member of the subset.public static XYZColor lerpColors(RColor input1, RColor input2, float amt)
input1 - The first color.input2 - The second color.amt - The lerping value [0, 1].public static XYZColor getRandomXYZ()
public RGBColor toRGB()
RColorpublic HSBColor toHSB()
RColorpublic XYZColor toXYZ()
RColorpublic LabColor toLab()
RColor