Add opacity implementation, basic widget, and example#3400
Conversation
|
Great work! One thing to note, the image path in the example won't work on Windows. "/" is not the path separator so |
|
Also, I shouldn't the opacity be handled by the layer stack like how transformations are? |
…ndering to an offscreen texture
Hmm I did an implementation with layer stack, I liked the other impl because of how simple it was and didn't need to render to an offscreen texture, easy win for perf. |
|
Yep. Overlapping opacity looks to be better. Were you able to benchmark this? Also it might be worth creating a post on this in the discussions channel of the iced discord so others can give more feedback |
I did this morning, wasn't sure if I should commit the benchmark code or not since This is on the GPU drawing a row with cards. This is on the CPU (tiny_skia). Also made that discord post. |
…ct for generalized batching
Re-opening this PR with correct source branch: #3182
And fully rebased on latest master.
Features:
New Opacity widget - Wraps any content and applies transparency
Nested opacity support - Opacity values multiply when nested (e.g., 50% × 50% = 25%)
GPU-accelerated - Implemented in both wgpu and tiny-skia renderers
Affects everything - Backgrounds, borders, images, SVGs, and text all respect opacity
Example added demonstrating how simple it is to integrate and how to do fade-in/out animations.
Related issue: #912