mirror of
https://github.com/DarthAffe/RGBSyncPlus
synced 2026-11-11 13:06:28 +00:00
Initial implementation
This commit is contained in:
1 parent
278e22020e
commit
fd662dcf34
63 files changed
+4881
No files matched your search
@@ -0,0 +1,48 @@
|
||||
using System.ComponentModel;
|
||||
using RGB.NET.Core;
|
||||
using RGBSyncPlus.Helper;
|
||||
using RGBSyncPlus.Model;
|
||||
|
||||
namespace RGBSyncPlus.Brushes
|
||||
{
|
||||
public class SyncBrush : AbstractBrush
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly SyncGroup _syncGroup;
|
||||
|
||||
private Led _syncLed;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public SyncBrush(SyncGroup syncGroup)
|
||||
{
|
||||
this._syncGroup = syncGroup;
|
||||
|
||||
syncGroup.PropertyChanged += SyncGroupOnPropertyChanged;
|
||||
_syncLed = syncGroup.SyncLed?.GetLed();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void SyncGroupOnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(SyncGroup.SyncLed))
|
||||
_syncLed = _syncGroup.SyncLed?.GetLed();
|
||||
}
|
||||
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget)
|
||||
{
|
||||
if (renderTarget.Led == _syncLed)
|
||||
return Color.Transparent;
|
||||
|
||||
return _syncLed?.Color ?? Color.Transparent;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user