Class RGBCoord

java.lang.Object
   |
   +----RGBCoord

public class RGBCoord
extends Object
implements Cloneable
This class encapsulates shared RGB coordinates.


Variable Index

 o blue
RGB space coordinates (0...255)
 o green
RGB space coordinates (0...255)
 o red
RGB space coordinates (0...255)
 o valid
Flag set to true if the coordinates are valid.

Constructor Index

 o RGBCoord(int, int, int)
Constructs RGBCoord given initial values.

Method Index

 o clone()
Overrides Cloneable
 o differentFrom(RGBCoord)
Compares RGB components.
 o getBlue()
Returns the blue component.
 o getFromRGB(RGBCoord)
Copy new RGB values includin the valid flag.
 o getGreen()
Returns the green component.
 o getRed()
Returns the red component.
 o getRGB(int[])
Copies the components into array.
 o isValid()
Returns true if the coordinates are valid.
 o setBlue(int)
Sets the blue component.
 o setGreen(int)
Sets the green component.
 o setRed(int)
Sets the red component.
 o setRGB(int, int, int)
Sets the RGB coordinates to specified values.
 o setValid(boolean)
Sets the valid flag.
 o toString()
Converts to String.

Variables

 o red
 protected int red
RGB space coordinates (0...255)

 o green
 protected int green
RGB space coordinates (0...255)

 o blue
 protected int blue
RGB space coordinates (0...255)

 o valid
 protected boolean valid
Flag set to true if the coordinates are valid.

Constructors

 o RGBCoord
 public RGBCoord(int red,
                 int green,
                 int blue)
Constructs RGBCoord given initial values. The values must be 0 to 255.

Methods

 o getFromRGB
 public synchronized void getFromRGB(RGBCoord rgb)
Copy new RGB values includin the valid flag.

Parameters:
rgb - source for the new RGB values.
 o getRed
 public synchronized int getRed()
Returns the red component.

 o getGreen
 public synchronized int getGreen()
Returns the green component.

 o getBlue
 public synchronized int getBlue()
Returns the blue component.

 o isValid
 public synchronized boolean isValid()
Returns true if the coordinates are valid.

 o 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
 o setRed
 public synchronized void setRed(int red)
Sets the red component.

 o setGreen
 public synchronized void setGreen(int green)
Sets the green component.

 o setBlue
 public synchronized void setBlue(int blue)
Sets the blue component.

 o setValid
 public synchronized void setValid(boolean valid)
Sets the valid flag.

 o 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.

 o 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
 o clone
 public synchronized Object clone()
Overrides Cloneable

Overrides:
clone in class Object
 o toString
 public String toString()
Converts to String.

Returns:
String
Overrides:
toString in class Object