Linebender in November 2024: color!

Bruce Mitchener, Daniel McNab, December 18, 2024

Linebender is an informal open-source organization working on various projects to advance the state of the art in GUI for the Rust programming language.

This month's update contains some surprises, even to us!

Color

When we published the update for October, 2024, we had already been discussing starting a new color-focused crate, but hadn't yet created a repository.

We may have a dedicated blog post about the color crate in the future and laying out some of the motivations, but we'll go over it a bit here.

Linebender, among other things, believes in helping build solid foundations for people building user interfaces and working in graphics, in the Rust programming language (and on GPUs). Upon seeing a problem, we prefer to produce a focused crate that solves that problem and that can be used by others within the Rust ecosystem. Color is one such area. It is much harder than it may appear at first, with many complicating factors like what should be done by a basic color struct, what color spaces to support, and whether or not to support color formats used in print (like CMYK).

We looked around at a wide variety of crates in various stages of maintenance and development, their feature sets, the "weight" of those crates, and how closely they fit in with what we would need in Vello, Tiny Skia, Resvg, SVG Types, Masonry, and Xilem. We decided to do a crate based on the CSS Color Module Level 4 draft specification, with support for a limited number of additional color spaces.

We released an alpha of this new crate as Color 0.1.0 on November 21, 2024. The documentation lays out more of the scope, goals, and main types provided by the crate.

Color can convert gradients between color spaces. This is a gradient from "lime" to "blue" in the Oklab color space, converted to sRGB by Color.

This is a gradient from "lime" to "blue" in Oklab, as generated by your browser. This is the reference for the above gradient, and should appear identical.

Since then, we have begun the work of making Peniko and Vello use the Color crate and improving it to support that usage. Early next year, we hope to use it within SVG Types, Resvg, and Tiny Skia.

We will be publishing a 0.2.0 release within the next month and encourage people to give it a try. The 0.2.0 release will include the (non-CSS 4) color space ACEScg, as well as things that we found useful when using Color in Peniko and Vello.

Many thanks to Brendan Zabarauskas for working with us to transfer his color crate name for our use. His original crate was published as 0.0.1 on November 21, 2014, motivating us ten years later to ship our 0.1.0 on November 21, 2024.

We're very excited about the future of this crate and look forward to talking to other people within the Rust ecosystem about using it.

Xilem

Xilem is our flagship GUI project, inspired by SwiftUI. It lets you build user interfaces declaratively by composing lightweight views together, and will diff them to provide minimal updates to a retained layer.

The majority of changes in November were made in the widget layer, which has its own section. This month only had small updates otherwise:

Work on Xilem web has been continuing well:

Masonry

Masonry is the widget system used by Xilem. It provides a non-opinionated retained widget tree, designed as a base layer for high-level GUI frameworks.

Daniel's talk Masonry: An Imperative Widget toolkit in Rust for GOSIM China 2024, was also published on YouTube.

Vello

Vello is our GPU vector renderer. It can draw large 2D scenes with high performance, using GPU compute shaders for most of the work.

Parley

Parley is a text layout library. It handles text layout, mostly at the level of line breaking and resolving glyph positions. In November, the main updates were:

Kaur also made several improvements to our CI, in parley#156, parley#171 and parley#184.

Kurbo

Kurbo has seen some minor updates within the last month and we're planning to publish them in a minor patch release within the next month.

Peniko

We've been working towards a big release, which will remove the old peniko::Color type and use the new color crate instead. This release will be the start of a path towards wider color gamut support throughout the Linebender ecosystem.

Piet

While there were no code changes, we did begin a discussion about a possible major revision to Piet and what a next-generation Piet might look like.

Something great about Piet was the idea that with a single rendering API, you could target multiple back-ends, mostly ones that were platform specific, but also SVG. With the advent of Vello, this was left behind, with a focus on making Vello work. Also, many things that used to be part of Piet are now separate crates, like Peniko, Parley, and Color. These new crates exceed the capabilities that were present in Piet.

Nico Burns started a discussion about this that took off in our Zulip, Low-level Piet. We look forward to continuing to discuss this topic over the coming months.

Tiny Skia, Resvg, SimpleCSS, SVG Types

In the last month, we have made progress on converting the SimpleCSS and SVG Types projects over to using the Linebender CI infrastructure.

The re-licensing of the code within the Resvg repository has been completed and is now under the "Apache-2.0 OR MIT" license pair.

Additionally, a couple of exciting improvements have landed in the Resvg repository:

Velato, Vello SVG

Velato 0.4.0 was released, updating it to use Vello 0.3. Additionally, 0.3.1 was released which correctly implemented non-linear easing.

Vello SVG 0.5.0 was released, updating it to use usvg 0.44.

Research and Future Directions

Linebender has an origin story in being a very research oriented group, looking to break new ground. While we are focused on shipping code today, we still have an eye on the future and how to be prepared for the new opportunities and technologies that are coming. This can be seen in our thinking about the future of Piet as previously discussed as well as the work that we're doing with Color.

We have a couple of active and ongoing research projects:

November also saw the transition of the Slang shader language from Nvidia to Khronos. We don't have any immediate plans to adopt Slang in Vello (we're already pretty busy!), but we are looking at Slang and thinking about how we can best make use of it to improve the usefulness of our crates. We'd love to talk to people who are adopting Slang within the Rust ecosystem or interested in publishing Slang code for wider use.

Get Involved

We welcome collaboration on any of our crates. This can include improving the documentation, implementing new features, improving our test coverage, or using them within your own code.

We host an hour long office hours meeting each week where we discuss what's going on in our projects. See #office hours in Zulip for details.