Comments (3)
Hi @naan, thanks for filing the issue and the commit to fix this. Seeing this is an issue of the SVG generator not properly dealing with floating point rounding, and not one from the library, I'm not entirely convinced that the change should get merged in yet.
Can you tell me what program you're using to generate your SVGs?
from swiftsvg.
Yeah, I realized that after I made a change, so I dug into this issue.
The application I'm generating SVG is Sketch, and here's original code:
<svg width="381px" height="520px" viewBox="-4 -7 381 520" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch -->
<desc>Created with Sketch.</desc>
<defs></defs>
<polygon id="Path-12" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="187.136435 512.08631 0 302.480469 0 166.554688"></polygon>
<polygon id="Path-12-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(281.499999, 343.701358) scale(-1, 1) translate(-281.499999, -343.701358) " points="374.999998 512.08631 188 304.378906 188 175.316406"></polygon>
<polygon id="Path-13" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="187.93703 511.744987 1.42108547e-14 107.175781 1.42108547e-14 2.84217094e-14 35.8710953 2.84217094e-14"></polygon>
<polygon id="Path-13-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(281.500000, 255.872494) scale(-1, 1) translate(-281.500000, -255.872494) " points="374.999999 511.744987 188 71.234375 188 0 223.292965 0"></polygon>
<polygon id="Path-16" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="190.454104 511.745614 77.3398438 1.90734863e-06 169.488281 -2.84217094e-14"></polygon>
<polygon id="Path-16-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(239.681641, 255.685072) scale(-1, 1) translate(-239.681641, -255.685072) " points="291.363282 511.370144 188 5.26313499e-06 257.167973 0"></polygon>
<polygon id="Path-18" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="191.637218 510.559211 374.999996 346.773437 374.999996 440.890623"></polygon>
<polygon id="Path-19" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="191.186873 509.039787 3.82425696e-07 350.667969 1.03732987e-06 429.853874"></polygon>
<polygon id="Path-20" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" points="190.078634 508.659931 -5.25835276e-07 463.644531 -7.17046191e-08 508.659931"></polygon>
<polygon id="Path-20-Copy" stroke="none" fill-opacity="0.300000012" fill="#FFC64D" fill-rule="evenodd" style="mix-blend-mode: multiply;" transform="translate(288.000000, 489.083731) scale(-1, 1) translate(-288.000000, -489.083731) " points="375 509.108866 201.000001 469.058594 201 509.108868"></polygon>
</svg>
As you pointed out, there're floating point value that is not properly rounded, and probably Sketch's error. (I assume they're using their own SVG code.) However, if I import this SVG code into say Adobe Illustrator, they handle values properly.
from swiftsvg.
Alright, I may still incorporate the change, but I want to do some benchmarking first. Thanks for sending the full SVG along and the help @naan.
from swiftsvg.
Related Issues (20)
- SwiftUI examples HOT 1
- Switch example project to use SPM instead of Cocoapods
- Conflicting with Floaty
- Is it possible to convert UIBezierPath to SVG ? HOT 1
- pod try SwiftSVG - fails to build 11.5
- Is this project still maintained? HOT 5
- Is there a way to parse layer path back to string path? HOT 1
- Fill:"None" not working, fills as black color HOT 13
- Problems with Command ("M") HOT 1
- Why do I have to comment this code so that the picture can be displayed on iOS? HOT 1
- The image size can not change
- SVG having multi grouping is not rendring properly
- The documentation link in README.md seems to be dead HOT 1
- resizeToFit ignores viewBox HOT 2
- Messy Xcode log HOT 1
- Support style element
- crash : CurveTo.execute HOT 1
- SVG Animation
- file-write-create error prevents compile HOT 1
- SwiftSVG cannot be build in macOS app with macOS 14 SDK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftsvg.