private void CreateCurveControl()
 {
     this.CurveControl = new CA.CurveControl();
     this.groupBox1.Controls.Add(this.CurveControl);
     this.CurveControl.Dock   = DockStyle.Top;
     this.CurveControl.Width  = 276;
     this.CurveControl.Height = 276;
     this.CurveControl.ControlPointChanged += new EventHandler(CurveControl_ControlPointChanged);
 }
示例#2
0
        //private EnumLocalizer colorTransferNames = EnumLocalizer.Create(typeof(ColorTransferMode));

        //private void modeComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        //{
        //    ColorTransferMode colorTransferMode;

        //    if (modeComboBox.SelectedIndex >= 0)
        //    {
        //        colorTransferMode = (ColorTransferMode)colorTransferNames.LocalizedNameToEnumValue(modeComboBox.SelectedItem.ToString());
        //    }
        //    else
        //    {
        //        colorTransferMode = ColorTransferMode.Rgb;
        //    }
        //    UpdateColorTransferMode(colorTransferMode);
        //}

        private void UpdateColorTransferMode(ColorTransferMode colorTransferMode)
        {
            CurveControl newCurveControl;

            newCurveControl = curveControls[colorTransferMode];

            if (curveControl != newCurveControl)
            {
                tableLayoutMain.Controls.Remove(curveControl);
                curveControl             = newCurveControl;
                curveControl.Bounds      = new Rectangle(0, 0, 258, 258);
                curveControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                //curveControl.ResetControlPoints();
                tableLayoutMain.SetColumnSpan(this.curveControl, 3);
                curveControl.Dock                = System.Windows.Forms.DockStyle.Fill;
                curveControl.ValueChanged       += curveControlValueChangedDelegate;
                curveControl.CoordinatesChanged += curveControlCoordinatesChangedDelegate;
                tableLayoutMain.Controls.Add(curveControl, 1, 2);

                int channels = newCurveControl.Channels;

                //maskCheckBoxes = new CheckBox[channels];

                //for (int i = 0; i < channels; ++i)
                //{
                //    CheckBox checkbox = new CheckBox();

                //    checkbox.Dock = DockStyle.Fill;
                //    checkbox.Checked = curveControl.GetSelected(i);
                //    checkbox.CheckedChanged += maskCheckChanged;
                //    checkbox.Text = curveControl.GetChannelName(i);

                //    maskCheckBoxes[i] = checkbox;
                //}

                //UpdateCheckboxEnables();
            }

            if (finishTokenOnDropDownChanged)
            {
                FinishTokenUpdate();
            }
        }
示例#3
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();
        }