Skip to content
Projects

orhanbalci/rough-rs has 57 GitHub stars and 11 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-16 00:02 UTC. Last push 2026-11-04.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
Update delayed
in 1 month
Update delayed

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

draw handy sketches from your rust applications

Creative & Media

README.md

Original

rough-rs

rustroughlogo

roughtext

This repository contains a set of crates which in result resembles functionality in Rough.js

πŸš€ Quick Start

roughr generates the sketchy shapes; an adapter crate draws them with your graphics library. With rough_tiny_skia, drawing to a PNG looks like this:

[dependencies]
roughr = "0.14"
rough_tiny_skia = "0.14"
palette = "0.7"
tiny-skia = "0.11"
use palette::Srgba;
use rough_tiny_skia::SkiaGenerator;
use roughr::core::{FillStyle, OptionsBuilder};
use tiny_skia::Pixmap;

fn main() {
    let options = OptionsBuilder::default()
        .stroke(Srgba::from_components((114u8, 87u8, 82u8, 255u8)).into_format())
        .fill(Srgba::from_components((254u8, 246u8, 201u8, 255u8)).into_format())
        .fill_style(FillStyle::Hachure)
        .fill_weight(1.0)
        .roughness(1.5)
        .build()
        .unwrap();
    let generator = SkiaGenerator::new(options);

    let mut pixmap = Pixmap::new(300, 200).unwrap();
    pixmap.fill(tiny_skia::Color::from_rgba8(150, 192, 183, 255));
    generator.rectangle::<f32>(50.0, 50.0, 200.0, 100.0).draw(&mut pixmap.as_mut());
    generator.circle::<f32>(150.0, 100.0, 60.0).draw(&mut pixmap.as_mut());
    pixmap.save_png("sketch.png").unwrap();
}

The other adapters work the same way: build Options, create the adapter's generator, then draw the shapes it returns.

πŸŽ›οΈ Options

Options controls how every shape is sketched. All fields have defaults, so set only what you want to change. Each image draws the same shape with one option changed, from left to right.

roughness

fill_style

All options

bowing

max_randomness_offset

stroke_width

disable_multi_stroke

preserve_vertices

stroke_line_dash

seed

curve_fitting

curve_step_count

curve_tightness

simplification

hachure_angle

hachure_gap

fill_weight

dash_offset

dash_gap

zigzag_offset

disable_multi_stroke_fill

Every option and its default is described in the Options docs. To try them interactively, run the drawing_app example: cargo run -p rough_iced --example drawing_app.

🧾 Drawing SVG Files

roughr can sketch SVG path data, and with usvg whole SVG files, including shapes like <rect> and <circle>, transforms and colors:

svg

cargo run -p rough_tiny_skia --example svg -- input.svg output.png

See the svg example and the roughr docs for how it works.

πŸ“¦ Crate Versions

The table below shows the current version of each crate and the versions of the other workspace crates it depends on. A β€” means there is no dependency.

Crate Version points_on_curve svg_path_ops roughr
points_on_curve 0.7.0 β€” β€” β€”
svg_path_ops 0.12.0 β€” β€” β€”
roughr 0.14.0 0.7.0 0.12.0 β€”
rough_piet 0.15.0 β€” 0.12.0 0.14.0
rough_tiny_skia 0.14.1 β€” 0.12.0 0.14.0
rough_vello 0.16.0 β€” 0.12.0 0.14.0
rough_iced 0.15.0 β€” 0.12.0 0.14.0
rough_plotters_svg 0.3.0 β€” β€” 0.14.0

Dependency requirements use Cargo's default caret semantics, so a requirement of 0.11.0 resolves to any 0.11.x β€” the svg_path_ops 0.11.1 bug-fix release is picked up automatically without republishing the dependent crates.

πŸ“ License

Licensed under MIT License (LICENSE).

🚧 Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.