dcsvg (and therefore KicadSVGFileDC) is now unused. Use SVG plotter only to export a board SVG file.
SVG export does not use no more wxWidgets wxDC. In pcbnew SVG files can be created by plot menu (in B&W) or export SVG menu (B&W or Color). Export SVG menu is more suitable to create a view of a board, and plot menu is better to create a B&W document of silkscreen layers. (In the future, the 2 menus could be merged, because they are not very different). Note: pcbnew plot code is cleaned, mainly in dialog files, but still needs more cleanup.
This commit is contained in:
@@ -152,54 +152,26 @@ void SVG_PLOTTER::setSVGPlotStyle()
|
||||
switch( m_fillMode )
|
||||
{
|
||||
case NO_FILL:
|
||||
fputs( "fill-opacity:0.0;\n", outputFile );
|
||||
fputs( "fill-opacity:0.0; ", outputFile );
|
||||
break;
|
||||
|
||||
case FILLED_SHAPE:
|
||||
fputs( "fill-opacity:1.0;\n", outputFile );
|
||||
fputs( "fill-opacity:1.0; ", outputFile );
|
||||
break;
|
||||
|
||||
case FILLED_WITH_BG_BODYCOLOR:
|
||||
fputs( "fill-opacity:0.6;\n", outputFile );
|
||||
fputs( "fill-opacity:0.6; ", outputFile );
|
||||
break;
|
||||
}
|
||||
|
||||
// output the pen color (RVB values in hex) and opacity
|
||||
double pen_opacity = 1.0; // 0.0 (transparent to 1.0 (solid)
|
||||
fprintf( outputFile, " stroke:#%6.6lX; stroke-opacity:%g;\n",
|
||||
m_pen_rgb_color, pen_opacity );
|
||||
|
||||
// output the pen cap
|
||||
int pen_cap = 0; // round, square, butt (currenly not used)
|
||||
|
||||
switch( pen_cap )
|
||||
{
|
||||
case 1:
|
||||
fputs( "stroke-linecap:square; ", outputFile );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
fputs( "stroke-linecap:butt; ", outputFile );
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
fputs( "stroke-linecap:round; ", outputFile );
|
||||
}
|
||||
|
||||
fputs( "stroke-linejoin:round; ", outputFile );
|
||||
|
||||
int pen_w = (int) userToDeviceSize( GetCurrentLineWidth() );
|
||||
fprintf( outputFile,
|
||||
"stroke-width:%d\" \n transform=\"translate(%.2g %.2g) scale(%.2g %.2g)\">\n",
|
||||
pen_w,
|
||||
userToDeviceSize( plotOffset.x ), userToDeviceSize( plotOffset.y ),
|
||||
plotScale, plotScale );
|
||||
double pen_w = userToDeviceSize( GetCurrentLineWidth() );
|
||||
fprintf( outputFile, "\nstroke:#%6.6lX; stroke-width:%g; stroke-opacity:1; \n",
|
||||
m_pen_rgb_color, pen_w );
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round;\">\n", outputFile );
|
||||
|
||||
m_graphics_changed = false;
|
||||
}
|
||||
|
||||
|
||||
/* Set the current line width (in IUs) for the next plot
|
||||
*/
|
||||
void SVG_PLOTTER::SetCurrentLineWidth( int width )
|
||||
@@ -487,10 +459,16 @@ bool SVG_PLOTTER::StartPlot( FILE* fout )
|
||||
// End of header
|
||||
fprintf( outputFile, " <desc>Picture generated by %s </desc>\n",
|
||||
TO_UTF8( creator ) );
|
||||
fputs( "<g style=\"fill:black; stroke:black; stroke-width:1\">\n",
|
||||
outputFile );
|
||||
setSVGPlotStyle();
|
||||
|
||||
// output the pen and brush color (RVB values in hex) and opacity
|
||||
double opacity = 1.0; // 0.0 (transparent to 1.0 (solid)
|
||||
fprintf( outputFile,
|
||||
"<g style=\"fill:#%6.6lX; fill-opacity:%g;stroke:#%6.6lX; stroke-opacity:%g;\n",
|
||||
m_brush_rgb_color, opacity, m_pen_rgb_color, opacity );
|
||||
|
||||
// output the pen cap and line joint
|
||||
fputs( "stroke-linecap:round; stroke-linejoin:round; \"\n", outputFile );
|
||||
fputs( " transform=\"translate(0 0) scale(1 1)\">\n", outputFile );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user