W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

[whatwg] Path object with transform function (was: isPointInPath on Path object)

From: Dirk Schulze <dschulze@adobe.com>
Date: Thu, 20 Sep 2012 22:47:34 -0700
To: Ian Hickson <ian@hixie.ch>
Message-ID: <B7767097-4678-4A39-AB1A-FF378B3845A3@adobe.com>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>

On Sep 21, 2012, at 3:12 AM, Ian Hickson <ian@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.

Greetings,
Dirk
Received on Friday, 21 September 2012 05:50:29 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC