Describe the bug
When rendering a control to a RenderTargetBitmap using the Render method, any DropShadowEffect applied to child controls is not included in the resulting image. The effect is visible on screen but missing from the saved bitmap:
To Reproduce
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
x:Class="AvaloniaDropShadowEffectTest.MainWindow"
Title="AvaloniaDropShadowEffectTest"
Background="Black"
Loaded="Window_Loaded">
<Grid Width="300" Height="300">
<Canvas Name="canvas" Background="White">
<Rectangle Fill="Red" Height="200" Width="200" Margin="50">
<Rectangle.Effect>
<DropShadowEffect Color="Black" BlurRadius="30"/>
</Rectangle.Effect>
</Rectangle>
</Canvas>
</Grid>
</Window>
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
namespace AvaloniaDropShadowEffectTest
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object? sender, RoutedEventArgs e)
{
PixelSize pixelSize = new PixelSize((int)canvas.Bounds.Width, (int)canvas.Bounds.Height);
using (RenderTargetBitmap renderBitmap = new RenderTargetBitmap(pixelSize))
{
renderBitmap.Render(canvas);
renderBitmap.Save("canvas.png");
}
}
}
}
Avalonia version
11.3.12
12.0.0-preview1
OS
Windows
Describe the bug
When rendering a control to a RenderTargetBitmap using the Render method, any DropShadowEffect applied to child controls is not included in the resulting image. The effect is visible on screen but missing from the saved bitmap:
To Reproduce
Avalonia version
11.3.12
12.0.0-preview1
OS
Windows