Need better, clearer image filter quality controls #76737
Labels
a: images
Loading, displaying, rendering images
a: quality
A truly polished experience
c: new feature
Nothing broken; request for a new capability
c: proposal
A detailed proposal for a change to Flutter
engine
flutter/engine repository. See also e: labels.
framework
flutter/packages/flutter repository. See also f: labels.
P3
Issues that are less important to the Flutter project
(turning the discussion from flutter/engine#24582 into a feature request)
Our image filter quality controls could be clearer and give developers better control.
Background
Currently the only way to specify image filter quality is by passing a
FilterQuality
enum value toPaint
,ImageFilter.matrix
, orTextureLayer
(docs). The enum provides 4 values:none
,low
,medium
,high
. These options do not always behave in accordance with their names. For example,high
is often worse thanmedium
when images are scaled down.Mipmapping is only used for
medium
with undocumented sampling algorithm. There's no way to choose the scale sampling separately from mipmap sampling.Proposals
Simplify
FilterQuality
Picking an enum value is quite simple. If the semantics of each value could be simplified the
FilterQuality
could serve as a simple way to choose quality for simple use-cases. Currently this enum isn't as simple as it could be due to the aforementioned "high" vs "medium" inconsistency. We can provide more clarity with fewer options while covering most use-cases.The values with useful semantics are:
none
- provides no quality enhancement, fast, useful for cases when the image is already pixel-perfect.low
- provides some quality enhancement cheaply.medium
- provides good quality.The algorithm behind
high
is confusing as it's good when scaling up, but worse thanmedium
when scaling down. We won't lose much if we removed this algorithm entirely.What's left is to remap the enum value to the algorithms:
low
- provides no quality enhancement, fast, useful for cases when the image is already pixel-perfect.medium
- provides some quality enhancement cheaply. This is the new default in the framework.high
- provides good quality.none
is deprecated and maps tolow
.Add explicit sampling and mipmapping
For advanced use-cases we expose SkSamplingOptions, which can express more advanced situations.
From @flar
The text was updated successfully, but these errors were encountered: