34 releases

0.7.0 Oct 24, 2024
0.6.2 Jan 30, 2023
0.6.0 Nov 25, 2022
0.5.0 Nov 12, 2021
0.0.2 Feb 22, 2019

#949 in Graphics APIs

Download history 1655/week @ 2024-08-19 1660/week @ 2024-08-26 1477/week @ 2024-09-02 1390/week @ 2024-09-09 1378/week @ 2024-09-16 1645/week @ 2024-09-23 1141/week @ 2024-09-30 608/week @ 2024-10-07 1132/week @ 2024-10-14 1525/week @ 2024-10-21 1224/week @ 2024-10-28 1114/week @ 2024-11-04 660/week @ 2024-11-11 684/week @ 2024-11-18 1255/week @ 2024-11-25 1293/week @ 2024-12-02

3,983 downloads per month
Used in 61 crates (14 directly)

Apache-2.0 OR MIT

455KB
5.5K SLoC

automatic backend selection for Piet

piet-common is a crate that chooses an appropriate implementation of the Piet 2D graphics API, for the current platform.

On Windows, the backend will be piet-direct2d, on macOS piet-coregraphics, and on Linux, OpenBSD, FreeBSD and NetBSD piet-cairo. The piet-web backend can be selected with the web feature.


lib.rs:

A piet backend appropriate for the current platform.

This crate reexports the piet crate, alongside an appropriate backend for the given platform. It also exposes kurbo, which defines shape and curve types useful in drawing, and image for image manipulation.

The intention of this crate is to provide a single dependency that handles the common piet use-case. If you have more complicated needs (such as supporting multiple backends simultaneously) you should use crates such as piet and piet-cairo directly.

The associated types for brushes, text, and images are exported as type definitions (resolving to concrete types within the backend), so they can be used directly. The text-related types are prefixed with "Piet" to avoid conflict with the text traits that would otherwise have the same name.

Also note that all public types for the specific backend are re-exported, but have their docs hidden here. These types can be useful for platform integration, and also potentially to access extensions specific to the backend. The types documented below can be used portable across all backends.

Dependencies

~0.7–12MB
~139K SLoC