Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add anti-aliasing to corners #232 #234

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
JoostScheffer committed May 20, 2023
commit a111c4aa93db68ab565b194d47d6e3d032efe91e
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added example/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions example/example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fn factorial(n: u64) -> u64 {
match n {
0 => 1,
_ => n * factorial(n - 1),
}
}

fn main() {
println!("10! = {}", factorial(10));
}
1 change: 1 addition & 0 deletions example/example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
silicon example.rs -o example.png
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down