svnno****@sourc*****
svnno****@sourc*****
2009年 3月 23日 (月) 22:04:30 JST
Revision: 1104 http://svn.sourceforge.jp/view?root=sie&view=rev&rev=1104 Author: dhrname Date: 2009-03-23 22:04:30 +0900 (Mon, 23 Mar 2009) Log Message: ----------- gradientTransform属性に対応 Modified Paths: -------------- branches/04x/046/sie.js Modified: branches/04x/046/sie.js =================================================================== --- branches/04x/046/sie.js 2009-03-21 14:34:37 UTC (rev 1103) +++ branches/04x/046/sie.js 2009-03-23 13:04:30 UTC (rev 1104) @@ -1002,7 +1002,7 @@ try { if (this._urlreg.test(this.fill)) { //fill属性の値がurl(#id)ならば、idを設定したグラデーション関連要素を呼び出す this.w = w; this.h = h; //radialGradientで必要 - isRadial = this.gradient(fillElement, RegExp.$1); + isRadial = this.gradient(fillElement, RegExp.$1, matrix); } else { fillElement.setAttribute("color", this.color(this.fill)); var fillOpacity = this.fillopacity * this.opacity; //opacityを掛け合わせる @@ -1213,7 +1213,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, /*Matrix*/ matrix) { var grad = document.getElementById(id); if (grad) { var grad2 = grad; @@ -1283,7 +1283,17 @@ degis = null; cx = cx*(er - el) + el; cy = cy*(eb - et) + et; rx = r*(er - el); ry = r*(eb - et); } + var gt = grad.getAttribute("gradientTransform"); + if (gt) { + grad.setAttribute("transform",gt); + matrix = NAIBU.transformToCTM(grad, matrix); + } el = cx - rx; et = cy - ry; er = cx + rx; eb = cy + ry; + var rrx = rx * 0.55228, rry = ry * 0.55228; + var list = ["m", cx,et, "c", cx-rrx,et, el,cy-rry, el,cy, el,cy+rry, cx-rrx,eb, cx,eb, cx+rrx,eb, er,cy+rry, er,cy, er,cy-rry, cx+rrx,et, cx,et, "x e"]; + var pl = new PList(list); + var plm = pl.matrixTransform(matrix); + var ellipse = plm.list.join(" "); var outline = document.getElementById("_NAIBU_outline"); var background = document.createElement("div"); background.style.position = "absolute"; @@ -1291,8 +1301,6 @@ 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(); @@ -1300,7 +1308,7 @@ background.filters[0].play(); this.tar.parentNode.insertBefore(background, this.tar); this.tar.setAttribute("filled", "false"); - ellipse = circle = null; + ellipse = circle = list = pl = plm = null; return true; } else { return false;