BerndK / SvgToXaml

Smart Tool to view svg-files and convert them to xaml for use in .NET
Other
886 stars 164 forks source link

viewBox not considered if stroke is in path #20

Closed Dave220 closed 2 years ago

Dave220 commented 3 years ago

If there is a "viewBox" in svg file, the SvgToXaml converter does not consider the relative coordinates of e.g. a "path", if there is a "stroke" defined in that "path". This is only done if there is a no "stroke" defined inside the "path" object in svg file. What happens is: In first case the convertrer produces e.g.:
    <GeometryDrawing Brush="#FFE68686" Geometry="{StaticResource testGeometry1}">         <GeometryDrawing.Pen>             <Pen Brush="#FFE6E6E6" Thickness="2" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" MiterLimit="10" />         </GeometryDrawing.Pen>     </GeometryDrawing>
In second case the convertre produces e.g.:
    <GeometryDrawing Brush="#FFE6E6E6" Geometry="{StaticResource testGeometry2}" />
The problem could be solved, if for the svg "viewBox" e.g.: viewBox="0 0 120 120" an additional line of e.g.:
    <GeometryDrawing Brush="Black" Geometry="F1 M120,120z M0,0z" />
would be added by the converter.

BerndK commented 3 years ago

Thanks for the feedback, but I did not get the problem. Can you provide a sample svg? (btw I can't promise to fix it)

BerndK commented 2 years ago

Closed due to long inactivity and not provided sample file.