SVG替代技术 [英] Replacement Technology for SVG

查看:229
本文介绍了SVG替代技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目正在使用SVG,并且有计划移出SVG并用适当的替代品替换现有功能.


我当前的SVG应用程序会执行以下操作,


1.在屏幕上显示对象(SVG形状)的关系或依赖性.

当存在两个大的形状(例如rect1和rect2)时,我们从rect1到react2画一条线,说它们是从属的.


2.当我们在形状上触发某些事件(单击或鼠标悬停)时,触发javascript函数.



有什么替代方法可以代替SVG并只需进行绘制过程吗?

我正在考虑将形状信息存储在数据库中并在UI中自动生成形状.



在此先感谢您.

My project is using SVG and there is a plan to move out of SVG and replace the existing functionality with suitable replacement.


My current SVG apps does following things,


1. Exposes the object(SVG shapes) relations or dependency in screen.

When there are two dependent shapes (say rect1 and rect2), we draw a line from rect1 to react2 to say that they are dependent.


2. Triggers javascript functions when we fire certain events (click or mouse over) on shapes.



Is there any alternatives to replace the SVG and simply the drawing process?

I am thinking to store the shapes information in database and auto generate the shapes in UI.



Thanks in advance.

推荐答案

我从来没有比SVG更好的东西了.对于在Web中使用它来说,它是必不可少的.因此,嵌入式SVG包含在HTML5标准中( http://en.wikipedia.org/wiki/HTML5 [^ ],http://dev.w3.org/html5/spec/spec.html [ http: //dev.w3.org/html5/markup/ [^ ]),因此可以在没有任何浏览器插件的情况下使用它.它已经可以在我所知道的所有主要浏览器中使用,除了……IE :-(.

但是,SVG始终可以嵌入<object><embed>标记.有关更多详细信息,请参见 http://www.w3schools.com/svg/svg_inhtml.asp [ ^ ].

另外,SVG可以用JavaScript创建,但是不要以为只有它可以做到.

如果您对SVG有任何疑问,请考虑使用第三方Inkscape, http://en.wikipedia.org/wiki/Inkscape [ ^ ],http://www.inkscape.org/ [ ^ ].它完全基于SVG,并使用了其所有高级功能.

最好的事情是:它可以导出到XAML,因此您可以在WPF和Silverlight应用程序中使用工程图.但是,除Silverlight之外,XAML还没有在Web上被普遍接受.浏览器需要插件.而且,XAML功能是SVG功能的子集,因此,所有可能的SVG绘图中只有一个子集可以用XAML呈现.

因此,我怀疑,如果您远离SVG,您将不会简化任何事情,但会对您的企业构成犯罪.但是,如果您真的知道更好的话,请告诉我.我会很高兴不了解这件事.即使您只是知道SVG或在HTML中使用SVG的一些缺陷,也请让我知道.有机会,我会找到解决方案的.到目前为止,我设法解决了所有问题.顺便说一下,我现在正在HTML中使用SVG.

祝你好运,
—SA
I never knew anything better than SVG; as to use of it in the Web, it is simply indispensable. That''s why embedded SVG was included in HTML5 standard (http://en.wikipedia.org/wiki/HTML5[^], http://dev.w3.org/html5/spec/spec.html[^], http://dev.w3.org/html5/markup/[^]), so it can be used without any browser plug-ins. It already works in all major browser I know except… IE :-(.

However, SVG can always be embedded with the <object> or the <embed> tag. For further detail, see http://www.w3schools.com/svg/svg_inhtml.asp[^].

Also, SVG can be created by JavaScript, but don''t think this is the only was to do it.

If you have any problems with SVG, consider using 3-rd party Inkscape, http://en.wikipedia.org/wiki/Inkscape[^], http://www.inkscape.org/[^]. It is totally based on SVG and uses all its advanced feature.

Best thing is: it exports to XAML, so you can use the drawings in your WPF and Silverlight applications. However, XAML is not universally accepted on the Web beyond Silverlight; browsers require plug-ins. Also, XAML features are a subset of SVG features, so only a subset of all possible SVG drawings could be rendered with XAML.

So, I suspect, if you go away from SVG you will not simplify anything but will commit a crime against your business. However, if you really know something better, please let me know. I would be too excited to learn about this thing. Even if you simply know some flaw about SVG or its use in HTML, let me know as well. Chances are, I''ll find the solution. So far, I managed to solve all the problems. I''m using SVG in HTML right now, by the way.

Good luck,
—SA


这篇关于SVG替代技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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