/// <summary>
 /// 参数编辑窗口初始化
 /// </summary>
 private void Init()
 {
     _actualArg = _arg as CurveAdjustProcessorArg;
     InitBandSelect();
     InitInterpolatorTypeSelect();
     InitLstControlPoints();
 }
 public override XmlElement ToXML(XmlDocument xmldoc)
 {
     if (_actualArg == null)
     {
         _actualArg = new CurveAdjustProcessorArg();
     }
     return(_actualArg.ToXML(xmldoc));
 }
 protected override void BeforeProcess()
 {
     base.BeforeProcess();
     _actualArg   = _arg as CurveAdjustProcessorArg;
     _rgbValues   = _actualArg.RGB.Values;
     _redValues   = _actualArg.Red.Values;
     _greenValues = _actualArg.Green.Values;
     _blueValues  = _actualArg.Blue.Values;
     _needRgb     = !_actualArg.RGB.IsEmpty;
     _needRed     = !_actualArg.Red.IsEmpty;
     _needGreen   = !_actualArg.Green.IsEmpty;
     _needBlue    = !_actualArg.Blue.IsEmpty;
 }
 public override void CreateDefaultArguments()
 {
     _arg = new CurveAdjustProcessorArg();
 }
Beispiel #5
0
        public override RgbProcessorArg Clone()
        {
            CurveAdjustProcessorArg arg = new CurveAdjustProcessorArg();

            return(arg);
        }
Beispiel #6
0
        /// <summary>
        /// 将控件参数传递到参数对象中
        /// </summary>
        protected override void CollectArguments()
        {
            if (_arg == null)
            {
                return;
            }
            CurveAdjustProcessorArg actualArg    = _arg as CurveAdjustProcessorArg;
            IInterpolator           interpolator = GetInterpolator();

            if (curveControl.Channels == 3)
            {
                for (int i = 0; i < curveControl.Channels; i++)
                {
                    interpolator.Clear();
                    CurveControl          curve = curveControl;// curveControls[CA.ColorTransferMode.Rgb];
                    SortedList <int, int> cps   = curve.ControlPoints[i];
                    for (int s = 0; s < cps.Count; s++)
                    {
                        interpolator.Add(cps.Keys[s], cps.Values[s]);
                    }
                    byte[] rgbMap = new byte[curveControl.Entries];
                    for (int j = 0; j < curveControl.Entries; j++)
                    {
                        rgbMap[j] = (byte)Utility.Clamp(interpolator.Interpolate((byte)j), 0, curveControl.Entries - 1);
                    }
                    if (i == 0)
                    {
                        actualArg.Red.Values = rgbMap;
                    }
                    else if (i == 1)
                    {
                        actualArg.Green.Values = rgbMap;
                    }
                    else if (i == 2)
                    {
                        actualArg.Blue.Values = rgbMap;
                    }
                }
                actualArg.RGB.Values = null;
            }
            else
            {
                interpolator.Clear();
                CurveControl          curve = curveControl;// curveControls[CA.ColorTransferMode.Luminosity];
                SortedList <int, int> cps   = curve.ControlPoints[0];
                for (int s = 0; s < cps.Count; s++)
                {
                    interpolator.Add(cps.Keys[s], cps.Values[s]);
                }
                byte[] rgbMap = new byte[curveControl.Entries];
                for (int j = 0; j < curveControl.Entries; j++)
                {
                    rgbMap[j] = (byte)Utility.Clamp(interpolator.Interpolate((byte)j), 0, curveControl.Entries - 1);
                }
                actualArg.RGB.Values   = rgbMap;
                actualArg.Red.Values   = null;
                actualArg.Green.Values = null;
                actualArg.Blue.Values  = null;
            }
            base.CollectArguments();
        }