SVG plotter: fix some issues: incorrect bitmap size and missing lines in header

Fixes #4256
https://gitlab.com/kicad/code/kicad/issues/4256
This commit is contained in:
jean-pierre charras 2020-04-24 16:28:12 +02:00
parent b09463cc86
commit 18150e5769
1 changed files with 9 additions and 7 deletions

View File

@ -6,8 +6,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -648,11 +648,9 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const wxPoint& aPos,
fprintf( outputFile, "\n" );
}
fprintf( outputFile, "\"\npreserveAspectRatio=\"none\" height=\"%f\" width=\"%f\" />",
fprintf( outputFile, "\"\npreserveAspectRatio=\"none\" width=\"%f\" height=\"%f\" />",
userToDeviceSize( drawsize.x ), userToDeviceSize( drawsize.y ) );
}
}
@ -712,7 +710,11 @@ bool SVG_PLOTTER::StartPlot()
"<?xml version=\"1.0\" standalone=\"no\"?>\n",
" <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> \n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" \n",
"<svg\n"
" xmlns:svg=\"http://www.w3.org/2000/svg\"\n"
" xmlns=\"http://www.w3.org/2000/svg\"\n",
" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n",
" version=\"1.1\"\n",
NULL
};
@ -724,7 +726,7 @@ bool SVG_PLOTTER::StartPlot()
// Write viewport pos and size
wxPoint origin; // TODO set to actual value
fprintf( outputFile, " width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
fprintf( outputFile, " width=\"%fcm\" height=\"%fcm\" viewBox=\"%d %d %d %d\">\n",
(double) paperSize.x / m_IUsPerDecimil * 2.54 / 10000,
(double) paperSize.y / m_IUsPerDecimil * 2.54 / 10000, origin.x, origin.y,
(int) ( paperSize.x * iuPerDeviceUnit ), (int) ( paperSize.y * iuPerDeviceUnit) );