[Kstars-devel] KDE/kdeedu/kstars/kstars/skycomponents
Jason Harris
kstars at 30doradus.org
Tue Aug 19 16:23:15 CEST 2008
SVN commit 849413 by harris:
Committing patch from Mederic to implement fading solar system trails with
transparency instead of interpolating the color to SkyColor. This will make faded
trails look correct when passing by the Milky Way.
Added his changes to SolarSystemListComponent, as well as
SolarSystemSingleComponent, so comets and asteroids can enjoy the new trails too
:)
CCMAIL: kstars-devel at kde.org
M +2 -9 solarsystemlistcomponent.cpp
M +2 -9 solarsystemsinglecomponent.cpp
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemlistcomponent.cpp #849412:849413
@@ -117,9 +117,6 @@
float Width = map->scale() * map->width();
float Height = map->scale() * map->height();
- QColor tcolor1 = QColor( data->colorScheme()->colorNamed( "PlanetTrailColor" ) );
- QColor tcolor2 = QColor( data->colorScheme()->colorNamed( "SkyColor" ) );
-
foreach ( SkyObject *obj, m_TrailList ) {
//DEBUG
kDebug() << obj->name() << endl;
@@ -139,17 +136,13 @@
doDrawLine = true;
}
- psky.setPen( QPen( tcolor1, 1 ) );
bool firstPoint( true );
+ QColor tcolor = QColor( data->colorScheme()->colorNamed( "PlanetTrailColor" ) );
foreach ( p, ksp->trail() ) {
if ( firstPoint ) { firstPoint = false; continue; } //skip first point
if ( Options::fadePlanetTrails() ) {
- //Define interpolated color
- QColor tcolor = QColor(
- (i*tcolor1.red() + (n-i)*tcolor2.red())/n,
- (i*tcolor1.green() + (n-i)*tcolor2.green())/n,
- (i*tcolor1.blue() + (n-i)*tcolor2.blue())/n );
+ tcolor.setAlphaF(static_cast<qreal>(i)/static_cast<qreal>(n));
++i;
psky.setPen( QPen( tcolor, 1 ) );
}
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemsinglecomponent.cpp #849412:849413
@@ -183,9 +183,6 @@
float Width = map->scale() * map->width();
float Height = map->scale() * map->height();
- QColor tcolor1 = QColor( data->colorScheme()->colorNamed( "PlanetTrailColor" ) );
- QColor tcolor2 = QColor( data->colorScheme()->colorNamed( "SkyColor" ) );
-
SkyPoint p = ksp()->trail().first();
QPointF o = map->toScreen( &p );
QPointF oLast( o );
@@ -200,17 +197,13 @@
doDrawLine = true;
}
- psky.setPen( QPen( tcolor1, 1 ) );
bool firstPoint( true );
+ QColor tcolor = QColor( data->colorScheme()->colorNamed( "PlanetTrailColor" ) );
foreach ( p, ksp()->trail() ) {
if ( firstPoint ) { firstPoint = false; continue; } //skip first point
if ( Options::fadePlanetTrails() ) {
- //Define interpolated color
- QColor tcolor = QColor(
- (i*tcolor1.red() + (n-i)*tcolor2.red())/n,
- (i*tcolor1.green() + (n-i)*tcolor2.green())/n,
- (i*tcolor1.blue() + (n-i)*tcolor2.blue())/n );
+ tcolor.setAlphaF(static_cast<qreal>(i)/static_cast<qreal>(n));
++i;
psky.setPen( QPen( tcolor, 1 ) );
}
More information about the Kstars-devel
mailing list