Ikon
A robust, flexible framework for creating encoders and decoders for various icon formats.
Overview
An icon consists of a map between keys and images. An entry is a key-value pair contained in an icon.
Ikon simply automates the process of re-scaling images, creating entries and combining them into an icon.
Keys
Each icon format is associated with a particular key type, which determines how entries are labeled. Each key can only be associated with a single image.
For example, icon formats that only differentiate entries by the dimensions of their associated
images are labeled by positive integers, such as the .ico
and .icns
file-formats.
On the other hand, icon formats that distinguish their entries by path, such as FreeDesktop icon themes , are labeled by path.
Note that, since the dimensions of the images contained in an entry are dictated by their
associated entries, every key must be convertible to a positive integers. Therefore, all
key types are required to implement AsSize
.
Resampling
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.
Support
Ikon uses image
for raster graphics manipulations and
resvg
with the raqote
backend
for svg
rasterization.
Note that some file formats supported by image
were explicitly left out of ikon
because
they were considered irrelevant to the library's domain.
Format | Supported? |
---|---|
png |
All supported color types |
jpeg |
Baseline and progressive |
gif |
Yes |
bmp |
Yes |
webp |
Lossy(Luma channel only) |
svg |
Static SVG Full 1.1 |
Build Requirements
Ikon relies on harfbuzz_rs
, wich means
CMake is required to be installed for it build.
License
Licensed under MIT license(LICENSE-MIT or http://opensource.org/licenses/MIT).
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.
Feel free to help out! Contributions are welcomed 😃