Exemple #1
0
        private void SetColorTempValue()
        {
            int            hz            = cbHz1.SelectedValue.ToString().GetInt32(System.Globalization.NumberStyles.Number);
            colorTempGroup group         = this.colorTempData.arrGroup[hz];
            int            colorTmp      = cbColorTempType1.SelectedValue.ToString().GetInt32(System.Globalization.NumberStyles.Number);
            colorTemp      colorTempData = group.arrData[colorTmp];

            UInt16 redVal   = (UInt16)numRed.Value;
            UInt16 greenVal = (UInt16)numGreen.Value;
            UInt16 blueVal  = (UInt16)numBlue.Value;

            byte[] redBtValue   = redVal.GetBytes();
            byte[] greenBtValue = greenVal.GetBytes();
            byte[] blueBtValue  = blueVal.GetBytes();

            //Red
            colorTempData.Red_Hi = redBtValue[0];
            colorTempData.Red_Lo = redBtValue[1];

            //Green
            colorTempData.Green_Hi = greenBtValue[0];
            colorTempData.Green_Lo = greenBtValue[1];

            //Blue
            colorTempData.Blue_Hi = blueBtValue[0];
            colorTempData.Blue_Lo = blueBtValue[1];
        }
Exemple #2
0
        public static colorTempData GetColorTempData(byte[] data)
        {
            int           offset        = 0;
            colorTempData colorTempData = new colorTempData();

            for (int i = 0; i < 4; i++)
            {
                //第一套为60Hz色温组,第二套为50Hz色温组,第三套为3D色温组,第四套预留用途
                colorTempData.arrGroup[i] = new colorTempGroup();
                colorTempGroup group = colorTempData.arrGroup[i];
                for (int j = 0; j < 10; j++)
                {
                    //10个色温,0 = 3200K , 1=6500K, 2=8500K,3=9300K,其他为自定义色温值
                    group.arrData[j] = new colorTemp();
                    colorTemp colorTemp = group.arrData[j];
                    colorTemp.Red_Hi   = data[0 + offset];
                    colorTemp.Red_Lo   = data[1 + offset];
                    colorTemp.Green_Hi = data[2 + offset];
                    colorTemp.Green_Lo = data[3 + offset];
                    colorTemp.Blue_Hi  = data[4 + offset];
                    colorTemp.Blue_Lo  = data[5 + offset];
                    offset            += 6;
                }
            }
            return(colorTempData);
        }
Exemple #3
0
        private void InitColorTempValue()
        {
            numRed.ValueChanged   -= numRed_ValueChanged;
            numGreen.ValueChanged -= numGreen_ValueChanged;
            numBlue.ValueChanged  -= numBlue_ValueChanged;

            int            hz            = cbHz1.SelectedValue.ToString().GetInt32(System.Globalization.NumberStyles.Number);
            colorTempGroup group         = this.colorTempData.arrGroup[hz];
            int            colorTmp      = cbColorTempType1.SelectedValue.ToString().GetInt32(System.Globalization.NumberStyles.Number);
            colorTemp      colorTempData = group.arrData[colorTmp];

            byte[] tmp = new byte[2];
            //Red
            tmp[0] = colorTempData.Red_Hi;
            tmp[1] = colorTempData.Red_Lo;
            ushort val = tmp.GetUInt16(0);

            numRed.Value = val;

            //Green
            tmp[0]         = colorTempData.Green_Hi;
            tmp[1]         = colorTempData.Green_Lo;
            val            = tmp.GetUInt16(0);
            numGreen.Value = val;

            //Blue
            tmp[0]        = colorTempData.Blue_Hi;
            tmp[1]        = colorTempData.Blue_Lo;
            val           = tmp.GetUInt16(0);
            numBlue.Value = val;

            numRed.ValueChanged   += numRed_ValueChanged;
            numGreen.ValueChanged += numGreen_ValueChanged;
            numBlue.ValueChanged  += numBlue_ValueChanged;
        }
Exemple #4
0
        public static byte[] GetData(colorTempData ct)
        {
            int offset = 0;

            byte[] data = new byte[1024].Fill(0xff);
            for (int i = 0; i < 4; i++)
            {
                //第一套为60Hz色温组,第二套为50Hz色温组,第三套为3D色温组,第四套预留用途
                colorTempGroup group = ct.arrGroup[i];
                for (int j = 0; j < 10; j++)
                {
                    //10个色温,0 = 3200K , 1=6500K, 2=8500K,3=9300K,其他为自定义色温值
                    colorTemp colorTemp = group.arrData[j];
                    data[0 + offset] = colorTemp.Red_Hi;
                    data[1 + offset] = colorTemp.Red_Lo;
                    data[2 + offset] = colorTemp.Green_Hi;
                    data[3 + offset] = colorTemp.Green_Lo;
                    data[4 + offset] = colorTemp.Blue_Hi;
                    data[5 + offset] = colorTemp.Blue_Lo;
                    offset          += 6;
                }
            }
            return(data);
        }