Crates.io | rasterization |
lib.rs | rasterization |
version | 0.2.0 |
source | src |
created_at | 2024-09-08 19:27:43.945465 |
updated_at | 2024-09-16 16:51:59.839081 |
description | Iterator and iterator adapters for rasterizing a circle and its parts. |
homepage | https://github.com/pic16f877ccs/rasterization |
repository | https://github.com/pic16f877ccs/rasterization |
max_upload_size | |
id | 1368479 |
size | 260,207 |
This crate provides iterators and adapters for generating sequential coordinates for various shapes of a circle or its parts using Bresenham's algorithm.
Visual examples of different shapes:
Here's how to use the crate:
use rasterization::{Rasterization, SemicircleFilled, DirectionGradient::Bottom};
let radius = 128_usize;
let iter = SemicircleFilled::<i32>::new(radius)
.circle()
.offset(radius as i32, radius as i32);
let iter = SemicircleFilled::<i32>::new(radius)
.circle_long(-128, 0)
.offset((radius * 2) as i32, radius as i32);
let iter = SemicircleFilled::<i32>::new(radius)
.semicircle_top()
.offset(radius as i32, radius as i32);
let iter = SemicircleFilled::<i32>::new(radius)
.semicircle_bottom()
.offset(radius as i32, radius as i32);
let iter = SemicircleFilled::<i32>::new(radius)
.circle()
.offset(radius as i32, radius as i32)
.gradient(radius as i32, radius * 2, Bottom(colorous::BROWN_GREEN));
Add the following to your Cargo.toml:
[dependencies]
rasterization = "0.2.0"
This project is licensed under the MIT License.