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)
-
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.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.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.
-
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.
-
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.
-