Package com.reportmill.graphics
Class RMColor
java.lang.Object
com.reportmill.base.RMObject
com.reportmill.graphics.RMColor
- All Implemented Interfaces:
RMArchiver.Archiving
,Cloneable
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRMColor()
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).Creates an RMColor from the given AWT color.Creates a new color from the given hex string. -
Method Summary
Modifier and TypeMethodDescriptionawt()
Returns an AWT version of this color.awt
(float dissolve) Returns an AWT version of this color, with the alpha component scaled by the given dissolve factor.Returns a color darker than this color (by this given fraction).brighter()
Returns a color 70% brighter than this color.brighter
(float aFactor) Retures a color with the given percent brighter than this color.static RMColor
colorValue
(Object anObj) Returns a color value for a given object.darker()
Returns a color darker than this color (70% of this color's brightness).boolean
Standar equals implementaiton.fromXML
(RXArchiver anArchiver, RXElement anElement) XML unarchival.int
getAlpha()
Returns the alpha component in the range 0-255.float
Returns the alpha component in the range 0-1.int
getBlue()
Returns the blue component in the range 0-255.float
Returns the blue component in the range 0-1.int
getGreen()
Returns the green component in the range 0-255.float
Returns the green component in the range 0-1.int
getRed()
Returns the red component in the range 0-255.float
getRed2D()
Returns the red component in the range 0-1.initWithArchiver
(RMArchiver anArchiver) Legacy unarchival.Returns a hex string representation of this color.toString()
Returns a string representation of this color.toXML
(RXArchiver anArchiver) XML archival.Methods inherited from class com.reportmill.base.RMObject
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals
-
Field Details
-
black
-
blue
-
cyan
-
darkGray
-
gray
-
green
-
lightGray
-
magenta
-
orange
-
pink
-
red
-
white
-
yellow
-
clear
-
lightBlue
-
clearWhite
-
-
Constructor Details
-
RMColor
public RMColor()Creates a plain black opaque color. -
RMColor
public RMColor(float g) Creates a color with the given gray value (0-1). -
RMColor
public RMColor(float g, float a) Creates a color with the given gray and alpha values (0-1). -
RMColor
public RMColor(float r, float g, float b) Creates a color with the given red, green blue values (0-1). -
RMColor
public RMColor(float r, float g, float b, float a) Creates a color with the given red, green, blue values (0-1). -
RMColor
public 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
Creates an RMColor from the given AWT color. -
RMColor
Creates a new color from the given hex string.
-
-
Method Details
-
getRed
public int getRed()Returns the red component in the range 0-255. -
getGreen
public int getGreen()Returns the green component in the range 0-255. -
getBlue
public int getBlue()Returns the blue component in the range 0-255. -
getAlpha
public int getAlpha()Returns the alpha component in the range 0-255. -
getRed2D
public float getRed2D()Returns the red component in the range 0-1. -
getGreen2D
public float getGreen2D()Returns the green component in the range 0-1. -
getBlue2D
public float getBlue2D()Returns the blue component in the range 0-1. -
getAlpha2D
public float getAlpha2D()Returns the alpha component in the range 0-1. -
brighter
Returns a color 70% brighter than this color. -
brighter
Retures a color with the given percent brighter than this color. -
darker
Returns a color darker than this color (70% of this color's brightness). -
blend
Returns a color darker than this color (by this given fraction). -
equals
Standar equals implementaiton. -
toString
Returns a string representation of this color. -
toHexString
Returns a hex string representation of this color. -
awt
Returns an AWT version of this color. -
awt
Returns an AWT version of this color, with the alpha component scaled by the given dissolve factor. -
colorValue
Returns a color value for a given object. -
toXML
XML archival. -
fromXML
XML unarchival. -
initWithArchiver
Legacy unarchival.- Specified by:
initWithArchiver
in interfaceRMArchiver.Archiving
- Overrides:
initWithArchiver
in classRMObject
-