[][src]Struct icns::IconFamily

pub struct IconFamily {
    pub elements: Vec<IconElement>,
}

A set of icons stored in a single ICNS file.

Fields

elements: Vec<IconElement>

The icon elements stored in the ICNS file.

Implementations

impl IconFamily[src]

pub fn new() -> IconFamily[src]

Creates a new, empty icon family.

pub fn is_empty(&self) -> bool[src]

Returns true if the icon family contains no icons nor any other elements.

pub fn add_icon(&mut self, image: &Image) -> Result<()>[src]

Encodes the image into the family, automatically choosing an appropriate icon type based on the dimensions of the image. Returns an error if there is no supported icon type matching the image dimensions.

pub fn add_icon_with_type(
    &mut self,
    image: &Image,
    icon_type: IconType
) -> Result<()>
[src]

Encodes the image into the family using the given icon type. If the selected type has an associated mask type, the image mask will also be added to the family. Returns an error if the image has the wrong dimensions for the selected type.

pub fn available_icons(&self) -> Vec<IconType>[src]

Returns a list of all (non-mask) icon types for which the icon family contains the necessary element(s) for a complete icon image (including alpha channel). These icon types can be passed to the get_icon_with_type method to decode the icons.

pub fn has_icon_with_type(&self, icon_type: IconType) -> bool[src]

Determines whether the icon family contains a complete icon with the given type (including the mask, if the given icon type has an associated mask type).

pub fn get_icon_with_type(&self, icon_type: IconType) -> Result<Image>[src]

Decodes an image from the family with the given icon type. If the selected type has an associated mask type, the two elements will decoded together into a single image. Returns an error if the element(s) for the selected type are not present in the icon family, or the if the encoded data is malformed.

pub fn read<R: Read>(reader: R) -> Result<IconFamily>[src]

Reads an icon family from an ICNS file.

pub fn write<W: Write>(&self, writer: W) -> Result<()>[src]

Writes the icon family to an ICNS file.

pub fn total_length(&self) -> u32[src]

Returns the encoded length of the file, in bytes, including the length of the header.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.