Renato Formato
unread,Jun 12, 2010, 2:54:11 PM6/12/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 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 {