Package rma.swing
Class RmaColor
java.lang.Object
java.awt.Color
rma.swing.RmaColor
- All Implemented Interfaces:
Paint
,Transparency
,Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
The color darkred.static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
Fields inherited from class java.awt.Color
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
Constructor Summary
ConstructorsConstructorDescriptionRmaColor
(float r, float g, float b) Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0).RmaColor
(float r, float g, float b, float a) Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0).RmaColor
(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.RmaColor
(int rgba, boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.RmaColor
(int r, int g, int b) Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255).RmaColor
(int r, int g, int b, int a) Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).RmaColor
(ColorSpace cspace, float[] components, float alpha) Creates a color in the specifiedColorSpace
with the color components specified in thefloat
array and the specified alpha. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
color2String
(Color c, boolean returnRGBString) given a Color return it's string representation if it's a now color (Color.red
) or a darker(Color.red.darker()
) or brigher (Color.red.brigher()
) version of a color return darkcolor or lightcolor ie.static List
static String
Returns a comma delimited String of rgb and alpha.static Color
parseColorString
(String colorString) return theColor
specified bycolorString
static Color
parseRGBString
(String rgbaStr) Parses the comma deliminated string into respective rgb and alpha values.toString()
Methods inherited from class java.awt.Color
brighter, createContext, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGB, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, HSBtoRGB, RGBtoHSB
-
Field Details
-
darkred
The color darkred. In the default sRGB space. -
lightred
-
darkblue
-
lightblue
-
darkcyan
-
lightcyan
-
darkgreen
-
lightgreen
-
darkmagenta
-
lightmagenta
-
darkpink
-
lightpink
-
darkyellow
-
lightyellow
-
darkorange
-
lightorange
-
purple
-
lightpurple
-
darkpurple
-
-
Constructor Details
-
RmaColor
public RmaColor(int r, int g, int b) Creates an opaque sRGB color with the specified red, green, and blue values in the range (0 - 255). The actual color used in rendering depends on finding the best match given the color space available for a given output device. Alpha is defaulted to 255.- Parameters:
r
- the red componentg
- the green componentb
- the blue component- See Also:
-
RmaColor
public RmaColor(int r, int g, int b, int a) Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0 - 255).- Parameters:
r
- the red componentg
- the green componentb
- the blue componenta
- the alpha component- See Also:
-
RmaColor
public RmaColor(int rgb) Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. The actual color used in rendering depends on finding the best match given the color space available for a particular output device. Alpha is defaulted to 255.- Parameters:
rgb
- the combined RGB components- See Also:
-
RmaColor
public RmaColor(int rgba, boolean hasalpha) Creates an sRGB color with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. If thehasalpha
argument isfalse
, alpha is defaulted to 255.- Parameters:
rgba
- the combined RGBA componentshasalpha
-true
if the alpha bits are valid;false
otherwise- See Also:
-
RmaColor
public RmaColor(float r, float g, float b) Creates an opaque sRGB color with the specified red, green, and blue values in the range (0.0 - 1.0). Alpha is defaulted to 1.0. The actual color used in rendering depends on finding the best match given the color space available for a particular output device.- Parameters:
r
- the red componentg
- the green componentb
- the blue component- See Also:
-
RmaColor
public RmaColor(float r, float g, float b, float a) Creates an sRGB color with the specified red, green, blue, and alpha values in the range (0.0 - 1.0). The actual color used in rendering depends on finding the best match given the color space available for a particular output device.- Parameters:
r
- the red componentg
- the green componentb
- the blue componenta
- the alpha component- See Also:
-
RmaColor
Creates a color in the specifiedColorSpace
with the color components specified in thefloat
array and the specified alpha. The number of components is determined by the type of theColorSpace
. For example, RGB requires 3 components, but CMYK requires 4 components.- Parameters:
cspace
- theColorSpace
to be used to interpret the componentscomponents
- an arbitrary number of color components that is compatible with thealpha
- alpha value- Throws:
IllegalArgumentException
- if any of the values in thecomponents
array oralpha
is outside of the range 0.0 to 1.0- See Also:
-
-
Method Details
-
parseColorString
return theColor
specified bycolorString
- Parameters:
colorString
- either a RGB value r,g,b or a color name "blue"- Returns:
- the
Color
specified bycolorString
g
-
color2String
-
color2String
given a Color return it's string representation if it's a now color (Color.red
) or a darker(Color.red.darker()
) or brigher (Color.red.brigher()
) version of a color return darkcolor or lightcolor ie. darkred or lightred. if it's not any of those return a r,g,b string- Returns:
- a string representation of the color.
-
getRGBString
Returns a comma delimited String of rgb and alpha. -
parseRGBString
Parses the comma deliminated string into respective rgb and alpha values. -
toString
-
getColorList
-