pub enum FilterQuality {
None,
Low,
Medium,
High,
}Expand description
Quality levels for image sampling in ImageFilter and Shader objects that sample
images and for Canvas operations that render images.
When scaling up typically the quality is lowest at none, higher at
low and medium, and for very large scale factors (over 10x)
the highest at high.
When scaling down, medium provides the best quality especially when scaling
an image to less than half its size or for animating the scale factor between such
reductions. Otherwise, low and high provide similar effects for
reductions of between 50% and 100% but the image may lose detail and have dropouts below 50%.
To get high quality when scaling images up and down, or when the scale is unknown,
medium is typically a good balanced choice.
See also:
Variants§
None
The fastest filtering method, albeit also the lowest quality.
This value results in a “Nearest Neighbor” algorithm which just repeats or eliminates pixels as an image is scaled up or down.
Low
Better quality than none, faster than medium.
This value results in a “Bilinear” algorithm which smoothly interpolates between pixels in an image.
Medium
The best all around filtering method that is only worse than high at
extremely large scale factors.
This value improves upon the “Bilinear” algorithm specified by low by
utilizing a Mipmap that pre-computes high quality lower resolutions of the image at half
(and quarter and eighth, etc.) sizes and then blends between those to prevent loss of
detail at small scale sizes.
High
Best possible quality when scaling up images by scale factors larger than 5-10x.
When images are scaled down, this can be worse than medium for scales
smaller than 0.5x, or when animating the scale factor.
This option is also the slowest.
This value results in a standard “Bicubic” algorithm which uses a 3rd order equation to smooth the abrupt transitions between pixels while preserving some of the sense of an edge and avoiding sharp peaks in the result.
Implementations§
Trait Implementations§
Source§impl Clone for FilterQuality
impl Clone for FilterQuality
impl Copy for FilterQuality
Source§impl Debug for FilterQuality
impl Debug for FilterQuality
Source§impl Display for FilterQuality
impl Display for FilterQuality
impl Eq for FilterQuality
Source§impl Hash for FilterQuality
impl Hash for FilterQuality
Source§impl PartialEq for FilterQuality
impl PartialEq for FilterQuality
impl StructuralPartialEq for FilterQuality
Auto Trait Implementations§
impl Forget for FilterQuality
impl Freeze for FilterQuality
impl Move for FilterQuality
impl RefUnwindSafe for FilterQuality
impl Send for FilterQuality
impl Sync for FilterQuality
impl Unpin for FilterQuality
impl UnsafeUnpin for FilterQuality
impl UnwindSafe for FilterQuality
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.