No, there simply isn't. :(
Most canavs libraries (such as cake.js) have instead implemented their own matrix class to keep track of the current transformation matrix.
The creator of cake.js thought that there being no way to get the current matrix was ridiculous enough to warrant a bug report about it. Unfortunately that was back in 2007 and there has been no effort to include a getCurrentTransform in the spec.
Edit: I have created a simple Transformation class that will allow you to easily make your own getCanvas()
or keep track of the Canvas's matrix side-by-side. Here it is. I hope that helps!
Edit June 2012: The new specification does include a way to get the current transformation matrix! context.currentTransform
can be used to get or set the current transformation matrix. Unfortunately no browsers have implemented it yet, though Firefox does have the vendor-specific mozCurrentTransform
property on its context. So you can't use it just yet, but it is in the spec, so soon!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…