Skip to main content

FilterQuality

Enum FilterQuality 

Source
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§

Source§

impl FilterQuality

Source

pub fn to_valo(self) -> Sampling

How valo samples an image at this quality: the engine’s ImageFilter::SamplingFromIndex as Impeller’s ToSamplerDescriptor turns it into a sampler, clamped at the edges as ReusableFragmentShader::SetImageSampler clamps them. Impeller samples High, the engine’s cubic, as it samples Medium.

Trait Implementations§

Source§

impl Clone for FilterQuality

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FilterQuality

Source§

impl Debug for FilterQuality

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FilterQuality

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FilterQuality

Source§

impl Hash for FilterQuality

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FilterQuality

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FilterQuality

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,