Class Cam16
CAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16 specification, and should be used when measuring distances between colors.
In traditional color spaces, a color can be identified solely by the observer's measurement of the color. Color appearance models such as CAM16 also use information about the environment where the color was observed, known as the viewing conditions.
For example, white under the traditional assumption of a midday sun white point is accurately measured as a slightly chromatic blue by CAM16. (roughly, hue 203, chroma 3, lightness 100)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleprivate final double(package private) static final double[][]private final doubleprivate final doubleprivate final doubleprivate final doubleprivate final doubleprivate final doubleprivate final doubleprivate final double[](package private) static final double[][] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCam16(double hue, double chroma, double j, double q, double m, double s, double jstar, double astar, double bstar) All of the CAM16 dimensions can be calculated from 3 of the dimensions, in the following combinations: - {j or q} and {c, m, or s} and hue - jstar, astar, bstar Prefer using a static method that constructs from 3 of those dimensions. -
Method Summary
Modifier and TypeMethodDescriptiondoubleCAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*, b*, or jstar, astar, bstar in code.static Cam16fromInt(int argb) Create a CAM16 color from a color, assuming the color was viewed in default viewing conditions.(package private) static Cam16fromIntInViewingConditions(int argb, ViewingConditions viewingConditions) Create a CAM16 color from a color in defined viewing conditions.(package private) static Cam16fromJch(double j, double c, double h) private static Cam16fromJchInViewingConditions(double j, double c, double h, ViewingConditions viewingConditions) static Cam16fromUcs(double jstar, double astar, double bstar) Create a CAM16 color from CAM16-UCS coordinates.static Cam16fromUcsInViewingConditions(double jstar, double astar, double bstar, ViewingConditions viewingConditions) Create a CAM16 color from CAM16-UCS coordinates in defined viewing conditions.(package private) static Cam16fromXyzInViewingConditions(double x, double y, double z, ViewingConditions viewingConditions) doublegetAstar()a* coordinate in CAM16-UCSdoublegetBstar()b* coordinate in CAM16-UCSdoubleChroma in CAM16doublegetHue()Hue in CAM16doublegetJ()Lightness in CAM16doublegetJstar()Lightness coordinate in CAM16-UCSdoublegetM()Colorfulness in CAM16.doublegetQ()Brightness in CAM16.doublegetS()Saturation in CAM16.inttoInt()ARGB representation of the color.(package private) intviewed(ViewingConditions viewingConditions) ARGB representation of the color, in defined viewing conditions.(package private) double[]xyzInViewingConditions(ViewingConditions viewingConditions, double[] returnArray)
-
Field Details
-
XYZ_TO_CAM16RGB
static final double[][] XYZ_TO_CAM16RGB -
CAM16RGB_TO_XYZ
static final double[][] CAM16RGB_TO_XYZ -
hue
private final double hue -
chroma
private final double chroma -
j
private final double j -
q
private final double q -
m
private final double m -
s
private final double s -
jstar
private final double jstar -
astar
private final double astar -
bstar
private final double bstar -
tempArray
private final double[] tempArray
-
-
Constructor Details
-
Cam16
private Cam16(double hue, double chroma, double j, double q, double m, double s, double jstar, double astar, double bstar) All of the CAM16 dimensions can be calculated from 3 of the dimensions, in the following combinations: - {j or q} and {c, m, or s} and hue - jstar, astar, bstar Prefer using a static method that constructs from 3 of those dimensions. This constructor is intended for those methods to use to return all possible dimensions.- Parameters:
hue- for example, red, orange, yellow, green, etc.chroma- informally, colorfulness / color intensity. like saturation in HSL, except perceptually accurate.j- lightnessq- brightness; ratio of lightness to white point's lightnessm- colorfulnesss- saturation; ratio of chroma to white point's chromajstar- CAM16-UCS J coordinateastar- CAM16-UCS a coordinatebstar- CAM16-UCS b coordinate
-
-
Method Details
-
distance
CAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16 specification, and is used to measure distances between colors. -
getHue
public double getHue()Hue in CAM16 -
getChroma
public double getChroma()Chroma in CAM16 -
getJ
public double getJ()Lightness in CAM16 -
getQ
public double getQ()Brightness in CAM16.Prefer lightness, brightness is an absolute quantity. For example, a sheet of white paper is much brighter viewed in sunlight than in indoor light, but it is the lightest object under any lighting.
-
getM
public double getM()Colorfulness in CAM16.Prefer chroma, colorfulness is an absolute quantity. For example, a yellow toy car is much more colorful outside than inside, but it has the same chroma in both environments.
-
getS
public double getS()Saturation in CAM16.Colorfulness in proportion to brightness. Prefer chroma, saturation measures colorfulness relative to the color's own brightness, where chroma is colorfulness relative to white.
-
getJstar
public double getJstar()Lightness coordinate in CAM16-UCS -
getAstar
public double getAstar()a* coordinate in CAM16-UCS -
getBstar
public double getBstar()b* coordinate in CAM16-UCS -
fromInt
Create a CAM16 color from a color, assuming the color was viewed in default viewing conditions.- Parameters:
argb- ARGB representation of a color.
-
fromIntInViewingConditions
Create a CAM16 color from a color in defined viewing conditions.- Parameters:
argb- ARGB representation of a color.viewingConditions- Information about the environment where the color was observed.
-
fromXyzInViewingConditions
static Cam16 fromXyzInViewingConditions(double x, double y, double z, ViewingConditions viewingConditions) -
fromJch
- Parameters:
j- CAM16 lightnessc- CAM16 chromah- CAM16 hue
-
fromJchInViewingConditions
private static Cam16 fromJchInViewingConditions(double j, double c, double h, ViewingConditions viewingConditions) - Parameters:
j- CAM16 lightnessc- CAM16 chromah- CAM16 hueviewingConditions- Information about the environment where the color was observed.
-
fromUcs
Create a CAM16 color from CAM16-UCS coordinates.- Parameters:
jstar- CAM16-UCS lightness.astar- CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian coordinate on the Y axis.bstar- CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian coordinate on the X axis.
-
fromUcsInViewingConditions
public static Cam16 fromUcsInViewingConditions(double jstar, double astar, double bstar, ViewingConditions viewingConditions) Create a CAM16 color from CAM16-UCS coordinates in defined viewing conditions.- Parameters:
jstar- CAM16-UCS lightness.astar- CAM16-UCS a dimension. Like a* in L*a*b*, it is a Cartesian coordinate on the Y axis.bstar- CAM16-UCS b dimension. Like a* in L*a*b*, it is a Cartesian coordinate on the X axis.viewingConditions- Information about the environment where the color was observed.
-
toInt
public int toInt()ARGB representation of the color. Assumes the color was viewed in default viewing conditions, which are near-identical to the default viewing conditions for sRGB. -
viewed
ARGB representation of the color, in defined viewing conditions.- Parameters:
viewingConditions- Information about the environment where the color will be viewed.- Returns:
- ARGB representation of color
-
xyzInViewingConditions
-