Struct PixelDensity
pub struct PixelDensity { pub density: (u16, u16), pub unit: PixelDensityUnit }
Represents the pixel density of an image
For example, a 300 DPI image is represented by:
use image::codecs::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: PixelDensityUnitThe unit in which the density is measured
Implementations
impl PixelDensity
fn dpi(density: u16) -> SelfCreates the most common pixel density type: the horizontal and the vertical density are equal, and measured in pixels per inch.
Trait Implementations
impl Clone for PixelDensity
fn clone(&self) -> Self
impl Copy for PixelDensity
impl Debug for PixelDensity
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for PixelDensity
fn default() -> SelfReturns a pixel density with a pixel aspect ratio of 1
impl Eq for PixelDensity
impl PartialEq for PixelDensity
fn eq(&self, other: &Self) -> bool