maclib
Class RGBColor

java.lang.Object
  extended by maclib.RGBColor

public class RGBColor
extends java.lang.Object

This class implements QuickDraw-like definitions for RGB colors where each component is valued between 0 and 65535.

Version:
28 may 2001
Author:
Philippe Chassignet, Ecole Polytechnique
See Also:
MacLib, Color

Field Summary
 int blue
          The blue component.
 int green
          The green component.
 int red
          The red component.
 
Constructor Summary
RGBColor()
          Constructs and initializes a color with components (0,0,0,0), that is the black color.
RGBColor(int r, int g, int b)
          Constructs and initializes a color with the given components.
 
Method Summary
 java.awt.Color getColor()
          Converts this color as a java.awt.Color object.
 int hashCode()
          Returns a hash code for this color.
 RGBColor setColor(java.awt.Color color)
          Sets the components of this color as specified by the given java.awt.Color object.
 java.lang.String toString()
          Returns a string representation for this color.
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

red

public int red
The red component.


green

public int green
The green component.


blue

public int blue
The blue component.

Constructor Detail

RGBColor

public RGBColor()
Constructs and initializes a color with components (0,0,0,0), that is the black color.


RGBColor

public RGBColor(int r,
                int g,
                int b)
Constructs and initializes a color with the given components.

Parameters:
r - the red component of the new color.
g - the green component of the new color.
b - the blue component of the new color.
Method Detail

getColor

public java.awt.Color getColor()
Converts this color as a java.awt.Color object.

Returns:
a new Color object.
See Also:
Color

setColor

public RGBColor setColor(java.awt.Color color)
Sets the components of this color as specified by the given java.awt.Color object.

Parameters:
color - the Color object used to specify the components.
See Also:
Color

toString

public java.lang.String toString()
Returns a string representation for this color.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of the components.

hashCode

public int hashCode()
Returns a hash code for this color.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code build up from the components.