Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This month in Linebender, November 2024 edition! #80

Merged
merged 18 commits into from
Dec 18, 2024
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 227 additions & 0 deletions content/blog/2024-12-03-tmil-11/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
+++
title = "Linebender in November 2024: color!"
authors = ["Bruce Mitchener", "Daniel McNab"]
+++

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](https://rust-lang.org).

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

## Color

When we published the update for [October, 2024](/blog/tmix-10/), 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.

<style>
div.gradient-demo { height: 50px }
#browser { background: linear-gradient(to right in oklab, lime, blue) }
#ours { background: linear-gradient(to right, color(srgb 0 1 0) 0%, color(srgb -0.22411254 0.92055106 0.4044056) 12.5%, color(srgb -0.28811926 0.8390731 0.5539247) 25%, color(srgb -0.31709152 0.66550463 0.7479822) 50%, color(srgb -0.26123333 0.45950305 0.88687235) 75%, color(srgb -0.19183734 0.3212008 0.94574267) 87.5%, color(srgb 0 0 1) 100%) }
</style>

<figure>

<div class='gradient-demo' id='ours'></div>

<figcaption>

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.

</figcaption>
</figure>

<figure>

<div class='gradient-demo' id='browser'></div>

<figcaption>

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.

</figcaption>
</figure>

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 some additional (non-CSS 4) color spaces like ACEScg, OkHsl, and OkHsv as well as things that we found useful when using it in Peniko and Vello.
DJMcNab marked this conversation as resolved.
Show resolved Hide resolved

Many thanks to [Brendan Zabarauskas][brendanzab] 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](#masonry), which has its own section.
This month only had small updates otherwise:

* [xilem#742][]: Made all built-in `View` types `#[must_use]`, improving error reporting in cases where views could be silently ignored.
* [xilem#732][]: Implemented `View` for `Rc<impl View>`.

Work on Xilem web has been continuing well:

* [xilem#731][], [xilem#734][]: Added a example using our SVG support for drawing, called `svgdraw`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* [xilem#731][], [xilem#734][]: Added a example using our SVG support for drawing, called `svgdraw`.
* [xilem#731][], [xilem#734][]: Added an example using our SVG support for drawing, called `svgdraw`.

* [xilem#749][]: Experimentally increased support for custom view context types.

## 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.

* [xilem#670][]: Added some features needed for custom client side decorations, by Marco Melorio.
* [xilem#735][]: Viktor Strate Kløvedal found and resolved several features which incorrectly private.
DJMcNab marked this conversation as resolved.
Show resolved Hide resolved
* [xilem#736][]: Added a padding property to `SizedBox`. This PR also exposed this property to Xilem.
* [xilem#754][], [xilem#755][], [xilem#762][]: Refactored Masonry's text support to reduce internal duplication and validate previously mentioned changes in Parley.

Daniel's talk *Masonry: An Imperative Widget toolkit in Rust* for GOSIM China 2024, was also published [on YouTube](https://youtu.be/99zU4bU4kP8).

<!-- TODO: Do we want to/could we embed the video? -->

## 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.

* [vello#735][], [vello#743][]: Update to wgpu 23.0.1, matching what is used by Bevy 0.15.
* [vello#722][]: Improving image sampling.
* [vello#740][]: Correcting support for PNG glyphs in fonts, important for emoji on macOS.

## 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:

* [parley#158][], [parley#160][]: Worked towards `no_std`. Full `no_std` is currently blocked (only) on the release of a dependency.
* [parley#154][]: `PlainEditor` was significantly refactored to have a more ergonomic and efficient API.
* [parley#166][]: AccessKit support was integrated directly into Parley. This was previous possible externally, but the external integration is much simpler.
* [parley#152][]: Cursor blinking was added to the editor example by [tannal](https://github.com/tannal).
* [parley#182][]: Font fallback on misconfigured Linux systems was resolved by Richard Hozák.
* [parley#173][]: Ada Böhm added snapshot testing, which will significantly improve our confidence in future changes.
* [parley#170][]: Significantly simplified the cursor model, which resolved several longstanding issues in text editing.

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.

* [kurbo#390][] Reduce number of operations in `Triangle::circumscribed_circle`.
* [kurbo#399][] Implement `Sum` for `Vec2`.

## 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
DJMcNab marked this conversation as resolved.
Show resolved Hide resolved

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:

* [resvg#843][]: Add support for the `!important` attribute.
* [resvg#850][]: Add support for embedded luma JPEG images.

## 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:

* Raph Levien on new rendering approaches for Vello.
* Joe Neeman on boolean path operations.

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](https://xi.zulipchat.com/#narrow/channel/359642-office-hours) for details.

* Daniel and Olivier's "office hours" appointments can still be booked by anyone for open-ended discussion of the ecosystem.
* [See Daniel's schedule here](https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ32eQYJ9DtZ_wJaYNtT36YioETiloZDIdImFpBFRo5-XsqGzpikgkg47LPsiHhpiwiQ1orOwwW2).
* [See Olivier's schedule here](https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ2t767ZRETD_TkRI_VxK2ZTG0VrO9OZ4l7HvTxefhtJcg85iK0ZN7zWNnAEZtH0Dn7C1GKxrmYM).

[CSS Color Module Level 4]: https://www.w3.org/TR/css-color-4/
[Low-level Piet]: https://xi.zulipchat.com/#narrow/channel/197075-gpu/topic/Low-level.20Piet
[talk]: https://xi.zulipchat.com/#narrow/channel/197075-gpu
[brendanzab]: https://github.com/brendanzab

[parley#152]: https://github.com/linebender/parley/pull/152
[parley#154]: https://github.com/linebender/parley/pull/154
[parley#156]: https://github.com/linebender/parley/pull/156
[parley#158]: https://github.com/linebender/parley/pull/158
[parley#160]: https://github.com/linebender/parley/pull/160
[parley#166]: https://github.com/linebender/parley/pull/166
[parley#170]: https://github.com/linebender/parley/pull/170
[parley#171]: https://github.com/linebender/parley/pull/171
[parley#173]: https://github.com/linebender/parley/pull/173
[parley#182]: https://github.com/linebender/parley/pull/182
[parley#184]: https://github.com/linebender/parley/pull/184
[resvg#843]: https://github.com/linebender/resvg/pull/843
[resvg#850]: https://github.com/linebender/resvg/pull/850
[vello#722]: https://github.com/linebender/vello/pull/722
[vello#735]: https://github.com/linebender/vello/pull/735
[vello#740]: https://github.com/linebender/vello/pull/740
[vello#743]: https://github.com/linebender/vello/pull/743
[xilem#670]: https://github.com/linebender/xilem/pull/670
[xilem#731]: https://github.com/linebender/xilem/pull/731
[xilem#732]: https://github.com/linebender/xilem/pull/732
[xilem#734]: https://github.com/linebender/xilem/pull/734
[xilem#735]: https://github.com/linebender/xilem/pull/735
[xilem#736]: https://github.com/linebender/xilem/pull/736
[xilem#742]: https://github.com/linebender/xilem/pull/742
[xilem#749]: https://github.com/linebender/xilem/pull/749
[xilem#754]: https://github.com/linebender/xilem/pull/754
[xilem#755]: https://github.com/linebender/xilem/pull/755
[xilem#762]: https://github.com/linebender/xilem/pull/762

[Color 0.1.0]: https://docs.rs/color/0.1.0/color/
[Velato 0.4.0]: https://github.com/linebender/velato/releases/tag/v0.4.0
[Vello SVG 0.5.0]: https://github.com/linebender/vello_svg/releases/tag/v0.5.0
Loading