W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2009

[whatwg] Canvas context.drawImage clarification

From: Gregg Tavares <gman@google.com>
Date: Fri, 10 Jul 2009 18:38:02 -0700
Message-ID: <de4bd3190907101838m2bf603b0wc4be214d0e7602d@mail.gmail.com>
On Thu, Jul 9, 2009 at 6:25 PM, Oliver Hunt <oliver at apple.com> wrote:

>  Inconsistency doesn't lead to no one depending on a behaviour, it just
>> means sites only work in one browser.  Your suggesting would result in sites
>> being broken in all browsers -- the only options from here on out are either
>> nothing gets drawn (as in gecko and presto), or the destination is
>> normalised (as in webkit).
>>
>
> Or making it consistent when the DOCTYPE is set to something.
>
> API behaviour is not effected by the DOCTYPE, only parsing.  Unfortunately
> you can't change a DOM API that has existed for years to something
> contradictory.
>

I guess I don't understand. I'm new to the list so forgive me but I thought
HTML5 was still a working draft and that the canvas tag was part of that
draft. How is a draft immutable?

Also, I don't follow the logic here: " Your suggesting would result in sites
being broken in all browsers -- the only options from here on out are either
nothing gets drawn (as in gecko and presto), or the destination is
normalised (as in webkit)."

I don't see how breaking some very small percentage of Webkit sites, or
breaking some very small percentage of Gecko/Presto sites is better than
from breaking some very small percentage of sites in all of them to make the
function useful and the spec specific.

(1) The number of sites that use cavnas is exceeding small at this point and
the number of those that count on negative width and height behavior being
one way or the other is and exceedingly small percent of those

(2) breaking some apps is the same as breaking some apps where some #1 is X
and some #2 is Y.  So what if X > Y if both X and Y are less than 0.000001%
of websites.

Consistency and usefulness should win in this case. There is the chance to
make the spec unambiguous and more useful before canvas becomes widely used.



>
>  Image scaling is implementation dependent everywhere else, why would it
>>> be spec defined in the case of canvas?
>>
>>
>> There are 2 issues here I brought up
>>
>> 1) What happens at the edges.
>>
>> The results are VASTLY different now. Unless this works consistently it
>> would be hard to make canvas graphics work across browsers and expect get
>> reproducible results.  The 2x2 pixel example I gave, one browser ends up
>> scaling with translucency even though there is no translucent pixels in the
>> source image.
>>
>>
>> This is just an artifact of scaling, and you agree below that scaling is
>> implementation dependent.
>>
>
> I disagree. When I scale a rectangular opaque image I expect rectangular
> opaque results.  The Firefox implementation does not do this. If I take a
> 1x1 pixel image and attempt to use it to cover up something in another image
> by scaling it it will not cover up that other image. Only the very center
> pixel will be opaque, all other pixels will be some percentage translucent,
> showing whatever was previously drawn on the canvas.  That's a much bigger
> issue than whether the scaled pixels are blocky or smooth.
>
> If you believe that to be the case then you can always file a bug at
> bugs.webkit.org .
>

I can't claim it's a bug if the spec doesn't define what the correct
behavior is.

Here's a webpage showing the issue.

http://greggman.com/downloads/examples/canvas-test/test-01/canvas-test-01-results.html



>
> --Oliver
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090710/8cc29542/attachment-0001.htm>
Received on Friday, 10 July 2009 18:38:02 UTC

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