Struct png::ScaledFloat
source · pub struct ScaledFloat(_);
Expand description
An unsigned integer scaled version of a floating point value, equivalent to an integer quotient with fixed denominator (100_000)).
Implementations§
source§impl ScaledFloat
impl ScaledFloat
sourcepub fn in_range(value: f32) -> bool
pub fn in_range(value: f32) -> bool
Gets whether the value is within the clamped range of this type.
sourcepub fn exact(value: f32) -> bool
pub fn exact(value: f32) -> bool
Gets whether the value can be exactly converted in round-trip.
sourcepub fn new(value: f32) -> Self
pub fn new(value: f32) -> Self
Slightly inaccurate scaling and quantization. Clamps the value into the representable range if it is negative or too large.
sourcepub fn from_scaled(val: u32) -> Self
pub fn from_scaled(val: u32) -> Self
Fully accurate construction from a value scaled as per specification.
sourcepub fn into_scaled(self) -> u32
pub fn into_scaled(self) -> u32
Get the accurate encoded value.
sourcepub fn into_value(self) -> f32
pub fn into_value(self) -> f32
Get the unscaled value as a floating point.
Trait Implementations§
source§impl Clone for ScaledFloat
impl Clone for ScaledFloat
source§fn clone(&self) -> ScaledFloat
fn clone(&self) -> ScaledFloat
Returns a copy 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 ScaledFloat
impl Debug for ScaledFloat
source§impl PartialEq<ScaledFloat> for ScaledFloat
impl PartialEq<ScaledFloat> for ScaledFloat
source§fn eq(&self, other: &ScaledFloat) -> bool
fn eq(&self, other: &ScaledFloat) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.