[Kalzium] Spectrum-classes: My vision of the future

Carsten Niehaus cniehaus at gmx.de
Wed Jul 13 11:06:09 CEST 2005


Wow, what a subject ;-)

Ok, in this mail I want to discribe what I want to do in Kalzium with regard 
to the spectrum-class.
Right now, SpectrumWidget can display a rainbow-like background which ranges 
from 450nm to 760nm. That is what the human eye sees as colors. You can tell 
the class to display for example the frequencies 560nm and 672nm. 
SpectrumWidget will show small vertical lines in the correct position and add 
the freqs as small strings to the bottom of the lines.

Ok so far. What is next:

a) I want it to be able to draw like this:

     http://onsager.bd.psu.edu/~jircitano/Na.gif

This should be optional, in same cases the user sure wants to have a black BG 
with colored lines and sometimes the other way around. 


b) I want to be able to do something like widget->setMin( 500.6 ) and 
setMax( 510.3 ) which would mean the widget would "zoom" in (and out). This 
is not really difficult. I added this method:

     QColor SpectrumWidget::linecolor( double spectrum )

This method return the correct color for a frequency. If we zoom in this 
method will make it very easy as nothing really changes, on the min/max 
value. Ok, right now this method doesn't work... I have no clue how to map a 
freq to a QColor or a QColor to a freq. I didn't find any algo for this.
Pino proposed this: Find a big graphical file. Then write a smart code which 
will calculate the position of the searched freq in the graphic. The we will 
take the color of that pixel and use it. Ok, that even works. But of course 
we need a file which is very big (big width) so that the gradient is as 
precise as possible. Currently, the biggest file I found is 575 pixel. I 
added it as src/data/spectrum.png.
A mathmatical calculation of the color would be much better (more precise) but 
I dunno how to do it... Do you have any ideas?

c) I want to write a editor where the user can define freq and Kalzium will 
generate a png of it. I could have used this a dozen times in my studies but 
never found a good app to do this...
But this editor will come after a and b are done, of course.

Carsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kalzium/attachments/20050713/62cc5aa5/attachment.pgp


More information about the Kalzium mailing list