From 8c749096754e46dea88894cbcc78d66db79ed0e6 Mon Sep 17 00:00:00 2001 From: Stephen Chenney Date: Mon, 5 Aug 2024 01:32:52 -0400 Subject: [PATCH] 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. --- source | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source b/source index 74985cd2fb5..de407dd6dc0 100644 --- a/source +++ b/source @@ -115930,9 +115930,15 @@ dictionary ImageBitmapOptions { interpolation quality to use when scaling images.

The "pixelated" value indicates a preference to scale - the image that maximizes the appearance. Scaling algorithms that "smooth" colors are acceptable, - such as bilinear interpolation.

+ data-x="dom-ResizeQuality-pixelated">pixelated" value indicates a preference for + scaling the image to preserve the pixelation of the original as much as possible, with minor + smoothing as necessary to avoid distorting the image when the target size is not a clean multiple + of the original.

+ +

To implement "pixelated", for each axis + independently, first determine the integer multiple of its natural size that puts it closest to + the target size and is greater than zero. Scale it to this integer-multiple-size using nearest + neighbor, then scale it the rest of the way to the target size using bilinear interpolation.

The "low" value indicates a preference for a low level of image interpolation quality. Low-quality image @@ -115950,7 +115956,8 @@ dictionary ImageBitmapOptions {

Bilinear scaling is an example of a relatively fast, lower-quality image-smoothing algorithm. Bicubic or Lanczos scaling are examples of image-scaling algorithms that produce higher-quality output. This specification does not mandate that specific interpolation algorithms - be used unless the value is "pixelated".

+ be used, except for "pixelated" as described + above.