Class RMColor
java.lang.Object
com.inductiveautomation.rm.graphics.RMColor
- All Implemented Interfaces:
- Archivable
This class represents an RGBA color, just like Java.awt.Color. It was originally needed when running without
 AWT. It still has some convenience, but maybe one day should be replaced by, or just subclass, Java.awt.Color.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionRMColor()Creates a plain black opaque color.RMColor(double g) Creates a color with the given gray value (0-1).RMColor(double g, double a) Creates a color with the given gray and alpha values (0-1).RMColor(double r, double g, double b) Creates a color with the given red, green blue values (0-1).RMColor(double r, double g, double b, double a) Creates a color with the given red, green, blue values (0-1).RMColor(double c, double m, double y, double k, double a) Creates a color with the given cyan, magenta, yellow, black and alpha values (0-1).RMColor(int r, int g, int b) Creates a color with the given red, green blue values (0-1).Creates an RMColor from the given AWT color.Creates a new color from the given hex string.
- 
Method SummaryModifier and TypeMethodDescriptionawt()Returns an AWT version of this color.Returns a color darker than this color (by this given fraction).brighter()Returns a color brighter than this color (blended with white).static RMColorcolorValue(Object anObj) Returns a color value for a given object.darker()Returns a color darker than this color (blended with black).booleanStandard equals implementation.fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.doublegetAlpha()Returns the alpha component in the range 0-1.intReturns the alpha component in the range 0-255.doublegetBlue()Returns the blue component in the range 0-1.intReturns the blue component in the range 0-255.doublegetGreen()Returns the green component in the range 0-1.intReturns the green component in the range 0-255.static RMColorReturns a random color.doublegetRed()Returns the red component in the range 0-1.intReturns the red component in the range 0-255.intgetRGBA()Returns the color as an int.static float[]rgbToLab(double r, double g, double b) Converts an RGB triplet to a CIELab tripletReturns a hex string representation of this color.float[]toLab()Converts an RMColor to a CIELab triplettoString()Returns a string representation of this color.toXML(RXArchiver anArchiver) XML archival.
- 
Field Details- 
black
- 
blue
- 
cyan
- 
darkGray
- 
gray
- 
green
- 
lightGray
- 
magenta
- 
orange
- 
pink
- 
red
- 
white
- 
yellow
- 
clear
- 
lightBlue
- 
clearWhite
 
- 
- 
Constructor Details- 
RMColorpublic RMColor()Creates a plain black opaque color.
- 
RMColorpublic RMColor(double g) Creates a color with the given gray value (0-1).
- 
RMColorpublic RMColor(double g, double a) Creates a color with the given gray and alpha values (0-1).
- 
RMColorpublic RMColor(double r, double g, double b) Creates a color with the given red, green blue values (0-1).
- 
RMColorpublic RMColor(int r, int g, int b) Creates a color with the given red, green blue values (0-1).
- 
RMColorpublic RMColor(double r, double g, double b, double a) Creates a color with the given red, green, blue values (0-1).
- 
RMColorpublic RMColor(double c, double m, double y, double k, double a) Creates a color with the given cyan, magenta, yellow, black and alpha values (0-1). Bogus right now.
- 
RMColorCreates an RMColor from the given AWT color.
- 
RMColorCreates a new color from the given hex string.
 
- 
- 
Method Details- 
getRedpublic double getRed()Returns the red component in the range 0-1.
- 
getGreenpublic double getGreen()Returns the green component in the range 0-1.
- 
getBluepublic double getBlue()Returns the blue component in the range 0-1.
- 
getAlphapublic double getAlpha()Returns the alpha component in the range 0-1.
- 
getRedIntpublic int getRedInt()Returns the red component in the range 0-255.
- 
getGreenIntpublic int getGreenInt()Returns the green component in the range 0-255.
- 
getBlueIntpublic int getBlueInt()Returns the blue component in the range 0-255.
- 
getAlphaIntpublic int getAlphaInt()Returns the alpha component in the range 0-255.
- 
getRGBApublic int getRGBA()Returns the color as an int.
- 
brighterReturns a color brighter than this color (blended with white).
- 
darkerReturns a color darker than this color (blended with black).
- 
blendReturns a color darker than this color (by this given fraction).
- 
equalsStandard equals implementation.
- 
toStringReturns a string representation of this color.
- 
toHexStringReturns a hex string representation of this color.
- 
colorValueReturns a color value for a given object. If we can't guess what color the object represents, returns null.
- 
toLabpublic float[] toLab()Converts an RMColor to a CIELab triplet
- 
rgbToLabpublic static float[] rgbToLab(double r, double g, double b) Converts an RGB triplet to a CIELab triplet
- 
getRandomReturns a random color.
- 
toXMLXML archival.- Specified by:
- toXMLin interface- Archivable
 
- 
fromXMLXML unarchival.- Specified by:
- fromXMLin interface- Archivable
 
- 
awtReturns an AWT version of this color.
 
-