Skip to content

Commit 9dda5f6

Browse files
committed
Fix format for inkscape
1 parent fcee6d7 commit 9dda5f6

File tree

16 files changed

+90
-112
lines changed

16 files changed

+90
-112
lines changed

.github/workflows/rust-test.yml renamed to .github/workflows/ci.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ concurrency:
33
group: ${{ github.workflow }}-${{ github.ref }}
44
cancel-in-progress: true
55
on:
6-
pull_request:
7-
paths:
8-
- icns-rs/**
6+
pull_request: null
97
push: null
108
workflow_dispatch: null
119
jobs:
@@ -20,14 +18,10 @@ jobs:
2018
toolchain: stable
2119
override: true
2220
- name: Run tests
23-
working-directory: ./icns-rs
2421
run: cargo test
2522
rustfmt:
2623
name: Rustfmt
2724
runs-on: ubuntu-latest
28-
defaults:
29-
run:
30-
working-directory: ./icns-rs
3125
steps:
3226
- uses: actions/checkout@v3
3327
- name: Setup Rust
@@ -37,5 +31,4 @@ jobs:
3731
override: true
3832
components: rustfmt
3933
- name: Run rustfmt
40-
working-directory: ./icns-rs
4134
run: cargo fmt -- --check

.github/workflows/rust-publish.yml renamed to .github/workflows/publish.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Cargo Publish
22
on:
33
push:
4-
tags:
5-
- rust-*
4+
tags: '*'
65
workflow_dispatch: null
76
jobs:
87
publish:
@@ -16,5 +15,4 @@ jobs:
1615
toolchain: stable
1716
override: true
1817
- name: Publish
19-
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}
20-
working-directory: ./icns-rs
18+
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Cargo
2+
target/
3+
Cargo.lock

icns-rs/Cargo.toml renamed to Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
name = "icns-rs"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
description = "A library for reading and writing Apple Icon Image (.icns) files."
66
license = "LGPL-3.0-or-later"
77
homepage = "https://github.com/JoshuaBrest/icns/tree/master/icns-rs"
88
documentation = "https://docs.rs/icns-rs"
9-
repository = "https://github.com/JoshuaBrest/icns"
9+
repository = "https://github.com/JoshuaBrest/icns-rs"
1010
catagories = ["image"]
1111
keywords = ["icns", "image", "apple", "icon"]
1212

README.md

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,74 @@
1-
# ICNS
1+
# icns-rs
22

3-
This repository contains a multiple libraries for reading and writing ICNS files.
4-
- Rust: [icns-rs](icns-rs/README.md)
3+
The ICNS format is a file format used by Apple to store icons for macOS applications. This crate provides a simple API for reading and (and soon)writing ICNS files.
4+
5+
## Roadmap
6+
7+
- [x] Write ICNS files
8+
- [ ] Read ICNS files
9+
10+
## Usage
11+
12+
Here's a simple example of how to read an ICNS file:
13+
14+
> You can find this example in `examples/encode.rs` or run it with:
15+
> ```sh
16+
> cargo run --example encode
17+
> ```
18+
19+
```rust
20+
use std::fs::File;
21+
use std::io::prelude::*;
22+
use image::open;
23+
use icns_rs::{IcnsEncoder, IconFormats};
24+
25+
fn main() -> std::io::Result<()> {
26+
// Open the image
27+
let image = match open("example.png") {
28+
Ok(image) => image,
29+
Err(e) => {
30+
println!("Error opening file: {}", e);
31+
return Ok(());
32+
}
33+
};
34+
35+
// Create the encoder
36+
let mut encoder = IcnsEncoder::new();
37+
38+
encoder.data(image);
39+
encoder.formats(IconFormats::recommended());
40+
41+
// Encode the image
42+
let data = match encoder.build() {
43+
Ok(data) => data,
44+
Err(e) => {
45+
println!("Error encoding image: {}", e);
46+
return Ok(());
47+
}
48+
};
49+
50+
// Write data to file
51+
let mut file = File::create("example.icns")?;
52+
file.write_all(&data)?;
53+
54+
Ok(())
55+
}
56+
```
57+
58+
## License
59+
60+
This project is licensed under the GPLv3 license. See the [LICENSE](LICENSE) file for more details.
561

662
## Contributing
763

864
Contributions are welcome! Feel free to open an issue or submit a pull request.
965

10-
## License
66+
## Acknowledgements
67+
68+
This project is heavily inspired by:
69+
- The Python package: [icnsutil](https://github.com/relikd/icnsutil/)
70+
- The JavaScript package: [@fiahfy/icns](https://github.com/fiahfy/icns/)
71+
- The JavaScript PackBits implementation: [@fiahfy/packbits](https://github.com/fiahfy/packbits/)
72+
- The Wikipedia page: [Wikipedia: Apple Icon Image Format](https://en.wikipedia.org/wiki/Apple_Icon_Image_format#Icon_types)
1173

12-
This project is licensed under the LGPLv3 license. See the [LICENSE](/LICENSE) file for more details.
74+
When I started building this, I didn't know there already was a ICNS lib for rust, but, after looking at it, it was not up to my standards because of the lack of ARGB, RGB, and, Mask support. I wanted to create a modern package that was easy to use and had a simple API. I also wanted to make sure that it was well documented and had a good test suite. I hope you enjoy using this package as much as I enjoyed making it!.
188 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.

icns-rs/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

icns-rs/README.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)