|0.3.2||Aug 30, 2022|
|0.2.9||Jul 28, 2022|
|0.1.10||Feb 28, 2022|
|0.1.8||Dec 22, 2021|
|0.1.2||Apr 30, 2021|
#27 in Rendering
75 downloads per month
Used in surf_n_term
This is a fully functional 2D rasterizer and SVG path parser.
- parsing SVG path format
- rendering elliptic arc, lines, cubic/quadratic bezier curves
- curve offsetting
- linear and radial gradients
There is a very simple binary in examples folder that can be used to render SVG path
$ cargo run --release --example rasterize -- data/squirrel.path -w 512 -o squirrel.bmp
This will produce:
Simple 2D library that support SVG path parsing/generation/manipulation and rasterization.
- SVG path parsing and generation
- Anti-aliased rendering
- Path offsetting [
- Linear and Radial gradients with [
GradLinear] and [
- Serde integration if
serdefeature is set (enabled by default)
Main types are:
Path] - Represents the same concept as an SVG path, the easiest way to construct it is with [
Path::builder] or it can be parsed from SVG path with [
str::parse]. Path can be stroked with [
Path::stroke] to generated new path that represents an outline.
Scene] - Represents an image that has not been rendered yet, multiple scenes can be composed to construct more complex scene. This is probably the simplest way to render something useful. See
examples/simple.rsfor a simple example. It can also be (de)serialized see
data/firefox.scenefor an example.
Paint] - Color/Gradient that can be used to fill a path.
Image] - 2D matrix that can hold and image and used as a target for rendering. Image can also be written into a file with [
Image::write_bmp] or to PNG with
pngfeature is enabled.