Different approach to coloring netname labels.
This commit is contained in:
parent
f4114d22c5
commit
861ea0592e
|
@ -82,9 +82,9 @@ public:
|
|||
*/
|
||||
COLOR4D& Highlight( double aFactor )
|
||||
{
|
||||
r = (double) r * (1.0 - aFactor) + aFactor;
|
||||
g = (double) g * (1.0 - aFactor) + aFactor;
|
||||
b = (double) b * (1.0 - aFactor) + aFactor;
|
||||
r = r * ( 1.0 - aFactor ) + aFactor;
|
||||
g = g * ( 1.0 - aFactor ) + aFactor;
|
||||
b = b * ( 1.0 - aFactor ) + aFactor;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -97,9 +97,23 @@ public:
|
|||
*/
|
||||
COLOR4D& Darken( double aFactor )
|
||||
{
|
||||
r = (double) r * (1.0 - aFactor);
|
||||
g = (double) g * (1.0 - aFactor);
|
||||
b = (double) b * (1.0 - aFactor);
|
||||
r = r * ( 1.0 - aFactor );
|
||||
g = g * ( 1.0 - aFactor );
|
||||
b = b * ( 1.0 - aFactor );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Invert
|
||||
* Makes the color inverted, alpha remains the same.
|
||||
* @return COLOR4D& Inverted color.
|
||||
*/
|
||||
COLOR4D& Invert()
|
||||
{
|
||||
r = ( 1.0 - r );
|
||||
g = ( 1.0 - g );
|
||||
b = ( 1.0 - b );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -112,9 +126,9 @@ public:
|
|||
*/
|
||||
COLOR4D Highlighted( double aFactor ) const
|
||||
{
|
||||
return COLOR4D( r * (1.0 - aFactor) + aFactor,
|
||||
g * (1.0 - aFactor) + aFactor,
|
||||
b * (1.0 - aFactor) + aFactor,
|
||||
return COLOR4D( r * ( 1.0 - aFactor ) + aFactor,
|
||||
g * ( 1.0 - aFactor ) + aFactor,
|
||||
b * ( 1.0 - aFactor ) + aFactor,
|
||||
a );
|
||||
}
|
||||
|
||||
|
@ -126,12 +140,22 @@ public:
|
|||
*/
|
||||
COLOR4D Darkened( double aFactor ) const
|
||||
{
|
||||
return COLOR4D( r * (1.0 - aFactor),
|
||||
g * (1.0 - aFactor),
|
||||
b * (1.0 - aFactor),
|
||||
return COLOR4D( r * ( 1.0 - aFactor ),
|
||||
g * ( 1.0 - aFactor ),
|
||||
b * ( 1.0 - aFactor ),
|
||||
a );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Inverted
|
||||
* Returns an inverted color, alpha remains the same.
|
||||
* @return COLOR4D& Inverted color.
|
||||
*/
|
||||
COLOR4D Inverted() const
|
||||
{
|
||||
return COLOR4D( 1.0 - r, 1.0 - g, 1.0 - b, a );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetBrightness
|
||||
* Returns the brightness value of the color ranged from 0.0 to 1.0.
|
||||
|
|
|
@ -309,10 +309,12 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
|
|||
// Set a proper color for the label
|
||||
color = getLayerColor( aTrack->GetLayer(), aTrack->GetNet(),
|
||||
aTrack->ViewIsHighlighted() );
|
||||
COLOR4D labelColor = getLayerColor( aLayer, 0, aTrack->ViewIsHighlighted() );
|
||||
|
||||
if( color.GetBrightness() > 0.5 )
|
||||
m_gal->SetStrokeColor( color.Darkened( 0.8 ) );
|
||||
m_gal->SetStrokeColor( labelColor.Inverted() );
|
||||
else
|
||||
m_gal->SetStrokeColor( color.Highlighted( 0.8 ) );
|
||||
m_gal->SetStrokeColor( labelColor );
|
||||
|
||||
m_gal->SetLineWidth( width / 10.0 );
|
||||
m_gal->SetBold( false );
|
||||
|
@ -447,11 +449,12 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
// Set a proper color for the label
|
||||
color = getLayerColor( aPad->GetParent()->GetLayer(), aPad->GetNet(),
|
||||
aPad->ViewIsHighlighted() );
|
||||
COLOR4D labelColor = getLayerColor( aLayer, 0, aPad->ViewIsHighlighted() );
|
||||
|
||||
if( color.GetBrightness() > 0.5 )
|
||||
m_gal->SetStrokeColor( color.Darkened( 0.8 ) );
|
||||
m_gal->SetStrokeColor( labelColor.Inverted() );
|
||||
else
|
||||
m_gal->SetStrokeColor( color.Highlighted( 0.8 ) );
|
||||
m_gal->SetStrokeColor( labelColor );
|
||||
|
||||
if( displayNetname && m_pcbSettings->m_padNumbers )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue