pub enum SimulationMode {
Accurate,
DownsampleOnly,
}Expand description
How to handle image scaling during viewing simulation.
When calculating perceptual metrics, we need to simulate how images appear on different devices. This affects whether we resample images or adjust metric thresholds.
Variants§
Accurate
Simulate browser behavior exactly.
- Undersized images (ratio < 1): Upsample to simulate browser upscaling
- Oversized images (ratio > 1): Downsample to simulate browser downscaling
This matches real-world viewing but introduces resampling artifacts that may affect metric accuracy.
DownsampleOnly
Never upsample, only downsample.
- Undersized images: Keep at native resolution, adjust effective PPD
- Oversized images: Downsample normally
This avoids introducing upsampling artifacts in the simulation. The effective PPD is adjusted to account for the missing upscale, making metric thresholds more lenient for undersized images.
Trait Implementations§
Source§impl Clone for SimulationMode
impl Clone for SimulationMode
Source§fn clone(&self) -> SimulationMode
fn clone(&self) -> SimulationMode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimulationMode
impl Debug for SimulationMode
Source§impl Default for SimulationMode
impl Default for SimulationMode
Source§fn default() -> SimulationMode
fn default() -> SimulationMode
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SimulationMode
impl<'de> Deserialize<'de> for SimulationMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SimulationMode
impl PartialEq for SimulationMode
Source§impl Serialize for SimulationMode
impl Serialize for SimulationMode
impl Copy for SimulationMode
impl Eq for SimulationMode
impl StructuralPartialEq for SimulationMode
Auto Trait Implementations§
impl Freeze for SimulationMode
impl RefUnwindSafe for SimulationMode
impl Send for SimulationMode
impl Sync for SimulationMode
impl Unpin for SimulationMode
impl UnwindSafe for SimulationMode
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more