W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2014

[whatwg] Canvas normalize rect() and strokeRect()

From: Dirk Schulze <dschulze@adobe.com>
Date: Sat, 5 Apr 2014 16:01:19 +0000
To: WHAT Working Group <whatwg@whatwg.org>
Message-ID: <3709B668-C951-4013-9907-A07A04C4DA9A@adobe.com>
Hi,

I looked at the behavior of negative width or height for the rect() and strokeRect() functions.

All browsers normalize the passed parameters for strokeRect() to have positive width and height.

strokeRect(90,10,-80,80) ó> strokeRect(10,10,80,80)

http://jsfiddle.net/za945/

Just WebKit seems to normalize for rect() as well:

http://jsfiddle.net/VT4MG/

The behavior of normalizing is not specified. Especially it seems odd that the behavior for fillRect()/strokeRect() should differ from rect(). So we should either normalize for all functions or donít do it for all IMO.

Note: fillRect() and clearRect() are not affected. The behavior for rect() is important for filling with different winding rules as well. It is not just stroking with dash arrays that is effected.

Greetings,
Dirk
Received on Saturday, 5 April 2014 16:01:48 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:28 UTC