Initial implementation

This commit is contained in:
DarthAffe committed 2018-06-04 22:36:56 +02:00
1 parent 278e22020e
commit fd662dcf34
63 files changed
+4881

No files matched your search

+48
View File
@@ -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
}
}