Fix bugs in B&W plotting.

Fixes https://gitlab.com/kicad/code/kicad/issues/9411
This commit is contained in:
Jeff Young 2021-10-26 22:26:11 +01:00
parent dd99b2dc2f
commit 3d2ffc12c1
2 changed files with 15 additions and 16 deletions

View File

@ -893,7 +893,7 @@ void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter,
void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen,
bool aPlotDrawingSheet ) bool aPlotDrawingSheet )
{ {
if( m_plotBackgroundColor->GetValue() ) if( m_plotBackgroundColor->GetValue() && aPlotter->GetColorMode() )
{ {
aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() ); aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
wxPoint end( aPlotter->PageSettings().GetWidthIU(), wxPoint end( aPlotter->PageSettings().GetWidthIU(),
@ -1084,7 +1084,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
plotter->StartPlot(); plotter->StartPlot();
if( m_plotBackgroundColor->GetValue() ) if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{ {
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(), plotter->PageSettings().GetHeightIU() ); wxPoint end( plotter->PageSettings().GetWidthIU(), plotter->PageSettings().GetHeightIU() );
@ -1213,7 +1213,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
plotter->StartPlot(); plotter->StartPlot();
if( m_plotBackgroundColor->GetValue() ) if( m_plotBackgroundColor->GetValue() && plotter->GetColorMode() )
{ {
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(), wxPoint end( plotter->PageSettings().GetWidthIU(),

View File

@ -550,14 +550,14 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint
wxASSERT( aPlotter != nullptr ); wxASSERT( aPlotter != nullptr );
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) ); aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
bool fill = aPlotter->GetColorMode();
// draw background for filled items using background option // draw background for filled items using background option
// Solid lines will be drawn after the background // Solid lines will be drawn after the background
for( const LIB_ITEM& item : m_drawings ) for( const LIB_ITEM& item : m_drawings )
{ {
if( item.Type() == LIB_SHAPE_T ) if( item.Type() != LIB_SHAPE_T )
{ continue;
const LIB_SHAPE& shape = static_cast<const LIB_SHAPE&>( item ); const LIB_SHAPE& shape = static_cast<const LIB_SHAPE&>( item );
// Do not draw items not attached to the current part // Do not draw items not attached to the current part
@ -567,9 +567,8 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint
if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) ) if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) )
continue; continue;
if( shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR ) if( shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR && aPlotter->GetColorMode() )
shape.Plot( aPlotter, aOffset, fill, aTransform ); shape.Plot( aPlotter, aOffset, true, aTransform );
}
} }
// Not filled items and filled shapes are now plotted // Not filled items and filled shapes are now plotted
@ -595,7 +594,7 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint
forceNoFill = shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR; forceNoFill = shape.GetFillType() == FILL_T::FILLED_WITH_BG_BODYCOLOR;
} }
item.Plot( aPlotter, aOffset, fill && !forceNoFill, aTransform ); item.Plot( aPlotter, aOffset, !forceNoFill, aTransform );
} }
} }