using System.Collections.Generic; using System.Drawing; using CUE.NET.Devices.Generic; using CUE.NET.Devices.Generic.Enums; namespace CUE.NET.Brushes { /// /// Represents a brush drawing the lighting of a CUE profile. /// public class ProfileBrush : AbstractBrush { #region Properties & Fields private Dictionary _colors; #endregion #region Constructors /// /// Initializes a new instance of the class. /// /// The light settings of the CUE profile. internal ProfileBrush(Dictionary keyLights) { this._colors = 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 CorsairColor GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget) { CorsairLed led = CueSDK.KeyboardSDK[renderTarget.LedId]; if (led == null) return CorsairColor.Transparent; CorsairColor color; return !_colors.TryGetValue(led.Id, out color) ? CorsairColor.Transparent : color; } #endregion } }