NOTE: Nanachi is still buggy and the API will changed!
Generated by cargo run --release --example nanachi
Basic usage example is following:
``` rust use image::RgbaImage; use nanachi::{ compositor, context::{Context, FillStyle}, fillcolor, fillrule, path_builder::PathBuilder, pixel::Rgba, };
let (width, height) = (512, 512);
// Make a Context let mut context = Context::frompixel(width, height, Rgba([1.0, 1.0, 1.0, 1.0])).highquality();
// Make a Path let mut builder = PathBuilder::new(); builder.moveto(100.0, 100.0); builder.lineto(200.0, 100.0); builder.lineto(200.0, 200.0); builder.lineto(100.0, 200.0); builder.close(); let path = builder.end();
// Make a FillStyle for filling let fillstyle = FillStyle::new( fillcolor::Solid::new(Rgba([1.0, 0.0, 0.0, 0.7])), compositor::SrcOver, fill_rule::NonZero, );
// Fill the path context.fill(&path, &fill_style);
// Make a FillStyle for stroking let fillstyle = FillStyle::new( fillcolor::Solid::new(Rgba([0.0, 0.0, 1.0, 1.0])), compositor::SrcOver, fill_rule::NonZero, );
// Stroke the path context.stroke(&path, &fill_style, 8.0);
// Save the image let img: RgbaImage = (&context.image).into(); img.save("./basic.png").unwrap(); ```
Copyright (c) 2020 carrotflakes (carrotflakes@gmail.com)
Licensed under the MIT License.