Path2D is a new object in the global namespace. Its main use case is to cache path segments. For instance, shumway could use it to cache the flash edgelists which should increase its drawing performance.
Eventually it will act as a bridge between SVG and Canvas but for now its use is limited to canvas (except that you can construct a path with an SVG path string). It's defined as the "Path" object in the WhatWG spec [1] but after a long discussion and author feedback that name was considered too generic and renamed. The signature for the new object is as follows: [Constructor, Constructor(Path2D path), Constructor(DOMString d)] interface Path2D { } Path2D implements CanvasPathMethods; and the new methods on the Canvas 2D context are: void fill(Path2D path, optional CanvasFillRule fillRule = "nonzero"); void stroke(Path2D path); void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero"); boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero"); boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y); WebKit and Blink implemented the same subset of the Path2D API. Blink also implemented the 'addPath' API [2] but Dirk and I feel that that API is not ready for shipping yet. (ie Blink and WK treat non-invertible matrices different from IE/FF + it's unclear if there is interop if we append paths that don't start with a 'moveto') The Path2D object is currently behind the "canvas.path" flag. Can we turn this feature on by default? 1: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#path-objects 2: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-path-addpath _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform