| | |
| | | return recolor; |
| | | } |
| | | /// <summary> |
| | | /// 获取rgb颜色数组 |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | /// <returns></returns> |
| | | public byte[] GetRGBbytes(Function function) |
| | | { |
| | | var color = function.GetAttrState(FunctionAttributeKey.RGB).Split(","); |
| | | |
| | | if (color.Length != 3) |
| | | { |
| | | color = new string[] { "100", "100", "100" }; |
| | | } |
| | | byte redColor = 0; |
| | | byte greenColor = 0; |
| | | byte blueColor = 0; |
| | | |
| | | byte.TryParse(color[0], out redColor); |
| | | byte.TryParse(color[1], out greenColor); |
| | | byte.TryParse(color[2], out blueColor); |
| | | |
| | | return new byte[] { redColor, greenColor, blueColor }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取rgb 控制字符串 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | function.SetAttrState(FunctionAttributeKey.RGB, color[0] + "," + color[1] + "," + color[2]); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置色温 |
| | | /// </summary> |
| | | /// <param name="cct"></param> |
| | | /// <param name="function"></param> |
| | | public void SetCCT(byte[] cct,Function function) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.CCT, cct[0] * 256 + cct[1]); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |