public class RGBColor extends Object
Constructor and Description |
---|
RGBColor()
Create with black color.
|
RGBColor(Color color)
Create from a
Color . |
RGBColor(int rgb)
Creates with an RGB value encoded as an int, as in the constructor for
Color . |
RGBColor(int red,
int green,
int blue)
Creates with specific values for the red, green and blue components.
|
Modifier and Type | Method and Description |
---|---|
RGBColor |
duplicate()
Creates a deep-copy of the current object.
|
boolean |
equals(Object obj) |
int |
get(int index)
Gets a component from an index 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 in
Color.getRGB() . |
int |
hashCode() |
String |
hexString()
Converts the red-blue-green values as a hex-string.
|
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.
|
Color |
toAWTColor()
Converts to a
Color representation. |
String |
toString() |
public RGBColor()
public RGBColor(Color color)
Color
.color
- the color to create from.public RGBColor(int rgb)
Color
.rgb
- an integer with the red component in bits 16-23, the green component in bits 8-15,
and the blue component in bits 0-7.public RGBColor(int red, int green, int blue)
red
- value for the red component.green
- value for the green component.blue
- value for the blue component.public int getRed()
public int getGreen()
public int get(int index)
An index of 0
is red.
An index of 1
is green.
An index of 2
is blue.
index
- the index.public int getBlue()
public int getRGB()
Color.getRGB()
.public void setRed(int value)
value
- the value to assignpublic void setGreen(int value)
value
- the value to assignpublic void setBlue(int value)
value
- the value to assignpublic String hexString()
public Color toAWTColor()
Color
representation.public RGBColor duplicate()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.