Skip to content

Commit 8c74909

Browse files
Fix the definition of pixelated for createImageBitmap
This adopts the CSS definition from https://drafts.csswg.org/css-images-3/#valdef-image-rendering-pixelated, adapted for the HTML context. Closes #3485.
1 parent 0068b12 commit 8c74909

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

source

+11-4
Original file line numberDiff line numberDiff line change
@@ -115930,9 +115930,15 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
115930115930
interpolation quality to use when scaling images.</p>
115931115931

115932115932
<p>The "<dfn enum-value for="ResizeQuality"><code
115933-
data-x="dom-ResizeQuality-pixelated">pixelated</code></dfn>" value indicates a preference to scale
115934-
the image that maximizes the appearance. Scaling algorithms that "smooth" colors are acceptable,
115935-
such as bilinear interpolation.</p>
115933+
data-x="dom-ResizeQuality-pixelated">pixelated</code></dfn>" value indicates a preference for
115934+
scaling the image to preserve the pixelation of the original as much as possible, with minor
115935+
smoothing as necessary to avoid distorting the image when the target size is not a clean multiple
115936+
of the original.</p>
115937+
115938+
<p>To implement "<code data-x="dom-ResizeQuality-pixelated">pixelated</code>", for each axis
115939+
independently, first determine the integer multiple of its natural size that puts it closest to
115940+
the target size and is greater than zero. Scale it to this integer-multiple-size using nearest
115941+
neighbor, then scale it the rest of the way to the target size using bilinear interpolation.</p>
115936115942

115937115943
<p>The "<dfn enum-value for="ResizeQuality"><code data-x="dom-ResizeQuality-low">low</code></dfn>"
115938115944
value indicates a preference for a low level of image interpolation quality. Low-quality image
@@ -115950,7 +115956,8 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
115950115956
<p class="note">Bilinear scaling is an example of a relatively fast, lower-quality image-smoothing
115951115957
algorithm. Bicubic or Lanczos scaling are examples of image-scaling algorithms that produce
115952115958
higher-quality output. This specification does not mandate that specific interpolation algorithms
115953-
be used unless the value is "<span data-x="dom-ResizeQuality-pixelated">pixelated</span>".</p>
115959+
be used, except for "<code data-x="dom-ResizeQuality-pixelated">pixelated</code>" as described
115960+
above.</p>
115954115961

115955115962
</div>
115956115963

0 commit comments

Comments
 (0)