Split off DrawGray method

This commit is contained in:
Jan Klass 2025-07-16 00:25:38 +02:00
commit 903929b3ee

View file

@ -56,6 +56,13 @@ namespace Greenshot.Editor.Drawing.Filters
graphics.ExcludeClip(rect); 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[] ColorMatrix grayscaleMatrix = new ColorMatrix(new[]
{ {
new[] new[]
@ -84,8 +91,6 @@ namespace Greenshot.Editor.Drawing.Filters
ia.SetColorMatrix(grayscaleMatrix); ia.SetColorMatrix(grayscaleMatrix);
graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia); graphics.DrawImage(applyBitmap, applyRect, applyRect.X, applyRect.Y, applyRect.Width, applyRect.Height, GraphicsUnit.Pixel, ia);
} }
graphics.Restore(state);
} }
} }
} }