[Sie-announce] SIEコード [1749]

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 3月 22日 (月) 23:26:16 JST


Revision: 1749
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1749
Author:   dhrname
Date:     2010-03-22 23:26:16 +0900 (Mon, 22 Mar 2010)

Log Message:
-----------


Modified Paths:
--------------
    branches/ufltima/dom/svg.js

Modified: branches/ufltima/dom/svg.js
===================================================================
--- branches/ufltima/dom/svg.js	2010-03-22 14:26:08 UTC (rev 1748)
+++ branches/ufltima/dom/svg.js	2010-03-22 14:26:16 UTC (rev 1749)
@@ -1975,44 +1975,34 @@
       var w = vi.width, h = vi.hight;
       tar._tar.path = dat + " e";
       tar._tar.coordsize = w + " " + h;
+      /*以下では、スタイルシートを用いて、fill-とstroke-関連の
+       *処理を行う。SVGPaintインターフェースをも用いる
+       */
       var style = tar.ownerDocument.defaultView.getComputedStyle(tar, "");
-      var _urlreg = /url\(#([^)]+)/, isNone = {
-        none: 1
-      };
       var el = tar._tar, fill = style.getPropertyCSSValue("fill"), stroke = style.getPropertyCSSValue("stroke");
-      if (isNone[fill.cssText]) {
-        el.filled = "false";
-      } else {
+      if (fill.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || fill.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
         var fillElement = document.createElement("v:fill");
         var isRadial = false;
-        try {
-        if (_urlreg.test(fill.cssText)) { //fill属性の値がurl(#id)ならば、idを設定したグラデーション関連要素を呼び出す
-        } else {
-          fill.setColor(SVGColor.SVG_COLORTYPE_RGBCOLOR, fill.cssText, null);
-          var fc = fill.rgbColor;
-          fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")");
-          var fillOpacity = parseFloat(style.getProperty("fill-opacity")) * parseFloat(style.getProperty("opacity")); //opacityを掛け合わせる
-          if (fillOpacity < 1) {
-            fillElement.setAttribute("opacity", fillOpacity+"");
-          }
+        var fc = fill.rgbColor;
+        fillElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")");
+        var fillOpacity = parseFloat(style.getPropertyValue("fill-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる
+        if (fillOpacity < 1) {
+          fillElement.setAttribute("opacity", fillOpacity+"");
         }
-        } catch(e) {stlog.add(e,682); fillElement.on = "true";
-        fillElement.color = "black";}
         if (!isRadial) {
           el.appendChild(fillElement);
         }
         isRadial = fillOpacity = null;
       }
-      if (isNone[stroke]) {
-        el.stroked = "false";
-      } else {
+      if (stroke.paintType === SVGPaint.SVG_PAINTTYPE_RGBCOLOR || stroke.paintType === SVGPaint.SVG_PAINTTYPE_CURRENTCOLOR) {
         var strokeElement = document.createElement("v:stroke");
         var sw = tar.ownerDocument.documentElement.createSVGLength(parseFloat(style.getProperty("stroke-width")));//, Math.sqrt((w*w + h*h) / 2));
-        var swx = sw.value * Math.sqrt(Math.abs(matrix.determinant()));
+        var swx = sw.value * Math.sqrt(Math.abs(matrix._determinant()));
         strokeElement.setAttribute("weight", swx + "px");
-        if (!_urlreg.test(stroke.cssText)) {
-          strokeElement.setAttribute("color", style.color(style.stroke));
-          var strokeOpacity = style.strokeopacity * style.opacity; //opacityを掛け合わせる
+        if (!stroke.uri) {
+          var fc = stroke.rgbColor;
+          strokeElement.setAttribute("color", "rgb(" +fc.red.getFloatValue()+ "," +fc.green.getFloatValue()+ "," +fc.blue.getFloatValue()+ ")");
+          var strokeOpacity = parseFloat(style.getPropertyValue("stroke-opacity")) * parseFloat(style.getPropertyValue("opacity")); //opacityを掛け合わせる
           if (swx < 1) {
             strokeOpacity *= swx; //太さが1px未満なら色を薄くする
           }
@@ -2021,36 +2011,36 @@
           }
           strokeOpacity = null;
         }
-        strokeElement.setAttribute("miterlimit", style.strokemiterlimit);
-        strokeElement.setAttribute("joinstyle", style.strokelinejoin);
-        if (style.strokelinecap === "butt") {
+        strokeElement.setAttribute("miterlimit", style.getPropertyValue("stroke-miterlimit"));
+        strokeElement.setAttribute("joinstyle", style.getPropertyValue("stroke-linejoin"));
+        if (style.getPropertyValue("stroke-linecap") === "butt") {
           strokeElement.setAttribute("endcap", "flat");
         } else {
-          strokeElement.setAttribute("endcap", style.strokelinecap);
+          strokeElement.setAttribute("endcap", style.getPropertyValue("stroke-linecap"));
         }
         var tsd = style.getPropertyValue("stroke-dasharray");
         if (!isNone[tsd]) {
           if (tsd.indexOf(",") > 0) { //コンマ区切りの文字列の場合
             var strs = tsd.split(",");
             for (var i = 0, sli = strs.length; i < sli; ++i) {
-              strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(style.strokewidth)); //精密ではないので注意
+              strs[i] = Math.ceil(parseFloat(strs[i]) / parseFloat(style.getPropertyValue("stroke-width"))); //精密ではないので注意
             }
-            style.strokedasharray = strs.join(" ");
+            var strokedasharray = strs.join(" ");
             if (strs.length % 2 === 1) {
-              style.strokedasharray += " " + style.strokedasharray;
+              strokedasharray += " " + strokedasharray;
             }
           }
-          strokeElement.setAttribute("dashstyle", style.strokedasharray);
+          strokeElement.setAttribute("dashstyle", strokedasharray);
           tsd = strs = null;
         }
         el.appendChild(strokeElement);
         sw = tsd = null;
       }
-      if (style.cursor !== "default") {
-        el.style.cursor = style.cursor;
+      var cursor = style.getPropertyValue("cursor");
+      if (cursor !== "default") {
+        el.style.cursor = cursor;
       }
-      w = h = null;
-      matrix = dat = x = y = null;
+      cursor = w = h = matrix = dat = x = y = null;
     }, false);
   }, false);
   return this;




Sie-announce メーリングリストの案内
Back to archive index