[whatwg] Canvas context.drawImage clarification

Oliver Hunt oliver at apple.com
Thu Jul 9 16:11:14 PDT 2009


> 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.

> 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?

--Oliver





More information about the whatwg mailing list