This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 19818 - Description of transformation in drawimage is confusing
Summary: Description of transformation in drawimage is confusing
Status: RESOLVED NEEDSINFO
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 19820
  Show dependency treegraph
 
Reported: 2012-11-01 15:42 UTC by rcabanie
Modified: 2013-03-25 19:35 UTC (History)
2 users (show)

See Also:


Attachments

Description rcabanie 2012-11-01 15:42:25 UTC
See http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#drawing-images-to-the-canvas

The text for drawImage currently states:
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, after applying the current transformation matrix to the points of the destination rectangle.

This is a bit confusing since you don't really apply the transform to the points. Basically, you map the source rect to the destination rect and then transform the destination rectangle.
I believe the spec should also call out that there should be no loss of precision when doing this (i.e. if the destination has half the pixels but scaled by 2, the original pixel should be preserve)
Comment 1 Ian 'Hixie' Hickson 2013-01-30 23:57:17 UTC
> This is a bit confusing since you don't really apply the transform to the
> points. Basically, you map the source rect to the destination rect and then
> transform the destination rectangle.

Well it doesn't really matter since you can't do perspective transforms. But yeah, I've changed this to transform the rectangle, not the points.


> I believe the spec should also call out that there should be no loss of
> precision when doing this (i.e. if the destination has half the pixels but
> scaled by 2, the original pixel should be preserve)

Could you elaborate on this? I don't understand what it means.
Comment 2 contributor 2013-01-31 00:04:57 UTC
Checked in as WHATWG revision r7677.
Check-in comment: Be more precise by having fewer words...
http://html5.org/tools/web-apps-tracker?from=7676&to=7677
Comment 3 Ian 'Hixie' Hickson 2013-03-25 19:35:24 UTC
cabanier: please see the end of comment 1; don't hesitate to reopen the bug if you think there's more that needs fixing here