Don't fill drawing sheet rects with transparent fill.

It might make sense to do that with board and/or schematic items for
hit-testing or something, but it definitely doesn't make any sense for
the drawing sheet border.

Also, when reading in items with a transparent fill, treat them as
unfilled (otherwise we get filled with layer colour in at least PCBNew).
This commit is contained in:
Jeff Young 2022-10-17 17:49:28 +01:00
parent d52d1cb489
commit 92f1ee556f
2 changed files with 16 additions and 4 deletions

View File

@ -112,8 +112,12 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
case WSG_RECT_T:
{
DS_DRAW_ITEM_RECT* rect = (DS_DRAW_ITEM_RECT*) item;
int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth );
plotter->Rect( rect->GetStart(), rect->GetEnd(), FILL_T::NO_FILL, penWidth );
plotter->SetCurrentLineWidth( std::max( rect->GetPenWidth(), defaultPenWidth ) );
plotter->MoveTo( rect->GetStart() );
plotter->LineTo( VECTOR2I( rect->GetEnd().x, rect->GetStart().y ) );
plotter->LineTo( VECTOR2I( rect->GetEnd().x, rect->GetEnd().y ) );
plotter->LineTo( VECTOR2I( rect->GetStart().x, rect->GetEnd().y ) );
plotter->FinishTo( rect->GetStart() );
}
break;

View File

@ -70,9 +70,16 @@ bool SVG_IMPORT_PLUGIN::Load( const wxString& aFileName )
bool SVG_IMPORT_PLUGIN::Import()
{
auto alpha =
[]( int color )
{
return color >> 24;
};
for( NSVGshape* shape = m_parsedImage->shapes; shape != nullptr; shape = shape->next )
{
double lineWidth = shape->strokeWidth;
bool filled = shape->fill.type == NSVG_PAINT_COLOR && alpha( shape->fill.color ) > 0;
GRAPHICS_IMPORTER::POLY_FILL_RULE rule = GRAPHICS_IMPORTER::PF_NONZERO;
@ -87,8 +94,9 @@ bool SVG_IMPORT_PLUGIN::Import()
for( NSVGpath* path = shape->paths; path != nullptr; path = path->next )
{
DrawPath( path->pts, path->npts, path->closed || rule == GRAPHICS_IMPORTER::PF_EVEN_ODD,
shape->fill.type == NSVG_PAINT_COLOR, lineWidth );
bool closed = path->closed || rule == GRAPHICS_IMPORTER::PF_EVEN_ODD;
DrawPath( path->pts, path->npts, closed, filled, lineWidth );
}
}