Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all lines and rectangles crisp #5518

Merged
merged 24 commits into from
Dec 26, 2024
Merged

Conversation

emilk
Copy link
Owner

@emilk emilk commented Dec 26, 2024

This aligns all rectangles and (horizontal or vertical) line segments to the physical pixel grid in the epaint::Tessellator, making these shapes appear crisp everywhere.

This undoes a lot of the explicit, egui-side aligning added in:

The new approach has several benefits over the old one:

  • It is done automatically by epaint, so it is applied to everything (no longer opt-in)
  • It is applied after any layer transforms (so it always works)
  • It makes line segments crisper on high-DPI screens
  • All filled rectangles now has sides that end on pixel boundaries

@emilk emilk changed the title Fix bug in Painter::with_layer_id Make all lines and rectangles crisp Dec 26, 2024
Copy link

Preview available at https://egui-pr-preview.github.io/pr/5518-emilkround-shapes-to-pixels
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@emilk emilk added egui epaint do not merge do-not-merge Do not merge yet, but you can still review it and removed do not merge labels Dec 26, 2024
@emilk emilk marked this pull request as ready for review December 26, 2024 18:16
@emilk emilk marked this pull request as draft December 26, 2024 18:26
@emilk emilk marked this pull request as ready for review December 26, 2024 19:29
Base automatically changed from emilk/round-coordinates to master December 26, 2024 19:54
@emilk emilk force-pushed the emilk/round-shapes-to-pixels branch from 23372b7 to 9a22b0c Compare December 26, 2024 19:57
@emilk emilk removed the do-not-merge Do not merge yet, but you can still review it label Dec 26, 2024
@emilk emilk merged commit d20f93e into master Dec 26, 2024
47 checks passed
@emilk emilk deleted the emilk/round-shapes-to-pixels branch December 26, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align shapes to physical pixel grid egui_demo_app color test lines
1 participant