Crates.io | stackblur |
lib.rs | stackblur |
version | 0.1.0 |
source | src |
created_at | 2021-05-15 04:53:05.550394 |
updated_at | 2021-05-15 04:53:05.550394 |
description | A fast approximation of gaussian blur |
homepage | https://github.com/owenthewizard/stackblur |
repository | https://github.com/owenthewizard/stackblur.git |
max_upload_size | |
id | 397706 |
size | 29,687 |
Fast gaussian blur approximation.
A Rust implementation of StackBlur
by
Mario Klingemann. Very fast and accurate
gaussian blur approximation. Based off of the Java implementation by Enrique López Mañas, licensed
under Apache 2.0.
stackblur is currently under heavy development, and may contain breaking
changes between releases. Releases will be stabilized for 1.0.0
.
use std::num::{NonZeroU8, NonZeroUsize};
use stackblur::blur;
const RED: u32 = 0xffff0000;
const GREEN: u32 = 0xff00ff00;
const BLUE: u32 = 0xff0000ff;
// load your image, u32 RGBA pixels
let mut pixels: Vec<u32> = vec![
RED, GREEN, GREEN, RED,
GREEN, RED, BLUE, GREEN,
GREEN, BLUE, RED, GREEN,
RED, GREEN, GREEN, RED,
];
// blur!
blur(
&mut pixels,
NonZeroUsize::new(4).unwrap(),
NonZeroUsize::new(4).unwrap(),
NonZeroU8::new(1).unwrap(),
);
All examples blurred in both directions with radius 15.
Add RGBA PNGs to samples/input
and run
cargo run --release --example samples
to see your own!
Obey rustfmt
and Rust 2018 conventions, as well as clippy
lints.
Pull requests are always welcome.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed under the terms of both the MIT License and the Apache License (Version 2.0).
This project adheres to Semantic Versioning.
Changes are documented in the Changelog.
See the tags for available releases.
See LICENSE-APACHE and LICENSE-MIT for details.
Want your name here? Contact me or open a PR!