• Stars
    star
    1,251
  • Rank 37,562 (Top 0.8 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 6 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An abstraction for 2D graphics.

image of piet logo

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.

Getting started

Running the examples requires that submodules be checked out. From the root directory, run

git submodule update --init

Contributing

Piet is in maintenance mode.

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.

Backends

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 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 crates.io

piet-web crates.io

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

More Repositories

1

druid

A data-first Rust-native UI design toolkit.
Rust
9,543
star
2

xilem

An experimental Rust native UI framework
Rust
3,444
star
3

vello

A GPU compute-centric 2D renderer.
Rust
2,315
star
4

runebender

A font editor written in Rust.
Rust
762
star
5

kurbo

A Rust library for manipulating curves
Rust
698
star
6

masonry

Rust UI design toolkit - moved.
Rust
405
star
7

skribo

A Rust library for low-level text layout.
Rust
325
star
8

glazier

Deprecated Rust Window Creation Library
Rust
209
star
9

parley

Rich text layout library
Rust
197
star
10

piet-metal

Experimental Metal-based GPU renderer for piet 2D graphics.
Rust
140
star
11

bevy_vello

An integration to render with Vello in Bevy game engine.
Rust
117
star
12

spline

A spline for interactive 2D curve design
Rust
112
star
13

druid-widget-nursery

A place where Druid widgets come to mature before moving to the Druid repo.
Rust
87
star
14

velato

An integration to parse and render Lottie with Vello.
Rust
71
star
15

norad

Rust crate for working with Unified Font Object files
Rust
43
star
16

rbf-interp

An implementation of Radial Basis Function multidimensional interpolation
Rust
35
star
17

gpu-stroke-expansion-paper

Rust
35
star
18

2d.graphics

Repo for an ideational book on 2D graphics, plus tools to make images
26
star
19

peniko

Primitive types for styling vector graphics.
Rust
22
star
20

vello_svg

An integration to render SVG files with Vello.
Rust
15
star
21

wiki

Wiki and documentation for 2D graphics projects
9
star
22

android_trace

Support for Android NDK Tracing in Rust
Rust
6
star
23

rfcs

Suggestions for major changes to the linebender ecosystem
6
star
24

linebender.github.io

Main webpage for linebender org
SCSS
5
star
25

interpoli

Rust
3
star
26

runebender.app

Ruby
2
star
27

piet-snapshots

Data for snapshot testing of piet backends
2
star