Class RGBColorBean
public class RGBColorBean extends AnchorBean<RGBColorBean>
A bean describing a color in the RGB
color space.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description RGBColorBean()Creates 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 Type Method Description RGBColorBeanduplicateBean()intgetBlue()The blue component value of the RGB color.intgetGreen()The green component value of the RGB color.intgetRed()The red component value of the RGB color.intgetRGB()Returns the RGB value encoded as an int as inColor.getRGB().voidsetBlue(int value)Sets the blue component value.voidsetGreen(int value)Sets the green component value.voidsetRed(int value)Sets the red component value.ColortoAWTColor()Converts to aColorrepresentation.RGBColortoRGBColor()TheRGBColorassociated 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
TheRGBColorassociated with the bean.- Returns:
- the color, as used internally.
-
toAWTColor
Converts to aColorrepresentation.- Returns:
- the color, as used internally.
-
duplicateBean
- Overrides:
duplicateBeanin classAnchorBean<RGBColorBean>
-