-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Images are a little blurry #494
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Let's not conflate things here! The original problem is probably caused by the The second problem is the result of using a generic anti-aliasing strategy (MSAA) in the It's also important to note that For the first issue, we should probably always align images to the physical pixel grid while rendering, although blurriness may still happen during magnification or minification (mipmapping may be the answer here). For the second issue, we will eventually need a better path rasterizer! I mentioned this when I first implemented the |
Closing in favor of #557. |
It looks like the
Image
widget draws images in such a way that some parts of the image are a little blurry (noticeable when images contain thin high-contrast lines), while other parts are displayed just fine.Here is a minimal reproducible example:
Archive with this example: iced-blurry-images.tar.gz
Cargo.toml
dependencies section:File
grid.png
:Result (screenshots):
Window size is not changed:
Window width is changed by ~1px:
(Screenshots are clickable and you should open them in the original size to clearly see what they show)
Some lines on the screenshots are 1px wide (as they should be), but other lines are drawn as if they pass right between the pixel rows (2px wide and the color is gray, not black). It looks like the image size does not matter, although I haven't tested it thoroughly.
This is reproducible even without a
Container
holding anImage
(that is, if we directly returnimage.into()
fromdraw
), but I use it to see how the image on the screen changes when the window is resized (and theImage
widget is moved).At first, my guess was that the coordinates of the top-left corner of the image might be fractional (and, likewise, the coordinates of the pixels of this image), but it doesn't explain why some lines are drawn normally, while others are blurry. However, it might be one of the factors responsible for this, since when the image is centered and the window width is changed by 1px, the image position is changed by 0.5px, which causes different lines to become "blurry". Actually, in an ideal case images should probably be aligned with the pixel grid, so that they could display their content without extra "blurriness" or similar distortions.
The text was updated successfully, but these errors were encountered: