[][src]Crate iconwriter

A simple solution for encoding common icon file-formats, such as .ico and .icns.

This crate is mostly a wrapper for other libraries, unifying existing APIs into a single, cohesive interface.

IcoWriter serves as Iconiic's internal library.

Overview

An icon consists of a set of entries. An entry is simply an image that has a particular size. IcoWriter simply automates the process of re-scaling pictures and combining them into an icon.

Pictures are scaled using resampling filters, which are represented by functions that take a source image and a size and return a re-scaled image.

This allows the users of this crate to provide their custom resampling filters. Common resampling filters are provided in the resample module.

Examples

General Usage

This example is not tested
use iconwriter::*;
  
fn example() -> iconwriter::Result<()> {
    let icon = Ico::new();
 
    match SourceImage::from_path("image.svg") {
        Some(img) => icon.add_entry(resample::linear, &img, 32),
        None      => Ok(())
    }
}

Writing to a File

This example is not tested
use iconwriter::*;
use std::{io, fs::File};
  
fn example() -> io::Result<()> {
    let icon = PngSequence::new();
 
    /* Process the icon */
 
    let file = File::create("out.icns")?;
    icon.write(file)
}

Re-exports

pub extern crate image;
pub extern crate resvg;
pub use resvg::usvg;
pub use resvg::raqote;

Modules

resample

A collection of commonly used resampling filters.

Structs

Icns

A collection of entries stored in a single .icns file.

Ico

A collection of entries stored in a single .ico file.

PngSequence

A collection of images stored in a single .tar file.

Tree

A nodes tree container.

Enums

DynamicImage

A Dynamic Image

Error

The error type for operations of the Icon trait.

SourceImage

A representation of a source image.

Traits

GenericImage

A trait for manipulating images.

GenericImageView

Trait to inspect an image.

Icon

A generic representation of an icon encoder.

Type Definitions

Result
RgbaImage

Sendable Rgb + alpha channel image buffer

Size