14 unstable releases (5 breaking)

0.5.0 Nov 12, 2021
0.4.0 Mar 28, 2021
0.3.0 Dec 23, 2020
0.2.0 Nov 10, 2020
0.1.1 May 21, 2020

#91 in Graphics APIs

Download history 370/week @ 2021-10-07 452/week @ 2021-10-14 542/week @ 2021-10-21 430/week @ 2021-10-28 417/week @ 2021-11-04 393/week @ 2021-11-11 416/week @ 2021-11-18 602/week @ 2021-11-25 561/week @ 2021-12-02 491/week @ 2021-12-09 311/week @ 2021-12-16 225/week @ 2021-12-23 425/week @ 2021-12-30 414/week @ 2022-01-06 589/week @ 2022-01-13 591/week @ 2022-01-20

2,062 downloads per month
Used in 18 crates (via piet-common)


4.5K SLoC

Piet: a 2D graphics abstraction

Crates.io Documentation Build Status

Cross-platform 2D graphics.

The Piet project consists of a core crate (piet) which describes a 2D graphics API, and a number of "backends", which implement that API on top of the built-in 2D graphics system of a given platform. This allows the same drawing code to be used on different platforms, without having to bundle a full 2D renderer.

The motivation for this crate is set forth in this blog post. It is used as the basis of Druid, a cross-platform GUI toolkit.

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


For cross-platform use, the piet-common crate reexports the most appropriate implementation for the current target.

piet-cairo crates.io

The piet-cairo crate depends on the cairo library. A simple test of the cairo backend is to run cargo run --example test-picture 0, which should produce an image file called cairo-test-0.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 0, 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 test-picture 0, which should produce an image called d2d-test-0.png.

piet-svg crates.io

piet-web crates.io


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 named after Piet Mondrian. It is abstract and intended to be used for drawing lots of rectangles.


~19K SLoC