Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ea44270

Browse files
authored
Expand FilterQuality API docs (#24582)
1 parent 4fd6bb1 commit ea44270

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

lib/ui/painting.dart

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,26 @@ enum BlendMode {
825825

826826
/// Quality levels for image filters.
827827
///
828-
/// See [Paint.filterQuality].
828+
/// When scaling up typically the quality is lowest at [none], higher at [low],
829+
/// even higher at [medium], and the highest at [high].
830+
///
831+
/// When scaling down, the higher the scale factor the less effective the [high]
832+
/// level is. Beyond certain scale level [medium] may provide better visual
833+
/// result than [high].
834+
///
835+
/// To get high quality when scaling images up and down, or when the scale is
836+
/// unknown, [medium] is typically a good enough choice.
837+
///
838+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/filter_quality.png)
839+
///
840+
/// When building for the web using the `--web-renderer=html` option, filter
841+
/// quality has no effect. All images are rendered using the respective
842+
/// browser's default setting.
843+
///
844+
/// See also:
845+
///
846+
/// * [Paint.filterQuality], which is used to pass [FilterQuality] to the
847+
/// engine while painting.
829848
enum FilterQuality {
830849
// This list comes from Skia's SkFilterQuality.h and the values (order) should
831850
// be kept in sync.
@@ -842,13 +861,28 @@ enum FilterQuality {
842861

843862
/// Better quality than [low], faster than [high].
844863
///
864+
/// When scaling down images, this is frequently better than [high].
865+
///
845866
/// Typically this implies a combination of bilinear interpolation and
846867
/// pyramidal parametric pre-filtering (mipmaps).
868+
///
869+
/// {@template dart.ui.filterQuality.seeAlso}
870+
/// See also:
871+
///
872+
/// * [FilterQuality] class-level documentation that goes into detail about
873+
/// relative qualities of the enum values.
874+
/// {@endtemplate}
847875
medium,
848876

849-
/// Best possible quality filtering, albeit also the slowest.
877+
/// Best possible quality when scaling up images.
878+
///
879+
/// When images are scaled down, this is frequently worse than [medium].
880+
///
881+
/// This option is the slowest.
850882
///
851883
/// Typically this implies bicubic interpolation or better.
884+
///
885+
/// {@macro dart.ui.filterQuality.seeAlso}
852886
high,
853887
}
854888

0 commit comments

Comments
 (0)