What about abstracting widgets' rendering #1248
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 |
Beta Was this translation helpful? Give feedback.
-
Thank you for your fast and detailed answer! Reusing widget logic sounds good! One question though: in ecb3df8, the button still has a |
Beta Was this translation helpful? Give feedback.
-
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
ButtonRenderer
orButtonDrawer
that implements more semantic functions, e.g.renderBackground
orrenderShadow
) 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?
Beta Was this translation helpful? Give feedback.
All reactions