Enum IconFormats

Source
pub enum IconFormats {
Show 21 variants IS32, IL32, IH32, IT32, S8MK, L8MK, H8MK, T8MK, IC04, IC05, IC07, IC08, IC09, IC10, IC11, IC12, IC13, IC14, ICP4, ICP5, ICP6,
}
Expand description

§ICNS Types

These are the types of icons that can be stored in an ICNS file. Not all of them are included, but the most common ones are. The full list can be found at Wikipedia https://en.wikipedia.org/wiki/Apple_Icon_Image_format#Icon_types

Variants§

§

IS32

  • OSName: is32
  • Size: 16x16
  • Format: 24-bit RGB icon
  • OS: System 8.5+
§

IL32

  • OSName: il32
  • Size: 32x32
  • Format: 24-bit RGB icon
  • OS: System 8.5+
§

IH32

  • OSName: ih32
  • Size: 48x48
  • Format: 24-bit RGB icon
  • OS: System 8.5+
§

IT32

  • OSName: it32
  • Size: 128x128
  • Format: 24-bit RGB icon
  • OS: Mac OS X 10.0+
§

S8MK

  • OSName: s8mk
  • Size: 16x12
  • Format: 8-bit mask
  • OS: System 8.5+
§

L8MK

  • OSName: l8mk
  • Size: 32x32
  • Format: 8-bit mask
  • OS: System 8.5+
§

H8MK

  • OSName: h8mk
  • Size: 48x48
  • Format: 8-bit mask
  • OS: System 8.5+
§

T8MK

  • OSName: t8mk
  • Size: 128x128
  • Format: 8-bit mask
  • OS: Mac OS X 10.0+
§

IC04

  • OSName: ic04
  • Size: 16x16
  • Format: ARGB
  • OS: N/A
§

IC05

  • OSName: ic05
  • Size: 32x32
  • Format: ARGB
  • OS: N/A
§

IC07

  • OSName: ic07
  • Size: 128x128
  • Format: PNG
  • OS: Mac OS X 10.7+
§

IC08

  • OSName: ic08
  • Size: 256x256
  • Format: PNG
  • OS: Mac OS X 10.5+
§

IC09

  • OSName: ic09
  • Size: 512x512
  • Format: PNG
  • OS: Mac OS X 10.5+
§

IC10

  • OSName: ic10
  • Size: 1024x1024
  • Format: PNG
  • OS: Mac OS X 10.7+
§

IC11

  • OSName: ic11
  • Size: 32x32
  • Format: PNG
  • OS: Mac OS X 10.8+
§

IC12

  • OSName: ic12
  • Size: 64x64
  • Format: PNG
  • OS: Mac OS X 10.8+
§

IC13

  • OSName: ic13
  • Size: 256x256
  • Format: PNG
  • OS: Mac OS X 10.8+
§

IC14

  • OSName: ic14
  • Size: 512x512
  • Format: PNG
  • OS: Mac OS X 10.8+
§

ICP4

  • OSName: icp4
  • Size: 16x16
  • Format: PNG
  • OS: Mac OS X 10.7+
§

ICP5

  • OSName: icp5
  • Size: 32x32
  • Format: PNG
  • OS: Mac OS X 10.7+
§

ICP6

  • OSName: icp6
  • Size: 64x64
  • Format: PNG
  • OS: Mac OS X 10.7+

Implementations§

Source§

impl IconFormats

Source

pub fn recommended() -> Vec<IconFormats>

Get the default recommended format for the icon type.

Examples found in repository?
examples/encode.rs (line 20)
6fn main() -> std::io::Result<()> {
7    // Open the image
8    let image = match open("example.png") {
9        Ok(image) => image,
10        Err(e) => {
11            println!("Error opening file: {}", e);
12            return Ok(());
13        }
14    };
15
16    // Create the encoder
17    let mut encoder = IcnsEncoder::new();
18
19    encoder.data(image);
20    encoder.formats(IconFormats::recommended());
21
22    // Encode the image
23    let data = match encoder.build() {
24        Ok(data) => data,
25        Err(e) => {
26            println!("Error encoding image: {}", e);
27            return Ok(());
28        }
29    };
30
31    // Write data to file
32    let mut file = File::create("example.icns")?;
33    file.write_all(&data)?;
34
35    Ok(())
36}
Source

pub fn get_format(&self) -> FileFormat

Source

pub fn get_size(&self) -> usize

Source

pub fn get_bytes(&self) -> [u8; 4]

Trait Implementations§

Source§

impl Clone for IconFormats

Source§

fn clone(&self) -> IconFormats

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IconFormats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for IconFormats

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for IconFormats

Source§

fn eq(&self, other: &IconFormats) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for IconFormats

Source§

impl Eq for IconFormats

Source§

impl StructuralPartialEq for IconFormats

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.