Struct tauri_icns::IconFamily
source · [−]pub struct IconFamily {
pub elements: Vec<IconElement>,
}
Expand description
A set of icons stored in a single ICNS file.
Fields
elements: Vec<IconElement>
The icon elements stored in the ICNS file.
Implementations
sourceimpl IconFamily
impl IconFamily
sourcepub fn new() -> IconFamily
pub fn new() -> IconFamily
Creates a new, empty icon family.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the icon family contains no icons nor any other elements.
sourcepub fn add_icon(&mut self, image: &Image) -> Result<()>
pub fn add_icon(&mut self, image: &Image) -> Result<()>
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.
sourcepub fn add_icon_with_type(
&mut self,
image: &Image,
icon_type: IconType
) -> Result<()>
pub fn add_icon_with_type(
&mut self,
image: &Image,
icon_type: IconType
) -> Result<()>
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.
sourcepub fn available_icons(&self) -> Vec<IconType>
pub fn available_icons(&self) -> Vec<IconType>
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.
sourcepub fn has_icon_with_type(&self, icon_type: IconType) -> bool
pub fn has_icon_with_type(&self, icon_type: IconType) -> bool
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).
sourcepub fn get_icon_with_type(&self, icon_type: IconType) -> Result<Image>
pub fn get_icon_with_type(&self, icon_type: IconType) -> Result<Image>
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.
sourcepub fn read<R: Read>(reader: R) -> Result<IconFamily>
pub fn read<R: Read>(reader: R) -> Result<IconFamily>
Reads an icon family from an ICNS file.
sourcepub fn total_length(&self) -> u32
pub fn total_length(&self) -> u32
Returns the encoded length of the file, in bytes, including the length of the header.
Auto Trait Implementations
impl RefUnwindSafe for IconFamily
impl Send for IconFamily
impl Sync for IconFamily
impl Unpin for IconFamily
impl UnwindSafe for IconFamily
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more