Renato Formato
未读,2010年6月12日 14:54:112010/6/12登录即可回复作者
登录即可转发
您无权在此群组中删除帖子
请登录以举报消息
要么此群组的电子邮件地址为匿名状态,要么您得查看成员电子邮件地址权限才能查看原始帖子
收件人 google-excanvas
Hi,
here is a patch against the HEAD to support no-repeat for patterns.
It works with translations and scaling, but not with rotations,
because the only way I've found to make it work is rotate the shape
itself, while current implementation does not rotate shapes but
transform its path.
I should have already signed the CLA
Index: excanvas.js
===================================================================
--- excanvas.js (revisione 73)
+++ excanvas.js (copia locale)
@@ -1069,15 +1069,16 @@
' focusposition="', focus.x, ',', focus.y, '" /
>');
} else if (fillStyle instanceof CanvasPattern_) {
if (width && height) {
- var deltaLeft = -min.x;
- var deltaTop = -min.y;
+ var wi = fillStyle.width_ * Z, hi = fillStyle.height_ * Z;
+ var deltaLeft = - width/2 + ctx.m_[2][0] * Z - min.x;
+ var deltaTop = - height/2 + ctx.m_[2][1] * Z - min.y;
lineStr.push('<g_vml_:fill',
+ ' origin="'+
(fillStyle.repetition_=="repeat"?"0,0":"-0.5,-0.5")+'"',
' position="',
- deltaLeft / width * arcScaleX * arcScaleX, ',',
- deltaTop / height * arcScaleY * arcScaleY, '"',
- ' type="tile"',
- // TODO: Figure out the correct size to fit the
scale.
- //' size="', w, 'px ', h, 'px"',
+ deltaLeft / width , ',',
+ deltaTop / height , '"',
+ ' type="'+
(fillStyle.repetition_=="repeat"?"tile":"frame")+'"',
+ ' size="', wi / width * arcScaleX , ',', hi /
height * arcScaleY , '"',
' src="', fillStyle.src_, '" />');
}
} else {