: QWidget( parent,name )
{
startValue = 450;
- endValue = 760;
+ endValue = 700;
m_realWidth = 360;
m_realHeight = 200;
spectrumpix += "kalzium/data/spektrum.png";
ref_image = QImage( spectrumpix );
+
+ m_stretch = 1;
}
SpectrumWidget::~SpectrumWidget(){}
p.begin( this );
p.fillRect( 0, 0, width(), height(), paletteBackgroundColor() );
p.drawRect( 0,0, width(), height() );
+ QImage i = ref_image;
+ QPixmap px;
+ px.convertFromImage( i.smoothScale( width(), height() ) );
+ m_stretch = ( width() * 1.0 ) / ref_image.width();
+ bitBlt( this, 0, 0, &px );
drawLines( &p );
}
//(255,231,49) is for 600 nm
//(246,144,49) is for 650 nm
+/*
for(int h = 450; h < 760 ; ++h)
{
p->setPen(linecolor(h) );
}
p->setPen(Qt::black);
+*/
int i = 0;
for ( QValueList<double>::Iterator it = m_spectra.begin();
int SpectrumWidget::xPos( double value )
{
+/*
double var = ( endValue-startValue );
double coeff = ( value - startValue )/var;
return coeff * m_realWidth;
+*/
+ int proportion = width() * ( value - startValue ) / ( endValue - startValue );
+ return proportion;
}
QColor SpectrumWidget::linecolor( double spectrum )
//Example: Freq is 600nm. 760-450 = 360.
//760 - 600 = 160. 360/160 = 2.25
- int proportion = m_realWidth * ( spectrum - startValue ) / ( endValue - startValue );
+ int proportion = m_stretch * ( spectrum - startValue ) / ( endValue - startValue );
QRgb rgb = ref_image.pixel(proportion, 2 );