graphics-rs

Crates.iographics-rs
lib.rsgraphics-rs
version0.0.10
sourcesrc
created_at2024-04-11 13:40:40.503139
updated_at2024-04-20 06:15:02.25797
descriptionA simple, extendable, CPU based 2D graphics library. Also supports CloudPoints and rotation!
homepagehttps://github.com/muhammadmnorouzi/graphics-rs
repositoryhttps://github.com/muhammadmnorouzi/graphics-rs
max_upload_size
id1204932
size94,039
Muhammad M. Norouzi (muhammadmnorouzi)

documentation

https://docs.rs/graphics-rs

README

A simple, extendable, CPU based 2D graphics library. Also supports CloudPoints and rotation!

Draw simple shapes with the least effort needed.

const WIDTH: usize = 800;
const HEIGHT: usize = 800;

fn main() -> Result<(), String> {
    let antialiasing = false;
    let antialiasing_resolution = 1;
    let fill_color = Some(color::BLACK);
    
    let mut canvas =
        SimpleCanvas::new(
            WIDTH, 
            HEIGHT, 
            fill_color, 
            antialiasing, 
            antialiasing_resolution);

    canvas.change_color(color::BLACK);
    canvas.fill();

    canvas.change_color(color::GREEN);
    canvas.draw_shape(&mut Circle::new(WIDTH /2 , HEIGHT / 2, 100));

    canvas
        .save("canvas.ppm")
        .map_err(|error| error.to_string())?;

    Ok(())
}
Commit count: 82

cargo fmt