On Sat, 17 Nov 2012, Gregg Tavares (社ç~T¨) wrote:This is a solved problem with the last batch of API additions:
>
> Why would I want to do this? Because making paths is time consuming.
> Assume my path requires 1000 lines. Why would I want to have to repeat
> that N times?
var path = new Path();
for (var i = 0; i < 1000; ++i) {path.moveTo(...);
path.lineTo(...);
}
c1.setContext(ctx);
ctx.stroke(path);
c2.setContext(ctx);
ctx.stroke(path);
c3.setContext(ctx);
ctx.stroke(path);
However, when do you ever just draw a single path to three bitmaps,
though?
In all the cases I've ever used canvas, there's been multiple
paths, changes to the line width, changes to the fill and strokes styles,
text, transforms, etc. Are you saying you'd want to iterate through the
canvases between each drawing operation just so you could reuse those
styles without having to set them on two different contexts or run the
same code for two canvases? That seems weird.
Sure. See my e-mail to the WHATWG list -- the spec is intentionally
> This is especially important in WebGL where you're trying to draw a top,
> front, side and perspective view.
written so that this can be done for WebGL.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'