#graphics #2d


Selection of a single preferred back-end for piet

15 releases

✓ Uses Rust 2018 edition

new 0.1.1 May 21, 2020
0.0.13 May 12, 2020
0.0.11 Mar 23, 2020
0.0.7 Nov 1, 2019
0.0.2 Feb 22, 2019

#134 in Graphics APIs

Download history 907/week @ 2020-01-25 963/week @ 2020-02-01 691/week @ 2020-02-08 1109/week @ 2020-02-15 450/week @ 2020-02-22 1035/week @ 2020-02-29 1690/week @ 2020-03-07 2058/week @ 2020-03-14 1177/week @ 2020-03-21 1024/week @ 2020-03-28 1224/week @ 2020-04-04 2011/week @ 2020-04-11 1009/week @ 2020-04-18 1091/week @ 2020-04-25 941/week @ 2020-05-02 1323/week @ 2020-05-09

5,444 downloads per month
Used in 8 crates (2 directly)


3.5K SLoC

Ruby HTML 2.5K SLoC // 0.2% comments Rust 883 SLoC // 0.2% comments

Piet: a 2D graphics abstraction

Crates.io Documentation 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. 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.


piet-cairo crates.io

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.

piet-coregraphics crates.io

The piet-coregraphics crate works on macOS only. A simple test of the coregraphics backend is to run cargo run --example test-picture, which should produce an image file called coregraphics-test-0.png.

piet-direct2d crates.io

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

piet-svg crates.io

piet-web crates.io


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.


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.


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.


~53K SLoC