From 41d33dd5177b5d5bdb60615a991152fb68392f6d Mon Sep 17 00:00:00 2001 From: Aytackydln Date: Sat, 2 Nov 2024 02:12:48 +0100 Subject: [PATCH] fix key exclusions with Bitmap Layers --- .../EffectsEngine/EffectLayer.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs b/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs index 6a494ebb6..4c7fccf2e 100755 --- a/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs @@ -63,6 +63,11 @@ public BitmapEffectLayer(string name, bool persistent) : this(name) /// public Color Get(DeviceKeys key) { + if (KeyExcluded(key)) + { + return TransparentColor; + } + var keyRectangle = Effects.Canvas.GetRectangle(key); if (keyRectangle.IsEmpty) @@ -1041,6 +1046,7 @@ private void PercentEffect(ColorSpectrum spectrum, FreeFormObject freeform, doub } private KeySequence _excludeSequence = new(); + private readonly ZoneKeysCache _excludeKeysCache = new(); /// public void Exclude(KeySequence sequence) @@ -1066,5 +1072,18 @@ public void OnlyInclude(KeySequence sequence) Invalidate(); } + private bool KeyExcluded(DeviceKeys key) + { + switch (_excludeSequence.Type) + { + case KeySequenceType.Sequence: + return _excludeSequence.Keys.Contains(key); + case KeySequenceType.FreeForm: + return _excludeKeysCache.GetKeys(_excludeSequence.Freeform).Contains(key); + } + + return false; + } + public override string ToString() => _name; } \ No newline at end of file