[−][src]Enum icns::IconType
Types of icon elements that can be decoded as images or masks.
This type enumerates the kinds of IconElement
that can be decoded by this library; each IconType
corresponds to a
particular OSType
. The non-mask IconType
values
can also be used with the higher-level
IconFamily
methods to
encode and
decode complete icons
that consist of multiple IconElements
.
Variants
16x16 24-bit icon (without alpha).
16x16 8-bit alpha mask.
32x32 24-bit icon (without alpha).
32x32 8-bit alpha mask.
48x48 24-bit icon (without alpha).
48x48 8-bit alpha mask.
128x128 24-bit icon (without alpha).
128x128 8-bit alpha mask.
16x16 32-bit icon.
16x16 32-bit icon at 2x "retina" density (so, 32 by 32 pixels).
32x32 32-bit icon.
32x32 32-bit icon at 2x "retina" density (so, 64 by 64 pixels).
64x64 32-bit icon. (For whatever reason, the ICNS format has no corresponding type for a 64x64 icon at 2x "retina" density.)
128x128 32-bit icon.
128x128 32-bit icon at 2x "retina" density (so, 256 by 256 pixels).
256x256 32-bit icon.
256x256 32-bit icon at 2x "retina" density (so, 512 by 512 pixels).
512x512 32-bit icon.
512x512 32-bit icon at 2x "retina" density (so, 1024 by 1024 pixels).
Implementations
impl IconType
[src]
pub fn from_ostype(ostype: OSType) -> Option<IconType>
[src]
Get the icon type associated with the given OSType, if any.
pub fn from_pixel_size(width: u32, height: u32) -> Option<IconType>
[src]
Return a (non-mask) icon type that has the given pixel width/height, if any.
Examples
use icns::IconType; assert_eq!(IconType::from_pixel_size(48, 48), Some(IconType::RGB24_48x48)); assert_eq!(IconType::from_pixel_size(256, 256), Some(IconType::RGBA32_256x256)); assert_eq!(IconType::from_pixel_size(1024, 1024), Some(IconType::RGBA32_512x512_2x));
pub fn from_pixel_size_and_density(
width: u32,
height: u32,
density: u32
) -> Option<IconType>
[src]
width: u32,
height: u32,
density: u32
) -> Option<IconType>
Return a (non-mask) icon type that has the given pixel width/height and pixel density, if any.
Examples
use icns::IconType; assert_eq!(IconType::from_pixel_size_and_density(48, 48, 1), Some(IconType::RGB24_48x48)); assert_eq!(IconType::from_pixel_size_and_density(256, 256, 1), Some(IconType::RGBA32_256x256)); assert_eq!(IconType::from_pixel_size_and_density(256, 256, 2), Some(IconType::RGBA32_128x128_2x));
pub fn ostype(self) -> OSType
[src]
Get the OSType that represents this icon type.
pub fn is_mask(self) -> bool
[src]
Returns true if this is icon type is a mask for some other icon type.
Examples
use icns::IconType; assert!(!IconType::RGB24_16x16.is_mask()); assert!(IconType::Mask8_16x16.is_mask()); assert!(!IconType::RGBA32_16x16.is_mask());
pub fn mask_type(self) -> Option<IconType>
[src]
If this icon type has an associated mask type, returns that mask type;
if this is a mask icon type, or a non-mask icon type that has no
associated mask type, returns None
.
Examples
use icns::IconType; assert_eq!(IconType::RGB24_16x16.mask_type(), Some(IconType::Mask8_16x16)); assert_eq!(IconType::Mask8_16x16.mask_type(), None); assert_eq!(IconType::RGBA32_16x16.mask_type(), None);
pub fn pixel_width(self) -> u32
[src]
Returns the pixel data width of this icon type. Normally this is the same as the screen width, but for 2x "retina" density icons, this will be twice that value.
Examples
use icns::IconType; assert_eq!(IconType::Mask8_128x128.pixel_width(), 128); assert_eq!(IconType::RGBA32_256x256.pixel_width(), 256); assert_eq!(IconType::RGBA32_256x256_2x.pixel_width(), 512);
pub fn pixel_height(self) -> u32
[src]
Returns the pixel data height of this icon type. Normally this is the same as the screen height, but for 2x "retina" density icons, this will be twice that value.
Examples
use icns::IconType; assert_eq!(IconType::Mask8_128x128.pixel_height(), 128); assert_eq!(IconType::RGBA32_256x256.pixel_height(), 256); assert_eq!(IconType::RGBA32_256x256_2x.pixel_height(), 512);
pub fn pixel_density(self) -> u32
[src]
Returns the pixel density for this icon type -- that is, 2 for 2x "retina" density icons, or 1 for other icon types.
Examples
use icns::IconType; assert_eq!(IconType::Mask8_128x128.pixel_density(), 1); assert_eq!(IconType::RGBA32_256x256.pixel_density(), 1); assert_eq!(IconType::RGBA32_256x256_2x.pixel_density(), 2);
pub fn screen_width(self) -> u32
[src]
Returns the screen width of this icon type. Normally this is the same as the pixel width, but for 2x "retina" density icons, this will be half that value.
Examples
use icns::IconType; assert_eq!(IconType::Mask8_128x128.screen_width(), 128); assert_eq!(IconType::RGBA32_256x256.screen_width(), 256); assert_eq!(IconType::RGBA32_256x256_2x.screen_width(), 256);
pub fn screen_height(self) -> u32
[src]
Returns the screen height of this icon type. Normally this is the same as the pixel height, but for 2x "retina" density icons, this will be half that value.
Examples
use icns::IconType; assert_eq!(IconType::Mask8_128x128.screen_height(), 128); assert_eq!(IconType::RGBA32_256x256.screen_height(), 256); assert_eq!(IconType::RGBA32_256x256_2x.screen_height(), 256);
pub fn encoding(self) -> Encoding
[src]
Returns the encoding used within an ICNS file for this icon type.
Trait Implementations
impl Clone for IconType
[src]
impl Copy for IconType
[src]
impl Debug for IconType
[src]
impl Eq for IconType
[src]
impl Hash for IconType
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<IconType> for IconType
[src]
impl StructuralEq for IconType
[src]
impl StructuralPartialEq for IconType
[src]
Auto Trait Implementations
impl RefUnwindSafe for IconType
impl Send for IconType
impl Sync for IconType
impl Unpin for IconType
impl UnwindSafe for IconType
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,