HPGL plotting: write rects as polygons to prevent always filling.

(cherry picked from commit d9c123b1ec)
This commit is contained in:
Alex Shvartzkop 2023-10-12 06:09:35 +03:00
parent e0158a8ed7
commit 4f5fca4e67
1 changed files with 8 additions and 14 deletions

View File

@ -394,22 +394,16 @@ void HPGL_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T aFill, i
VECTOR2D p1_device = userToDeviceCoordinates( p1 ); VECTOR2D p1_device = userToDeviceCoordinates( p1 );
VECTOR2D p2_device = userToDeviceCoordinates( p2 ); VECTOR2D p2_device = userToDeviceCoordinates( p2 );
MoveTo( p1 ); // EA command seems to always fill the rectangle, so plot as a polygon instead
std::vector<VECTOR2I> cornerList;
if( aFill == FILL_T::FILLED_SHAPE ) cornerList.emplace_back( p1.x, p1.y );
{ cornerList.emplace_back( p2.x, p1.y );
startOrAppendItem( p1_device, wxString::Format( "RA %.0f,%.0f;", cornerList.emplace_back( p2.x, p2.y );
p2_device.x, cornerList.emplace_back( p1.x, p2.y );
p2_device.y ) ); cornerList.emplace_back( p1.x, p1.y );
}
startOrAppendItem( p1_device, wxString::Format( "EA %.0f,%.0f;", PlotPoly( cornerList, aFill, aWidth, nullptr );
p2_device.x,
p2_device.y ) );
m_current_item->loc_end = m_current_item->loc_start;
m_current_item->bbox.Merge( p2_device );
PenFinish();
} }