设为首页收藏本站订阅更新

无忧脚本

 找回密码
 加入无忧

QQ登录

只需一步,快速开始

搜索
查看: 8939|回复: 3

[求助] svg转vml

[复制链接]
发表于 2009-6-16 21:34:14 | 显示全部楼层 |阅读模式
这是要转为vml的svg代码(保存为.svg文件在FF打开可以看到一个闭合图形)

  1. <?xml version="1.0" standalone="no"?>
  2. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  3. "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  4. <svg viewBox="0 0 1024 768" xmlns="http://www.w3.org/2000/svg">
  5. <path d="M50,50 c100,100 400,400 500,50 z" stroke="blue" stroke-width="5" fill="none" />
  6. <circle cx="50" cy="50" r="5" fill="#000000" />
  7. <circle cx="100" cy="100" r="5" fill="#0088ff" />
  8. <circle cx="400" cy="400" r="5" fill="red" />
  9. <circle cx="500" cy="0" r="5" fill="#008800" />
  10. </svg>
复制代码

这是我根据上面的svg代码写的vml代码(在IE内核的浏览器运行能看到跟上图差不多的图,但不会闭合)这vml的路径该怎样闭合呢?

  1. <HTML xmlns:v><STYLE>v\:*{behavior:url(#default#VML);}</STYLE><BODY>
  2. <v:shape
  3. style=";WIDTH:1024;HEIGHT:768"
  4. coordsize="1024,768"
  5. filled="t"
  6. fillcolor="white"
  7. path="M50,50 c100,100 400,400 500,50 e"/>
复制代码

下面的这个c指令后面这么多数字的,把这些数字换到vml里就完全不一样了,这样的要怎样转换?

  1. <?xml version="1.0" standalone="no"?>
  2. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  3. "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  4. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  5. <path d="M253.746 90.5357c-0.6881,-0.6882 -1.3763,-1.3234 -2.0115,-1.9586 -0.847,-1.7469 -1.3234,-2.5409 -2.8056,-2.3292 -0.3176,0.6882 -

  6. 0.6353,1.3763 -0.9529,2.0645 -0.8469,0 -1.8527,-1.9586 -1.9057,-2.1704 -0.3176,0 -0.3705,-0.4764 -0.4764,-0.6352 -0.3705,-0.1059 -0.7411,-

  7. 0.2117 -1.1116,-0.2647 -1.0587,-1.6939 -1.641,-1.4822 -2.8586,-1.588 -0.0529,0.0529 -0.1058,0.1588 -0.1588,0.2646 -2.1703,1.0587 -1.7468,-

  8. 1.0057 -1.6939,-2.0645 -0.6882,-0.6881 -0.8999,-0.5823 -1.4293,-0.5823 -0.3176,0.3177 -0.6352,0.6882 -0.9528,1.0588 -0.2118,0.1058 -

  9. 0.4235,0.2117 -0.6352,0.3705 -0.6882,0.9529 -2.6468,1.2705 -3.5467,1.3763 -1.9057,-0.794 -2.488,-1.3234 -2.8056,-2.7526 -1.0588,-1.5881 -

  10. 0.847,-1.1117 -2.2233,-1.2705 -0.053,0 -0.1059,0.053 -0.1589,0.1059 -0.5822,-0.2647 -0.7411,-0.6352 -0.7411,-1.0058 0.4765,-0.2647 1.1646,-

  11. 0.2117 1.8528,-0.7411 0,-0.847 -0.1588,-1.3234 -0.2647,-1.7469 -0.1588,-0.2646 -0.3176,-0.4764 -0.4235,-0.6881 -1.2175,0 -1.1116,0.1588 -

  12. 1.641,1.2175 -1.0058,0 -1.588,-0.794 -2.1703,-1.0058 -0.2118,-0.847 -0.3177,-0.794 -0.6882,-1.2704 -0.0529,-0.4235 -0.0529,-0.847 -0.0529,-

  13. 1.2705 1.0057,-0.7411 1.4822,-1.4293 2.0645,-2.3292 0.2117,-1.7998 1.588,-2.5938 2.1174,-3.9702 0,-0.3705 0,-0.6881 0.0529,-1.0057 0.3706,0

  14. 0.5294,0.3176 0.6353,0.5823 0,0.6352 -0.4765,1.641 0.6881,2.2233 0.5294,0 1.2705,0.1058 1.8528,-0.4765 0,-1.1646 0.1588,-2.7526 -0.053,-

  15. 3.4937 -1.3763,-1.3764 -0.8999,-2.1704 -0.2646,-3.282 0,-1.2176 -0.6882,-2.6468 -1.0058,-2.8056 -0.053,-0.4235 -0.1059,-0.847 -0.1588,-1.2705

  16. 0.2117,-0.4764 0.4235,-0.9528 0.6352,-1.3763 0,-0.9529 0.4235,-1.694 0.6882,-2.5939 0,-2.0645 -1.1117,-4.923 -2.488,-5.6112 -1.3234,0 -

  17. 1.9586,0.053 -2.6468,0.7411 -0.794,1.3764 -0.847,1.5352 -2.2762,1.8528 -1.3234,0 -2.2763,0.5293 -3.2821,0.6881 -1.1646,-0.5822 -1.0057,-

  18. 1.3763 -1.2175,-1.9586 -0.2117,-1.4822 -0.6882,-2.2762 -1.2704,-2.8585 -2.541,-1.0587 -2.9644,-0.794 -2.9644,1.4822 -0.7411,-0.5823 -1.4822,

  19. -1.1117 -2.1704,-1.641 -0.0529,-0.1059 -0.0529,-0.2118 -0.0529,-0.3176 0.3176,-0.3706 0.6352,-0.7411 1.0057,-1.1117 0.053,-0.6352 0.1588,-

  20. 1.2704 0.2647,-1.8527 -0.2647,-0.2118 -0.5293,-0.4235 -0.7411,-0.6353 1.0587,-0.6352 2.1174,-1.2175 3.1762,-1.7998 1.1116,-0.4235 1.9056,-

  21. 0.6881 3.5466,-0.3705 0.847,0.6352 1.5881,0.794 3.0703,0.8999 1.4822,-0.4235 2.1175,-0.4764 3.9173,0.3176 1.3234,1.4822 2.8056,3.5467

  22. 4.6054,5.5053 0.3176,0.794 0.6352,1.5881 1.0058,2.4351 0.6881,0.6352 1.3763,1.2704 2.1174,1.9056 0.847,1.0588 1.0058,1.1117 1.1646,2.8586

  23. 0.2117,0.3176 0.9528,0.7411 1.6939,1.3234 0.053,0.1058 0.1588,0.2646 0.2647,0.4235 0,0.5822 0,0.9528 0.3706,2.0645 0.3176,0.2117

  24. 2.2762,0.2646 3.282,-0.053 0.8469,0 1.0057,-0.1059 2.2762,0.6352 0.3706,0 0.7411,0 1.1646,0 0.3705,-0.3705 0.3176,-0.3705 1.2705,-0.3705

  25. 0.6881,0.5823 1.3763,1.2175 2.0644,1.8527 0.6882,0 1.694,-0.1058 2.488,0.6882 0.2647,0.6352 0.5294,1.2705 0.847,1.9057 0.2647,1.2175

  26. 1.4293,4.3937 3.8114,2.9644 1.0058,-0.1588 2.1174,-0.5294 3.3879,-0.9528 0.2117,-0.2118 0.4764,-0.4235 0.7411,-0.5823 0.9528,-1.694 1.6939,-

  27. 2.3821 3.1761,-3.5997 0.4235,-0.4764 0.847,-0.9528 1.2705,-1.3763 0.794,-0.6882 1.588,-1.3763 2.435,-2.0645 1.2705,0.2117 1.3234,0

  28. 0.9529,1.694 0,0.6881 0,1.4292 0,2.1703 0.3705,0.4235 1.3234,1.0587 1.588,2.2233 -0.0529,0.6882 -0.1058,1.3763 -0.1588,2.1174 -0.2117,0.4235

  29. -0.3705,0.847 -0.5293,1.3234 -0.5823,0.5823 -0.4765,1.7469 -0.2118,2.9644 -0.0529,1.1117 -0.0529,2.2233 -0.0529,3.335 -0.1588,0.6352 -

  30. 0.3176,1.3234 -0.4764,2.0116 0,0.6881 0.0529,1.4292 0.1058,2.1703 -0.3176,0.3176 -0.5823,0.6882 -1.0057,0.8999 -0.4235,0 -0.7941,0.053 -

  31. 1.1646,0.1059 -1.3764,-0.4235 -1.9057,-0.3705 -2.7527,-0.4235 -0.4764,0.4764 -0.4764,0.8999 -0.847,1.3763 -1.4822,0.3706 -1.6939,0.9 -

  32. 1.5351,2.4351 0.2647,0.4235 0.5294,0.847 0.847,1.2705 0.2117,1.2704 0.8469,2.8585 1.7998,4.5524 0.1588,0.6882 0.3176,1.3764 0.4764,2.0645 -

  33. 1.7998,0 -2.8056,-1.3763 -3.5467,-1.7469 0,-1.1116 -1.1116,-1.3763 -1.4822,-1.0057 -0.0529,0.1058 -0.0529,0.2117 -0.0529,0.3705 -

  34. 1.1646,0.1588 -1.9586,0.794 -2.8586,1.2175 0,0.3176 0,0.6353 0,0.9529 0.053,0.0529 0.1059,0.1059 0.1589,0.1588 -0.5294,0.2647 -0.6882,0.4764

  35. -1.0058,0.794 -0.3176,0.053 -0.6353,0.1588 -0.9529,0.2647z"/>
  36. </svg>
复制代码

[[I] 本帖最后由 网页修行 于 2009-6-17 17:37 编辑 [/I]]
 楼主| 发表于 2009-6-17 18:02:12 | 显示全部楼层
还是自己搞明白了,大概是这样:svg里c指令后面每四对数据对为一条曲线,每一条曲线的数据为相对前一条曲线的数据。而vml的都不是相对的。
下面是三条相连曲线的vml代码

  1. <HTML xmlns:v><STYLE>v\:*{behavior:url(#default#VML);}</STYLE><BODY>
  2. <v:shape
  3. style=";WIDTH:1024;HEIGHT:768"
  4. coordsize="1024,768"
  5. filled="t"
  6. fillcolor="white"
  7. path="M50,50 c100,100 150,400 200,50 300,150 350,450 400,100 500,200 550,500 600,150e"/>
复制代码
下面是三条相连曲线的svg代码

  1. <?xml version="1.0" standalone="no"?>
  2. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  3. "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  4. <svg viewBox="0 0 1024 768" xmlns="http://www.w3.org/2000/svg">
  5. <path d="M50,50 c100,100 150,400 200,50 100,100 150,400 200,50 100,100 150,400 200,50" stroke="blue"

  6. stroke-width="5" fill="none" />
  7. </svg>
复制代码

这下它俩的图形一样了,但如果有闭合的路径,vml的路径该怎样闭合这个问题还没解决

[[I] 本帖最后由 网页修行 于 2009-6-17 19:57 编辑 [/I]]
 楼主| 发表于 2009-6-20 21:25:37 | 显示全部楼层
已经把一个svg地图转成了vml地图了,准备在这个网站里应用http://www.hs818.com/1.html
发表于 2010-9-10 17:47:12 | 显示全部楼层
svg 与 vml的三次贝塞尔曲线参数都是3对坐标值。
您需要登录后才可以回帖 登录 | 加入无忧

本版积分规则

小黑屋|手机版|Archiver|无忧脚本 ( 苏ICP备05080427号 )|值班电话:027-62300445   鄂公网安备 42011102000433号

GMT+8, 2017-11-18 06:51 , Processed in 0.092092 second(s), 10 queries , Gzip On, Memcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表