10BC0 Enable antialiasing based on EdgeMode in DrawBitmap by snowflysky · Pull Request #20116 · AvaloniaUI/Avalonia · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@snowflysky
Copy link
Contributor
@snowflysky snowflysky commented Nov 21, 2025

What does the pull request do?

This PR addresses the issue where Image controls exhibit jagged/aliased edges when a transform (such as RotateTransform) is applied in the Skia backend.

It enables antialiasing for bitmap drawing operations by configuring the SKPaint.IsAntialias property, while still respecting RenderOptions.EdgeMode.

What is the current behavior?

Currently, when drawing a Bitmap via DrawingContext.DrawImage, the SKPaint used defaults to IsAntialias = false.

This causes the edges of the bitmap to appear jagged (aliased) when the image is rotated or drawn off the pixel grid, even if RenderOptions.BitmapInterpolationMode is set to HighQuality.

What is the updated/expected behavior with this PR?

  • Rotated Images: Edges of Image controls are now smooth (antialiased) when rotated.
  • EdgeMode Support: The implementation checks RenderOptions.EdgeMode. If set to Aliased, antialiasing is disabled. Otherwise, it defaults to enabled.

Checklist

Breaking changes

None. This is a visual improvement. Users who specifically require aliased edges can still achieve them by setting RenderOptions.EdgeMode="Aliased"

Fixed issues

Fixes #20079

@MrJul
Copy link
Member
MrJul commented Nov 21, 2025

Thank you! Could you please add a matching render test?

@snowflysky
Copy link
Contributor Author

I'm sorry, I'm not very familiar with rendering test, so adding tests might take a long time. Or could someone take over the testing part?😅

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0060249-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@snowflysky
Copy link
Contributor Author

I have attempted to add rendering tests.
Additionally, I found that the ImageBrush_Tile_UniformToFill test failed due to this change, and I have updated the expected image.

MrJul
MrJul previously approved these changes Nov 24, 2025
Copy link
Member
@MrJul MrJul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the tests :)
LGTM, thank you!

@MrJul MrJul added this pull request to the merge queue Nov 24, 2025
@MrJul MrJul removed this pull request from the merge queue due to a manual request Nov 24, 2025
@MrJul
Copy link
Member
MrJul commented Nov 24, 2025

Note: we're removing Direct2D in #20132, the Direct2D tests can be removed from this PR (I'll do it if you don't @snowflysky).

@snowflysky
Copy link
Contributor Author

Note: we're removing Direct2D in #20132, the Direct2D tests can be removed from this PR (I'll do it if you don't @snowflysky).

Okay, I have deleted the Direct2D tests.

@MrJul MrJul enabled auto-merge November 24, 2025 13:18
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0060301-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added this pull request to the merge queue Nov 24, 2025
Merged via the queue into AvaloniaUI:master with commit c7bc7e9 Nov 24, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-rendering area-skia backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image shows jagged edges when using RotateTransform

3 participants

0