コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public void InitColorChange(RGBValue newrefValue)
 {
     if (colorSweepState == 0)
     {
         colorSweepState = 1;
         oldRGBrefValue  = newRGBrefValue;
         newRGBrefValue  = newrefValue;
     }
 }
コード例 #3
0
        private void ExecuteCollorFading()
        {
            currentRGBrefValue =
                oldRGBrefValue * ((float)(colorChangeStep - colorChangeCycle) / colorChangeStep) +
                newRGBrefValue * ((float)colorChangeCycle / colorChangeStep);
            colorChangeCycle++;

            if (colorChangeCycle > colorChangeStep)
            {
                colorSweepState  = 0;
                colorChangeCycle = 0;
            }
        }