***************************************************************************/
#include "spectrum.h"
+#include <kglobal.h>
+#include <kstandarddirs.h>
+
SpectrumWidget::SpectrumWidget( QWidget* parent, const char* name )
: QWidget( parent,name )
{
m_realWidth = 360;
m_realHeight = 200;
- ref_image = QImage( "/home/carsten/cvs/trunk/kdeedu/kalzium/src/data/spectrum.png" );
+ QString spectrumpix = KGlobal::dirs()->findResourceDir("data", "kalzium/data/" );
+ spectrumpix += "kalzium/data/spektrum.png";
+
+ ref_image = QImage( spectrumpix );
}
SpectrumWidget::~SpectrumWidget(){}
//(255,231,49) is for 600 nm
//(246,144,49) is for 650 nm
- for(int h = 450; h < 750 ; ++h)
+ for(int h = 450; h < 760 ; ++h)
{
p->setPen(linecolor(h) );
p->drawLine(h-450,0,h-450,m_realHeight );
//The picture has 575 pixel
//
- int max = endValue;
- int min = startValue;
-
//Example: Freq is 600nm. 760-450 = 360.
//760 - 600 = 160. 360/160 = 2.25
- int proportion = ( max-min )/( max - spectrum );
+ int proportion = m_realWidth * ( spectrum - startValue ) / ( endValue - startValue );
QRgb rgb = ref_image.pixel(proportion, 2 );