新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论SVG, GML, X3D, VRML, VML, XAML, AVALON, Batik等基于XML的图形技术,以及有关GIS的应用。
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - 高级XML应用『 SVG/GML/VRML/X3D/XAML 』 → 基于SVG在线画线 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 16990 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 基于SVG在线画线 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     jxfml 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:10
      积分:107
      门派:XML.ORG.CN
      注册:2008/1/14

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jxfml发送一个短消息 把jxfml加入好友 查看jxfml的个人资料 搜索jxfml在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jxfml的博客楼主
    发贴心情 基于SVG在线画线

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat-20030114.dtd">
    <!-- Created by SVGDeveloper 1.0 -->
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
      zoomAndPan="disable" onload="getSVGDoc(evt)">
      <title>SVG - Learning By Coding</title>
      <desc>SVG-Spezifikation in Beispielen</desc>
      <defs>
        <script type="text/javascript">
          <![CDATA[
          var svgdoc,svgroot,newline,posx,posy,posmin=50,drawing;
          var linecol="#000",linewidth="1px",check=false;
          var svgns="http://www.w3.org/2000/svg";
          function getSVGDoc(load_evt)
          {
            svgdoc=load_evt.target.ownerDocument;
            svgroot=svgdoc.rootElement;
            drawing=svgdoc.getElementById("drawing");
            svgroot.addEventListener("mousedown",MDown,false);
            svgroot.addEventListener("mousemove",MMove,false);
            svgroot.addEventListener("mouseup",MUp,false);
          }
          function MDown(mousedown_event)
          {
            Coords(mousedown_event);
            newline=svgdoc.createElementNS(svgns,"line");
            newline.setAttribute("x1",posx);
            newline.setAttribute("x2",posx);
            newline.setAttribute("y1",posy);
            newline.setAttribute("y2",posy);
            newline.setAttribute("stroke",linecol);
            newline.setAttribute("stroke-width",linewidth);
            check=true;
          }
          function MMove(mousemove_event)
          {
            if(check)
            {
              Coords(mousemove_event);
              newline.setAttribute("x2",posx);
              newline.setAttribute("y2",posy);
              drawing.appendChild(newline);
           }
          }
          function MUp()
          {
            check=false;
          }
          function Coords(mouse_event)
          {
            posx=mouse_event.clientX;
            posy=mouse_event.clientY;
            if(posx<posmin)posx=posmin;
            if(posy<posmin)posy=posmin;
            if(posx>640+posmin)posx=640+posmin;
            if(posy>480+posmin)posy=480+posmin;
          }
          function SetLineColor(mousedown_event)
          {
            linecol=mousedown_event.target.style.getPropertyValue("fill");
            svgdoc.getElementById("aktline").style.setProperty("stroke",linecol,"");
          }
          function SetLineWidth(mousedown_event)
          {
            linewidth=mousedown_event.target.style.getPropertyValue("stroke-width");
            svgdoc.getElementById("aktline").style.setProperty("stroke-width",linewidth,"");
          }
          ]]>
        </script>
      </defs>
      <text x="30" y="30" style="fill: #000; font-size: 24px">
        Linien zeichnen (mit Wahl von Farbe und Strichst?rke)</text>
      <rect x="50" y="50" width="640" height="480" rx="5" ry="5"
        style="fill: #FFF; stroke: #000"/>
      <g onmousedown="SetLineColor(evt)">
        <rect x="30" y="60" width="10" height="10"
          style="fill: #FF0; stroke: #000"/>
        <rect x="30" y="80" width="10" height="10"
          style="fill: #F00; stroke: #000"/>
        <rect x="30" y="100" width="10" height="10"
          style="fill: #090; stroke: #000"/>
        <rect x="30" y="120" width="10" height="10"
          style="fill: #00C; stroke: #000"/>
        <rect x="30" y="140" width="10" height="10"
          style="fill: #000; stroke: #000"/>
      </g>
      <g onmousedown="SetLineWidth(evt)">
        <line x1="30" y1="180" x2="40" y2="180"
          style="stroke: #000; stroke-width: 1px"/>
        <line x1="30" y1="200" x2="40" y2="200"
          style="stroke: #000; stroke-width: 2px"/>
        <line x1="30" y1="220" x2="40" y2="220"
          style="stroke: #000; stroke-width: 3px"/>
        <line x1="30" y1="240" x2="40" y2="240"
          style="stroke: #000; stroke-width: 4px"/>
        <line x1="30" y1="260" x2="40" y2="260"
          style="stroke: #000; stroke-width: 5px"/>
      </g>
      <line id="aktline" x1="18" y1="58" x2="18" y2="262"
        style="stroke: #000; stroke-width: 1px"/>
      <!-- Ausgabe der Zeichnungsobjekte -->
      <g id="drawing"></g>
    </svg>

       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/13 1:35:00
     
     gprs 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:1
      积分:55
      门派:XML.ORG.CN
      注册:2008/3/14

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给gprs发送一个短消息 把gprs加入好友 查看gprs的个人资料 搜索gprs在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看gprs的博客2
    发贴心情 
    是FLEX的代码吧?
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/14 22:39:00
     
     jxfml 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:10
      积分:107
      门派:XML.ORG.CN
      注册:2008/1/14

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jxfml发送一个短消息 把jxfml加入好友 查看jxfml的个人资料 搜索jxfml在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jxfml的博客3
    发贴心情 
    不是呀,是.SVG文件,在浏览器里可以打开.
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/16 14:54:00
     
     ansly20060 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:10
      积分:88
      门派:XML.ORG.CN
      注册:2012/9/19

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给ansly20060发送一个短消息 把ansly20060加入好友 查看ansly20060的个人资料 搜索ansly20060在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看ansly20060的博客4
    发贴心情 
    能实现左边点击一个,就在画布中添加一个图元吗
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2012/9/28 10:29:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 SVG/GML/VRML/X3D/XAML 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/4/18 16:31:54

    本主题贴数4,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    78.125ms