Color Class Diagram

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ancestor class specifications:

java.lang.Object

Color Class Specifications

            Invariant

                    A Color object ...

                             - is a color that can be used in drawing

                             - 0 <= redness <= 255    AND    0 <= greeness <= 255    AND    0 <= blueness <= 255

                                      (larger numbers denote more saturation)

 

            Constructor Methods

public Color (float r, float g, float b)

      pre:   0.0 <= r <= 1.0    and    0.0 <= g <= 1.0    and    0.0 <= b <= 1.0

      post:  A new Color object is created with attributes as follows: redness == r * 255    and    greeness== g * 255    and    blueness== b * 255

 

public Color (int r, int g, int b)

      pre:   0 <= r <= 255  and  0 <= g <= 255  and  0 <= b <= 255

      post:  A new Color object is created with attributes as follows:  redness == r    and    greeness== g     and    blueness == b