mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Fix a bunch of errors involving implied line widths in plotters.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20818
This commit is contained in:
parent
5374bffb8e
commit
1f07c28999
@ -542,10 +542,9 @@ void DXF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if the polygon outline has thickness, and is not filled
|
||||
// (i.e. is a polyline) plot outlines with thick segments
|
||||
if( aWidth > 0 && aFill == FILL_T::NO_FILL )
|
||||
else if( aFill == FILL_T::NO_FILL )
|
||||
{
|
||||
MoveTo( aCornerList[0] );
|
||||
|
||||
@ -734,7 +733,7 @@ void DXF_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
|
||||
orient += ANGLE_90;
|
||||
}
|
||||
|
||||
sketchOval( aPos, size, orient, -1 );
|
||||
sketchOval( aPos, size, orient, USE_DEFAULT_LINE_WIDTH );
|
||||
}
|
||||
|
||||
|
||||
|
@ -886,7 +886,7 @@ void GERBER_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
{
|
||||
// Prevent plotting very short arcs as full circles, especially with 4.5 mm precision.
|
||||
// Also reduce the risk of integer overflow issues.
|
||||
polyArc( aCenter, aStartAngle, aAngle, aRadius, aFill, aWidth );
|
||||
polyArc( aCenter, aStartAngle, aAngle, aRadius, aFill, GetCurrentLineWidth() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1095,8 +1095,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
|
||||
|
||||
fmt::println( m_outputFile, "G37*" );
|
||||
}
|
||||
|
||||
if( aWidth > 0 || aFill == FILL_T::NO_FILL ) // Draw the polyline/polygon outline
|
||||
else if( aWidth != 0 ) // Draw the polyline/polygon outline
|
||||
{
|
||||
SetCurrentLineWidth( aWidth, gbr_metadata );
|
||||
|
||||
@ -1125,8 +1124,7 @@ void GERBER_PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aPoly, FILL_T aFill, int
|
||||
|
||||
// Ensure the thick outline is closed for filled polygons
|
||||
// (if not filled, could be only a polyline)
|
||||
if( ( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) )
|
||||
&& ( aPoly.IsClosed() || aFill != FILL_T::NO_FILL ) )
|
||||
if( ( aPoly.CPoint( 0 ) != aPoly.CPoint( -1 ) ) && ( aPoly.IsClosed() || aFill != FILL_T::NO_FILL ) )
|
||||
LineTo( VECTOR2I( aPoly.CPoint( 0 ) ) );
|
||||
|
||||
PenFinish();
|
||||
@ -1165,7 +1163,7 @@ void GERBER_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T
|
||||
fmt::println( m_outputFile, "G37*" );
|
||||
}
|
||||
|
||||
if( aWidth > 0 || aFill == FILL_T::NO_FILL ) // Draw the polyline/polygon outline
|
||||
if( aWidth != 0 || aFill == FILL_T::NO_FILL ) // Draw the polyline/polygon outline
|
||||
{
|
||||
SetCurrentLineWidth( aWidth, gbr_metadata );
|
||||
|
||||
@ -1201,7 +1199,7 @@ void GERBER_PLOTTER::ThickSegment( const VECTOR2I& start, const VECTOR2I& end, i
|
||||
else
|
||||
{
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
segmentAsOval( start, end, width, tracemode );
|
||||
segmentAsOval( start, end, GetCurrentLineWidth(), tracemode );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1232,7 +1230,7 @@ void GERBER_PLOTTER::ThickArc( const VECTOR2D& aCentre, const EDA_ANGLE& aStartA
|
||||
|
||||
|
||||
void GERBER_PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int width,
|
||||
OUTLINE_MODE tracemode, void* aData )
|
||||
OUTLINE_MODE tracemode, void* aData )
|
||||
{
|
||||
GBR_METADATA *gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||
SetCurrentLineWidth( width, gbr_metadata );
|
||||
@ -1247,15 +1245,15 @@ void GERBER_PLOTTER::ThickRect( const VECTOR2I& p1, const VECTOR2I& p2, int widt
|
||||
else
|
||||
{
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
VECTOR2I offsetp1( p1.x - ( width - m_currentPenWidth ) / 2,
|
||||
p1.y - (width - m_currentPenWidth) / 2 );
|
||||
VECTOR2I offsetp2( p2.x + ( width - m_currentPenWidth ) / 2,
|
||||
p2.y + (width - m_currentPenWidth) / 2 );
|
||||
VECTOR2I offsetp1( p1.x - ( width - GetCurrentLineWidth() ) / 2,
|
||||
p1.y - (width - GetCurrentLineWidth()) / 2 );
|
||||
VECTOR2I offsetp2( p2.x + ( width - GetCurrentLineWidth() ) / 2,
|
||||
p2.y + (width - GetCurrentLineWidth()) / 2 );
|
||||
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, -1 );
|
||||
offsetp1.x += (width - m_currentPenWidth);
|
||||
offsetp1.y += (width - m_currentPenWidth);
|
||||
offsetp2.x -= (width - m_currentPenWidth);
|
||||
offsetp2.y -= (width - m_currentPenWidth);
|
||||
offsetp1.x += (width - GetCurrentLineWidth());
|
||||
offsetp1.y += (width - GetCurrentLineWidth());
|
||||
offsetp2.x -= (width - GetCurrentLineWidth());
|
||||
offsetp2.y -= (width - GetCurrentLineWidth());
|
||||
Rect( offsetp1, offsetp2, FILL_T::NO_FILL, DO_NOT_SET_LINE_WIDTH );
|
||||
}
|
||||
}
|
||||
@ -1395,7 +1393,7 @@ void GERBER_PLOTTER::FlashPadOval( const VECTOR2I& aPos, const VECTOR2I& aSize,
|
||||
orient -= ANGLE_270;
|
||||
}
|
||||
|
||||
sketchOval( aPos, size, orient, -1 );
|
||||
sketchOval( aPos, size, orient, USE_DEFAULT_LINE_WIDTH );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,20 +449,14 @@ void HPGL_PLOTTER::Circle( const VECTOR2I& aCenter, int aDiameter, FILL_T aFill,
|
||||
void HPGL_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
|
||||
void* aData )
|
||||
{
|
||||
if( aFill == FILL_T::NO_FILL && aWidth <= 0 )
|
||||
if( aFill == FILL_T::NO_FILL && aWidth == 0 )
|
||||
return;
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
if( aCornerList.size() <= 1 )
|
||||
return;
|
||||
|
||||
// Width less than zero is occasionally used to create background-only
|
||||
// polygons. Don't set that as the plotter line width, that'll cause
|
||||
// trouble. Also, later, skip plotting the outline if this is the case.
|
||||
if( aWidth > 0 )
|
||||
{
|
||||
SetCurrentLineWidth( aWidth );
|
||||
}
|
||||
|
||||
MoveTo( aCornerList[0] );
|
||||
startItem( userToDeviceCoordinates( aCornerList[0] ) );
|
||||
|
||||
@ -484,20 +478,11 @@ void HPGL_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aF
|
||||
m_current_item->content += hpgl_end_polygon_cmd; // Close, fill polygon and draw outlines
|
||||
m_current_item->pen_returns = true;
|
||||
}
|
||||
else if( aWidth != 0 )
|
||||
else
|
||||
{
|
||||
// Plot only the polygon outline.
|
||||
for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
|
||||
LineTo( aCornerList[ii] );
|
||||
|
||||
// Always close polygon if filled.
|
||||
if( aFill != FILL_T::NO_FILL )
|
||||
{
|
||||
int ii = aCornerList.size() - 1;
|
||||
|
||||
if( aCornerList[ii] != aCornerList[0] )
|
||||
LineTo( aCornerList[0] );
|
||||
}
|
||||
}
|
||||
|
||||
PenFinish();
|
||||
|
@ -223,11 +223,11 @@ void PDF_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
||||
{
|
||||
wxASSERT( m_workFile );
|
||||
|
||||
if( fill == FILL_T::NO_FILL && width <= 0 )
|
||||
return;
|
||||
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
if( fill == FILL_T::NO_FILL && GetCurrentLineWidth() <= 0 )
|
||||
return;
|
||||
|
||||
VECTOR2I size = p2 - p1;
|
||||
|
||||
if( size.x == 0 && size.y == 0 )
|
||||
@ -274,22 +274,16 @@ void PDF_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T aFill, int w
|
||||
{
|
||||
wxASSERT( m_workFile );
|
||||
|
||||
if( aFill == FILL_T::NO_FILL && width <= 0 )
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
if( aFill == FILL_T::NO_FILL && GetCurrentLineWidth() <= 0 )
|
||||
return;
|
||||
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||
double radius = userToDeviceSize( diametre / 2.0 );
|
||||
|
||||
/* OK. Here's a trick. PDF doesn't support circles or circular angles, that's
|
||||
a fact. You'll have to do with cubic beziers. These *can't* represent
|
||||
circular arcs (NURBS can, beziers don't). But there is a widely known
|
||||
approximation which is really good
|
||||
*/
|
||||
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
// If diameter is less than width, switch to filled mode
|
||||
if( aFill == FILL_T::NO_FILL && diametre < width )
|
||||
if( aFill == FILL_T::NO_FILL && diametre < GetCurrentLineWidth() )
|
||||
{
|
||||
aFill = FILL_T::FILLED_SHAPE;
|
||||
SetCurrentLineWidth( 0 );
|
||||
@ -297,6 +291,12 @@ void PDF_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T aFill, int w
|
||||
radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
|
||||
}
|
||||
|
||||
/* OK. Here's a trick. PDF doesn't support circles or circular angles, that's
|
||||
a fact. You'll have to do with cubic beziers. These *can't* represent
|
||||
circular arcs (NURBS can, beziers don't). But there is a widely known
|
||||
approximation which is really good
|
||||
*/
|
||||
|
||||
double magic = radius * 0.551784; // You don't want to know where this come from
|
||||
|
||||
// This is the convex hull for the bezier approximated circle
|
||||
@ -333,9 +333,11 @@ void PDF_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
{
|
||||
wxASSERT( m_workFile );
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
if( aRadius <= 0 )
|
||||
{
|
||||
Circle( aCenter, aWidth, FILL_T::FILLED_SHAPE, 0 );
|
||||
Circle( aCenter, GetCurrentLineWidth(), FILL_T::FILLED_SHAPE, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -352,8 +354,6 @@ void PDF_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
if( startAngle > endAngle )
|
||||
std::swap( startAngle, endAngle );
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
// Usual trig arc plotting routine...
|
||||
start.x = KiROUND( aCenter.x + aRadius * ( -startAngle ).Cos() );
|
||||
start.y = KiROUND( aCenter.y + aRadius * ( -startAngle ).Sin() );
|
||||
@ -392,14 +392,14 @@ void PDF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
|
||||
{
|
||||
wxASSERT( m_workFile );
|
||||
|
||||
if( aFill == FILL_T::NO_FILL && aWidth <= 0 )
|
||||
return;
|
||||
|
||||
if( aCornerList.size() <= 1 )
|
||||
return;
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
if( aFill == FILL_T::NO_FILL && GetCurrentLineWidth() <= 0 )
|
||||
return;
|
||||
|
||||
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
|
||||
fmt::println( m_workFile, "{:f} {:f} m", pos.x, pos.y );
|
||||
|
||||
@ -412,7 +412,7 @@ void PDF_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFi
|
||||
// Close path and stroke and/or fill
|
||||
if( aFill == FILL_T::NO_FILL )
|
||||
fmt::println( m_workFile, "S" );
|
||||
else if( aWidth == 0 )
|
||||
else if( GetCurrentLineWidth() == 0 )
|
||||
fmt::println( m_workFile, "f" );
|
||||
else
|
||||
fmt::println( m_workFile, "b" );
|
||||
@ -440,8 +440,9 @@ void PDF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
|
||||
{
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||
fmt::println( m_workFile, "{:f} {:f} {}",
|
||||
pos_dev.x, pos_dev.y,
|
||||
( plume=='D' ) ? 'l' : 'm' );
|
||||
pos_dev.x,
|
||||
pos_dev.y,
|
||||
plume == 'D' ? 'l' : 'm' );
|
||||
}
|
||||
|
||||
m_penState = plume;
|
||||
@ -571,14 +572,13 @@ int PDF_PLOTTER::startPdfStream( int handle )
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_DebugPDFWriter )
|
||||
{
|
||||
fmt::println( m_outputFile,
|
||||
"<< /Length {} 0 R >>\nstream", handle + 1 );
|
||||
fmt::println( m_outputFile, "<< /Length {} 0 R >>\nstream",
|
||||
handle + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::println( m_outputFile,
|
||||
"<< /Length {} 0 R /Filter /FlateDecode >>\n"
|
||||
"stream", handle + 1 );
|
||||
fmt::println( m_outputFile, "<< /Length {} 0 R /Filter /FlateDecode >>\nstream",
|
||||
handle + 1 );
|
||||
}
|
||||
|
||||
// Open a temporary file to accumulate the stream
|
||||
@ -1622,21 +1622,21 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
|
||||
VECTOR2I t_size( std::abs( aSize.x ), std::abs( aSize.y ) );
|
||||
bool textMirrored = aSize.x < 0;
|
||||
|
||||
computeTextParameters( aPos, aText, aOrient, t_size, textMirrored, aH_justify, aV_justify,
|
||||
aWidth, aItalic, aBold, &wideningFactor, &ctm_a, &ctm_b, &ctm_c, &ctm_d,
|
||||
&ctm_e, &ctm_f, &heightFactor );
|
||||
|
||||
SetColor( aColor );
|
||||
SetCurrentLineWidth( aWidth, aData );
|
||||
|
||||
computeTextParameters( aPos, aText, aOrient, t_size, textMirrored, aH_justify, aV_justify,
|
||||
GetCurrentLineWidth(), aItalic, aBold, &wideningFactor,
|
||||
&ctm_a, &ctm_b, &ctm_c, &ctm_d, &ctm_e, &ctm_f, &heightFactor );
|
||||
|
||||
wxStringTokenizer str_tok( aText, " ", wxTOKEN_RET_DELIMS );
|
||||
|
||||
// If aFont is not specilied (== nullptr), use the default kicad stroke font
|
||||
if( !aFont )
|
||||
aFont = KIFONT::FONT::GetFont();
|
||||
|
||||
VECTOR2I full_box( aFont->StringBoundaryLimits( aText, t_size, aWidth, aBold, aItalic,
|
||||
aFontMetrics ) );
|
||||
VECTOR2I full_box( aFont->StringBoundaryLimits( aText, t_size, GetCurrentLineWidth(),
|
||||
aBold, aItalic, aFontMetrics ) );
|
||||
|
||||
if( textMirrored )
|
||||
full_box.x *= -1;
|
||||
@ -1662,12 +1662,12 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
|
||||
wxString word = str_tok.GetNextToken();
|
||||
|
||||
computeTextParameters( pos, word, aOrient, t_size, textMirrored, GR_TEXT_H_ALIGN_LEFT,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, aWidth, aItalic, aBold, &wideningFactor,
|
||||
GR_TEXT_V_ALIGN_BOTTOM, GetCurrentLineWidth(), aItalic, aBold, &wideningFactor,
|
||||
&ctm_a, &ctm_b, &ctm_c, &ctm_d, &ctm_e, &ctm_f, &heightFactor );
|
||||
|
||||
// Extract the changed width and rotate by the orientation to get the offset for the
|
||||
// next word
|
||||
VECTOR2I bbox( aFont->StringBoundaryLimits( word, t_size, aWidth,
|
||||
VECTOR2I bbox( aFont->StringBoundaryLimits( word, t_size, GetCurrentLineWidth(),
|
||||
aBold, aItalic, aFontMetrics ).x, 0 );
|
||||
|
||||
if( textMirrored )
|
||||
@ -1695,8 +1695,8 @@ void PDF_PLOTTER::Text( const VECTOR2I& aPos,
|
||||
}
|
||||
|
||||
// Plot the stroked text (if requested)
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||
aBold, aMultilineAllowed, aFont, aFontMetrics );
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, GetCurrentLineWidth(),
|
||||
aItalic, aBold, aMultilineAllowed, aFont, aFontMetrics );
|
||||
}
|
||||
|
||||
|
||||
|
@ -245,13 +245,9 @@ void PSLIKE_PLOTTER::FlashPadTrapez( const VECTOR2I& aPadPos, const VECTOR2I* aC
|
||||
cornerList.push_back( aCorners[ii] );
|
||||
|
||||
if( aTraceMode == FILLED )
|
||||
{
|
||||
SetCurrentLineWidth( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
}
|
||||
|
||||
for( int ii = 0; ii < 4; ii++ )
|
||||
{
|
||||
@ -499,13 +495,14 @@ void PS_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
|
||||
|
||||
void PS_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width )
|
||||
{
|
||||
if( fill == FILL_T::NO_FILL && width <= 0 )
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
if( fill == FILL_T::NO_FILL && GetCurrentLineWidth() <= 0 )
|
||||
return;
|
||||
|
||||
VECTOR2D p1_dev = userToDeviceCoordinates( p1 );
|
||||
VECTOR2D p2_dev = userToDeviceCoordinates( p2 );
|
||||
|
||||
SetCurrentLineWidth( width );
|
||||
fmt::print( m_outputFile, "{:g} {:g} {:g} {:g} rect{}\n", p1_dev.x, p1_dev.y,
|
||||
p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, getFillId( fill ) );
|
||||
}
|
||||
@ -513,14 +510,15 @@ void PS_PLOTTER::Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int
|
||||
|
||||
void PS_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width )
|
||||
{
|
||||
if( fill == FILL_T::NO_FILL && width <= 0 )
|
||||
SetCurrentLineWidth( width );
|
||||
|
||||
if( fill == FILL_T::NO_FILL && GetCurrentLineWidth() <= 0 )
|
||||
return;
|
||||
|
||||
wxASSERT( m_outputFile );
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( pos );
|
||||
double radius = userToDeviceSize( diametre / 2.0 );
|
||||
|
||||
SetCurrentLineWidth( width );
|
||||
fmt::print( m_outputFile, "{:g} {:g} {:g} cir{}\n", pos_dev.x, pos_dev.y, radius, getFillId( fill ) );
|
||||
}
|
||||
|
||||
@ -559,14 +557,14 @@ void PS_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
void PS_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
|
||||
void* aData )
|
||||
{
|
||||
if( aFill == FILL_T::NO_FILL && aWidth <= 0 )
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
if( aFill == FILL_T::NO_FILL && GetCurrentLineWidth() <= 0 )
|
||||
return;
|
||||
|
||||
if( aCornerList.size() <= 1 )
|
||||
return;
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
VECTOR2D pos = userToDeviceCoordinates( aCornerList[0] );
|
||||
fmt::print( m_outputFile, "newpath\n{:g} {:g} moveto\n", pos.x, pos.y );
|
||||
|
||||
@ -914,8 +912,8 @@ void PS_PLOTTER::Text( const VECTOR2I& aPos,
|
||||
fmt::print( m_outputFile, "{} {:g} {:g} phantomshow\n", ps_test.c_str(), pos_dev.x, pos_dev.y );
|
||||
}
|
||||
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||
aBold, aMultilineAllowed, aFont, aFontMetrics, aData );
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, GetCurrentLineWidth(),
|
||||
aItalic, aBold, aMultilineAllowed, aFont, aFontMetrics, aData );
|
||||
}
|
||||
|
||||
|
||||
|
@ -429,9 +429,10 @@ void SVG_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int wi
|
||||
setSVGPlotStyle( GetCurrentLineWidth() );
|
||||
|
||||
// If diameter is less than width, switch to filled mode
|
||||
if( fill == FILL_T::NO_FILL && diametre < width )
|
||||
if( fill == FILL_T::NO_FILL && diametre < GetCurrentLineWidth() )
|
||||
{
|
||||
setFillMode( FILL_T::FILLED_SHAPE );
|
||||
width = GetCurrentLineWidth();
|
||||
SetCurrentLineWidth( 0 );
|
||||
|
||||
radius = userToDeviceSize( ( diametre / 2.0 ) + ( width / 2.0 ) );
|
||||
@ -867,7 +868,7 @@ void SVG_PLOTTER::Text( const VECTOR2I& aPos,
|
||||
|
||||
// aSize.x or aSize.y is < 0 for mirrored texts.
|
||||
// The actual text size value is the absolute value
|
||||
text_size.x = std::abs( GRTextWidth( aText, aFont, aSize, aWidth, aBold, aItalic,
|
||||
text_size.x = std::abs( GRTextWidth( aText, aFont, aSize, GetCurrentLineWidth(), aBold, aItalic,
|
||||
aFontMetrics ) );
|
||||
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
|
||||
VECTOR2D anchor_pos_dev = userToDeviceCoordinates( aPos );
|
||||
@ -922,7 +923,7 @@ void SVG_PLOTTER::Text( const VECTOR2I& aPos,
|
||||
"<g class=\"stroked-text\"><desc>{}</desc>\n",
|
||||
TO_UTF8( XmlEsc( aText ) ) );
|
||||
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, GetCurrentLineWidth(),
|
||||
aItalic, aBold, aMultilineAllowed, aFont, aFontMetrics );
|
||||
|
||||
fmt::print( m_outputFile, "</g>" );
|
||||
|
@ -267,7 +267,7 @@ void PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double aSc
|
||||
end.x += size.x;
|
||||
end.y += size.y;
|
||||
|
||||
Rect( start, end, FILL_T::NO_FILL );
|
||||
Rect( start, end, FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
|
||||
}
|
||||
|
||||
|
||||
@ -541,12 +541,12 @@ void PLOTTER::sketchOval( const VECTOR2I& aPos, const VECTOR2I& aSize, const EDA
|
||||
MoveTo( corners[0] );
|
||||
FinishTo( corners[1] );
|
||||
|
||||
Arc( corners[2], -orient, ANGLE_180, radius, FILL_T::NO_FILL );
|
||||
Arc( corners[2], -orient, ANGLE_180, radius, FILL_T::NO_FILL, aWidth );
|
||||
|
||||
MoveTo( corners[3] );
|
||||
FinishTo( corners[4] );
|
||||
|
||||
Arc( corners[5], -orient, -ANGLE_180, radius, FILL_T::NO_FILL );
|
||||
Arc( corners[5], -orient, -ANGLE_180, radius, FILL_T::NO_FILL, aWidth );
|
||||
}
|
||||
|
||||
|
||||
@ -584,11 +584,11 @@ void PLOTTER::ThickArc( const VECTOR2D& centre, const EDA_ANGLE& aStartAngle,
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCurrentLineWidth( -1 );
|
||||
Arc( centre, aStartAngle, aAngle, aRadius - ( aWidth - m_currentPenWidth ) / 2,
|
||||
FILL_T::NO_FILL, -1 );
|
||||
Arc( centre, aStartAngle, aAngle, aRadius + ( aWidth - m_currentPenWidth ) / 2,
|
||||
FILL_T::NO_FILL, -1 );
|
||||
SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH );
|
||||
Arc( centre, aStartAngle, aAngle, aRadius - KiROUND( ( aWidth - m_currentPenWidth ) / 2 ),
|
||||
FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
|
||||
Arc( centre, aStartAngle, aAngle, aRadius + KiROUND( ( aWidth - m_currentPenWidth ) / 2 ),
|
||||
FILL_T::NO_FILL, USE_DEFAULT_LINE_WIDTH );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ void SCH_JUNCTION::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPT
|
||||
|
||||
aPlotter->SetColor( color );
|
||||
|
||||
aPlotter->Circle( m_pos, GetEffectiveDiameter(), FILL_T::FILLED_SHAPE );
|
||||
aPlotter->Circle( m_pos, GetEffectiveDiameter(), FILL_T::FILLED_SHAPE, 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -212,17 +212,15 @@ public:
|
||||
int GetPlotterArcHighDef() const { return m_IUsPerDecimil * 2; }
|
||||
|
||||
// Low level primitives
|
||||
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill,
|
||||
int width = USE_DEFAULT_LINE_WIDTH ) = 0;
|
||||
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
|
||||
int width = USE_DEFAULT_LINE_WIDTH ) = 0;
|
||||
virtual void Rect( const VECTOR2I& p1, const VECTOR2I& p2, FILL_T fill, int width ) = 0;
|
||||
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int width ) = 0;
|
||||
|
||||
virtual void Arc( const VECTOR2D& aStart, const VECTOR2D& aMid, const VECTOR2D& aEnd,
|
||||
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH );
|
||||
FILL_T aFill, int aWidth );
|
||||
|
||||
virtual void Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aAngle, double aRadius, FILL_T aFill,
|
||||
int aWidth = USE_DEFAULT_LINE_WIDTH );
|
||||
int aWidth );
|
||||
|
||||
/**
|
||||
* Generic fallback: Cubic Bezier curve rendered as a polyline.
|
||||
@ -231,7 +229,7 @@ public:
|
||||
*/
|
||||
virtual void BezierCurve( const VECTOR2I& aStart, const VECTOR2I& aControl1,
|
||||
const VECTOR2I& aControl2, const VECTOR2I& aEnd,
|
||||
int aTolerance, int aLineThickness = USE_DEFAULT_LINE_WIDTH );
|
||||
int aTolerance, int aLineThickness );
|
||||
|
||||
/**
|
||||
* Moveto/lineto primitive, moves the 'pen' to the specified direction.
|
||||
|
@ -1190,7 +1190,7 @@ static void FillNegativeKnockout( PLOTTER *aPlotter, const BOX2I &aBbbox )
|
||||
|
||||
BOX2I area = aBbbox;
|
||||
area.Inflate( margin );
|
||||
aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILL_T::FILLED_SHAPE );
|
||||
aPlotter->Rect( area.GetOrigin(), area.GetEnd(), FILL_T::FILLED_SHAPE, 0 );
|
||||
aPlotter->SetColor( BLACK );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user