dotnet / dotnet/wpf

Effects not rendered correctly in System.Windows.Media.Imaging.RenderTargetBitmap on ARM64

Open
#9,909 0 comments 0 reactions 0 assignees View on GitHub
ARM64 Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

The System.Windows.Media.Imaging.RenderTargetBitmap can be used to render UI controls, but when controls have effects such as BlurEffect or DropShadowEffect, the effects are lost and cannot be rendered correctly in ARM64 environment. However, this issue does not occur on x86 and x64 platforms.

### Reproduction Steps

Minimal reproduction: https://github.com/WXRIW/RenderTargetBitmapTest

Key code:
```
public static System.Windows.Media.Imaging.RenderTargetBitmap SaveFrameworkElementToImage(FrameworkElement ui, double renderScale = 1)
{
System.Windows.Media.Imaging.RenderTargetBitmap bmp = new(
(int)(ui.ActualWidth * renderScale),
(int)(ui.ActualHeight * renderScale),
96d * renderScale,
96d * renderScale,
System.Windows.Media.PixelFormats.Default);
bmp.Render(ui);

return bmp;
}
```

### Expected behavior

![image](https://github.com/user-attachments/assets/28ae7b4f-58aa-4227-a0e9-3d1e8ff106e4)

### Actual behavior

![image](https://github.com/user-attachments/assets/2664ccad-e9fb-4bbd-8d8a-d2e0294ad119)

### Regression?

Both .NET 6 and .NET 8 have this issue.

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

ARM64

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.