pub struct PixelDensity {
pub density: (u16, u16),
pub unit: PixelDensityUnit,
}
Expand description
Represents the pixel density of an image
For example, a 300 DPI image is represented by:
use image::jpeg::*;
let hdpi = PixelDensity::dpi(300);
assert_eq!(hdpi, PixelDensity {density: (300,300), unit: PixelDensityUnit::Inches})
Fields§
§density: (u16, u16)
A couple of values for (Xdensity, Ydensity)
unit: PixelDensityUnit
The unit in which the density is measured
Implementations§
source§impl PixelDensity
impl PixelDensity
sourcepub fn dpi(density: u16) -> PixelDensity
pub fn dpi(density: u16) -> PixelDensity
Creates the most common pixel density type: the horizontal and the vertical density are equal, and measured in pixels per inch.
Trait Implementations§
source§impl Clone for PixelDensity
impl Clone for PixelDensity
source§fn clone(&self) -> PixelDensity
fn clone(&self) -> PixelDensity
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 PixelDensity
impl Debug for PixelDensity
source§impl Default for PixelDensity
impl Default for PixelDensity
source§fn default() -> PixelDensity
fn default() -> PixelDensity
Returns a pixel density with a pixel aspect ratio of 1
source§impl PartialEq for PixelDensity
impl PartialEq for PixelDensity
source§fn eq(&self, other: &PixelDensity) -> bool
fn eq(&self, other: &PixelDensity) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for PixelDensity
impl Eq for PixelDensity
impl StructuralEq for PixelDensity
impl StructuralPartialEq for PixelDensity
Auto Trait Implementations§
impl RefUnwindSafe for PixelDensity
impl Send for PixelDensity
impl Sync for PixelDensity
impl Unpin for PixelDensity
impl UnwindSafe for PixelDensity
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified
method
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default
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, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
Convert into T with values clamped to the color defined bounds Read more
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined range,
otherwise an
OutOfBounds
error is returned which contains the unclamped color. Read moresource§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
Compare self to
key
and return true
if they are equal.