[whatwg] Canvas context.drawImage clarification

On Thu, Jul 9, 2009 at 4:11 PM, Oliver Hunt <oliver at apple.com> wrote:

> I'd like to make a passionate plea that the spec say "implementations must
>> support negative widths and negative heights and draw the image backward
>> effectively flipping the result".
>>
>
> We'd need to be fairly sure that such a change would not break existing
> content -- this is a change that would result in substantially different
> rendering in some scenarios.
>

Given that it's inconsistent in the various browsers it's hard to see how
this would break something since it's broken in 2 browsers one way or the
other currently.



>
>
>  Also, I'd like to suggest that a widths and heights of 0 for source should
>> be
>> valid as well as rectangles outside of the source also be valid and that
>> this
>> part of the spec.
>>
>> "If the source rectangle is not entirely within the source image, or if
>> one of
>> the sw or sh arguments is zero, the implementation must raise an
>> INDEX_SIZE_ERR
>> exception."
>>
>> be changed to reflect that.
>>
> The issues of when exceptions should be thrown in the canvas API have been
> discussed repeatedly on this list, you should search the archives and see if
> there are any arguments you can make that have not already been made. (I
> note that i am also all for exceptions not being thrown in many of these
> cases)


>
>  The next issue related to drawImage is that the spec does not specify how
>> to
>> filter an image when scaling it. Should it use bi-linear interpolation?
>> Nearest
>> Neighbor? Maybe that should stay implementation dependent?
>>
> 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.

2) How it does the scaling.

I agree that it being implementation dependent is probably fine.



>
> --Oliver
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090709/971c6e72/attachment-0001.htm>

Received on Thursday, 9 July 2009 16:19:12 UTC