Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: clarify canvas coordinate system #2867

Merged
merged 4 commits into from Sep 28, 2017
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions source
Expand Up @@ -59276,7 +59276,7 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</pre>
element is available. For example, it is inappropriate to use a <code>canvas</code> element to
render a page heading: if the desired presentation of the heading is graphically intense, it
should be marked up using appropriate elements (typically <code>h1</code>) and then styled using
CSS and supporting technologies such as Web Components.</p>
CSS and supporting technologies such as <span data-x="shadow tree">shadow trees</span>.</p>

<p>When authors use the <code>canvas</code> element, they must also provide content that, when
presented to the user, conveys essentially the same function or purpose as the
Expand Down Expand Up @@ -60066,11 +60066,25 @@ interface <dfn>Path2D</dfn> {

<p>The size of the coordinate space does not necessarily represent the size of the actual bitmaps
that the user agent will use internally or during rendering. On high-definition displays, for
instance, the user agent may internally use bitmaps with two device pixels per unit in the
instance, the user agent may internally use bitmaps with four device pixels per unit in the
coordinate space, so that the rendering remains at high quality throughout. Anti-aliasing can
similarly be implemented using over-sampling with bitmaps of a higher resolution than the final
similarly be implemented using oversampling with bitmaps of a higher resolution than the final
image on the display.</p>

<div class="example">
<p>Using <span data-x="'px'">CSS pixels</span> to describe the size of a rendering context's
<span>output bitmap</span> does not mean that when rendered an equivalent number of <span
data-x="'px'">CSS pixels</span> ends up being used. <span data-x="'px'">CSS pixels</span> are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

(...) does not mean that when rendered the canvas will cover an equivalent area in <span data-x="'px'">CSS pixels</span>.

reused for ease of integration with CSS features, such as text layout.</p>

<p>In other words, the <code>canvas</code> element below's rendering context has a 200x200
<span>output bitmap</span> (which internally uses <span data-x="'px'">CSS pixels</span> as a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be clarified that 200x200 represents both: a) the domain of the canvas's coordinate space in CSS pixels, and b) the size of the canvas's bitmap in actual pixels.

unit for ease of integration with CSS) and is rendered as 100x100 <span data-x="'px'">CSS
pixels</span>:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear to me what you are trying to explain in this sentence. By "device pixels" are you referring to the pixels of the canvas's bitmap or the pixels of the physical display device? Whichever it is, this sentence doesn't really provide any actionable information (because of the word "could").

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to the physical device. It was meant as a statement of fact to affirm the details.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then perhaps you should state what conditions need to be met in order to get 1 to 1 correspondence with physical device pixels. Something about the layout vs intrinsic size matching the devicePixelRatio.

<pre>&lt;canvas width=200 height=200 style=width:100px;width:100px></pre>
</div>

<hr>

<p>The <dfn>2D context creation algorithm</dfn>, which is passed a <var>target</var> (a
Expand Down