Beispiel #1
0
        private void UpdateAdjustmentControls(ImageAdjustmentType adjustmentType, Int32 adjustmentValue)
        {
            EnumControls(this.Controls);

            void EnumControls(IEnumerable controls)
            {
                foreach (Control control in controls)
                {
                    var controlAdjustmentType = ImageAdjustmentTypeExtensions.ToImageAdjustmentType(control);
                    if (controlAdjustmentType == adjustmentType)
                    {
                        if (control is TrackBar trackBar)
                        {
                            this.UpdateAdjustmentControl(() => trackBar.Value = adjustmentValue);
                        }
                        else if (control is NumericUpDown numericUpDown)
                        {
                            this.UpdateAdjustmentControl(() => numericUpDown.Value = adjustmentValue);
                        }
                    }

                    if (control.HasChildren)
                    {
                        EnumControls(control.Controls);
                    }
                }
            }
        }
Beispiel #2
0
        private void AddEvent(ImageAdjustmentType type, Int32 diff, Int32 value)
        {
            lock (this._adjustmentEvents)
            {
                if ((this._lastAdjustment != null) && (type == this._lastAdjustment.Type))
                {
                    Trace.WriteLine($"Skip {value}");

                    this._lastAdjustment.Diff  = 0;
                    this._lastAdjustment.Value = value;
                }
                else
                {
                    Trace.WriteLine($"Add  {value}");

                    this._lastAdjustment = new AdjustmentEvent()
                    {
                        Type  = type,
                        Diff  = diff,
                        Value = value
                    };
                    this._adjustmentEvents.Push(this._lastAdjustment);
                }
            }

            this._adjustmentTimer.Stop();
            this._adjustmentTimer.Start();
        }
Beispiel #3
0
        private Int32 UpdateImageProperty(ImageAdjustmentType adjustmentType, Int32 adjustmentDiff, Int32 adjustmentValue)
        {
            var newAdjustmentValue = 0 == adjustmentDiff ? adjustmentValue : (this._imageBuilder.ImageProperties.Get(adjustmentType) + adjustmentDiff);

            this._imageBuilder.ImageProperties.Set(adjustmentType, newAdjustmentValue);

            return(newAdjustmentValue);
        }
Beispiel #4
0
        public void SetAdjustment(ImageAdjustmentType adjustmentType, Int32 adjustmentDiff, Int32 adjustmentValue)
        {
            switch (adjustmentType)
            {
            case ImageAdjustmentType.Contrast:
                this.AddEvent(adjustmentType, adjustmentDiff, adjustmentValue);
                break;

            default:
                // TODO
                return;
            }
        }
Beispiel #5
0
 public void Set(ImageAdjustmentType imageAdjustmentType, Int32 imageAdjustmentValue) => this.adjustmentValues[imageAdjustmentType] = imageAdjustmentValue;
Beispiel #6
0
 public Int32 Get(ImageAdjustmentType imageAdjustmentType) => this.adjustmentValues[imageAdjustmentType];
Beispiel #7
0
 public Boolean IsModified(ImageAdjustmentType imageAdjustmentType) => this.adjustmentValues[imageAdjustmentType] != 0;