[whatwg] Canvas stroke alignment

Mike Wilcox mike at mikewilcox.net
Mon Jul 19 08:47:26 PDT 2010


Wow, that would be so enormously useful. You make a shape, add a shape inside of it that is 100x100, add a stroke, get the width and it's 101. This "error" cascades, and shifts your items around on redraw. The math workaround is not easy.

FWIW, Photoshop uses "position" for this option (I don't believe Flash supports this).
I don't think the CSS3 box-sizing:border-box helps.

Does voting count? +1!


Mike Wilcox
http://clubajax.org
mike at mikewilcox.net



On Jul 19, 2010, at 10:08 AM, Nick wrote:

> Canvas would benefit from a way to set stroke alignment. With the only available alignment being center, which is not very useful, custom paths have to be drawn to mimic inside and outside stroke alignment. That workaround may give unwanted transparency on pixels between a path and its stroke path once a path goes diagonal or curves.
> 
> Having Canvas take care of stroke alignment (center, inside and outside) by adding something like strokeAlign can fix these transparency problems and makes adding strokes a lot easier and more useful.
> 
> --
> Nick Stakenburg




More information about the whatwg mailing list