Crates.io | definitely-not-piet-direct2d-please-ignore |
lib.rs | definitely-not-piet-direct2d-please-ignore |
version | 0.6.0 |
source | src |
created_at | 2023-01-15 03:45:39.771531 |
updated_at | 2023-01-15 03:45:39.771531 |
description | Direct2D backend for piet 2D graphics abstraction. |
homepage | |
repository | https://github.com/linebender/piet |
max_upload_size | |
id | 759193 |
size | 169,699 |
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.
Running the examples requires that submodules be checked out. From the root directory, run
git submodule update --init
Piet has largely stabilized, and no major API additions are planned by the original developers. Bug fixes and performance improvements are welcome.
If there is a significant feature you would like to add that can be discussed. For a new feature to be considered, there must be a plan for how it would be implemented in at least the coregraphics, direct2d, and cairo backends, and the actual implementation should include support for at least two of these.
For questions and discussions we use a zulip chat instance at xi.zulipchat.com under the #piet stream.
For cross-platform use, the piet-common
crate reexports the most
appropriate implementation for the current target.
piet-cairo
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
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
The piet-direct2d
crate 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
piet-web
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 library is named after Piet Mondrian. It is abstract and intended to be used for drawing lots of rectangles.