Class RMColor
- java.lang.Object
- 
- com.inductiveautomation.rm.graphics.RMColor
 
- 
- All Implemented Interfaces:
- Archivable
 
 public class RMColor extends java.lang.Object implements 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 Modifier and Type Field Description static RMColorblackstatic RMColorbluestatic RMColorclearstatic RMColorclearWhitestatic RMColorcyanstatic RMColordarkGraystatic RMColorgraystatic RMColorgreenstatic RMColorlightBluestatic RMColorlightGraystatic RMColormagentastatic RMColororangestatic RMColorpinkstatic RMColorredstatic RMColorwhitestatic RMColoryellow
 - 
Constructor SummaryConstructors Constructor Description RMColor()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).RMColor(java.awt.Color awt)Creates an RMColor from the given AWT color.RMColor(java.lang.String aHexString)Creates a new color from the given hex string.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Colorawt()Returns an AWT version of this color.RMColorblend(RMColor aColor, double aFraction)Returns a color darker than this color (by this given fraction).RMColorbrighter()Returns a color brighter than this color (blended with white).static RMColorcolorValue(java.lang.Object anObj)Returns a color value for a given object.RMColordarker()Returns a color darker than this color (blended with black).booleanequals(java.lang.Object anObj)Standard equals implementation.java.lang.ObjectfromXML(RXArchiver anArchiver, RXElement anElement)XML unarchival.doublegetAlpha()Returns the alpha component in the range 0-1.intgetAlphaInt()Returns the alpha component in the range 0-255.doublegetBlue()Returns the blue component in the range 0-1.intgetBlueInt()Returns the blue component in the range 0-255.doublegetGreen()Returns the green component in the range 0-1.intgetGreenInt()Returns the green component in the range 0-255.static RMColorgetRandom()Returns a random color.doublegetRed()Returns the red component in the range 0-1.intgetRedInt()Returns 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 tripletjava.lang.StringtoHexString()Returns a hex string representation of this color.float[]toLab()Converts an RMColor to a CIELab tripletjava.lang.StringtoString()Returns a string representation of this color.RXElementtoXML(RXArchiver anArchiver)XML archival.
 
- 
- 
- 
Field Detail- 
blackpublic static RMColor black 
 - 
bluepublic static RMColor blue 
 - 
cyanpublic static RMColor cyan 
 - 
darkGraypublic static RMColor darkGray 
 - 
graypublic static RMColor gray 
 - 
greenpublic static RMColor green 
 - 
lightGraypublic static RMColor lightGray 
 - 
magentapublic static RMColor magenta 
 - 
orangepublic static RMColor orange 
 - 
pinkpublic static RMColor pink 
 - 
redpublic static RMColor red 
 - 
whitepublic static RMColor white 
 - 
yellowpublic static RMColor yellow 
 - 
clearpublic static RMColor clear 
 - 
lightBluepublic static RMColor lightBlue 
 - 
clearWhitepublic static RMColor clearWhite 
 
- 
 - 
Constructor Detail- 
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.
 - 
RMColorpublic RMColor(java.awt.Color awt) Creates an RMColor from the given AWT color.
 - 
RMColorpublic RMColor(java.lang.String aHexString) Creates a new color from the given hex string.
 
- 
 - 
Method Detail- 
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.
 - 
brighterpublic RMColor brighter() Returns a color brighter than this color (blended with white).
 - 
darkerpublic RMColor darker() Returns a color darker than this color (blended with black).
 - 
blendpublic RMColor blend(RMColor aColor, double aFraction) Returns a color darker than this color (by this given fraction).
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.- Overrides:
- equalsin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() Returns a string representation of this color.- Overrides:
- toStringin class- java.lang.Object
 
 - 
toHexStringpublic java.lang.String toHexString() Returns a hex string representation of this color.
 - 
colorValue@Nullable public static RMColor colorValue(java.lang.Object anObj) Returns 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
 - 
getRandompublic static RMColor getRandom() Returns a random color.
 - 
toXMLpublic RXElement toXML(RXArchiver anArchiver) XML archival.- Specified by:
- toXMLin interface- Archivable
 
 - 
fromXMLpublic java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.- Specified by:
- fromXMLin interface- Archivable
 
 - 
awtpublic java.awt.Color awt() Returns an AWT version of this color.
 
- 
 
-