Bugzilla – Bug 20956
Getting a more formal definition for imageSmoothingEnabled
Last modified: 2013-03-04 18:43:49 UTC
With imageSmoothingEnabled checked in, there's been discussion of improving on the description. This bug is to track that.
As the canvas property was set up with the same basic use-cases as the CSS property, perhaps just reference one of the values in http://dev.w3.org/csswg/css4-images/#the-image-rendering. "true" means "image-rendering: auto;", "false" presumably means "image-rendering: pixelated;".
Wouldn't we be looking at more of a model where false doesn't attempt any smoothing, rather than a nearest neighbor to create a pixelated image? The way I read the CSS spec, on scaling up, the image gets pixelated, on scaling down, it looks like smoothing = true.
There's no such thing as "doesn't attempt any smoothing" when scaling down. You have more colors than you can deal with, and you have to resolve that somehow.
Scaling down, smoothing algorithms are much better than some dumb version of NN. You don't have the same problems as when scaling up.
I recommend using the following normative text:
"If the imageSmoothingEnabled attribute is set to false, the user agent must use nearest-neighbor interpolation when rescaling images drawn by the drawImage() method or rescaling patterns created by the createPattern() method. If the imageSmoothingEnabled attribute is set to true, the user agent may use any filtering algorithm, e.g., bilinear or bicubic filtering.
The imageSmoothingEnabled attribute, on getting, must return the last value it was set to. On setting, it must be set to the new value. When the CanvasRenderingContext2D object is created, the attribute must be set to true."
New text added.