Advanced widget rendering/styling

ok so, afaict iced currently only supports basic quad rendering, and image (raster and vector) rendering through the Renderer trait. the quads, intended for widgets like buttons, include ability to draw:

  • a rectangle within some bounds.
  • a single border with a single color and width, but the ability to change the border radius of each corner individually.
  • a single shadow with an offset, single color, and a blur radius.
  • a background within the bounds of either the rectangle, or if there is a border, within that (including any rounded corners).
    • the background may be a single color or a linear gradient.

in terms of potential improvements to this rendering feature set i would probably mention (and please lmk if there is something important that i have missed):

  • shadow-related:
    • multiple shadows.
    • inner shadows.
    • shadow spread.
    • shadow color being replaced with backgrounds (for gradient, and other background features).
  • spread:
    • spreads should have the ability to be based on scale reference, or distance from object path shape.
  • backgrounds:
    • further gradient types (radial, etc.).
    • background image (tiled, scale, etc.).
    • multiple backgrounds? (as backgrounds can be transparent and stack on each other).
  • borders:
    • different border widths, styles, and color depending on side (top, right, bottom, left).
    • color option based on background like shadows.
    • more border types (dashed, dotted, etc.).
    • border image (with slice, fill, width, outset, and repeat-x/y options (stretch, repeat, round, space)).
    • multiple borders:
      • this one is a little messy, i think the only real use for this one is if you want to define an interesting border shape with border-image, and then add a basic border (solid, dashed, etc.) following the path of the image border shape. so basically at most there are two ‘borders’. following a border-image path would also be incompatible with any defined border-radius on the basic border. i guess you could technically potentially also like to have two different basic borders on top of each other? as in, a solid base, and a dashed overlay border, something like that.
  • other:
    • perspective warp for base quad, and for shadows, independently from the parent quad.

i’m guessing implementing these would require (breaking?) changes to the Renderer api, and therefore a bunch of new shader code, changes in wgpu and tiny_skia crates. also changes to the Border, Shadow, Background, Quad types, maybe a new ImageBorder type, Warp type. as well as of course actually editing the widget style catalogs to allow these options to be changed.

now my questions would be:

  • is my understanding generally correct?
  • would this level of styling even (eventually) be considered ‘in scope’ for the library?

i would also like to say i am of course interested in tackling these rendering features eventually, probably both once the iced api has become more stable, and i can prioritize it. i’m mostly just putting this here for discussion and reference atm.