10 releases (6 breaking)

Uses new Rust 2024

0.6.2 Oct 30, 2025
0.6.1 Oct 9, 2025
0.5.0 Jul 21, 2025
0.4.1 Jul 4, 2025
0.0.0 Nov 26, 2024

#134 in Graphics APIs

Download history 370/week @ 2025-08-29 366/week @ 2025-09-05 230/week @ 2025-09-12 357/week @ 2025-09-19 347/week @ 2025-09-26 1324/week @ 2025-10-03 677/week @ 2025-10-10 716/week @ 2025-10-17 587/week @ 2025-10-24 853/week @ 2025-10-31 435/week @ 2025-11-07 468/week @ 2025-11-14 497/week @ 2025-11-21 454/week @ 2025-11-28 839/week @ 2025-12-05 450/week @ 2025-12-12

2,267 downloads per month
Used in 16 crates (10 directly)

MIT/Apache

15KB
323 lines

AnyRender

A Rust 2D drawing abstraction.

Linebender Zulip, #kurbo channel dependency status Apache 2.0 or MIT license. Crates.io Docs

AnyRender is a 2D drawing abstaction that allows applications/frameworks to support many rendering backends through a unified API.

Discussion of AnyRender development happens in the Linebender Zulip at https://xi.zulipchat.com/.

Crates

anyrender

The core anyrender crate is a lightweight type/trait-only crate that defines three abstractions:

  • The PaintScene trait accepts drawing commands. Applications and libraries draw by pushing commands into a PaintScene. Backends generally execute those commands to produce an output (although they may do other things like store them for later use).
  • The WindowRenderer trait abstracts over types that can render to a window
  • The ImageRenderer trait abstracts over types that can render to a Vec<u8> image buffer

Backends

Currently existing backends are:

Contributions for other backends (tiny-skia, femtovg, etc) would be very welcome.

Content renderers

These crates sit on top of the the AnyRender abstraction, and allow you render content through it:

  • anyrender_svg allows you to render SVGs with AnyRender. usvg is used to parse the SVGs.
  • blitz-paint can be used to HTML/CSS (and markdown) that has been parsed, styled, and layouted by blitz-dom using AnyRender.
  • polymorpher implements Material Design 3 shape morphing, and can be used with AnyRender by enabling the kurbo feature.

Utility crates

Minimum supported Rust Version (MSRV)

This version of AnyRender has been verified to compile with Rust 1.86 and later.

Future versions of AnyRender might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases.

License

Licensed under either of

at your option.

Contribution

Contributions are welcome by pull request. The Rust code of conduct applies.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.


lib.rs:

2D drawing abstraction that allows applications/frameworks to support many rendering backends through a unified API.

Painting a scene

The core abstraction in AnyRender is the PaintScene trait.

PaintScene is a "sink" which accepts drawing commands:

  • Applications and libraries draw by pushing commands into a PaintScene
  • Backends execute those commands to produce an output

Rendering to surface or buffer

In addition to PaintScene, there is:

  • The ImageRenderer trait which provides an abstraction for rendering to a Vec<u8> RGBA8 buffer.
  • The WindowRenderer trait which provides an abstraction for rendering to a surface/window

SVG

The anyrender_svg crate allows SVGs to be rendered using AnyRender

Backends

Currently existing backends are:

Dependencies

~1MB
~22K SLoC