Class RGBColorBean
A bean describing a color in the RGB
color space.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionCreates with a completely black color.RGBColorBean
(int red, int green, int blue) Create from values for red, green and blue.RGBColorBean
(Color color) Create from aColor
.RGBColorBean
(RGBColor color) Create from aRGBColor
. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new bean that deep-copies every property value.int
getBlue()
The blue component value of the RGB color.int
getGreen()
The green component value of the RGB color.int
getRed()
The red component value of the RGB color.int
getRGB()
Returns the RGB value encoded as an int as inColor.getRGB()
.void
setBlue
(int value) Sets the blue component value.void
setGreen
(int value) Sets the green component value.void
setRed
(int value) Sets the red component value.Converts to aColor
representation.TheRGBColor
associated with the bean.Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
RGBColorBean
public RGBColorBean()Creates with a completely black color.i.e. Red, green, blue values are assigned
0
-
RGBColorBean
Create from aRGBColor
.- Parameters:
color
- the color, which continues to be used internally after the constructor call.
-
RGBColorBean
Create from aColor
.- Parameters:
color
- the color, which is no longer used internally after the constructor call.
-
RGBColorBean
public RGBColorBean(int red, int green, int blue) Create from values for red, green and blue.- Parameters:
red
- the value for the red color component.green
- the value for the green color component.blue
- the value for the blue color component.
-
-
Method Details
-
getRed
public int getRed()The red component value of the RGB color.- Returns:
- a value between 0 and 255 (inclusive)
-
getGreen
public int getGreen()The green component value of the RGB color.- Returns:
- a value between 0 and 255 (inclusive)
-
getBlue
public int getBlue()The blue component value of the RGB color.- Returns:
- a value between 0 and 255 (inclusive)
-
setRed
public void setRed(int value) Sets the red component value.- Parameters:
value
- the value to assign
-
setGreen
public void setGreen(int value) Sets the green component value.- Parameters:
value
- the value to assign
-
setBlue
public void setBlue(int value) Sets the blue component value.- Parameters:
value
- the value to assign
-
getRGB
public int getRGB()Returns the RGB value encoded as an int as inColor.getRGB()
.- Returns:
- the rgb value encoded as an int.
-
toRGBColor
TheRGBColor
associated with the bean.- Returns:
- the color, as used internally.
-
toAWTColor
Converts to aColor
representation.- Returns:
- the color, as used internally.
-
duplicateBean
Description copied from class:AnchorBean
Creates a new bean that deep-copies every property value.Any state that is not a
BeanField
is ignored.- Overrides:
duplicateBean
in classAnchorBean<RGBColorBean>
- Returns:
- the newly created bean
-