//set random gradient color private void button4_Click(object sender, EventArgs e) { Color one = ts.RandomColor(); Color two = ts.RandomColor(); List <Color> colooren = ColorManipulations.GetGradientColors(one, two, NUMBER_OF_LEDS + 1); currentColor = colooren; write_color_stream(colooren); }
//set single color private void button2_Click(object sender, EventArgs e) { if (colorDialog1.ShowDialog() == DialogResult.OK) { List <Color> colooren = ColorManipulations.GetGradientColors(colorDialog1.Color, colorDialog1.Color, NUMBER_OF_LEDS + 1); currentColor = colooren; apply_color.BackColor = colorDialog1.Color; } }
//set gradient color private void button3_Click(object sender, EventArgs e) { if (colorDialog1.ShowDialog() == DialogResult.OK) { Color one, two; one = colorDialog1.Color; if (colorDialog1.ShowDialog() == DialogResult.OK) { two = colorDialog1.Color; List <Color> colooren = ColorManipulations.GetGradientColors(one, two, NUMBER_OF_LEDS + 1); currentColor = colooren; write_color_stream(colooren); } } }
private void timer1_Tick(object sender, EventArgs e) { Point cursor = new Point(); ColorManipulations.GetCursorPos(ref cursor); Color c = ColorManipulations.GetColorAt(cursor); this.BackColor = c; if (c != prevColor) { prevColor = c; List <Color> colooren = ColorManipulations.GetGradientColors(c, c, NUMBER_OF_LEDS + 1); write_color_stream(colooren); } }
private void change_brightness(int value) { if (!clicked) { float normalized_value = ((value - 0f) / (255f - 0f)) * (1f - -1f) + -1f; //generate value between -1 and 1, from range 0 to 255 List <Color> modiCols = new List <Color>(); if (currentColor != null) { foreach (Color col in currentColor) { modiCols.Add(ColorManipulations.ChangeColorBrightness(col, normalized_value)); } // coltmp = modiCols; write_color_stream(modiCols); } } }
private void button7_Click(object sender, EventArgs e) { List <Color> colooren = ColorManipulations.GetGradientColors(Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 0), NUMBER_OF_LEDS + 1); write_color_stream(colooren); }