在 Android 2.x 上捕获矢量格式的签名
我正在编写一个需要以矢量格式捕获用户签名的应用程序。在 iOS 上,我使用 SVG 元素进行绘制,然后将该 SVG 矢量转换为我需要的矢量格式。 现在我需要在 Android 2.x 中执行此操作。问题是 Android 仅支持画布绘图。
无论如何,有没有办法跟踪用户在画布上绘图,以便我获得矢量格式?由于画布创建光栅图像,我无法将其转换为矢量。
任何想法都会有帮助。
谢谢
I am writing an app that needs to capture a users signature in a vector format. On iOS I am using an SVG element to draw to then converting that SVG vector into the vector format I need.
Now I need to do this in Android 2.x. The issue with this is that Android only supports the canvas for drawing.
Is there anyway to trace the user drawing on the canvas so that I get a vector format? Since the canvas creates a raster image I can't convert it to a vector.
Any ideas would be helpful.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不相信这是直接支持的。我认为最好的选择是继承
android.graphics.Path
并覆盖moveTo(int, int)
和lineTo(int, int)
,存储这些事件后,您可以创建一个 toSvgPathString() 并获取您需要的“M x,y L x,yx,yx,y ..”字符串。I don't believe this is supported directly. I think your best bet is to subclass
android.graphics.Path
and overridemoveTo(int, int)
andlineTo(int, int)
, after storing these events you could then create atoSvgPathString()
and get the "M x,y L x,y x,y x,y .." string you need.