[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kstars-devel
Subject:    [Kstars-devel] [PATCH] Prettier (?) stars
From:       Médéric_Boquien <mboquien () free ! fr>
Date:       2008-08-21 5:32:20
Message-ID: 200808210132.20529.mboquien () free ! fr
[Download RAW message or body]

Hello,

I have made a patch which modifies the aspect of stars in the "Classic" and 
"Moonless night" colour schemes. In summary, instead of drawing a coloured 
annulus around the central white circle, i use the change the saturation and 
the transparency in function of the radius, so it looks a bit more smooth and 
blends with the background. The attached patch is included if you want to play 
and if you find a better transfer function for the saturation and the 
transparency channels. Note, it is not 100% clean, and i do not expect it to 
be committed yet. For the most impatient, i have also included a screenshot.
What do you think of the new stars. Are they better? Worse? How could they be 
improved?

Thanks,

Médéric

["colors.patch" (text/x-patch)]

Index: kstars/starobject.cpp
===================================================================
--- kstars/starobject.cpp	(révision 849724)
+++ kstars/starobject.cpp	(copie de travail)
@@ -199,6 +199,7 @@
 void StarObject::initImages() {
     SkyMap *map = SkyMap::Instance();
     double scale = 1.0;
+    const int starColorIntensity = Options::starColorIntensity();
 
     if ( map && map->scale() > 1.0 ) scale = map->scale();
 
@@ -237,8 +238,8 @@
     }
 
     foreach ( const QString &color, ColorMap.keys() ) {
-        QString imKey = color+"14";
-        QPixmap BigImage( int(14*scale), int(14*scale) ); 
+        QString imKey = color+"15";
+        QPixmap BigImage( int(15*scale), int(15*scale) ); 
         BigImage.fill( Qt::transparent );
 
         QPainter p;
@@ -247,22 +248,31 @@
 
         //Set the width of the pen according to starColorIntensity()
         float w=2.0*scale;
-        if ( Options::starColorMode() == 0 ) {
-            w = w*float(Options::starColorIntensity())/4.0;
-        }
 
-        p.setPen( QPen(ColorMap[color], w) );
         if ( Options::starColorMode() == 0 ) {
-            p.setBrush( QColor(Qt::white) );
+            int i,j;
+            qreal h, s, v, a;
+            p.setRenderHint( QPainter::Antialiasing, false );
+            p.setBrush( QBrush() );
+            QColor tmpColor = ColorMap[color];
+            tmpColor.getHsvF(&h, &s, &v, &a);
+            for (i = 0; i < 15; i++ ) {
+                for (j = 0; j < 15; j++ ) {
+                    qreal dist = sqrt( pow( i-7., 2. ) + pow( j-7., 2. ) )/7.;
+                    tmpColor.setHsvF(h, qMin( 1., dist < \
starColorIntensity/10.?0:dist ), v, qMax( 0., dist < starColorIntensity/20.?1:1-dist \
) ); +                    p.setPen( tmpColor );
+                    p.drawPoint( i, j );
+                }
+            }
         } else {
+            p.setPen( QPen(ColorMap[color], w) );
             p.setBrush( p.pen().color() );
+            p.drawEllipse( QRectF( 2*scale, 2*scale, 10*scale, 10*scale ) );
         }
-
-        p.drawEllipse( QRectF( 2*scale, 2*scale, 10*scale, 10*scale ) );
         p.end();
         StarImage.insert( imKey, BigImage );
 
-        for ( int size = 13; size > 0; size-- ) {
+        for ( int size = 14; size > 0; size-- ) {
             imKey = color+QString("%1").arg(size);
             StarImage.insert( imKey, BigImage.scaled( size*scale, size*scale, \
Qt::KeepAspectRatio, Qt::SmoothTransformation ) );  }


["kstars_new_stars.png" (image/png)]

_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic