wrong transformation ( from accidently removed viewBox ) in svg2qvg

fixed. qvg files recreated
This commit is contained in:
Uwe Rathmann 2024-04-22 11:40:09 +02:00
parent e8db2581f4
commit 2236e44686
37 changed files with 22 additions and 15 deletions

View File

@ -24,3 +24,8 @@ c) Material3 Icons
Code: https://github.com/marella/material-design-icons
SPDX-License-Identifier: Apache License 2.0
d) Fluent2 Icons
Code: https://github.com/microsoft/fluentui-system-icons
SPDX-License-Identifier: MIT License

Binary file not shown.

View File

@ -25,6 +25,22 @@ static void usage( const char* appName )
qWarning() << "usage: " << appName << "svgfile qvgfile";
}
static QRectF viewBox( QSvgRenderer& renderer )
{
/*
QSvgRenderer::viewBoxF() returns a bounding box when no viewBox
has been defined. So we clear the viewBox and compare the result with
the initial value - assuming, that there was a viewBox when they differ.
*/
const auto viewBox = renderer.viewBoxF();
renderer.setViewBox( QRectF() );
const bool hasViewBox = ( viewBox != renderer.viewBoxF() );
renderer.setViewBox( viewBox );
return hasViewBox ? viewBox : QRectF( 0.0, 0.0, -1.0, -1.0 );
}
int main( int argc, char* argv[] )
{
if ( argc != 3 )
@ -56,21 +72,7 @@ int main( int argc, char* argv[] )
return -2;
QskGraphic graphic;
{
/*
QSvgRenderer::viewBoxF() returns a bounding box when no viewBox
has been defined. So we clear the viewBox and compare the result with
the initial value - assuming, that there was a viewBox when they differ.
*/
const auto viewBox = renderer.viewBoxF();
renderer.setViewBox( QRectF() );
if ( viewBox != renderer.viewBoxF() )
graphic.setViewBox( viewBox );
}
graphic.setViewBox( ::viewBox( renderer ) );
QPainter painter( &graphic );
renderer.render( &painter );