Re: converting HSV to RGB

Hi Patrick,

> 1. In the BaseColorControl class there is a method for initializing RGB
> colormap to HSV Values. Now, is it possible to convert the HSV values
> back to RGB again ?

The toReference() method of visad/HSVCoordinateSystem.java
converts arrays of HSV values to arrays of RGB values.

> 2. I also have got  problems with the getTable method. After defining the
> display as follows, the getTable() methods return a NullPointerException.

The problem is that ScalarMaps to Hue and Saturation do
not generate any Controls, so getControl() returns null.
The mapping from exp to Hue is linear and controlled by
setRange() calls on the ScalarMap itself.

A ScalarMap to Display.HSV will generate a ColorControl,
which controls the mapping from RealType values to Hue,
Saturation and Value.

> ...
> ...
> 
> ScalarMap colMap = new ScalarMap(col, Display.XAxis);
> ScalarMap rowMap = new ScalarMap(row, Display.YAxis);
> ScalarMap expMap = new ScalarMap(exp, Display.Hue);
> ScalarMap errMap = new ScalarMap(err, Display.Saturation);
> ConstantMap constMap = new ConstantMap(1.0f, Display.Value);
> 
> display.addMap(colMap);
> display.addMap(rowMap);
> display.addMap(expMap);
> display.addMap(errMap);
> display.addMap(constMap);
> 
> ..
> ..
> 
> ColorControl saturationControl = (ColorControl)errMap.getControl();
> float[][] saturation = saturationControl.getTable();
> 
> ColorControl hueControl = (ColorControl)expMap.getControl();
> float[][] hue = hueControl.getTable();

----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html