Class HSVHex

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----HSVHex

public class HSVHex
extends Canvas
This class produces the HSV hexagon component.


Variable Index

 o Bx
coordinates for Blue vertex.
 o By
coordinates for Blue vertex.
 o Cx
coordinates for Cyan vertex.
 o Cy
coordinates for Cyan vertex.
 o D
 o fradius
radius (float)
 o Gx
coordinates for Green vertex.
 o Gy
coordinates for Green vertex.
 o H
 o h
hue and saturation for each (x,y) of the image.
 o hue
Current HSV space coordinates.
 o image
Image of the hexagon.
 o iradius
radius (int)
 o Mx
coordinates for Magenta vertex.
 o My
coordinates for Magenta vertex.
 o pix
pixel array.
 o Rx
coordinates for Red vertex.
 o Ry
coordinates for Red vertex.
 o s
hue and saturation for each (x,y) of the image.
 o saturation
Current HSV space coordinates.
 o value
Current HSV space coordinates.
 o yout
 o Yx
coordinates for Yellow vertex.
 o Yy
coordinates for Yellow vertex.

Constructor Index

 o HSVHex(float, float, float)
Constructs the hexagon.

Method Index

 o compute_hs(int, int)
compute H and S for given (x,y) position on the hexagon.
 o computeImage()
Computes and creates the hexagon image.
 o drawHS(Graphics)
Draws the marker indicating current (H,S) coordinates.
 o minimumSize()
Overrides the default minimumSize() method.
 o paint(Graphics)
Draws the image of the hexagon and the (H,S) marker.
 o preferredSize()
Overrides the default preferredSize() method.
 o setHSV(float)
Sets the V value and repaints the hexagon.
 o setHSV(float, float)
Sets the S and H values and repaints the hexagon.
 o setHSV(float, float, float)
Sets the H, S and V values and repaints the hexagon.
 o update(Graphics)
Overrides the default update(Graphics) method in order not to clear screen to avoid flicker.

Variables

 o image
 Image image
Image of the hexagon.

 o hue
 float hue
Current HSV space coordinates.

 o saturation
 float saturation
Current HSV space coordinates.

 o value
 float value
Current HSV space coordinates.

 o h
 float h
hue and saturation for each (x,y) of the image.

 o s
 float s
hue and saturation for each (x,y) of the image.

 o pix
 int pix[]
pixel array.

 o Rx
 int Rx
coordinates for Red vertex.

 o Ry
 int Ry
coordinates for Red vertex.

 o Yx
 int Yx
coordinates for Yellow vertex.

 o Yy
 int Yy
coordinates for Yellow vertex.

 o Gx
 int Gx
coordinates for Green vertex.

 o Gy
 int Gy
coordinates for Green vertex.

 o Cx
 int Cx
coordinates for Cyan vertex.

 o Cy
 int Cy
coordinates for Cyan vertex.

 o Bx
 int Bx
coordinates for Blue vertex.

 o By
 int By
coordinates for Blue vertex.

 o Mx
 int Mx
coordinates for Magenta vertex.

 o My
 int My
coordinates for Magenta vertex.

 o fradius
 float fradius
radius (float)

 o iradius
 int iradius
radius (int)

 o yout
 int yout
 o D
 int D
 o H
 int H

Constructors

 o HSVHex
 public HSVHex(float hue,
               float saturation,
               float value)
Constructs the hexagon.

Parameters:
hue - the H coordinate
saturation - the S coordinate
value - the V coordinate

Methods

 o compute_hs
 void compute_hs(int x,
                 int y)
compute H and S for given (x,y) position on the hexagon. (x,y) must be inside the hexagon.

 o setHSV
 public void setHSV(float value)
Sets the V value and repaints the hexagon.

Parameters:
value - the V coordinate
 o setHSV
 public void setHSV(float hue,
                    float saturation)
Sets the S and H values and repaints the hexagon.

Parameters:
hue - the H coordinate
saturation - the S coordinate
 o setHSV
 public void setHSV(float hue,
                    float saturation,
                    float value)
Sets the H, S and V values and repaints the hexagon.

Parameters:
hue - the H coordinate
saturation - the S coordinate
value - the V coordinate
 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
 o computeImage
 void computeImage()
Computes and creates the hexagon image.

 o drawHS
 void drawHS(Graphics g)
Draws the marker indicating current (H,S) coordinates.

 o paint
 public void paint(Graphics g)
Draws the image of the hexagon and the (H,S) marker.

Overrides:
paint in class Canvas
 o update
 public void update(Graphics g)
Overrides the default update(Graphics) method in order not to clear screen to avoid flicker.

Overrides:
update in class Component