From 867dbeacdaa4a298ee7fe5f2ade4317e73bc21ac Mon Sep 17 00:00:00 2001 From: PMahern Date: Tue, 5 Sep 2023 15:58:30 -0500 Subject: [PATCH] Made clear behavior in RenderTargetBitmap.CreateDrawingContext optional The original behavior is still preserved so this shouldn't be a breaking change for anyone relying on the clear behavior. --- src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs b/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs index d638630bb1..5824a2b994 100644 --- a/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs +++ b/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs @@ -62,10 +62,16 @@ namespace Avalonia.Media.Imaging return factory.CreateRenderTargetBitmap(size, dpi); } - public DrawingContext CreateDrawingContext() + /// + /// Creates a for drawing to the . + /// + /// Indicates if the image should be cleared. + /// The drawing context. + public DrawingContext CreateDrawingContext(bool clear = true) { var platform = PlatformImpl.Item.CreateDrawingContext(); - platform.Clear(Colors.Transparent); + if(clear) + platform.Clear(Colors.Transparent); return new PlatformDrawingContext(platform); }