Package trclib.dataprocessor
Class TrcColor
java.lang.Object
trclib.dataprocessor.TrcColor
This class implements a platform independent color object. The color object describes color in either RGB or HSV
 formats. It also provides methods to convert between the two formats.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionTrcColor(int red, int green, int blue) Constructor: Create an instance of the object.
- 
Method SummaryModifier and TypeMethodDescriptiondoublegetBlue()This method returns the normalized blue value.doublegetGreen()This method returns the normalized green value.double[]getHSV()This method returns the HSV values in an array.doublegetHue()This method returns the hue of the HSV color.doublegetRed()This method returns the normalized red value.double[]getRGB()This method returns the normalized RGB values in an array.doubleThis method returns the saturation of the HSV color.doublegetValue()This method returns the value of the HSV color.static double[]rgbToHsv(double... rgb) This method translates the RGB color values into HSV.
- 
Field Details- 
rgbprivate final double[] rgb
- 
hsvprivate final double[] hsv
 
- 
- 
Constructor Details- 
TrcColorpublic TrcColor(int red, int green, int blue) Constructor: Create an instance of the object.- Parameters:
- red- specifies the red value (0-255).
- green- specifies the green value (0-255).
- blue- specifies the blue value (0-255).
 
 
- 
- 
Method Details- 
getRedpublic double getRed()This method returns the normalized red value.- Returns:
- normalized red value (0.0-1.0).
 
- 
getGreenpublic double getGreen()This method returns the normalized green value.- Returns:
- normalized green value (0.0-1.0).
 
- 
getBluepublic double getBlue()This method returns the normalized blue value.- Returns:
- normalized blue value (0.0-1.0).
 
- 
getRGBpublic double[] getRGB()This method returns the normalized RGB values in an array.- Returns:
- normalized RGB values (0.0-1.0).
 
- 
getHuepublic double getHue()This method returns the hue of the HSV color.- Returns:
- HSV hue.
 
- 
getSaturationpublic double getSaturation()This method returns the saturation of the HSV color.- Returns:
- HSV saturation.
 
- 
getValuepublic double getValue()This method returns the value of the HSV color.- Returns:
- HSV value.
 
- 
getHSVpublic double[] getHSV()This method returns the HSV values in an array.- Returns:
- HSV values.
 
- 
rgbToHsvpublic static double[] rgbToHsv(double... rgb) This method translates the RGB color values into HSV.- Returns:
- HSV values of the color object as an array of doubles.
 
 
-