[html5] r7849 - [giow] (0) ImageData objects now expose an explicit pixel density, enabling them [...]
whatwg at whatwg.org
whatwg at whatwg.org
Tue Apr 23 11:32:08 PDT 2013
Author: ianh
Date: 2013-04-23 11:32:07 -0700 (Tue, 23 Apr 2013)
New Revision: 7849
Modified:
complete.html
index
source
Log:
[giow] (0) ImageData objects now expose an explicit pixel density, enabling them to be converted to BitmapImage objects correctly.
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=21329
Affected topics: Canvas, DOM APIs
Modified: complete.html
===================================================================
--- complete.html 2013-04-23 00:05:05 UTC (rev 7848)
+++ complete.html 2013-04-23 18:32:07 UTC (rev 7849)
@@ -7986,6 +7986,7 @@
<h4 id=safe-passing-of-structured-data><span class=secno>2.7.6 </span>Safe passing of structured data</h4>
+<!--CLEANUP-->
<p>When a user agent is required to obtain a <dfn id=structured-clone>structured
clone</dfn> of a value, optionally with a <i>transfer map</i>, it
must run the following algorithm, which either returns a separate
@@ -8074,7 +8075,7 @@
<dt>If <var title="">input</var> is an <code><a href=#imagedata>ImageData</a></code> object</dt>
<dd><p>Let <var title="">output</var> be a newly constructed
- <code><a href=#imagedata>ImageData</a></code> object whose <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> and <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> attributes have values
+ <code><a href=#imagedata>ImageData</a></code> object whose <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code>, <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code>, and <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attributes have values
equal to the corresponding attributes on <var title="">input</var>, and whose <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has the value
obtained from invoking the <a href=#internal-structured-cloning-algorithm>internal structured cloning
algorithm</a> recursively with the value of the <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute on <var title="">input</var> as the new "<var title="">input</var>"
@@ -33233,6 +33234,7 @@
interface <dfn id=imagedata>ImageData</dfn> {
readonly attribute unsigned long <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
readonly attribute unsigned long <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
+ readonly attribute double <a href=#dom-imagedata-resolution title=dom-imagedata-resolution>resolution</a>;
readonly attribute <a href=#uint8clampedarray>Uint8ClampedArray</a> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
};
@@ -35620,9 +35622,10 @@
<li><code><a href=#imagebitmap>ImageBitmap</a></code></li>
- <!-- v3: supporting ImageData object might make sense (when resizing as well as filtering) - ack Charles Pritchard -->
+ </ul><p class=note>The <code><a href=#imagebitmap>ImageBitmap</a></code> interface can be created from a number of other
+ image-representing types, including <code><a href=#imagedata>ImageData</a></code>.</p>
- </ul><p>When a user agent is required to <dfn id=check-the-usability-of-the-image-argument>check the usability of the <var title="">image</var>
+ <p>When a user agent is required to <dfn id=check-the-usability-of-the-image-argument>check the usability of the <var title="">image</var>
argument</dfn>, where <var title="">image</var> is a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object, the
user agent must run these steps, which return either <i>good</i>, <i>bad</i>, or
<i>aborted</i>:</p>
@@ -37624,6 +37627,7 @@
<h6 id=pixel-manipulation><span class=secno>4.8.11.2.16 </span><dfn>Pixel manipulation</dfn></h6>
+<!--CLEANUP-->
<dl class=domintro><dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var title="">sw</var>, <var title="">sh</var>)</dt>
@@ -37701,6 +37705,18 @@
</dd>
+ <dt><var title="">imagedata</var> . <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code></dt>
+
+ <dd>
+
+ <p>Returns the theoretical number of pixels in the <code><a href=#imagedata>ImageData</a></code> object's data per
+ corresponding coordinate space unit. This value is automatically determined from the source
+ image when the <code><a href=#imagedata>ImageData</a></code> object is created. It is only used to ensure that
+ <code><a href=#imagebitmap>ImageBitmap</a></code> objects have the right pixel density when generated from
+ <code><a href=#imagedata>ImageData</a></code> objects.</p>
+
+ </dd>
+
<dt><var title="">imagedata</var> . <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code></dt>
<dd>
@@ -37726,7 +37742,8 @@
<p>Throws a <code><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the
arguments are not finite.</p>
- <p>Each pixel in the image data is mapped to one coordinate space unit on the bitmap.</p>
+ <p>Each pixel in the image data is mapped to one coordinate space unit on the bitmap, regardless
+ of the value of the <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute.</p>
</dd>
@@ -37735,8 +37752,8 @@
<dd>
<p>Paints the data from the given <code><a href=#imagedata>ImageData</a></code> object onto the bitmap, at the bitmap's
- native pixel density. If a dirty rectangle is provided, only the pixels from that rectangle are
- painted.</p>
+ native pixel density (regardless of the value of the <code><a href=#imagedata>ImageData</a></code> object's <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute). If a dirty rectangle is provided,
+ only the pixels from that rectangle are painted.</p>
<p>The <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>
and <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
@@ -37758,23 +37775,21 @@
objects.</p>
<p>When the <dfn id=dom-context-2d-createimagedata title=dom-context-2d-createImageData><code>createImageData()</code></dfn>
- method is invoked with two arguments <var title="">sw</var> and <var title="">sh</var>, it must return a new <code><a href=#imagedata>ImageData</a></code>
- object representing a rectangle with a width in equal to the
- absolute magnitude of <var title="">sw</var> and a height equal to
- the absolute magnitude of <var title="">sh</var>. When invoked with
- a single <var title="">imagedata</var> argument, it must return a
- new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with the
- same dimensions as the <code><a href=#imagedata>ImageData</a></code> object passed as the
- argument. The <code><a href=#imagedata>ImageData</a></code> object returned must be filled
- with transparent black.</p>
+ method is invoked with two arguments <var title="">sw</var> and <var title="">sh</var>, it must
+ return a new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with a width in equal to the
+ absolute magnitude of <var title="">sw</var> and a height equal to the absolute magnitude of <var title="">sh</var>, and with a 1.0 pixel density. When invoked with a single <var title="">imagedata</var> argument, it must return a new <code><a href=#imagedata>ImageData</a></code> object representing
+ a rectangle with the same dimensions and pixel density as the <code><a href=#imagedata>ImageData</a></code> object passed
+ as the argument. In either case, the <code><a href=#imagedata>ImageData</a></code> object returned must be filled with
+ transparent black.</p>
<p>When the <dfn id=dom-context-2d-createimagedatahd title=dom-context-2d-createImageDataHD><code>createImageDataHD()</code></dfn>
method is invoked (with its two arguments <var title="">sw</var> and <var title="">sh</var>) it
must return a new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with a width in equal to
- the absolute magnitude of <var title="">sw</var> multiplied by <var title="">scale</var> and a
- height equal to the absolute magnitude of <var title="">sh</var> multiplied by <var title="">scale</var>, where <var title="">scale</var> is the number of pixels in the <a href=#scratch-bitmap>scratch
- bitmap</a> per coordinate space units. The <code><a href=#imagedata>ImageData</a></code> object returned must be
- filled with transparent black.</p>
+ the absolute magnitude of <var title="">sw</var> multiplied by <var title="">scale</var>, a height
+ equal to the absolute magnitude of <var title="">sh</var> multiplied by <var title="">scale</var>,
+ and a pixel density equal to <var title="">scale</var>, where <var title="">scale</var> is the
+ number of pixels in the <a href=#scratch-bitmap>scratch bitmap</a> per coordinate space units. The
+ <code><a href=#imagedata>ImageData</a></code> object returned must be filled with transparent black.</p>
<p>The <dfn id=dom-context-2d-getimagedata title=dom-context-2d-getImageData><code>getImageData(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must, if
either the <var title="">sw</var> or <var title="">sh</var> arguments are zero, throw an
@@ -37783,6 +37798,7 @@
if the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a>
flag is set to false, it must throw a <code><a href=#securityerror>SecurityError</a></code> exception;
<!--REMOVE-TOPIC:Security-->
+
otherwise, it must return an <code><a href=#imagedata>ImageData</a></code> object with width <var title="">sw</var> and
height <var title="">sh</var> representing the <a href=#scratch-bitmap>scratch bitmap</a> for the area of that
bitmap denoted by the rectangle whose corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in the bitmap's coordinate space
@@ -37790,7 +37806,7 @@
the value of each pixel in the returned abject must be derived from the value(s) of the pixel(s)
in the bitmap that correspond to the same coordinate. Pixels outside the <a href=#scratch-bitmap>scratch
bitmap</a> must be returned as transparent black. Pixels must be returned as non-premultiplied
- alpha values.</p>
+ alpha values. The pixel density of the object returned must be 1.0.</p>
<p>The <dfn id=dom-context-2d-getimagedatahd title=dom-context-2d-getImageDataHD><code>getImageDataHD(<var title="">sx</var>,
<var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must,
@@ -37804,13 +37820,17 @@
multiplied by <var title="">scale</var> and height <var title="">sh</var> multiplied by <var title="">scale</var> representing the <a href=#scratch-bitmap>scratch bitmap</a> for the area of that bitmap
denoted by the rectangle whose corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in the bitmap's coordinate space
units. Pixels outside the <a href=#scratch-bitmap>scratch bitmap</a> must be returned as transparent black.
- Pixels must be returned as non-premultiplied alpha values.</p>
+ Pixels must be returned as non-premultiplied alpha values. The pixel density of the object
+ returned must be <var title="">scale</var>. For the purposes of this paragraph, <var title="">scale</var> is the number of pixels in the <a href=#scratch-bitmap>scratch bitmap</a> per coordinate
+ space units.</p>
+<!--CLEANUP-->
<p>New <code><a href=#imagedata>ImageData</a></code> objects must be initialized so that
their <dfn id=dom-imagedata-width title=dom-imagedata-width><code>width</code></dfn>
attribute is set to the number of pixels per row in the image data,
their <dfn id=dom-imagedata-height title=dom-imagedata-height><code>height</code></dfn>
- attribute is set to the number of rows in the image data, and their
+ attribute is set to the number of rows in the image data,
+ their <dfn id=dom-imagedata-resolution title=dom-imagedata-resolution><code>resolution</code></dfn> is set to the object's pixel density, and their
<dfn id=dom-imagedata-data title=dom-imagedata-data><code>data</code></dfn> attribute is
initialized to a <code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object. The
<code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object must use a <a href=#canvas-pixel-arraybuffer>Canvas Pixel
@@ -73825,7 +73845,9 @@
<li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>
<li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data given by the
- <code><a href=#imagedata>ImageData</a></code> object, <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>.</li>
+ <code><a href=#imagedata>ImageData</a></code> object, <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>, using the value
+ ofd the object's <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute as the
+ object's pixel density.</li>
<li><p>Return, but continue running these steps asynchronously.</li>
Modified: index
===================================================================
--- index 2013-04-23 00:05:05 UTC (rev 7848)
+++ index 2013-04-23 18:32:07 UTC (rev 7849)
@@ -7986,6 +7986,7 @@
<h4 id=safe-passing-of-structured-data><span class=secno>2.7.6 </span>Safe passing of structured data</h4>
+<!--CLEANUP-->
<p>When a user agent is required to obtain a <dfn id=structured-clone>structured
clone</dfn> of a value, optionally with a <i>transfer map</i>, it
must run the following algorithm, which either returns a separate
@@ -8074,7 +8075,7 @@
<dt>If <var title="">input</var> is an <code><a href=#imagedata>ImageData</a></code> object</dt>
<dd><p>Let <var title="">output</var> be a newly constructed
- <code><a href=#imagedata>ImageData</a></code> object whose <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> and <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> attributes have values
+ <code><a href=#imagedata>ImageData</a></code> object whose <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code>, <code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code>, and <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attributes have values
equal to the corresponding attributes on <var title="">input</var>, and whose <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has the value
obtained from invoking the <a href=#internal-structured-cloning-algorithm>internal structured cloning
algorithm</a> recursively with the value of the <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute on <var title="">input</var> as the new "<var title="">input</var>"
@@ -33233,6 +33234,7 @@
interface <dfn id=imagedata>ImageData</dfn> {
readonly attribute unsigned long <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
readonly attribute unsigned long <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
+ readonly attribute double <a href=#dom-imagedata-resolution title=dom-imagedata-resolution>resolution</a>;
readonly attribute <a href=#uint8clampedarray>Uint8ClampedArray</a> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
};
@@ -35620,9 +35622,10 @@
<li><code><a href=#imagebitmap>ImageBitmap</a></code></li>
- <!-- v3: supporting ImageData object might make sense (when resizing as well as filtering) - ack Charles Pritchard -->
+ </ul><p class=note>The <code><a href=#imagebitmap>ImageBitmap</a></code> interface can be created from a number of other
+ image-representing types, including <code><a href=#imagedata>ImageData</a></code>.</p>
- </ul><p>When a user agent is required to <dfn id=check-the-usability-of-the-image-argument>check the usability of the <var title="">image</var>
+ <p>When a user agent is required to <dfn id=check-the-usability-of-the-image-argument>check the usability of the <var title="">image</var>
argument</dfn>, where <var title="">image</var> is a <code><a href=#canvasimagesource>CanvasImageSource</a></code> object, the
user agent must run these steps, which return either <i>good</i>, <i>bad</i>, or
<i>aborted</i>:</p>
@@ -37624,6 +37627,7 @@
<h6 id=pixel-manipulation><span class=secno>4.8.11.2.16 </span><dfn>Pixel manipulation</dfn></h6>
+<!--CLEANUP-->
<dl class=domintro><dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-createImageData><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var title="">sw</var>, <var title="">sh</var>)</dt>
@@ -37701,6 +37705,18 @@
</dd>
+ <dt><var title="">imagedata</var> . <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code></dt>
+
+ <dd>
+
+ <p>Returns the theoretical number of pixels in the <code><a href=#imagedata>ImageData</a></code> object's data per
+ corresponding coordinate space unit. This value is automatically determined from the source
+ image when the <code><a href=#imagedata>ImageData</a></code> object is created. It is only used to ensure that
+ <code><a href=#imagebitmap>ImageBitmap</a></code> objects have the right pixel density when generated from
+ <code><a href=#imagedata>ImageData</a></code> objects.</p>
+
+ </dd>
+
<dt><var title="">imagedata</var> . <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code></dt>
<dd>
@@ -37726,7 +37742,8 @@
<p>Throws a <code><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the
arguments are not finite.</p>
- <p>Each pixel in the image data is mapped to one coordinate space unit on the bitmap.</p>
+ <p>Each pixel in the image data is mapped to one coordinate space unit on the bitmap, regardless
+ of the value of the <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute.</p>
</dd>
@@ -37735,8 +37752,8 @@
<dd>
<p>Paints the data from the given <code><a href=#imagedata>ImageData</a></code> object onto the bitmap, at the bitmap's
- native pixel density. If a dirty rectangle is provided, only the pixels from that rectangle are
- painted.</p>
+ native pixel density (regardless of the value of the <code><a href=#imagedata>ImageData</a></code> object's <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute). If a dirty rectangle is provided,
+ only the pixels from that rectangle are painted.</p>
<p>The <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>
and <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>
@@ -37758,23 +37775,21 @@
objects.</p>
<p>When the <dfn id=dom-context-2d-createimagedata title=dom-context-2d-createImageData><code>createImageData()</code></dfn>
- method is invoked with two arguments <var title="">sw</var> and <var title="">sh</var>, it must return a new <code><a href=#imagedata>ImageData</a></code>
- object representing a rectangle with a width in equal to the
- absolute magnitude of <var title="">sw</var> and a height equal to
- the absolute magnitude of <var title="">sh</var>. When invoked with
- a single <var title="">imagedata</var> argument, it must return a
- new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with the
- same dimensions as the <code><a href=#imagedata>ImageData</a></code> object passed as the
- argument. The <code><a href=#imagedata>ImageData</a></code> object returned must be filled
- with transparent black.</p>
+ method is invoked with two arguments <var title="">sw</var> and <var title="">sh</var>, it must
+ return a new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with a width in equal to the
+ absolute magnitude of <var title="">sw</var> and a height equal to the absolute magnitude of <var title="">sh</var>, and with a 1.0 pixel density. When invoked with a single <var title="">imagedata</var> argument, it must return a new <code><a href=#imagedata>ImageData</a></code> object representing
+ a rectangle with the same dimensions and pixel density as the <code><a href=#imagedata>ImageData</a></code> object passed
+ as the argument. In either case, the <code><a href=#imagedata>ImageData</a></code> object returned must be filled with
+ transparent black.</p>
<p>When the <dfn id=dom-context-2d-createimagedatahd title=dom-context-2d-createImageDataHD><code>createImageDataHD()</code></dfn>
method is invoked (with its two arguments <var title="">sw</var> and <var title="">sh</var>) it
must return a new <code><a href=#imagedata>ImageData</a></code> object representing a rectangle with a width in equal to
- the absolute magnitude of <var title="">sw</var> multiplied by <var title="">scale</var> and a
- height equal to the absolute magnitude of <var title="">sh</var> multiplied by <var title="">scale</var>, where <var title="">scale</var> is the number of pixels in the <a href=#scratch-bitmap>scratch
- bitmap</a> per coordinate space units. The <code><a href=#imagedata>ImageData</a></code> object returned must be
- filled with transparent black.</p>
+ the absolute magnitude of <var title="">sw</var> multiplied by <var title="">scale</var>, a height
+ equal to the absolute magnitude of <var title="">sh</var> multiplied by <var title="">scale</var>,
+ and a pixel density equal to <var title="">scale</var>, where <var title="">scale</var> is the
+ number of pixels in the <a href=#scratch-bitmap>scratch bitmap</a> per coordinate space units. The
+ <code><a href=#imagedata>ImageData</a></code> object returned must be filled with transparent black.</p>
<p>The <dfn id=dom-context-2d-getimagedata title=dom-context-2d-getImageData><code>getImageData(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must, if
either the <var title="">sw</var> or <var title="">sh</var> arguments are zero, throw an
@@ -37783,6 +37798,7 @@
if the <a href=#scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean title=concept-canvas-origin-clean>origin-clean</a>
flag is set to false, it must throw a <code><a href=#securityerror>SecurityError</a></code> exception;
<!--REMOVE-TOPIC:Security-->
+
otherwise, it must return an <code><a href=#imagedata>ImageData</a></code> object with width <var title="">sw</var> and
height <var title="">sh</var> representing the <a href=#scratch-bitmap>scratch bitmap</a> for the area of that
bitmap denoted by the rectangle whose corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in the bitmap's coordinate space
@@ -37790,7 +37806,7 @@
the value of each pixel in the returned abject must be derived from the value(s) of the pixel(s)
in the bitmap that correspond to the same coordinate. Pixels outside the <a href=#scratch-bitmap>scratch
bitmap</a> must be returned as transparent black. Pixels must be returned as non-premultiplied
- alpha values.</p>
+ alpha values. The pixel density of the object returned must be 1.0.</p>
<p>The <dfn id=dom-context-2d-getimagedatahd title=dom-context-2d-getImageDataHD><code>getImageDataHD(<var title="">sx</var>,
<var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must,
@@ -37804,13 +37820,17 @@
multiplied by <var title="">scale</var> and height <var title="">sh</var> multiplied by <var title="">scale</var> representing the <a href=#scratch-bitmap>scratch bitmap</a> for the area of that bitmap
denoted by the rectangle whose corners are the four points (<var title="">sx</var>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in the bitmap's coordinate space
units. Pixels outside the <a href=#scratch-bitmap>scratch bitmap</a> must be returned as transparent black.
- Pixels must be returned as non-premultiplied alpha values.</p>
+ Pixels must be returned as non-premultiplied alpha values. The pixel density of the object
+ returned must be <var title="">scale</var>. For the purposes of this paragraph, <var title="">scale</var> is the number of pixels in the <a href=#scratch-bitmap>scratch bitmap</a> per coordinate
+ space units.</p>
+<!--CLEANUP-->
<p>New <code><a href=#imagedata>ImageData</a></code> objects must be initialized so that
their <dfn id=dom-imagedata-width title=dom-imagedata-width><code>width</code></dfn>
attribute is set to the number of pixels per row in the image data,
their <dfn id=dom-imagedata-height title=dom-imagedata-height><code>height</code></dfn>
- attribute is set to the number of rows in the image data, and their
+ attribute is set to the number of rows in the image data,
+ their <dfn id=dom-imagedata-resolution title=dom-imagedata-resolution><code>resolution</code></dfn> is set to the object's pixel density, and their
<dfn id=dom-imagedata-data title=dom-imagedata-data><code>data</code></dfn> attribute is
initialized to a <code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object. The
<code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object must use a <a href=#canvas-pixel-arraybuffer>Canvas Pixel
@@ -73825,7 +73845,9 @@
<li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>
<li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data given by the
- <code><a href=#imagedata>ImageData</a></code> object, <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>.</li>
+ <code><a href=#imagedata>ImageData</a></code> object, <a href=#cropped-to-the-source-rectangle>cropped to the source rectangle</a>, using the value
+ ofd the object's <code title=dom-imagedata-resolution><a href=#dom-imagedata-resolution>resolution</a></code> attribute as the
+ object's pixel density.</li>
<li><p>Return, but continue running these steps asynchronously.</li>
Modified: source
===================================================================
--- source 2013-04-23 00:05:05 UTC (rev 7848)
+++ source 2013-04-23 18:32:07 UTC (rev 7849)
@@ -7637,6 +7637,7 @@
<h4>Safe passing of structured data</h4>
+<!--CLEANUP-->
<p>When a user agent is required to obtain a <dfn>structured
clone</dfn> of a value, optionally with a <i>transfer map</i>, it
must run the following algorithm, which either returns a separate
@@ -7737,8 +7738,9 @@
<dd><p>Let <var title="">output</var> be a newly constructed
<code>ImageData</code> object whose <code
- title="dom-imagedata-width">width</code> and <code
- title="dom-imagedata-height">height</code> attributes have values
+ title="dom-imagedata-width">width</code>, <code
+ title="dom-imagedata-height">height</code>, and <code
+ title="dom-imagedata-resolution">resolution</code> attributes have values
equal to the corresponding attributes on <var
title="">input</var>, and whose <code
title="dom-imagedata-data">data</code> attribute has the value
@@ -35860,6 +35862,7 @@
interface <dfn>ImageData</dfn> {
readonly attribute unsigned long <span title="dom-imagedata-width">width</span>;
readonly attribute unsigned long <span title="dom-imagedata-height">height</span>;
+ readonly attribute double <span title="dom-imagedata-resolution">resolution</span>;
readonly attribute <span>Uint8ClampedArray</span> <span title="dom-imagedata-data">data</span>;
};
@@ -38707,10 +38710,11 @@
<li><code>ImageBitmap</code></li>
- <!-- v3: supporting ImageData object might make sense (when resizing as well as filtering) - ack Charles Pritchard -->
-
</ul>
+ <p class="note">The <code>ImageBitmap</code> interface can be created from a number of other
+ image-representing types, including <code>ImageData</code>.</p>
+
<p>When a user agent is required to <dfn>check the usability of the <var title="">image</var>
argument</dfn>, where <var title="">image</var> is a <code>CanvasImageSource</code> object, the
user agent must run these steps, which return either <i>good</i>, <i>bad</i>, or
@@ -41118,6 +41122,7 @@
<h6><dfn>Pixel manipulation</dfn></h6>
+<!--CLEANUP-->
<dl class="domintro">
@@ -41197,6 +41202,18 @@
</dd>
+ <dt><var title="">imagedata</var> . <code title="dom-imagedata-resolution">resolution</code></dt>
+
+ <dd>
+
+ <p>Returns the theoretical number of pixels in the <code>ImageData</code> object's data per
+ corresponding coordinate space unit. This value is automatically determined from the source
+ image when the <code>ImageData</code> object is created. It is only used to ensure that
+ <code>ImageBitmap</code> objects have the right pixel density when generated from
+ <code>ImageData</code> objects.</p>
+
+ </dd>
+
<dt><var title="">imagedata</var> . <code title="dom-imagedata-data">data</code></dt>
<dd>
@@ -41223,7 +41240,8 @@
<p>Throws a <code>NotSupportedError</code> exception if any of the
arguments are not finite.</p>
- <p>Each pixel in the image data is mapped to one coordinate space unit on the bitmap.</p>
+ <p>Each pixel in the image data is mapped to one coordinate space unit on the bitmap, regardless
+ of the value of the <code title="dom-imagedata-resolution">resolution</code> attribute.</p>
</dd>
@@ -41232,8 +41250,9 @@
<dd>
<p>Paints the data from the given <code>ImageData</code> object onto the bitmap, at the bitmap's
- native pixel density. If a dirty rectangle is provided, only the pixels from that rectangle are
- painted.</p>
+ native pixel density (regardless of the value of the <code>ImageData</code> object's <code
+ title="dom-imagedata-resolution">resolution</code> attribute). If a dirty rectangle is provided,
+ only the pixels from that rectangle are painted.</p>
<p>The <code title="dom-context-2d-globalAlpha">globalAlpha</code>
and <code
@@ -41259,27 +41278,24 @@
methods are used to instantiate new blank <code>ImageData</code>
objects.</p>
- <p>When the <dfn
- title="dom-context-2d-createImageData"><code>createImageData()</code></dfn>
- method is invoked with two arguments <var title="">sw</var> and <var
- title="">sh</var>, it must return a new <code>ImageData</code>
- object representing a rectangle with a width in equal to the
- absolute magnitude of <var title="">sw</var> and a height equal to
- the absolute magnitude of <var title="">sh</var>. When invoked with
- a single <var title="">imagedata</var> argument, it must return a
- new <code>ImageData</code> object representing a rectangle with the
- same dimensions as the <code>ImageData</code> object passed as the
- argument. The <code>ImageData</code> object returned must be filled
- with transparent black.</p>
+ <p>When the <dfn title="dom-context-2d-createImageData"><code>createImageData()</code></dfn>
+ method is invoked with two arguments <var title="">sw</var> and <var title="">sh</var>, it must
+ return a new <code>ImageData</code> object representing a rectangle with a width in equal to the
+ absolute magnitude of <var title="">sw</var> and a height equal to the absolute magnitude of <var
+ title="">sh</var>, and with a 1.0 pixel density. When invoked with a single <var
+ title="">imagedata</var> argument, it must return a new <code>ImageData</code> object representing
+ a rectangle with the same dimensions and pixel density as the <code>ImageData</code> object passed
+ as the argument. In either case, the <code>ImageData</code> object returned must be filled with
+ transparent black.</p>
<p>When the <dfn title="dom-context-2d-createImageDataHD"><code>createImageDataHD()</code></dfn>
method is invoked (with its two arguments <var title="">sw</var> and <var title="">sh</var>) it
must return a new <code>ImageData</code> object representing a rectangle with a width in equal to
- the absolute magnitude of <var title="">sw</var> multiplied by <var title="">scale</var> and a
- height equal to the absolute magnitude of <var title="">sh</var> multiplied by <var
- title="">scale</var>, where <var title="">scale</var> is the number of pixels in the <span>scratch
- bitmap</span> per coordinate space units. The <code>ImageData</code> object returned must be
- filled with transparent black.</p>
+ the absolute magnitude of <var title="">sw</var> multiplied by <var title="">scale</var>, a height
+ equal to the absolute magnitude of <var title="">sh</var> multiplied by <var title="">scale</var>,
+ and a pixel density equal to <var title="">scale</var>, where <var title="">scale</var> is the
+ number of pixels in the <span>scratch bitmap</span> per coordinate space units. The
+ <code>ImageData</code> object returned must be filled with transparent black.</p>
<p>The <dfn title="dom-context-2d-getImageData"><code>getImageData(<var title="">sx</var>, <var
title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must, if
@@ -41289,6 +41305,7 @@
if the <span>scratch bitmap</span>'s <span title="concept-canvas-origin-clean">origin-clean</span>
flag is set to false, it must throw a <code>SecurityError</code> exception;
<!--REMOVE-TOPIC:Security-->
+
otherwise, it must return an <code>ImageData</code> object with width <var title="">sw</var> and
height <var title="">sh</var> representing the <span>scratch bitmap</span> for the area of that
bitmap denoted by the rectangle whose corners are the four points (<var title="">sx</var>, <var
@@ -41300,7 +41317,7 @@
the value of each pixel in the returned abject must be derived from the value(s) of the pixel(s)
in the bitmap that correspond to the same coordinate. Pixels outside the <span>scratch
bitmap</span> must be returned as transparent black. Pixels must be returned as non-premultiplied
- alpha values.</p>
+ alpha values. The pixel density of the object returned must be 1.0.</p>
<p>The <dfn title="dom-context-2d-getImageDataHD"><code>getImageDataHD(<var title="">sx</var>,
<var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</code></dfn> method must,
@@ -41319,13 +41336,18 @@
title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span
title=""><var title="">sy</var>+<var title="">sh</var></span>), in the bitmap's coordinate space
units. Pixels outside the <span>scratch bitmap</span> must be returned as transparent black.
- Pixels must be returned as non-premultiplied alpha values.</p>
+ Pixels must be returned as non-premultiplied alpha values. The pixel density of the object
+ returned must be <var title="">scale</var>. For the purposes of this paragraph, <var
+ title="">scale</var> is the number of pixels in the <span>scratch bitmap</span> per coordinate
+ space units.</p>
+<!--CLEANUP-->
<p>New <code>ImageData</code> objects must be initialized so that
their <dfn title="dom-imagedata-width"><code>width</code></dfn>
attribute is set to the number of pixels per row in the image data,
their <dfn title="dom-imagedata-height"><code>height</code></dfn>
- attribute is set to the number of rows in the image data, and their
+ attribute is set to the number of rows in the image data,
+ their <dfn title="dom-imagedata-resolution"><code>resolution</code></dfn> is set to the object's pixel density, and their
<dfn title="dom-imagedata-data"><code>data</code></dfn> attribute is
initialized to a <code>Uint8ClampedArray</code> object. The
<code>Uint8ClampedArray</code> object must use a <span>Canvas Pixel
@@ -82835,7 +82857,9 @@
<li><p>Create a new <code>ImageBitmap</code> object.</p></li>
<li><p>Let the <code>ImageBitmap</code> object's bitmap data be the image data given by the
- <code>ImageData</code> object, <span>cropped to the source rectangle</span>.</p></li>
+ <code>ImageData</code> object, <span>cropped to the source rectangle</span>, using the value
+ ofd the object's <code title="dom-imagedata-resolution">resolution</code> attribute as the
+ object's pixel density.</p></li>
<li><p>Return, but continue running these steps asynchronously.</p></li>
More information about the Commit-Watchers
mailing list