如何将SVG导入/解析为UIBezierpaths,NSBezierpaths,CGPaths? [英] How to import/parse SVG into UIBezierpaths, NSBezierpaths, CGPaths?

查看:186
本文介绍了如何将SVG导入/解析为UIBezierpaths,NSBezierpaths,CGPaths?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将矢量绘图程序中的路径导入ios环境。我想让他们进入CGpaths或UIbezierpaths。我最感兴趣的是从adobe illustrator导入路径。最好的方法似乎保存为svg然后导入。

I am trying to import paths from a vector drawing program into the ios environment. I would like to get them into CGpaths or UIbezierpaths. I am most interested in importing paths from adobe illustrator. The best way seems to save as an svg and then import.

我找到了一些资源来解析导出的描述路径的SVG文件。但是,我发现的一切只涉及绝对路径而不是相对路径。下面的路径有大写字母C和小写字母C.我知道如何解析大写字母C(绝对路径),但我不知道如何解析小写字母c(相对路径)

I have found some resources for parsing exported SVG files that describe the paths. However, everything I have found only deals with absolute paths and not relative paths. The path below has capital C's and lowercase C's. I know how to parse the capital C (absolute paths) but I have no idea how to parse the lowercase c's (relative paths)

我正在寻找帮助写一个用于将svg文件导入ios / cocoa的解析器。我认为通过在互联网上搜索几周就有很大的需求。

I am looking for help with writing a parser for importing svg files into ios/cocoa. I think there is a big need for this judging by searching the internet for weeks.

这里是我想要导入我的iphone应用程序的路径示例。我不想导入图像,我想要路径本身。所以,我可以操纵它。任何帮助将不胜感激。

Here, is an example of a path I would like to import into my iphone app. I am not looking to import the image, I want the path itself. So, I can manipulate it. Any help would be much appreciated.

x="0px" y="0px" width="320px" height="436px" viewBox="-1.4 -0.5 320 436"

 d="M294.1,116C290.6,1.4,170.9,0.4,159.6,0.5
C148.3,0.4,28.7,1.4,25.2,116c-3.7,120.3-49.6,141.4-5.9,233.9c41.3,87.4,130.7,87,140.4,86.7c9.7,0.3,99.1,0.8,140.4-86.7
C343.7,257.4,297.8,236.3,294.1,116z

如果这是绝对路径,我现在可以解决这个问题。是相对的(即低位(c)路径)真的让我感到困惑。

If this was all absolute paths I would be able to solve this now. It is the relative (i.e. lowecase (c) paths) that are really confusing me.

推荐答案

好的人,如果你愿意的话这个工具可以解决你所有的问题。你可以导入svg或psd并为你生成代码。我已经用过了它就太棒了!

Alright folks, if you're willing to pay for it. This tool will solve all your issues. You can import svg or psd and will produce the code for you. I've used it and it is amazing!

http://www.paintcodeapp.com/

这篇关于如何将SVG导入/解析为UIBezierpaths,NSBezierpaths,CGPaths?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆