From 59d14ddcea1d93f0293280b702bc6ab6fe026ee3 Mon Sep 17 00:00:00 2001 From: Paisley Mahern Date: Fri, 8 Sep 2023 14:20:02 -0500 Subject: [PATCH] Update RenderTargetBitmap.cs --- .../Media/Imaging/RenderTargetBitmap.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs b/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs index 4adac60c2d..b1c9c81b39 100644 --- a/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs +++ b/src/Avalonia.Base/Media/Imaging/RenderTargetBitmap.cs @@ -68,19 +68,18 @@ namespace Avalonia.Media.Imaging /// /// The drawing context. public DrawingContext CreateDrawingContext() - { - var platform = PlatformImpl.Item.CreateDrawingContext(); - platform.Clear(Colors.Transparent); - return new PlatformDrawingContext(platform); - } + => CreateDrawingContext(true); /// - /// Creates a for editing the already existing image in the . + /// Creates a for drawing to the . /// + /// If true, clears the current image data to transparent, if false, leaves the image data unchanged. /// The drawing context. - public DrawingContext CreateEditDrawingContext() + public DrawingContext CreateDrawingContext(bool clear) { var platform = PlatformImpl.Item.CreateDrawingContext(); + if(clear) + platform.Clear(Colors.Transparent); return new PlatformDrawingContext(platform); }