🌞🌞 We not need this, GPUI has it own gradient implementation.
https://github.com/zed-industries/zed/blob/main/crates/gpui/examples/gradient.rs
This is a simple Element to render a gradient for GPUI.
The core implementation is based drawing the gradient into a bitmap img, and then use cx.paint_image()
to render the image to the GPUI.
![image](/https://private-user-images.githubusercontent.com/5518/377844239-5261fd6c-f666-4b94-b9ac-52f2d4e788dd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4OTUxMjQsIm5iZiI6MTczODg5NDgyNCwicGF0aCI6Ii81NTE4LzM3Nzg0NDIzOS01MjYxZmQ2Yy1mNjY2LTRiOTQtYjlhYy01MmYyZDRlNzg4ZGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDdUMDIyMDI0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWQzZDVjZTljNjZjMDc1ODU5Mjg2MTQ0YzQ2Nzg1NGI0Y2JjOTViMzQwOGU3YWI2MTFlOWQ2MTlmNDEwMDdlZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.bqSNBp_hpDxytrrQ4bw6sRjJ7c46YAeBzj_1slpTJJc)
cargo run --example hello_world