Apply exclusion to grayscale filters as well

(cherry picked from commit e0b04a11f02e6188e364ea26de96944d9927291a)
This commit is contained in:
nathbrow 2025-07-17 14:45:22 -07:00 committed by Nathan
commit dd0cdf4724
2 changed files with 5 additions and 1 deletions

View file

@ -396,7 +396,7 @@ namespace Greenshot.Editor.Drawing
public bool HasFilters => Filters.Count > 0; public bool HasFilters => Filters.Count > 0;
public bool IsAreaHighlightContainer => Filters.Any(f => f is BrightnessFilter) && Filters.Any(f => f is BlurFilter); public bool IsAreaHighlightContainer => Filters.Any(f => f.Invert && (f is BrightnessFilter || f is BlurFilter || f is GrayscaleFilter));
public abstract void Draw(Graphics graphics, RenderMode renderMode); public abstract void Draw(Graphics graphics, RenderMode renderMode);

View file

@ -55,6 +55,10 @@ namespace Greenshot.Editor.Drawing.Filters
{ {
graphics.SetClip(applyRect); graphics.SetClip(applyRect);
graphics.ExcludeClip(rect); graphics.ExcludeClip(rect);
foreach (NativeRect area in areasToExcludeFromFilters)
{
graphics.ExcludeClip(area);
}
} }
ColorMatrix grayscaleMatrix = new ColorMatrix(new[] ColorMatrix grayscaleMatrix = new ColorMatrix(new[]