pub struct ImageInfo {
pub format: ImageFormat,
pub width_px: u32,
pub height_px: u32,
pub bits_per_component: u8,
pub color_space: String,
pub data: Vec<u8>,
}Expand description
Image information
Fields§
§format: ImageFormatImage format
width_px: u32Image width in pixels
height_px: u32Image height in pixels
bits_per_component: u8Bits per component (typically 8)
color_space: StringColor space (DeviceRGB, DeviceGray, etc.)
data: Vec<u8>Raw image data
Implementations§
Source§impl ImageInfo
impl ImageInfo
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self>
pub fn from_bytes(data: &[u8]) -> Result<Self>
Create image info from raw data
Sourcepub fn calculate_display_size(
&self,
max_width: Length,
max_height: Length,
) -> (Length, Length)
pub fn calculate_display_size( &self, max_width: Length, max_height: Length, ) -> (Length, Length)
Calculate display dimensions maintaining aspect ratio
Sourcepub fn dpi_at_size(&self, display_width: Length) -> f64
pub fn dpi_at_size(&self, display_width: Length) -> f64
Get DPI assuming standard 72 DPI display
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageInfo
impl RefUnwindSafe for ImageInfo
impl Send for ImageInfo
impl Sync for ImageInfo
impl Unpin for ImageInfo
impl UnsafeUnpin for ImageInfo
impl UnwindSafe for ImageInfo
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