W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2007

[whatwg] Canvas rectangles

From: Philip Taylor <excors+whatwg@gmail.com>
Date: Sun, 1 Jul 2007 00:06:25 +0100
Message-ID: <ea09c0d10706301606u3814913es5eeda9e5c0406a9f@mail.gmail.com>
"The clearRect() method ... The fillRect() method ... The strokeRect()
method ..." - should say "clearRect(x, y, w, h)" etc, for consistency
with all the other function definitions.


"Shapes are ... subject to ... shadow effects, global alpha, ... and
global composition operators" is a bit confusing since clearRect isn't
subject to those things. (Actually, clearRect is subject to shadow
effects in Safari, and subject to composition operators in Opera, but
I'd say those are just bugs.)


strokeRect: The definition is vague about where line-joins occur, in
the normal case and in the "If only one of [width and height] is zero
..." case, since it doesn't really say that it's a closed path.

There is minor implementation disagreement in the zero-width case
(<http://canvex.lazyilluminati.com/misc/rects.html>) - in Safari it is
equivalent to drawing a rectangle with infinitesimal width (hence with
four line-joins connecting perpendicular edges), whereas in
FF/Opera/spec it's equivalent to a line (with two line-joins
connecting parallel edges). Also, Safari/FF3 draw stuff in the
width=height=0 case, though that's related to the more general
line-caps-on-zero-length-lines thing (as in
<http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2007-June/011883.html>).
I believe it would be nice (for consistency and predictability) if
strokeRect worked the same as rect+stroke (and the same as
moveTo+lineTo+lineTo+lineTo+closePath+stroke) - that is what everyone
except Safari does, but it doesn't seem to be explicit or obvious in
the spec.

Perhaps it would be easier and most precise to define strokeRect in
terms of existing methods, like: "The strokeRect(x, y, w, h) method
must be equivalent to the following sequence of method calls:
beginPath(); rect(x, y, w, h); stroke(); except with the current path
after calling the strokeRect method remaining the same as before the
call."

-- 
Philip Taylor
excors at gmail.com
Received on Saturday, 30 June 2007 16:06:25 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:56 UTC