[whatwg] Path object with transform function (was: isPointInPath on Path object)
dschulze at adobe.com
Thu Sep 20 22:47:34 PDT 2012
On Sep 21, 2012, at 3:12 AM, Ian Hickson <ian at hixie.ch> wrote:
>> The only situation that might be reasonable would be a transform on the
>> Canvas that an author want to cover in the Path. But for the rare case
>> where this matters, you can create a new Path object, add your path with
>> the transform and call isPointInPath.
> Yeah, you could do that too.
>> Furthermore, a transform() function that applies to a Path object seems
>> to be useable as well.
> You can create a new Path, then add another Path to it while applying a
> transform, using the addPath() method.
Yes, it is possible. But there are two reasons why I think that it still makes sense to use a transform function.
First it seems natural to have a transform on Path object, like the CanvasRenderingContext2D already has. Both share a lot of functions, why disallow it for transforms?
Second, the solution that you mention requires a copy operation. A lot of libraries would create a new path, add the other path and apply the transform afterwards. Seems unnecessary for me.
More information about the whatwg