From 903929b3ee1fc1a50c83e33fb1fde0b6a72a2380 Mon Sep 17 00:00:00 2001 From: Jan Klass Date: Wed, 16 Jul 2025 00:25:38 +0200 Subject: [PATCH] Split off DrawGray method --- .../Drawing/Filters/GrayscaleFilter.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Greenshot.Editor/Drawing/Filters/GrayscaleFilter.cs b/src/Greenshot.Editor/Drawing/Filters/GrayscaleFilter.cs index 441102980..ab540f4e0 100644 --- a/src/Greenshot.Editor/Drawing/Filters/GrayscaleFilter.cs +++ b/src/Greenshot.Editor/Drawing/Filters/GrayscaleFilter.cs @@ -56,6 +56,13 @@ namespace Greenshot.Editor.Drawing.Filters graphics.ExcludeClip(rect); } + DrawGray(graphics, applyBitmap, applyRect); + + graphics.Restore(state); + } + + public static void DrawGray(Graphics graphics, Bitmap applyBitmap, NativeRect applyRect) + { ColorMatrix grayscaleMatrix = new ColorMatrix(new[] { new[] @@ -83,9 +90,7 @@ namespace Greenshot.Editor.Drawing.Filters { ia.SetColorMatrix(grayscaleMatrix); graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); - } - - graphics.Restore(state); + } } } } \ No newline at end of file