fix missing -1 for top right corner, add example directory and update picture to readme

I also added example.sh, I think it could also be excluded.
This commit is contained in:
JScheffer 2023-05-20 19:48:45 +02:00
parent 329e58c45a
commit a111c4aa93
5 changed files with 13 additions and 2 deletions

View File

@ -9,7 +9,7 @@ Silicon is an alternative to [Carbon](https://github.com/dawnlabs/carbon) implem
It can render your source code into a beautiful image.
<img width="66%" src="http://storage.aloxaf.cn/silicon.png?v=2">
<img width="66%" src="example/example.png">
## Why Silicon

BIN
example/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

10
example/example.rs Normal file
View File

@ -0,0 +1,10 @@
fn factorial(n: u64) -> u64 {
match n {
0 => 1,
_ => n * factorial(n - 1),
}
}
fn main() {
println!("10! = {}", factorial(10));
}

1
example/example.sh Normal file
View File

@ -0,0 +1 @@
silicon example.rs -o example.png

View File

@ -303,7 +303,7 @@ pub(crate) fn round_corner(image: &mut DynamicImage, radius: u32) {
image.copy_from(&*part, 0, 0).unwrap();
// top right
let part = crop_imm(&circle, radius + 1, 1, radius, radius);
let part = crop_imm(&circle, radius + 1, 1, radius, radius - 1);
image.copy_from(&*part, width - radius, 0).unwrap();
// bottom left