draw2d / rfcs

Somewhere to start to discuss how a 2d drawing library would work in rust, whether it is necessary, and what it should look like.
Apache License 2.0
22 stars 1 forks source link

Modern rendering engine for user interfaces #2

Open nical opened 5 years ago

nical commented 5 years ago

Filing this for a focused discussion on the needs of GUIs which appears to be a popular topic. I'll chime in when I have a bit of time. There has been a lot of discussion about what people want from a GUI toolkit in the past (note to self to dig up the reddit and internals forum links). Perhaps we should try to keep an eye on solutions and feasibility in this thread to maximize the chance of moving some things forward.

boustrophedon commented 5 years ago

Some links to discussions:

sophistifunk commented 5 years ago

I've been lurking, just thought I'd put in my 2c.

My background: new to Rust, and have very little hands-on experience writing code for GPUs. I do have a very long history of consuming APIs for graphics and GUIs though. I've built many custom components over the years on many different platforms / frameworks.

I would like to suggest a good target for this effort would be something very similar to the Flash display list / scene graph. A "retained-mode" scene graph, consisting of painted nodes, transforms, filters, and clipping regions. Of course the API would have to be "rusted"- probably want to separate the tree structure from the node attributes, things of that nature. But you basically give it a tree of nodes, it takes care of compositing and moving pixels to the screen, gives you some interaction events, and you can ask it to transform local<->global coordinates any time you need to. It has no notion of component lifecycles, animation, stylesheets, or anything like that. Consider it akin to Flutter at the "layer" layer.

Using something like this, higher level frameworks analogous to Flex or React or Vue could make their own decisions about layout, component invalidation, cascading styles, lifecycle, etc, while those who want more direct control for simplicity or performance can simply manipulate the scene graph themselves. It would probably make a great platform to host v8 with a port of React, for example.

Happy to elaborate on my thoughts and experiences if anybody's interested, or to go back to lurking if I'm just adding noise and not value :)

derekdreery commented 5 years ago

Happy to elaborate on my thoughts and experiences if anybody's interested, or to go back to lurking if I'm just adding noise and not value :)

Definitely adding value, as is everyone else!