Commit 3f74b17d authored by Akarsh Simha's avatar Akarsh Simha

Add a solid (non-bitmap) colored star mode.

This is not as realistic as "Real colors" which uses bitmaps to give a
realistic appearance, but might be useful especially for vectorized
star chart export.

This returns the "feature" provided by the previously existing bug.

FEATURE:
parent 2ea4c3c7
......@@ -767,9 +767,9 @@
</entry>
<entry name="StarColorMode" type="UInt">
<label>Mode for rendering stars</label>
<whatsthis>The method for rendering stars: 0="realistic colors"; 1="solid red"; 2="solid black"; 3="solid white"</whatsthis>
<whatsthis>The method for rendering stars: 0="realistic colors"; 1="solid red"; 2="solid black"; 3="solid white"; 4="solid real colors"</whatsthis>
<default>0</default>
<max>3</max>
<max>4</max>
</entry>
<entry name="StarColorIntensity" type="UInt">
<label>Saturation level of star colors</label>
......
......@@ -86,6 +86,7 @@ OpsColors::OpsColors()
kcfg_StarColorMode->addItem( i18nc( "show stars as red circles", "Solid Red" ) );
kcfg_StarColorMode->addItem( i18nc( "show stars as black circles", "Solid Black" ) );
kcfg_StarColorMode->addItem( i18nc( "show stars as white circles", "Solid White" ) );
kcfg_StarColorMode->addItem( i18nc( "show stars as colored circles", "Solid Colors" ) );
kcfg_StarColorMode->setCurrentIndex( KStarsData::Instance()->colorScheme()->starColorMode() );
if ( KStarsData::Instance()->colorScheme()->starColorMode() != 0 ) //mode is not "Real Colors"
......
......@@ -77,6 +77,7 @@ namespace {
int SkyQPainter::starColorMode = 0;
QColor SkyQPainter::m_starColor = QColor();
QMap<char, QColor> SkyQPainter::ColorMap = QMap<char, QColor>();
SkyQPainter::SkyQPainter( QPaintDevice *pd )
......@@ -144,9 +145,9 @@ void SkyQPainter::setBrush(const QBrush& brush)
void SkyQPainter::initStarImages()
{
QMap<char, QColor> ColorMap;
const int starColorIntensity = Options::starColorIntensity();
ColorMap.clear();
switch( Options::starColorMode() ) {
case 1: // Red stars.
m_starColor = Qt::red;
......@@ -409,7 +410,7 @@ bool SkyQPainter::drawPointSource(SkyPoint* loc, float mag, char sp)
void SkyQPainter::drawPointSource(const QPointF& pos, float size, char sp)
{
int isize = qMin(static_cast<int>(size), 14);
if( !m_vectorStars || ( starColorMode <=0 || starColorMode > 3 ) ) {
if( !m_vectorStars || starColorMode == 0 ) {
// Draw stars as bitmaps, either because we were asked to, or because we're painting real colors
QPixmap* im = imageCache[ harvardToIndex(sp) ][isize];
float offset = 0.5 * im->width();
......@@ -417,8 +418,16 @@ void SkyQPainter::drawPointSource(const QPointF& pos, float size, char sp)
}
else {
// Draw stars as vectors, for better printing / SVG export etc.
setPen( m_starColor );
setBrush( m_starColor );
if ( starColorMode != 4 ) {
setPen( m_starColor );
setBrush( m_starColor );
}
else {
// Note: This is not efficient, but we use vector stars only when plotting SVG, not when drawing the skymap, so speed is not very important.
QColor c = ColorMap.value( sp, Qt::white );
setPen( c );
setBrush( c );
}
// Be consistent with old raster representation
if( size > 14 )
......
......@@ -99,7 +99,7 @@ private:
QSize m_size;
static int starColorMode;
static QColor m_starColor;
static QMap<char, QColor> ColorMap;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment