Package com.reportmill.graphics
Class RMColor
- java.lang.Object
- 
- com.reportmill.base.RMObject
- 
- com.reportmill.graphics.RMColor
 
 
- 
- All Implemented Interfaces:
- RMArchiver.Archiving,- java.lang.Cloneable
 
 public class RMColor extends RMObject 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(float g)Creates a color with the given gray value (0-1).RMColor(float g, float a)Creates a color with the given gray and alpha values (0-1).RMColor(float r, float g, float b)Creates a color with the given red, green blue values (0-1).RMColor(float r, float g, float b, float a)Creates a color with the given red, green, blue values (0-1).RMColor(float c, float m, float y, float k, float a)Creates a color with the given cyan, magenta, yellow, black and alpha 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.java.awt.Colorawt(float dissolve)Returns an AWT version of this color, with the alpha component scaled by the given dissolve factor.RMColorblend(RMColor aColor, float fraction)Returns a color darker than this color (by this given fraction).RMColorbrighter()Returns a color 70% brighter than this color.RMColorbrighter(float aFactor)Retures a color with the given percent brighter than this color.static RMColorcolorValue(java.lang.Object anObj)Returns a color value for a given object.RMColordarker()Returns a color darker than this color (70% of this color's brightness).booleanequals(java.lang.Object obj)Standar equals implementaiton.java.lang.ObjectfromXML(RXArchiver anArchiver, RXElement anElement)XML unarchival.intgetAlpha()Returns the alpha component in the range 0-255.floatgetAlpha2D()Returns the alpha component in the range 0-1.intgetBlue()Returns the blue component in the range 0-255.floatgetBlue2D()Returns the blue component in the range 0-1.intgetGreen()Returns the green component in the range 0-255.floatgetGreen2D()Returns the green component in the range 0-1.intgetRed()Returns the red component in the range 0-255.floatgetRed2D()Returns the red component in the range 0-1.java.lang.ObjectinitWithArchiver(RMArchiver anArchiver)Legacy unarchival.java.lang.StringtoHexString()Returns a hex string representation of this color.java.lang.StringtoString()Returns a string representation of this color.RXElementtoXML(RXArchiver anArchiver)XML archival.- 
Methods inherited from class com.reportmill.base.RMObjectclone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals
 
- 
 
- 
- 
- 
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(float g) Creates a color with the given gray value (0-1).
 - 
RMColorpublic RMColor(float g, float a)Creates a color with the given gray and alpha values (0-1).
 - 
RMColorpublic RMColor(float r, float g, float b)Creates a color with the given red, green blue values (0-1).
 - 
RMColorpublic RMColor(float r, float g, float b, float a)Creates a color with the given red, green, blue values (0-1).
 - 
RMColorpublic RMColor(float c, float m, float y, float k, float a)Creates a color with the given cyan, magenta, yellow, black and alpha values (0-1).
 - 
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 int getRed() Returns the red component in the range 0-255.
 - 
getGreenpublic int getGreen() Returns the green component in the range 0-255.
 - 
getBluepublic int getBlue() Returns the blue component in the range 0-255.
 - 
getAlphapublic int getAlpha() Returns the alpha component in the range 0-255.
 - 
getRed2Dpublic float getRed2D() Returns the red component in the range 0-1.
 - 
getGreen2Dpublic float getGreen2D() Returns the green component in the range 0-1.
 - 
getBlue2Dpublic float getBlue2D() Returns the blue component in the range 0-1.
 - 
getAlpha2Dpublic float getAlpha2D() Returns the alpha component in the range 0-1.
 - 
brighterpublic RMColor brighter() Returns a color 70% brighter than this color.
 - 
brighterpublic RMColor brighter(float aFactor) Retures a color with the given percent brighter than this color.
 - 
darkerpublic RMColor darker() Returns a color darker than this color (70% of this color's brightness).
 - 
blendpublic RMColor blend(RMColor aColor, float fraction) Returns a color darker than this color (by this given fraction).
 - 
equalspublic boolean equals(java.lang.Object obj) Standar equals implementaiton.- 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.
 - 
awtpublic java.awt.Color awt() Returns an AWT version of this color.
 - 
awtpublic java.awt.Color awt(float dissolve) Returns an AWT version of this color, with the alpha component scaled by the given dissolve factor.
 - 
colorValuepublic static RMColor colorValue(java.lang.Object anObj) Returns a color value for a given object.
 - 
toXMLpublic RXElement toXML(RXArchiver anArchiver) XML archival.
 - 
fromXMLpublic java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.
 - 
initWithArchiverpublic java.lang.Object initWithArchiver(RMArchiver anArchiver) Legacy unarchival.- Specified by:
- initWithArchiverin interface- RMArchiver.Archiving
- Overrides:
- initWithArchiverin class- RMObject
 
 
- 
 
-