svnno****@sourc*****
svnno****@sourc*****
2009年 3月 16日 (月) 19:51:24 JST
Revision: 1085 http://svn.sourceforge.jp/view?root=sie&view=rev&rev=1085 Author: dhrname Date: 2009-03-16 19:51:24 +0900 (Mon, 16 Mar 2009) Log Message: ----------- 0.45統合 Modified Paths: -------------- trunk/sie.js Property Changed: ---------------- trunk/sie.js Modified: trunk/sie.js =================================================================== --- trunk/sie.js 2009-03-16 10:44:46 UTC (rev 1084) +++ trunk/sie.js 2009-03-16 10:51:24 UTC (rev 1085) @@ -232,7 +232,7 @@ if (te !== void 0) { do { try{ - if (name.indexOf(te.nodeName) === -1) { + if (name.indexOf(te.nodeName) === -1) { //タグ名が一致しないのであれば var ns = te.nextSibling; //次のノードをnsに収納 var er = ele.removeChild(te); er = null; @@ -999,7 +999,8 @@ var isRadial = false; try { if (this._urlreg.test(this.fill)) { //fill属性の値がurl(#id)ならば、idを設定したグラデーション関連要素を呼び出す - isRadial = this.gradient(fillElement, RegExp.$1); + this.w = w; this.h = h; //radialGradientで必要 + isRadial = this.gradient(fillElement, RegExp.$1, el.getAttribute("path"), el.currentStyle.width, el.currentStyle.height); } else { fillElement.setAttribute("color", this.color(this.fill)); var fillOpacity = this.fillopacity * this.opacity; //opacityを掛け合わせる @@ -1210,7 +1211,7 @@ return color; } //linearGradient、radialGradient要素を処理 -NAIBU.PaintColor.prototype.gradient = function pcgradient( /*element*/ ele, /*string*/ id) { +NAIBU.PaintColor.prototype.gradient = function pcgradient( /*element*/ ele, /*string*/ id, /*string*/ data) { var grad = document.getElementById(id); if (grad) { var grad2 = grad; @@ -1252,18 +1253,58 @@ } catch(e) {stlog.add(e,749); angle = 270;} ele.setAttribute("type", "gradient"); ele.setAttribute("angle", angle + ""); + x1 = y1 = x2 = y2 = angle = null; } else if (type === "gradientRadial") { try{ ele.setAttribute("type", "gradientTitle"); ele.setAttribute("focus", "100%"); ele.setAttribute("focusposition", "0.5 0.5"); - } catch(e) {stlog.add(e,1175);} + var cx = parseFloat((grad.getAttribute("cx") || "0.5").replace(/%/, "")); + var cy = parseFloat((grad.getAttribute("cy") || "0.5").replace(/%/, "")); + var r = rx = ry = parseFloat((grad.getAttribute("r") || "0.5").replace(/%/, "")); + var el = this.w, et = this.h, er = 0, eb = 0; + var units = grad.getAttribute("gradientUnits"); + if (!units || units === "objectBoundingBox") { + //%の場合は小数点に変換(10% -> 0.1) + cx = cx > 1 ? cx/100 : cx; cy = cy > 1 ? cy/100 : cy; r = r > 1 ? r/100 : r; + //要素の境界領域を求める(四隅の座標を求める) + var degis = (this.tar.getAttribute("path")+"").match(/[0-9\-]+/g); + for (var i=0,degisli=degis.length;i<degisli;i+=2) { + var nx = parseInt(degis[i]), ny = parseInt(degis[i+1]); + el = el > nx ? nx : el; + et = et > ny ? ny : et; + er = er > nx ? er : nx; + eb = eb > ny ? eb : ny; + } + degis = null; + cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et); + } + el = cx - rx; et = cy - ry; er = cx + rx; eb = cy + ry; + var outline = document.getElementById("_NAIBU_outline"); + var background = document.createElement("div"); + background.style.position = "absolute"; + background.style.textAlign = "left"; background.style.top = 0; background.style.left = 0; background.style.width = this.w; background.style.height = this.h; + outline.appendChild(background); + background.style.filter = "progid:DXImageTransform.Microsoft.Compositor"; + background.filters.item('DXImageTransform.Microsoft.Compositor').Function = 23; + var er2 = er - el / 2; + var ellipse = "ar " +el+ "," +et+ "," +er+ "," +eb+ " " +er2+ ",0 " +er2+ ",0 e"; + var circle = '<v:shape style="position:relative; antialias:false; top:0px; left:0px;" coordsize="' +this.w+ ' ' +this.h+ '" path="' +ellipse+ '" stroked="f">' +ele.outerHTML+ '</v:shape>'; + background.innerHTML = '<v:shape style="position:relative; top:0px; left:0px;" coordsize="' +this.w+ ' ' +this.h+ '" path="' +data+ '" stroked="f" fillcolor="' +color[color.length-1]+ '" />'; + background.filters[0].apply(); + background.innerHTML = circle; + background.filters[0].play(); + this.tar.parentNode.insertBefore(background, this.tar); + this.tar.setAttribute("filled", "false"); + ellipse = circle = null; + return true; + } catch(e) {stlog.add(e,1175);} } } else { - return; + return false; } - x1 = y1 = type = color = colors = opacity = null; - return; + stops = type = color = colors = opacity = null; + return false; } //font属性、関連プロパティを処理する @@ -1331,32 +1372,23 @@ } catch(e){stlog.add(e,1185);} } - //NAIBU.transformToCTM transform属性を処理。Matrix型に変換 //あらかじめ正規表現オブジェクトを生成しておく NAIBU.comaR = /[A-Za-z]+(?=\s*\()/g; NAIBU.listR = /\([^\)]+\)/g; NAIBU.degR = /[\-\d\.e]+/g; -NAIBU.etR = /([\-\d\.]+)e([\-\d\.]+)/; NAIBU.transformToCTM = function ( /*element*/ ele, /*Matrix*/ matrix) { try { var tft = ele.getAttribute("transform"); if (tft) { var coma = tft.match(NAIBU.comaR); //コマンド文字にマッチ translate var list = tft.match(NAIBU.listR); //カッコ内のリストにマッチ (10 20 30...) - var degR = NAIBU.degR, etR = NAIBU.etR; for (var j=0;j<coma.length;j++) { var lis = list[j], com = coma[j]; var a,b,c,d,e,f; - var deg = lis.match(degR); + var deg = lis.match(NAIBU.degR); var rad = parseFloat(deg[0]) / 180 * Math.PI; var degli = deg.length; - for (var i=0;i<degli;++i) { - var et = etR.test(deg[i]); - if (et) { - deg[i] = parseFloat(RegExp.$1) * Math.pow(10,parseFloat(RegExp.$2)); - } - } if (degli === 6) { a = parseFloat(deg[0]); b = parseFloat(deg[1]); c = parseFloat(deg[2]); d = parseFloat(deg[3]); e = parseFloat(deg[4]); f = parseFloat(deg[5]); } else if (degli === 3) { @@ -1671,15 +1703,15 @@ STLength.prototype._dR = /\D+$/; //RegExpオブジェクトをあらかじめ生成 STLength.prototype._n = [1, 0.01, 1, 1, 1, 35.43307, 3.543307, 90, 1.25, 15]; //利用単位への変換値 STLength.prototype._tani = { //単位に番号を振る - "pt": 9, - "pc": 10, - "mm": 7, - "cm": 6, - "in": 8, - "em": 3, - "ex": 4, - "px": 5, - "%": 2 + "pt": 9, + "pc": 10, + "mm": 7, + "cm": 6, + "in": 8, + "em": 3, + "ex": 4, + "px": 5, + "%": 2 } STLength.prototype.newValueSpecifiedUnits = function stlengthnvsu( /*number*/ ut, /*number*/ value) { this.unitType = ut; @@ -1867,6 +1899,9 @@ obst.width = regwv; obst.height = reghv; ob.setAttribute("coordsize",regwv +" "+ reghv); + var oba = document.createElement("div"); + oba.setAttribute("id","_NAIBU_outline"); + obj.parentNode.appendChild(oba); STdocument[dn] = new SVGtoVML(obc,obwidth,obheight,regw,regh); obj.parentNode.insertBefore(ob,obj); STdocument[dn].read(); Property changes on: trunk/sie.js ___________________________________________________________________ Modified: svn:mergeinfo - /branches/04x/040/sie.js:812-829 /branches/04x/041/sie.js:891-923 /branches/04x/042/sie.js:927-967 /branches/04x/043/sie.js:969-1013 /branches/04x/sie.js:830-1027 + /branches/04x/040/sie.js:812-829 /branches/04x/041/sie.js:891-923 /branches/04x/042/sie.js:927-967 /branches/04x/043/sie.js:969-1013 /branches/04x/044/sie.js:1015-1067 /branches/04x/045/sie.js:1069-1078 /branches/04x/sie.js:830-1084