Class RGBCoord
java.lang.Object
|
+----RGBCoord
- public class RGBCoord
- extends Object
- implements Cloneable
This class encapsulates shared RGB coordinates.
-
blue
- RGB space coordinates (0...255)
-
green
- RGB space coordinates (0...255)
-
red
- RGB space coordinates (0...255)
-
valid
- Flag set to true if the coordinates are valid.
-
RGBCoord(int, int, int)
- Constructs RGBCoord given initial values.
-
clone()
- Overrides Cloneable
-
differentFrom(RGBCoord)
- Compares RGB components.
-
getBlue()
- Returns the blue component.
-
getFromRGB(RGBCoord)
- Copy new RGB values includin the valid flag.
-
getGreen()
- Returns the green component.
-
getRed()
- Returns the red component.
-
getRGB(int[])
- Copies the components into array.
-
isValid()
- Returns true if the coordinates are valid.
-
setBlue(int)
- Sets the blue component.
-
setGreen(int)
- Sets the green component.
-
setRed(int)
- Sets the red component.
-
setRGB(int, int, int)
- Sets the RGB coordinates to specified values.
-
setValid(boolean)
- Sets the valid flag.
-
toString()
- Converts to String.
red
protected int red
- RGB space coordinates (0...255)
green
protected int green
- RGB space coordinates (0...255)
blue
protected int blue
- RGB space coordinates (0...255)
valid
protected boolean valid
- Flag set to true if the coordinates are valid.
RGBCoord
public RGBCoord(int red,
int green,
int blue)
- Constructs RGBCoord given initial values. The values
must be 0 to 255.
getFromRGB
public synchronized void getFromRGB(RGBCoord rgb)
- Copy new RGB values includin the valid flag.
- Parameters:
- rgb - source for the new RGB values.
getRed
public synchronized int getRed()
- Returns the red component.
getGreen
public synchronized int getGreen()
- Returns the green component.
getBlue
public synchronized int getBlue()
- Returns the blue component.
isValid
public synchronized boolean isValid()
- Returns true if the coordinates are valid.
getRGB
public synchronized boolean getRGB(int rgb[])
- Copies the components into array.
- Parameters:
- rgb[] - array to place red, green and blue
components, respectively.
- Returns:
- the valid flag
setRed
public synchronized void setRed(int red)
- Sets the red component.
setGreen
public synchronized void setGreen(int green)
- Sets the green component.
setBlue
public synchronized void setBlue(int blue)
- Sets the blue component.
setValid
public synchronized void setValid(boolean valid)
- Sets the valid flag.
setRGB
public synchronized void setRGB(int red,
int green,
int blue)
- Sets the RGB coordinates to specified values. The values
must be 0 to 255.
differentFrom
public synchronized boolean differentFrom(RGBCoord rgb)
- Compares RGB components. Use when verifying if components
must be updated from another source.
- Parameters:
- rgb - set of components to compare with.
- Returns:
- true if different in any respect; false otherwise
clone
public synchronized Object clone()
- Overrides Cloneable
- Overrides:
- clone in class Object
toString
public String toString()
- Converts to String.
- Returns:
- String
- Overrides:
- toString in class Object