#graphics #2d

piet-common

Selection of a single preferred back-end for piet

7 releases

✓ Uses Rust 2018 edition

0.0.7 Nov 1, 2019
0.0.6 Aug 9, 2019
0.0.5 Jul 22, 2019
0.0.4 Jun 25, 2019
0.0.1 Jan 29, 2019

#24 in #2d

Download history 94/week @ 2019-07-19 77/week @ 2019-07-26 194/week @ 2019-08-02 158/week @ 2019-08-09 143/week @ 2019-08-16 195/week @ 2019-08-23 116/week @ 2019-08-30 106/week @ 2019-09-06 225/week @ 2019-09-13 129/week @ 2019-09-20 88/week @ 2019-09-27 353/week @ 2019-10-04 84/week @ 2019-10-11 548/week @ 2019-10-18 537/week @ 2019-10-25

962 downloads per month
Used in 3 crates (1 directly)

MIT/Apache

89KB
1.5K SLoC

Piet: a 2D graphics abstraction

Build Status

This repo holds an API for 2D graphics drawing.

The motivation for this crate is set forth in this blog post. Ideally it will become a layer to help druid become cross-platform.

This repo is structured as a core API crate, "piet" and a separate crate for each back-end, currently "piet-direct2d", "piet-cairo", and "piet-web". One motivation for this structure is that additional back-ends can be written without coupling to the main crate, and clients can opt in to the back-ends they need. In addition, it's possible use multiple back-ends, which will likely be useful for testing.

A companion for Bézier path representation and geometry is kurbo.

The piet-cairo crate depends on the cairo library, found at https://www.cairographics.org/download/. A simple test of the cairo backend is to run cargo run --example basic-cairo, which should produce an image file called "temp-cairo.png".

The piet-direct2d create works on Windows only. Build with cargo build --all to include it. A simple test of the direct2d backend is to run cargo run --example basic, which should produce an image called "temp-image.png".

Roadmap

Since the project is in its infant stages, there's not currently a set roadmap. For a good idea of what the library will eventually be capable of see this list of requirements to be a backend 2D graphics library for the SVG rendering library resvg.

Contributing

Contributions are welcome! It's in early stages, so there are lots of opportunities to fill things out.

You can find other collaborators at xi.zulipchat.com under the #druid stream.

Inspirations

Piet's interface is largely inspired by the Skia Graphics Library as well as the C++ 2D graphics api proposal although piet aims to be much more lightweight and modular.

The Name

The library is of course named after Piet Mondrian. It's abstract and hopefully will be used for drawing lots of rectangles.

Dependencies

~0.2–1MB
~18K SLoC