diff --git a/Brushes/AbstractBrush.cs b/Brushes/AbstractBrush.cs index 0a5968c..5a43138 100644 --- a/Brushes/AbstractBrush.cs +++ b/Brushes/AbstractBrush.cs @@ -85,7 +85,7 @@ namespace CUE.NET.Brushes RenderedTargets.Clear(); foreach (BrushRenderTarget point in renderTargets) - RenderedTargets[point] = GetColorAtPoint(rectangle, point); + RenderedTargets[point] = new CorsairColor(GetColorAtPoint(rectangle, point)); // Clone the color, we don't want to have reference issues here and brushes might return the same color multiple times! } /// @@ -95,7 +95,7 @@ namespace CUE.NET.Brushes { List renderTargets = RenderedTargets.Keys.ToList(); foreach (BrushRenderTarget renderTarget in renderTargets) - RenderedTargets[renderTarget] = FinalizeColor(RenderedTargets[renderTarget]); + RenderedTargets[renderTarget] = FinalizeColor(RenderedTargets[renderTarget]); // Cloning here again shouldn't be needed since we did this above. } /// @@ -109,6 +109,7 @@ namespace CUE.NET.Brushes /// /// Finalizes the color by appliing the overall brightness and opacity.
/// This method should always be the last call of a implementation. + /// If you overwrite this method please make sure that you never return the same color-object twice to prevent reference-issues! ///
/// The color to finalize. /// The finalized color. diff --git a/Devices/Generic/CorsairColor.cs b/Devices/Generic/CorsairColor.cs index aed69d0..346cdc5 100644 --- a/Devices/Generic/CorsairColor.cs +++ b/Devices/Generic/CorsairColor.cs @@ -39,6 +39,10 @@ namespace CUE.NET.Devices.Generic this.B = b; } + public CorsairColor(CorsairColor color) + : this(color.A, color.R, color.G, color.B) + { } + #endregion #region Operators