using System.Collections.Generic; using System.Drawing; using CUE.NET.Devices.Keyboard.Enums; using CUE.NET.Devices.Keyboard.Keys; namespace CUE.NET.Brushes { /// /// Represents a brush drawing the lighting of a CUE profile. /// public class ProfileBrush : AbstractBrush { #region Properties & Fields /// /// Gets the strongly-typed target used for the effect. /// protected override IBrush EffectTarget => this; private Dictionary _keyLights; #endregion #region Constructors /// /// Initializes a new instance of the class. /// /// The light settings of the CUE profile. internal ProfileBrush(Dictionary keyLights) { this._keyLights = keyLights; } #endregion #region Methods /// /// Gets the color at an specific point assuming the brush is drawn into the given rectangle. /// /// The rectangle in which the brush should be drawn. /// The target (key/point) from which the color should be taken. /// The color at the specified point. protected override Color GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget) { CorsairKey key = CueSDK.KeyboardSDK[(CorsairKeyboardKeyId)renderTarget.LedId]; if (key == null) return Color.Transparent; Color color; return !_keyLights.TryGetValue(key.KeyId, out color) ? Color.Transparent : color; } #endregion } }