Skip to content

Align shapes to physical pixel grid #5164

@emilk

Description

@emilk

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.

Metadata

Metadata

Assignees

Labels

epaintvisualsRenderings / graphics releated

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions