[whatwg] Canvas context.drawImage clarification

On Mon, 27 Jul 2009, Gregg Tavares wrote:
> >
> > Could you explain what other interpretations of the following you think
> > are reasonable?:
> >
> > # The source rectangle is the rectangle whose corners are the four points
> > # (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh).
> > # [...]
> > # The destination rectangle is the rectangle whose corners are the four
> > # points (dx, dy), (dx+dw, dy), (dx+dw, dy+dh), (dx, dy+dh).
> > #
> > # When drawImage() is invoked, the region of the image specified by the
> > # source rectangle must be painted on the region of the canvas specified
> > # by the destination rectangle [...]
> 
> It's ambiguous because images have a direction.  An image that starts at 
> 10 with a width of -5 is not the same as an image that starts at 6 with 
> a width of +5 any more than starting in SF and driving 5 miles south is 
> not the same as starting in Brisbane and driving 5 miles north.

Huh. I've never considered images as having a direction.

I've tried to add text to the spec to make sure that it's clear that no 
direction is implied here.


On Wed, 29 Jul 2009, Gregg Tavares wrote:
> 
> If it's so clear, why do you think 2 of the 4 browsers that implemented 
> it apparently got it wrong?

The browsers only paid passing attention to the spec when implementing it; 
the spec was being written at the same time.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Monday, 3 August 2009 22:16:27 UTC