Commit Graph

82 Commits

Author SHA1 Message Date
Emil Ernerfeldt d50287b83c
Add `taplo.toml` for toml formatting (#7618) 2025-10-09 15:38:00 +02:00
Emil Ernerfeldt 843ceea90c
Use more workspace dependencies (#7596) 2025-10-07 15:07:16 +02:00
Emil Ernerfeldt 226bdc4c5b
0.32.3 release: Bump version numbers and update changelog (#7536) 2025-09-12 08:18:19 +02:00
Lucas Meurer 34cd613378
Update changelogs and versions for 0.32.2 (#7505) 2025-09-08 10:42:10 +02:00
Emil Ernerfeldt 6a355c3808 Add 0.32.1 to changelogs 2025-08-15 13:42:49 +02:00
YgorSouza fb5fe645be
Make the `hex_color` macro `const` (#7444)
* Closes <https://github.com/emilk/egui/issues/5160>
* [x] I have followed the instructions in the PR template
2025-08-12 09:12:44 +02:00
Emil Ernerfeldt 3024c39eaf
Enable and fix some more clippy lints (#7426)
One can never have too many lints
2025-08-08 09:57:53 +02:00
Alexander c38d38e89d
Align `Color32` to 4 bytes (#7318)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

It could be useful when you want to preprocess an image using SIMD
instructions without extra copying to convert it to a texture.

Possibly we might add it as a feature.

* Closes <https://github.com/emilk/egui/issues/7292>
* [x] I have followed the instructions in the PR template

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-08-05 12:04:30 +02:00
Emil Ernerfeldt fabd4aa7a5
Release 0.32.0 - Atoms, popups, and better SVG support (#7329) 2025-07-10 16:58:39 +02:00
Emil Ernerfeldt b2995dcb83
Use Rust edition 2024 (#7280) 2025-06-30 14:01:57 +02:00
Nicolas f33ff2c83d
Make `HSVA` derive serde (#7132)
This pull request introduces a change to the `Hsva` struct in the
`crates/ecolor/src/hsva.rs` file to enable serialization and
deserialization when the `serde` feature is enabled.

* Closes <https://github.com/emilk/egui/issues/7131>
* [x] I have followed the instructions in the PR template
2025-06-16 01:40:42 +02:00
Emil Ernerfeldt 92fea8a18f
Remove things that have been deprecated for over a year (#7099)
Removes all things that were marked `#[deprecated]` more than 12 months
ago
2025-05-28 09:47:15 +02:00
Emil Ernerfeldt f9245954eb
Enable more clippy lints (#6853)
* Follows https://github.com/emilk/egui/pull/6848
2025-04-24 17:32:50 +02:00
Nicolas 58b2ac88c0
Add assert messages and print bad argument values in asserts (#5216)
Enabled the `missing_assert_message` lint

* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Lucas Meurer <lucasmeurer96@gmail.com>
2025-03-25 09:20:29 +01:00
Emil Ernerfeldt 3f731ec794
Fix semi-transparent colors appearing too bright (#5824)
The bug was in `Color32::from_rgba_unmultiplied` and by extension
affects:

* `Color32::from_rgba_unmultiplied`
* `hex_color!`
* `HexColor`
* `ColorImage::from_rgba_unmultiplied`
* All images with transparency (png, webp, …)
* `Color32::from_white_alpha`

The bug caused translucent colors to appear too bright.

## More
Color is hard.

When I started out egui I thought "linear space is objectively better,
for everything!" and then I've been slowly walking that back for various
reasons:

* sRGB textures not available everywhere
* gamma-space is more _perceptually_ even, so it makes sense to use for
anti-aliasing
* other applications do everything in gamma space, so that's what people
expect (this PR)

Similarly, pre-multiplied alpha _makes sense_ for blending colors. It
also enables additive colors, which is nice. But it does complicate
things. Especially when mixed with sRGB/gamma (As @karhu [points
out](https://github.com/emilk/egui/pull/5824#issuecomment-2738099254)).

## Related
* Closes https://github.com/emilk/egui/issues/5751
* Closes https://github.com/emilk/egui/issues/5771 ? (probably; hard to
tell without a repro)
* But not https://github.com/emilk/egui/issues/5810

## TODO
* [x] I broke the RGBA u8 color picker. Fix it

---------

Co-authored-by: Andreas Reich <andreas@rerun.io>
2025-03-21 10:45:25 +01:00
Lucas Meurer 93c06c3405
Add color picker menu item example (#5755)
* To be merged after #5756 



https://github.com/user-attachments/assets/ad40c172-cad2-4cc5-a3ef-3284b6545e94
2025-03-19 09:33:17 +01:00
Lucas Meurer 159ccb2fef Release 0.31.1 - text_edit and kittest fixes 2025-03-05 08:37:34 +01:00
Emil Ernerfeldt 42a88b677c Fix some clippy lints from the future 2025-02-25 14:10:42 +01:00
Lucas Meurer 5c372a7b36 Release 0.31.0 - Scene container, improved rendering quality 2025-02-04 16:47:56 +01:00
Emil Ernerfeldt 3c07e01d08
Improve tessellation quality (#5669)
## Defining what `Rounding` is
This PR defines what `Rounding` means: it is the corner radius of
underlying `RectShape` rectangle. If you use `StrokeKind::Inside`, this
means the rounding is of the outer part of the stroke. Conversely, if
you use `StrokeKind::Outside`, the stroke is outside the rounded
rectangle, so the stroke has an inner radius or `rounding`, and an outer
radius that is larger by `stroke.width`.

This definitions is the same as Figma uses.

## Improving general shape rendering
The rendering of filled shapes (rectangles, circles, paths, bezier) has
been rewritten. Instead of first painting the fill with the stroke on
top, we now paint them as one single mesh with shared vertices at the
border. This has several benefits:

* Less work (faster and with fewer vertices produced)
* No overdraw (nicer rendering of translucent shapes)
* Correct blending of stroke and fill

The logic for rendering thin strokes has also been improved, so that the
width of a stroke of `StrokeKind::Outside` never affects the filled area
(this used to be wrong for thin strokes).

## Improving of rectangle rendering
Rectangles also has specific improvements in how thin rectangles are
painted.
The handling of "Blur width" is also a lot better, and now works for
rectangles with strokes.
There also used to be bugs with specific combinations of corner radius
and stroke width, that are now fixed.

##  But why?
With the new `egui::Scene` we end up with a lot of zoomed out shapes,
with sub-pixel strokes. These need to look good! One thing led to
another, and then I became obsessive 😅

## Tessellation Test
In order to investigate the rendering, I created a Tessellation Test in
the `egui_demo_lib`.

[Try it
here](https://egui-pr-preview.github.io/pr/5669-emilkimprove-tessellator)

![Screenshot 2025-02-04 at 08 45
50](https://github.com/user-attachments/assets/20b47a30-de6a-4ff5-885b-2e2fd6d88321)


![image](https://github.com/user-attachments/assets/e17c50eb-5ae7-48d4-bb0d-4f2165075897)
2025-02-04 11:30:12 +01:00
Juan Campa 9e1117019a
Add `Color32::CYAN` and `Color32::MAGENTA` (#5663)
I often find myself reaching out for these two colors so I figured I'd
just add the constants next to `YELLOW` to have CMYK
2025-02-04 10:29:26 +01:00
Emil Ernerfeldt 320377e3ca
Release 0.30 - egui_kittest and modals (#5487) 2024-12-16 17:45:35 +01:00
Emil Ernerfeldt 046034f902
Add `Color32::mul` (#5437)
Multiply two `Color32` together quickly, in gamma-space
2024-12-05 13:53:20 +01:00
GiGaGon 1787952a83
Create gray -> grey doc aliases (#5362)
As someone who uses "grey" instead of "gray", it is annoying that my
autocomplete can never find any of the "gray" color related things, so
this adds doc aliases for that.

* [x] I have followed the instructions in the PR template
2024-11-11 13:21:58 +01:00
Cody Neiman 2cd3485dd4
Update MSRV from 1.76 to 1.77 (#5322)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* [X] I have followed the instructions in the PR template

I am preparing a separate PR that adds support for JXL with `jxl-oxide`,
which is unlikely to be added to the `image` crate anytime soon (more
context will be provided in that PR).

`jxl-oxide` makes use of the
[`array::each_mut`](https://doc.rust-lang.org/stable/std/primitive.array.html#method.each_mut)
API which was stabilized in 1.77, which is the motivation for this MSRV
bump.

Rust 1.77 was officially released to stable on 21 March, 2024.
2024-10-30 09:06:34 +01:00
YgorSouza f75a235c90
Use boxed slice for lookup table to avoid stack overflow (#5212)
* Closes <https://github.com/emilk/egui/issues/5210>
* [x] I have followed the instructions in the PR template
2024-10-23 14:42:47 +02:00
Emil Ernerfeldt fe368bacc4 Release 0.29.1 - Bug fixes 2024-10-01 10:08:21 +02:00
Emil Ernerfeldt 59d71831fd Release 0.29.0 - Multipass, `UiBuilder`, & visual improvements 2024-09-26 15:32:02 +02:00
YgorSouza a59e178131
Document the fact that the hex_color macro is not const (#5169)
It cannot be made const with the current version of Rust, and that is
counterintuitive since it does compile-time checks, so we make that
clear in the documentation. It might be possible to make it const once
MSRV is bumped to 1.82.

* See <https://github.com/emilk/egui/issues/5160>
* [x] I have followed the instructions in the PR template
2024-09-26 09:15:28 +02:00
Emil Ernerfeldt 5d46f67f79
Add `DebugOptions::show_unaligned` (#5165)
This tool highlights coordinates that are non-integer.

* Closes https://github.com/emilk/egui/issues/4927
* Will be used for https://github.com/emilk/egui/issues/5163

This is disabled by default (even in debug builds), because so many
widgets cause un-alignment currently.
2024-09-25 16:05:30 +02:00
Emil Ernerfeldt 9ef4d02ab8
More compact `Debug` formatting of `Color32` (#5162)
Especially when using the verbose `{:#?}`, which before would result in

```
Color32([
    255,
    0,
    0,
    255
])
```

but now becomes `#ff_00_00_ff`
2024-09-25 11:14:44 +02:00
YgorSouza f897405a82
Use precomputed lookup table in Color32::from_rgba_unmultiplied (#5088)
Improves performances significantly (about 40 times) according to the
benchmarks.

* Closes <https://github.com/emilk/egui/issues/5086>
* [x] I have followed the instructions in the PR template
2024-09-10 09:50:56 +02:00
Guillaume Gomez da04339f5e
Enable rustdoc `generate-link-to-definition` feature on docs.rs (#5030)
You can see this feature in action
[here](https://docs.rs/sysinfo/latest/src/sysinfo/common/system.rs.html#46)
or on any of dtolnay's crates and many others. I found myself going
through your project code recently on docs.rs and I was a bit sad I
couldn't have this feature enabled. This should fix it at next release.
:)
2024-08-30 11:22:29 +02:00
Nicolas 343c3d16c3
Remove wildcard imports (#5018)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

I removed (I hope so) all wildcard imports I found.

For me on my pc this improved the build time:
- for egui -5s
- for eframe -12s

* [x] I have followed the instructions in the PR template
2024-08-28 12:18:42 +02:00
Emil Ernerfeldt 8d2df5491e
Remove some debug asserts (#4826)
* Closes https://github.com/emilk/egui/issues/4825
2024-07-15 11:20:22 +02:00
Emil Ernerfeldt abab06867c Release 0.28.1 - Tooltip tweaks 2024-07-05 12:09:21 +02:00
Emil Ernerfeldt 234274d46f Release 0.28.0 - Sizing pass, and better eframe web 2024-07-03 14:54:08 +02:00
Antoine Beyeler 2545939c15
Add `Color32::lerp_to_gamma` (#4627)
Add `lerp_to_gamma` utility function to `Color32`

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-06-06 15:41:10 +02:00
Oscar Gustafsson c1eb3f884d
Move dependencies to workspace (#4495)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

Inspired by:

44d65f41ac/Cargo.toml (L65)

I took the liberty of removing that comment since I *think* that I got
all "relevant" ones (showing up more than once, sort of).
2024-05-14 11:02:49 +02:00
Emil Ernerfeldt f19f99180e
Remove `extra_asserts` and `extra_debug_asserts` feature flags (#4478)
Removes `egui_assert` etc and replaces it with normal `debug_assert`
calls.

Previously you could opt-in to more runtime checks using feature flags.
Now these extra runtime checks are always enabled for debug builds.

You are most likely to encounter them if you use negative sizes or NaNs
or other similar bugs.
These usually indicate bugs in user space.
2024-05-10 19:39:08 +02:00
Emil Ernerfeldt 2f508d6a61
Replace cargo-cranky with workspace lints (#4413)
Replace `cargo-cranky` (which has served us well) with workspace lints
2024-04-25 17:24:50 +02:00
Joe Sorensen 2ce82cce21
Added ability to define colors at UV coordinates along a path (#4353)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

I had to make a couple types not Copy because closures, but it should'nt
be a massive deal.

I tried my best to make the API change as non breaking as possible.
Anywhere a PathStroke is used, you can just use a normal Stroke instead.
As mentioned above, the bezier paths couldn't be copy anymore, but IMO
that's a minor caveat.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-04-22 18:35:09 +02:00
Emil Ernerfeldt 87b294534e
Add `emath::OrderedFloat` (moved from `epaint::util::OrderedFloat`) (#4389)
It makes much more sense in `emath`
2024-04-21 20:36:32 +02:00
dataphract fe454573db
Fix `hex_color!` macro by re-exporting `color_hex` crate from `ecolor` (#4372)
The `hex_color!` macro currently makes an unqualified reference to the
`color_hex` crate, which users may not have in their `Cargo.toml`. This
PR re-exports `color_hex` from the root of `ecolor` and changes the
macro to use the re-exported path.

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* Closes https://github.com/emilk/egui/issues/2644
2024-04-21 11:07:55 +02:00
Emil Ernerfeldt 15b0ef3259 Release 0.27.2 - Fix blurry web rendering 2024-04-02 18:18:43 +02:00
Emil Ernerfeldt ab720ce900
Change `Frame::multiply_with_opacity` to multiply in gamma space (#4283)
This produces a more perceptually even change when used in animations,
like when fading out a closed window
2024-03-30 18:39:05 +01:00
Emil Ernerfeldt dfbe118ea4
Release 0.27.1 (#4264)
## egui changelog
### 🐛 Fixed
* Fix visual glitch on the right side of highly rounded rectangles
[#4244](https://github.com/emilk/egui/pull/4244)
* Prevent visual glitch when shadow blur width is very high
[#4245](https://github.com/emilk/egui/pull/4245)
* Fix `InputState::any_touches` and add `InputState::has_touch_screen`
[#4247](https://github.com/emilk/egui/pull/4247)
* Fix `Context::repaint_causes` returning no causes
[#4248](https://github.com/emilk/egui/pull/4248)
* Fix touch-and-hold to open context menu
[#4249](https://github.com/emilk/egui/pull/4249)
* Hide shortcut text on zoom buttons if `zoom_with_keyboard` is false
[#4262](https://github.com/emilk/egui/pull/4262)

### 🔧 Changed
* Don't apply a clip rect to the contents of an `Area` or `Window`
[#4258](https://github.com/emilk/egui/pull/4258)


## eframe changelog
* Web: repaint if the `#hash` in the URL changes
[#4261](https://github.com/emilk/egui/pull/4261)
* Add web support for `zoom_factor`
[#4260](https://github.com/emilk/egui/pull/4260) (thanks
[@justusdieckmann](https://github.com/justusdieckmann)!)

---------

Co-authored-by: Justus Dieckmann <45795270+justusdieckmann@users.noreply.github.com>
2024-03-29 13:12:26 +01:00
Emil Ernerfeldt 4d4cb3d20d Release 0.27.0 - Nicer menus and new hit test logic 2024-03-26 17:13:57 +01:00
Emil Ernerfeldt 3672b150ed Release 0.26.2 - Response.interact/context_menu fix 2024-02-14 10:49:57 +01:00
Emil Ernerfeldt d22ee81ab0 Release 0.26.1 - Bug Fixes 2024-02-11 09:03:09 +01:00