What about abstracting widgets' rendering #1248
stephanemagnenat
started this conversation in
Ideas
Replies: 2 comments 1 reply
|
This was possible before and I ended up removing the abstraction layer completely in #1110. Instead of an additional rendering abstraction, I believe we should make widget logic reusable. So, if users want to implement their own |
1 reply
|
Thank you for your fast and detailed answer! Reusing widget logic sounds good! One question though: in ecb3df8, the button still has a |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello,
Currently, in iced the renderer is abstract and widgets are styled, but nonetheless the drawing code is fixed. If we consider the button, for example, it is explicitly rendered as a quad (
button.rs:312) and the shadow is manually hacked through an offset quad. However, if one would like to use iced for a game, one might want a button made of 9 pieces textures (4 corners, non-stretched; 4 sides, stretched in 1D; 1 center, stretched in 2D). Moreover, if the renderer can render proper shadows in a shader, one might not want to use the shifted-rectangle hack.Hence, my idea/question is the following: is there a desire or plan to add one layer of abstraction for rendering widgets? It could be a trait (such as
ButtonRendererorButtonDrawerthat implements more semantic functions, e.g.renderBackgroundorrenderShadow) that is specific to each widget. That would allow to reuse the widget logic with a completely different visual style, and possibly better performance by matching the abilities to the underlying renderer more closely.What do you think?
All reactions