public void RefreshData(RGBValue[] rgbStripeHandle) { if (curveChangeState > 0) { ExecuteCurveFading(); } if (colorSweepState > 0) { ExecuteCollorFading(); } for (int idx = 0; idx < StripeLenght; idx++) { Byte red = (Byte)((int)Curves[CurveIndex][idx + cycleCount] * currentRGBrefValue.Red / RGBValue.MaxValue); Byte green = (Byte)((int)Curves[CurveIndex][idx + cycleCount] * currentRGBrefValue.Green / RGBValue.MaxValue); Byte blue = (Byte)((int)Curves[CurveIndex][idx + cycleCount] * currentRGBrefValue.Blue / RGBValue.MaxValue); rgbStripeHandle[idx] = new RGBValue() { Intensity = currentRGBrefValue.Intensity, Red = red, Green = green, Blue = blue }; } cycleCount++; if (cycleCount >= StripeLenght) { cycleCount = 0; } }
public void InitColorChange(RGBValue newrefValue) { if (colorSweepState == 0) { colorSweepState = 1; oldRGBrefValue = newRGBrefValue; newRGBrefValue = newrefValue; } }
private void ExecuteCollorFading() { currentRGBrefValue = oldRGBrefValue * ((float)(colorChangeStep - colorChangeCycle) / colorChangeStep) + newRGBrefValue * ((float)colorChangeCycle / colorChangeStep); colorChangeCycle++; if (colorChangeCycle > colorChangeStep) { colorSweepState = 0; colorChangeCycle = 0; } }