You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
thumbnailer/src/size.rs

24 lines
575 B
Rust

/// Represents fixed sizes of a thumbnail
#[derive(Clone, Copy, Debug)]
pub enum ThumbnailSize {
Icon,
Small,
Medium,
Large,
Larger,
Custom((u32, u32))
}
impl ThumbnailSize {
pub fn dimensions(&self) -> (u32, u32) {
match self {
ThumbnailSize::Icon => (64, 64),
ThumbnailSize::Small => (128, 128),
ThumbnailSize::Medium => (256, 256),
ThumbnailSize::Large => (512, 512),
ThumbnailSize::Larger => (1024, 1024),
ThumbnailSize::Custom(size) => *size,
}
}
}