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

Pixelated image rendering regression in 11.0.2 and 11.04 #12786

Closed
hhyyrylainen opened this issue Sep 5, 2023 · 7 comments
Closed

Pixelated image rendering regression in 11.0.2 and 11.04 #12786

hhyyrylainen opened this issue Sep 5, 2023 · 7 comments
Labels
area-rendering by-design The behavior reported in the issue is actually correct.

Comments

@hhyyrylainen
Copy link

Describe the bug
The following issue is happening again: #11319 so I'm opening a new issue to point out the regression.

To Reproduce
Steps to reproduce the behavior:

  1. Add an Image with a size much smaller than the native resolution of the image
  2. Don't add the manual fix which should have been set as the default in Avalonia according to Pixelated Image Rendering in 11 Preview 8 #11319 (RenderOptions.BitmapInterpolationMode="HighQuality")
  3. Run the program and see the image have a lot of jagged / pixelated edges

Expected behavior
According to that closed issue this should be fixed, but apparently the problem is back.

Screenshots
Here's how my example project looks without manually setting that option that shouldn't be necessary:

Kuvakaappaus - 2023-09-05 11-07-18

And here it is when I manually put in that workaround:

Kuvakaappaus - 2023-09-05 11-08-25

The difference is slight but I can't unsee it in my real Avalonia application where multiple buttons with icons on them now look bad in comparison to how they should look.

Desktop (please complete the following information):

  • OS: Linux
  • Version 11.0.2 and 11.04 both show this issue (11.0.2 is the current version used by the templates)

Additional context
This is a sample project showing the problem, I just used the new avalonia.mvvm template and did just the few changes needed to add the image file and code to display it:

AvaloniaImageTest.zip

@timunie
Copy link
Contributor

timunie commented Sep 5, 2023

/cc @Gillibald

@Gillibald
Copy link
Contributor

<StackPanel>
        <TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>

        <Border Background="Gray" RenderOptions.BitmapInterpolationMode="None">
            <Image Source="/Assets/revert.png" Width="32" />
        </Border>
		<Border Background="Gray" RenderOptions.BitmapInterpolationMode="LowQuality">
			<Image Source="/Assets/revert.png" Width="32" />
		</Border>
		<Border Background="Gray" RenderOptions.BitmapInterpolationMode="MediumQuality">
			<Image Source="/Assets/revert.png" Width="32" />
		</Border>
		<Border Background="Gray" RenderOptions.BitmapInterpolationMode="HighQuality">
			<Image Source="/Assets/revert.png" Width="32" />
		</Border>

    </StackPanel>

Screenshot 2023-09-05 111015

Works as expected. The default is LowQuality

@hhyyrylainen
Copy link
Author

I was under the impression after reading the discussion in #11319 that the default value was supposed to be fixed back to what it was in Avalonia in 0.x versions (i.e. high quality)... But reading the PR #11397 makes low quality the default option, which looks worse than in previous Avalonia versions.

@timunie
Copy link
Contributor

timunie commented Sep 5, 2023

I still think it would be great to have a switch in the AppBuilder to specify / override this per App, so don't have to re-do it on every window. That would be just one switch for the developer and may be a good compromise to all usecases.

@hhyyrylainen
Copy link
Author

That'd be a pretty good option as long as the Avalonia documentation mentions that in some sensible place. For example the Image control could have a short warning section explaining that scaling big images down a lot will not look good without an extra setting. Otherwise I doubt people would actually find that (it took me a bit of searching to find that existing issue about this) and have to resort to workarounds for the image drawing.

That'd be the second best option in my opinion after doing the right thing by default, which was what Avalonia did before version 11. Is there a big performance impact from this or what's the reason with the change to the default? I find that maybe some other performance thing like not constantly looping the X11 messages when there's nothing to receive would save a lot more CPU time in a long running application...

@wieslawsoltes
Copy link
Collaborator

RenderOptions.BitmapInterpolationMode="HighQuality

@Gillibald Would be nice if I could set this via style but I get error Writable property is expected:
image

@timunie
Copy link
Contributor

timunie commented Apr 25, 2024

After internal discussion this is by design and need to be set per each root control. This is done on purpose for performance overhead. A behavior or custom attached properties should still be possible to add in your own library.

Will open an issue to reflect that in the docs.

@timunie timunie closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
@timunie timunie added area-rendering by-design The behavior reported in the issue is actually correct. and removed bug labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-rendering by-design The behavior reported in the issue is actually correct.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants