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

Align shapes to physical pixel grid #5164

Open
emilk opened this issue Sep 25, 2024 · 0 comments
Open

Align shapes to physical pixel grid #5164

emilk opened this issue Sep 25, 2024 · 0 comments
Labels
epaint visuals Renderings / graphics releated

Comments

@emilk
Copy link
Owner

emilk commented Sep 25, 2024

When painting shapes, it is sometimes preferably to align them to the physical pixel grid.

There are a few different ways we can attack this:
A) A document and make it easy for users to align
B) Always align shapes, and opt-in to non-aligned shapes
C) Always align all shapes

I think B is preferable, the question is how to accomplish it on a per-shape basis.

We could add a bool flag to each shape, and have the tessellator do the alignment, unless the flag is set.
Or the Painter aligns all shapes, unless you call painter.add_unaligned(…) or something like that.

When to align

Sharpness

We always align text to the physical grid (unless rotated), because otherwise it looks blurry.

Similarly we align many vertical lines, horizontal lines, and rectangle frames to make them sharper:

Tiling

When painting many rectangles that should seamlessly tile:
#4928 (comment)
image

In this case, the end results would look better if the rectangle was aligned to the physical pixel grid.

When not to align

When you want to smoothly animate something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epaint visuals Renderings / graphics releated
Projects
None yet
Development

No branches or pull requests

1 participant