Class RGBCube

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----CanvasDB
                           |
                           +----RGBCube

public class RGBCube
extends CanvasDB
This class produces RGB cube in RGB or YIQ color spaces.


Constructor Index

 o RGBCube(float, float, float)
Constructs an RGB cube in YIQ color space.
 o RGBCube(int, int, int)
Constructs an RGB cube in RGB color space.

Method Index

 o minimumSize()
Overrides the default minimumSize() method.
 o mouseDown(Event, int, int)
Processes mouse down event.
 o mouseDrag(Event, int, int)
Processes mouse drag event to rotate the RGB cube.
 o paint(Graphics)
Computes and paints all vertices and edges of the RGB cube.
 o preferredSize()
Overrides the default preferredSize() method.
 o setCoord(float, float, float)
Updates the position of the vertex indicating current color position within the cube.
 o setCoord(int, int, int)
Updates the position of the vertex indicating current color position within the cube.

Constructors

 o RGBCube
 public RGBCube(int red,
                int green,
                int blue)
Constructs an RGB cube in RGB color space.

Parameters:
red - initial value of red component
green - initial value of green component
blue - initial value of blue component
 o RGBCube
 public RGBCube(float y,
                float i,
                float q)
Constructs an RGB cube in YIQ color space.

Parameters:
y - initial value of Y component
i - initial value of I component
q - initial value of Q component

Methods

 o mouseDown
 public boolean mouseDown(Event e,
                          int x,
                          int y)
Processes mouse down event.

Overrides:
mouseDown in class Component
 o mouseDrag
 public boolean mouseDrag(Event e,
                          int x,
                          int y)
Processes mouse drag event to rotate the RGB cube.

Overrides:
mouseDrag in class Component
 o setCoord
 public void setCoord(int red,
                      int green,
                      int blue)
Updates the position of the vertex indicating current color position within the cube.

Parameters:
red - new red component
green - new green component
blue - new blue component
 o setCoord
 public void setCoord(float y,
                      float i,
                      float q)
Updates the position of the vertex indicating current color position within the cube.

Parameters:
y - new Y component
i - new I component
q - new Q component
 o paint
 public void paint(Graphics g)
Computes and paints all vertices and edges of the RGB cube.

Overrides:
paint in class Canvas
 o minimumSize
 public Dimension minimumSize()
Overrides the default minimumSize() method.

Returns:
new Dimension
Overrides:
minimumSize in class Component
 o preferredSize
 public Dimension preferredSize()
Overrides the default preferredSize() method.

Returns:
new Dimension
Overrides:
preferredSize in class Component