zed/crates/gpui/examples
Jason Lee 792c1e4710
gpui: Add paint_path example (#20499)
Release Notes:

- N/A

---

```
cargo run -p gpui --example painting
```

I added this demo to verify the detailed support of Path drawing in
GPUI.

Because of, when we actually used GPUI to draw a 2D line chart, we found
that the straight line Path#line_to did not support `anti-aliasing`, and
the drawn line looked very bad.

As shown in the demo image, if we zoom in on the image, we can clearly
see that all the lines are jagged.

I read and tried to make some appropriate adjustments to the functions
in Path, but since I have no experience in the graphics field, I still
cannot achieve anti-aliasing support so far.

I don't know if I used it wrong somewhere. I checked `curve_to` and
found that the curves drawn have anti-aliasing effects, as shown in the
arc part of the figure below.

<img width="1136" alt="image"
src="https://github.com/user-attachments/assets/4dfb7603-e746-43e9-b737-cff56b56329f">
2024-11-16 13:36:13 +02:00
..
image Add Loading and Fallback States to Image Elements (via StyledImage) (#20371) 2024-11-15 19:12:01 -08:00
svg
animation.rs
gif_viewer.rs Add Loading and Fallback States to Image Elements (via StyledImage) (#20371) 2024-11-15 19:12:01 -08:00
hello_world.rs
image_loading.rs Add Loading and Fallback States to Image Elements (via StyledImage) (#20371) 2024-11-15 19:12:01 -08:00
input.rs Deadkeys 2 (#20612) 2024-11-13 10:42:08 -07:00
opacity.rs
ownership_post.rs
painting.rs gpui: Add paint_path example (#20499) 2024-11-16 13:36:13 +02:00
set_menus.rs
shadow.rs
text_wrapper.rs
uniform_list.rs
window.rs
window_positioning.rs
window_shadow.rs