java.lang.Object
omix.lang.Color
- All Implemented Interfaces:
Serializable
,Brush
,Paint
public final class Color extends Object implements Brush, Serializable
This class represents color in Omix diagrams.
- Author:
- Dr. Peter Droste, Omix Visualization
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description Color(int color)
Creates a color with the given RGBA value.Color(int red, int green, int blue)
Creates a color with the submitted red, green and blue values between 0 and 255.Color(int red, int green, int blue, int alpha)
Creates a color with the given red, green, blue and alpha values between 0 and 255.Color(String c)
Creates a new color from the given string.Color(Color color)
clones the submitted color. -
Method Summary
Modifier and Type Method Description Color
clone()
boolean
equals(Object obj)
int
getAlpha()
Returns the alpha component in the range 0-255.int
getBlue()
Returns the blue component in the range 0-255.int
getGreen()
Returns the green component in the range 0-255.int
getRed()
Returns the red component in the range 0-255.int
getRgba()
Returns the RGBA value representing the color.int
hashCode()
int
rgba()
String
toHexString()
This method returns the rgba value as hexadecimal string.String
toString()
Returns the rgba value as text.
-
Constructor Details
-
Color
Creates a new color from the given string. This can be a hexadecimal number starting with "#" or "0x" or one of:- "black"
- "blue"
- "cyan"
- "darkGray"
- "gray"
- "green"
- "lightGray"
- "magenta"
- "orange"
- "pink"
- "red"
- "white"
- "yellow"
- Parameters:
c
- Color as text.
-
Color
clones the submitted color.- Parameters:
color
- Color to be cloned
-
Color
@ConstructorProperties({"red","green","blue","alpha"}) public Color(int red, int green, int blue, int alpha)Creates a color with the given red, green, blue and alpha values between 0 and 255.- Parameters:
red
- Redgreen
- Greenblue
- Bluealpha
- Alpha
-
Color
Creates a color with the submitted red, green and blue values between 0 and 255.- Parameters:
red
- Redgreen
- Greenblue
- Blue
-
Color
Creates a color with the given RGBA value.- Parameters:
color
- RGBA value
-
-
Method Details
-
toString
Returns the rgba value as text.- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
toHexString
This method returns the rgba value as hexadecimal string.- Returns:
- hexadecimal string representation of the rgba value.
-
getRed
public int getRed()Returns the red component in the range 0-255.- Returns:
- the red component.
- See Also:
getRgba()
-
getGreen
public int getGreen()Returns the green component in the range 0-255.- Returns:
- the green component.
- See Also:
getRgba()
-
getBlue
public int getBlue()Returns the blue component in the range 0-255.- Returns:
- the blue component.
- See Also:
getRgba()
-
getAlpha
public int getAlpha()Returns the alpha component in the range 0-255.- Returns:
- the alpha component.
- See Also:
getRgba()
-
getRgba
public int getRgba()Returns the RGBA value representing the color. (Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue).- Returns:
- the RGBA value of the color.
- See Also:
getRed()
,getGreen()
,getBlue()
,getAlpha()
-
rgba
- Returns:
- the RGBA value of the color.
- See Also:
getRgba()
-
clone
-
hashCode
public int hashCode() -
equals
-