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

[whatwg] <canvas> drawing with singular transforms and zero-sized gradients

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Fri, 24 Jun 2011 13:38:02 -0400
Message-ID: <BANLkTinMmEPxdzQnza+jcnJwVpP8RXkQ8A@mail.gmail.com>
On Fri, Jun 24, 2011 at 1:09 AM, Robert O'Callahan <robert at ocallahan.org> wrote:
> Consider this testcase:
> http://people.mozilla.org/~roc/SingularCanvasMatrix.html
> It sets up a rectangle to fill, then sets the current matrix to a singular
> matrix (yy=0 in this case), then fills with different fillStyles. It's not
> clear from the spec how this is supposed to behave, and there's not much
> interop:

There's an existing bug: http://www.w3.org/Bugs/Public/show_bug.cgi?id=12705

I'm not familiar enough with the canvas API to have an informed
opinion on what should happen here, but mathematically it makes sense
to me that nothing should be drawn ever if the transform matrix is
singular.  Everything will be collapsed to line or point in that case,
with zero width, so it's invisible.  Even if it's just a solid color,
conceptually you're collapsing the whole color-filled *plane* into
something with zero width, so it should still be invisible.

If you define different behavior for solid colors or gradients,
doesn't that mean that they'll behave differently from if you used an
image that looked exactly the same?  That seems bad.
Received on Friday, 24 June 2011 10:38:02 UTC

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