7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Update PTH/Via rendering

- Add separate hole wall and net name color for vias
- Overemphasize hole wall thickness to make objects more visible
This commit is contained in:
Jon Evans 2024-12-28 10:02:11 -05:00
parent e7e2007acd
commit 78f83b5a39
10 changed files with 43 additions and 13 deletions

View File

@ -123,6 +123,7 @@ static const wxChar ExtensionSnapActivateOnHover[] = wxT( "ExtensionSnapActivate
static const wxChar EnableSnapAnchorsDebug[] = wxT( "EnableSnapAnchorsDebug" );
static const wxChar EnableJobset[] = wxT( "EnableJobset" );
static const wxChar MinParallelAngle[] = wxT( "MinParallelAngle" );
static const wxChar HoleWallPaintingMultiplier[] = wxT( "HoleWallPaintingMultiplier" );
} // namespace KEYS
@ -294,6 +295,7 @@ ADVANCED_CFG::ADVANCED_CFG()
m_EnableSnapAnchorsDebug = false;
m_MinParallelAngle = 0.001;
m_HoleWallPaintingMultiplier = 1.5;
loadFromConfigFile();
}
@ -563,6 +565,10 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
&m_MinParallelAngle, m_MinParallelAngle,
0.0, 45.0 ) );
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::HoleWallPaintingMultiplier,
&m_HoleWallPaintingMultiplier, m_HoleWallPaintingMultiplier,
0.1, 100.0 ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
wxString traceMasks;

View File

@ -198,6 +198,7 @@ wxString LayerName( int aLayer )
case LAYER_CONFLICTS_SHADOW: return _( "Courtyard collision shadow" );
case NETNAMES_LAYER_ID_START: return _( "Track net names" );
case LAYER_PAD_NETNAMES: return _( "Pad net names" );
case LAYER_VIA_NETNAMES: return _( "Via net names" );
default:
wxCHECK_MSG( false, wxEmptyString, wxString::Format( "Unknown layer ID %d", aLayer ) );

View File

@ -168,10 +168,12 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ LAYER_RATSNEST, CSS_COLOR( 0, 248, 255, 0.35 ) },
{ LAYER_SELECT_OVERLAY, CSS_COLOR( 4, 255, 67, 1 ) },
{ LAYER_VIA_HOLES, CSS_COLOR( 227, 183, 46, 1 ) },
{ LAYER_VIA_HOLEWALLS, CSS_COLOR( 236, 236, 236, 1 ) },
{ LAYER_DRAWINGSHEET, CSS_COLOR( 200, 114, 171, 1 ) },
{ LAYER_PAGE_LIMITS, CSS_COLOR( 132, 132, 132, 1 ) },
{ NETNAMES_LAYER_ID_START, CSS_COLOR( 255, 255, 255, 0.7 ) },
{ LAYER_PAD_NETNAMES, CSS_COLOR( 255, 255, 255, 0.9 ) },
{ LAYER_VIA_NETNAMES, CSS_COLOR( 50, 50, 50, 0.9 ) },
{ F_Cu, CSS_COLOR( 200, 52, 52, 1 ) },
{ In1_Cu, CSS_COLOR( 127, 200, 127, 1 ) },
@ -384,10 +386,12 @@ static const std::map<int, COLOR4D> s_classicTheme =
{ LAYER_RATSNEST, COLOR4D( WHITE ) },
{ LAYER_SELECT_OVERLAY, COLOR4D( PUREGREEN ) },
{ LAYER_VIA_HOLES, COLOR4D( 0.5, 0.4, 0, 0.8 ) },
{ LAYER_VIA_HOLEWALLS, COLOR4D( WHITE ) },
{ LAYER_DRAWINGSHEET, COLOR4D( DARKRED ) },
{ LAYER_PAGE_LIMITS, COLOR4D( DARKGRAY) },
{ NETNAMES_LAYER_ID_START, CSS_COLOR( 255, 255, 255, 0.7 ) },
{ LAYER_PAD_NETNAMES, CSS_COLOR( 255, 255, 255, 0.9 ) },
{ LAYER_VIA_NETNAMES, CSS_COLOR( 50, 50, 50, 0.9 ) },
{ F_Cu, COLOR4D( RED ) },
{ In1_Cu, COLOR4D( YELLOW ) },

View File

@ -129,10 +129,12 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "board.plated_hole", LAYER_NON_PLATEDHOLES );
CLR( "board.ratsnest", LAYER_RATSNEST );
CLR( "board.via_hole", LAYER_VIA_HOLES );
CLR( "board.via_hole_walls", LAYER_VIA_HOLEWALLS );
CLR( "board.worksheet", LAYER_DRAWINGSHEET );
CLR( "board.page_limits", LAYER_PAGE_LIMITS );
CLR( "board.track_net_names", NETNAMES_LAYER_ID_START );
CLR( "board.pad_net_names", LAYER_PAD_NETNAMES );
CLR( "board.pad_net_names", LAYER_PAD_NETNAMES );
CLR( "board.via_net_names", LAYER_VIA_NETNAMES );
CLR( "board.copper.f", F_Cu );
CLR( "board.copper.in1", In1_Cu );

View File

@ -706,6 +706,16 @@ public:
*/
double m_MinParallelAngle;
/**
* What factor to use when painting via and PTH pad hole walls, so that
* the painted hole wall can be overemphasized compared to physical reality
* to make the wall easier to see on-screen.
*
* Setting name: "HoleWallPaintingMultiplier"
* Default value: 1.5
*/
double m_HoleWallPaintingMultiplier;
///@}
private:

View File

@ -165,6 +165,7 @@ enum NETNAMES_LAYER_ID: int
LAYER_PAD_FR_NETNAMES,
LAYER_PAD_BK_NETNAMES,
LAYER_PAD_NETNAMES,
LAYER_VIA_NETNAMES,
NETNAMES_LAYER_ID_END
};

View File

@ -658,7 +658,6 @@ std::set<int> g_excludedLayers =
{
LAYER_VIAS,
LAYER_VIA_THROUGH,
LAYER_VIA_HOLEWALLS,
LAYER_VIA_BBLIND,
LAYER_VIA_MICROVIA,
LAYER_FOOTPRINTS_FR,

View File

@ -75,7 +75,7 @@ const int GAL_LAYER_ORDER[] =
LAYER_DRC_ERROR, LAYER_DRC_WARNING, LAYER_DRC_EXCLUSION, LAYER_MARKER_SHADOWS,
LAYER_DRC_SHAPE1, LAYER_DRC_SHAPE2,
LAYER_PAD_NETNAMES,
LAYER_PAD_NETNAMES, LAYER_VIA_NETNAMES,
Dwgs_User, ZONE_LAYER_FOR( Dwgs_User ),
Cmts_User, ZONE_LAYER_FOR( Cmts_User ),
Eco1_User, ZONE_LAYER_FOR( Eco1_User ),
@ -361,6 +361,7 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( PCB_LAYER_ID aLayer )
LAYER_CONFLICTS_SHADOW,
GetNetnameLayer( aLayer ),
LAYER_PAD_FR_NETNAMES, LAYER_PAD_BK_NETNAMES, LAYER_PAD_NETNAMES,
LAYER_VIA_NETNAMES,
ZONE_LAYER_FOR( aLayer ),
BITMAP_LAYER_FOR( aLayer ),
LAYER_PAD_PLATEDHOLES, LAYER_PAD_HOLEWALLS, LAYER_NON_PLATEDHOLES,
@ -404,7 +405,7 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
LAYER_VIA_THROUGH, LAYER_VIA_BBLIND, LAYER_VIA_MICROVIA, LAYER_VIA_HOLES,
LAYER_VIA_HOLEWALLS,
LAYER_PAD_PLATEDHOLES, LAYER_PAD_HOLEWALLS, LAYER_NON_PLATEDHOLES,
LAYER_PAD_NETNAMES,
LAYER_PAD_NETNAMES, LAYER_VIA_NETNAMES,
LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY,
LAYER_RATSNEST,
LAYER_DRC_ERROR, LAYER_DRC_WARNING, LAYER_DRC_EXCLUSION, LAYER_MARKER_SHADOWS,
@ -458,6 +459,8 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
// of layer ordering...
m_view->SetLayerOrder( LAYER_PAD_NETNAMES,
m_view->GetLayerOrder( LAYER_MARKER_SHADOWS ) + 3 );
m_view->SetLayerOrder( LAYER_VIA_NETNAMES,
m_view->GetLayerOrder( LAYER_MARKER_SHADOWS ) + 4 );
}
}
@ -694,6 +697,7 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
m_view->SetRequired( LAYER_VIA_MICROVIA, LAYER_VIAS );
m_view->SetRequired( LAYER_VIA_BBLIND, LAYER_VIAS );
m_view->SetRequired( LAYER_VIA_THROUGH, LAYER_VIAS );
m_view->SetRequired( LAYER_VIA_NETNAMES, LAYER_VIAS );
m_view->SetLayerTarget( LAYER_SELECT_OVERLAY, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_SELECT_OVERLAY ) ;

View File

@ -25,6 +25,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <advanced_config.h>
#include <board.h>
#include <board_design_settings.h>
#include <pcb_track.h>
@ -243,9 +244,8 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const BOARD_ITEM* aItem, int aLayer ) con
aLayer = aLayer - LAYER_ZONE_START;
}
// Hole walls should pull from the via hole layer since it does not vary with active copper
// layer. For simplicity of configuration, pad hole walls can use the via color.
else if( aLayer == LAYER_VIA_HOLEWALLS || aLayer == LAYER_PAD_HOLEWALLS )
// Use via "golden copper" hole color for pad hole walls for contrast
else if( aLayer == LAYER_PAD_HOLEWALLS )
aLayer = LAYER_VIA_HOLES;
// Show via mask layers if appropriate
@ -1108,12 +1108,14 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer )
if( aLayer == LAYER_VIA_HOLEWALLS )
{
double radius = ( getViaDrillSize( aVia ) / 2.0 ) + m_holePlatingThickness;
double thickness =
m_holePlatingThickness * ADVANCED_CFG::GetCfg().m_HoleWallPaintingMultiplier;
double radius = ( getViaDrillSize( aVia ) / 2.0 ) + thickness;
if( !outline_mode )
{
m_gal->SetLineWidth( m_holePlatingThickness );
radius -= m_holePlatingThickness / 2.0;
m_gal->SetLineWidth( thickness );
radius -= thickness / 2.0;
}
// Underpaint the hole so that there aren't artifacts at its edge
@ -1436,11 +1438,12 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
{
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( m_holePlatingThickness );
double widthFactor = ADVANCED_CFG::GetCfg().m_HoleWallPaintingMultiplier;
m_gal->SetLineWidth( widthFactor * m_holePlatingThickness );
m_gal->SetStrokeColor( color );
std::shared_ptr<SHAPE_SEGMENT> slot = aPad->GetEffectiveHoleShape();
int holeSize = slot->GetWidth() + m_holePlatingThickness;
int holeSize = slot->GetWidth() + ( widthFactor * m_holePlatingThickness );
if( slot->GetSeg().A == slot->GetSeg().B ) // Circular hole
m_gal->DrawCircle( slot->GetSeg().A, KiROUND( holeSize / 2.0 ) );

View File

@ -1422,7 +1422,7 @@ const BOX2I PCB_TRACK::ViewBBox() const
std::vector<int> PCB_VIA::ViewGetLayers() const
{
LAYER_RANGE layers( Padstack().Drill().start, Padstack().Drill().end, MAX_CU_LAYERS );
std::vector<int> ret_layers{ LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_PAD_NETNAMES };
std::vector<int> ret_layers{ LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_VIA_NETNAMES };
ret_layers.reserve( MAX_CU_LAYERS + 6 );
// TODO(JE) Rendering order issue