static void SetLedColors(ILedGroup ledGroup) { using (Graphics g = Graphics.FromImage(BigScreen)) { // Take screenshot g.CopyFromScreen(0, 0, 0, 0, BigScreen.Size); } using (Graphics g = Graphics.FromImage(SmallScreen)) { // Squeeze the screenshot into a 1x1 bitmap g.DrawImage(BigScreen, 0, 0, 1, 1); } // Get the color of the squeezed pixel System.Drawing.Color pixelRGB = SmallScreen.GetPixel(0, 0); // Convert RGB -> HSV HSV pixelHSV = new HSV(pixelRGB); // Crank up saturation //if (pixelHSV.H > 0.1) // pixelHSV.S = 1.0; // Convert HSV -> RGB System.Drawing.Color newPixelRGB = pixelHSV.ToRGB(); RGB.NET.Core.Color color = new RGB.NET.Core.Color((newPixelRGB.R), (newPixelRGB.G), (newPixelRGB.B)); // Assign the color to all the LEDs in your ledGroup ledGroup.Brush = new SolidColorBrush(color); }
public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color) { var point = renderTarget.Led.AbsoluteLedRectangle.Center; if (_bitmap != null && _bitmap.Width - 1 >= point.X && _bitmap.Height - 1 >= point.Y) { var pixel = _bitmap.GetPixel((int)point.X, (int)point.Y); return(new Color(pixel.A, pixel.R, pixel.G, pixel.B)); } return(new Color(0, 0, 0)); }
public Color ManipulateColor(Rectangle rectangle, BrushRenderTarget renderTarget, Color color) { int barSampleIndex = Math.Min(_visualizationProvider.VisualizationData.Length, (int)Math.Floor(_visualizationProvider.VisualizationData.Length * (renderTarget.Point.X / (rectangle.Location.X + rectangle.Size.Width)))); double curBarHeight = 1.0 - Math.Max(0f, _visualizationProvider.VisualizationData[barSampleIndex]); double verticalPos = (renderTarget.Point.Y / rectangle.Size.Height); return(curBarHeight > verticalPos?color.SetA(0) : color); }