Linear brightening doesn't work well for colours near white.

This commit is contained in:
Jeff Young 2021-09-16 11:42:49 +01:00
parent 6197717251
commit fdd9df6dff
2 changed files with 9 additions and 4 deletions

View File

@ -57,10 +57,14 @@ void RENDER_SETTINGS::update()
for( int i = 0; i < LAYER_ID_COUNT; i++ )
{
m_hiContrastColor[i] = m_layerColors[i].Mix( m_layerColors[LAYER_PCB_BACKGROUND],
m_hiContrastFactor );
m_hiContrastFactor );
m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );
m_layerColorsSel[i] = m_layerColors[i].Brightened( m_selectFactor );
// Linear brightening doesn't work well for colors near white
double factor = ( m_selectFactor * 0.6 ) + pow( m_layerColors[i].GetBrightness(), 3 );
m_layerColorsSel[i] = m_layerColors[i].Brightened( std::min( factor, 1.0 ) );
}
}

View File

@ -311,9 +311,10 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
}
if( netColor == COLOR4D::UNSPECIFIED )
{
netColor = color;
if( selected )
}
else if( selected )
{
// Selection brightening overrides highlighting
netColor.Brighten( m_selectFactor );