Is their GPUI library open source?
Here's my effort: https://github.com/audulus/rui
https://github.com/audulus/vger
and a rust version:
https://github.com/audulus/vger-rs
(which powers my rust GUI library: https://github.com/audulus/rui)
Here's the approach for rendering path fills. From the readme:
> The bezier path fill case is somewhat original. To avoid having to solve quadratic equations (which has numerical issues), the fragment function uses a sort-of reverse Loop-Blinn. To determine if a point is inside or outside, vger tests against the lines formed between the endpoints of each bezier curve, flipping inside/outside for each intersection with a +x ray from the point. Then vger tests the point against the area between the bezier segment and the line, flipping inside/outside again if inside. This avoids the pre-computation of Loop-Blinn, and the AA issues of Kokojima.
It works pretty well, and doesn't require as much preprocessing as the code in the article. Also doesn't require any GPU compute (though I do use GPU compute for some things). I think ultimately the approach in the article (essentially Piet-metal, aka tessellating and binning into tiles) will deliver better performance, and support more primitives, but at greater implementation complexity. I've tried the Piet-metal approach myself and it's tricky! I like the simpler Shadertoy/SDF inspired approach :)
That said, I think Druid is a good Minimum Viable Product. I just needed GPU acceleration for my app, and wanted something closer to SwiftUI, which I'm used to.
let text = self.text.clone();
focus(move |has_focus| {
let text = text.clone();
state(TextEditorState::new(), move |state| {
let text = text.clone();
let text2 = text.clone();
let cursor = state.with(|s| s.cursor);
let state2 = state.clone();
currently looks like this: focus(move |has_focus| {
state(TextEditorState::new, move |state, cx| {
let cursor = cx[state].cursor;
canvas(move |cx, rect, vger| {
(Note the context (cx) passed to callbacks to look things up.)Taylor Holliday of the Audulus fame is porting it to Rust