Ejemplo n.º 1
1
        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            Grid grid = new Grid();
            int rowIndex = 0;

            CheckBox distinctEdgesCheckBox = new CheckBox();
            TextBlock textBlock = new TextBlock {Text = AppResources.DistinctEdges};
            distinctEdgesCheckBox.Content = textBlock;
            distinctEdgesCheckBox.IsChecked = _cartoonFilter.DistinctEdges;
            distinctEdgesCheckBox.Checked += distinctEdgesCheckBox_Checked;
            distinctEdgesCheckBox.Unchecked += distinctEdgesCheckBox_Unchecked;
            Grid.SetRow(distinctEdgesCheckBox, rowIndex++);

            for (int i = 0; i < rowIndex; ++i)
            {
                RowDefinition rd = new RowDefinition();
                grid.RowDefinitions.Add(rd);
            }

            grid.Children.Add(distinctEdgesCheckBox);

            control.ControlsContainer.Children.Add(grid);

            return true;
        }
        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            var grid = new Grid();
            int rowIndex = 0;

            TextBlock levelText = new TextBlock()
            {
                Text = "Level"
            };
            Grid.SetRow(levelText, rowIndex++);

            Slider levelSlider = new Slider() { Minimum = 0.0, Maximum = 1.0, Value = _filter.Level};
            levelSlider.ValueChanged += levelSlider_ValueChanged;
            Grid.SetRow(levelSlider, rowIndex++);

            for (int i = 0; i < rowIndex; ++i)
            {
                RowDefinition rd = new RowDefinition();
                grid.RowDefinitions.Add(rd);
            }

            grid.Children.Add(levelText);
            grid.Children.Add(levelSlider);

            control.ControlsContainer.Children.Add(grid);

            return true;
        }
        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            var cropRegionControl = new CropRegionControl()
            {
                Width = 400,
                Height = 500
            };

            cropRegionControl.DidUpdateCropRect = cropRegionControl_DidUpdateCropRect;

            control.ControlsContainer.Children.Add(cropRegionControl);

            return true;
        }
        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            Grid grid = new Grid();
            int rowIndex = 0;

            TextBlock sketchModeText = new TextBlock {Text = AppResources.SketchMode};
            Grid.SetRow(sketchModeText, rowIndex++);

            RadioButton grayRadioButton = new RadioButton {GroupName = SketchModeGroup};
            TextBlock textBlock = new TextBlock {Text = AppResources.Gray};
            grayRadioButton.Content = textBlock;
            grayRadioButton.Checked += grayRadioButton_Checked;
            Grid.SetRow(grayRadioButton, rowIndex++);

            RadioButton colorRadioButton = new RadioButton {GroupName = SketchModeGroup};
            textBlock = new TextBlock {Text = AppResources.Color};
            colorRadioButton.Content = textBlock;
            colorRadioButton.Checked += colorRadioButton_Checked;
            Grid.SetRow(colorRadioButton, rowIndex++);

            if (_sketchFilter.SketchMode == SketchMode.Gray)
            {
                grayRadioButton.IsChecked = true;
            }
            else
            {
                colorRadioButton.IsChecked = true;
            }

            for (int i = 0; i < rowIndex; ++i)
            {
                RowDefinition rd = new RowDefinition();
                grid.RowDefinitions.Add(rd);
            }

            grid.Children.Add(sketchModeText);
            grid.Children.Add(grayRadioButton);
            grid.Children.Add(colorRadioButton);

            control.ControlsContainer.Children.Add(grid);

            return true;
        }
        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            Grid grid = new Grid();
            int rowIndex = 0;

            TextBlock brightnessText = new TextBlock {Text = AppResources.Brightness};
            Grid.SetRow(brightnessText, rowIndex++);

            Slider brightnessSlider = new Slider {Minimum = 0.0, Maximum = 1.0, Value = _lomoFilter.Brightness};
            brightnessSlider.ValueChanged += brightnessSlider_ValueChanged;
            Grid.SetRow(brightnessSlider, rowIndex++);

            TextBlock saturationText = new TextBlock {Text = AppResources.Saturation};
            Grid.SetRow(saturationText, rowIndex++);

            Slider saturationSlider = new Slider {Minimum = 0.0, Maximum = 1.0, Value = _lomoFilter.Saturation};
            saturationSlider.ValueChanged += saturationSlider_ValueChanged;
            Grid.SetRow(saturationSlider, rowIndex++);

            TextBlock lomoVignettingText = new TextBlock {Text = AppResources.LomoVignetting};
            Grid.SetRow(lomoVignettingText, rowIndex++);

            RadioButton highRadioButton = new RadioButton {GroupName = _lomoVignettingGroup};
            TextBlock textBlock = new TextBlock {Text = AppResources.High};
            highRadioButton.Content = textBlock;
            highRadioButton.Checked += highRadioButton_Checked;
            Grid.SetRow(highRadioButton, rowIndex++);

            RadioButton medRadioButton = new RadioButton {GroupName = _lomoVignettingGroup};
            textBlock = new TextBlock {Text = AppResources.Medium};
            medRadioButton.Content = textBlock;
            medRadioButton.Checked += medRadioButton_Checked;
            Grid.SetRow(medRadioButton, rowIndex++);

            RadioButton lowRadioButton = new RadioButton {GroupName = _lomoVignettingGroup};
            textBlock = new TextBlock {Text = AppResources.Low};
            lowRadioButton.Content = textBlock;
            lowRadioButton.Checked += lowRadioButton_Checked;
            Grid.SetRow(lowRadioButton, rowIndex++);

            switch (_lomoFilter.LomoVignetting)
            {
                case LomoVignetting.Low: lowRadioButton.IsChecked = true; break;
                case LomoVignetting.Medium: medRadioButton.IsChecked = true; break;
                case LomoVignetting.High: highRadioButton.IsChecked = true; break;
            }

            for (int i = 0; i < rowIndex; ++i)
            {
                RowDefinition rd = new RowDefinition();
                grid.RowDefinitions.Add(rd);
            }

            grid.Children.Add(brightnessText);
            grid.Children.Add(brightnessSlider);
            grid.Children.Add(saturationText);
            grid.Children.Add(saturationSlider);
            grid.Children.Add(lomoVignettingText);
            grid.Children.Add(lowRadioButton);
            grid.Children.Add(medRadioButton);
            grid.Children.Add(highRadioButton);

            control.ControlsContainer.Children.Add(grid);

            return true;
        }
        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            _hdrControl = new HdrControl
            {
                NoiseSuppression = _hdrEffect.NoiseSuppression,
                Strength = _hdrEffect.Strength,
                Saturation = _hdrEffect.Saturation
            };

            control.ControlsContainer.Children.Add(_hdrControl);
            _hdrControl.ValueChanged += HdrValueChanged;

            return true;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Attaches a UI controls for adjusting filter properties.
 /// </summary>
 /// <param name="control"></param>
 /// <returns>True if the control was populated, false otherwise.</returns>
 public virtual bool AttachControl(FilterPropertiesControl control)
 {
     return false;
 }