public override bool AttachControl(FilterPropertiesControl control) { Control = control; Grid grid = new Grid(); int rowIndex = 0; TextBlock brightnessText = new TextBlock(); brightnessText.Text = "Threshold"; Grid.SetRow(brightnessText, rowIndex++); Slider brightnessSlider = new Slider(); brightnessSlider.Minimum = 0.0; brightnessSlider.Maximum = 1.0; brightnessSlider.Value = _colorSwapFilter.Threshold; brightnessSlider.ValueChanged += brightnessSlider_ValueChanged; Grid.SetRow(brightnessSlider, rowIndex++); for (int i = 0; i < rowIndex; ++i) { RowDefinition rd = new RowDefinition(); grid.RowDefinitions.Add(rd); } grid.Children.Add(brightnessText); grid.Children.Add(brightnessSlider); control.ControlsContainer.Children.Add(grid); return true; }
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; Grid grid = new Grid(); int rowIndex = 0; TextBlock sketchModeText = new TextBlock(); sketchModeText.Text = AppResources.SketchMode; Grid.SetRow(sketchModeText, rowIndex++); RadioButton grayRadioButton = new RadioButton(); grayRadioButton.GroupName = SketchModeGroup; TextBlock textBlock = new TextBlock(); textBlock.Text = AppResources.Gray; grayRadioButton.Content = textBlock; grayRadioButton.Checked += grayRadioButton_Checked; Grid.SetRow(grayRadioButton, rowIndex++); RadioButton colorRadioButton = new RadioButton(); colorRadioButton.GroupName = SketchModeGroup; textBlock = new TextBlock(); 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(); brightnessText.Text = AppResources.Brightness; Grid.SetRow(brightnessText, rowIndex++); Slider brightnessSlider = new Slider(); brightnessSlider.Minimum = 0.0; brightnessSlider.Maximum = 1.0; brightnessSlider.Value = _lomoFilter.Brightness; brightnessSlider.ValueChanged += brightnessSlider_ValueChanged; Grid.SetRow(brightnessSlider, rowIndex++); TextBlock saturationText = new TextBlock(); saturationText.Text = AppResources.Saturation; Grid.SetRow(saturationText, rowIndex++); Slider saturationSlider = new Slider(); saturationSlider.Minimum = 0.0; saturationSlider.Maximum = 1.0; saturationSlider.Value = _lomoFilter.Saturation; saturationSlider.ValueChanged += saturationSlider_ValueChanged; Grid.SetRow(saturationSlider, rowIndex++); TextBlock lomoVignettingText = new TextBlock(); lomoVignettingText.Text = AppResources.LomoVignetting; Grid.SetRow(lomoVignettingText, rowIndex++); RadioButton highRadioButton = new RadioButton(); highRadioButton.GroupName = _lomoVignettingGroup; TextBlock textBlock = new TextBlock(); textBlock.Text = AppResources.High; highRadioButton.Content = textBlock; highRadioButton.Checked += highRadioButton_Checked; Grid.SetRow(highRadioButton, rowIndex++); RadioButton medRadioButton = new RadioButton(); medRadioButton.GroupName = _lomoVignettingGroup; textBlock = new TextBlock(); textBlock.Text = AppResources.Medium; medRadioButton.Content = textBlock; medRadioButton.Checked += medRadioButton_Checked; Grid.SetRow(medRadioButton, rowIndex++); RadioButton lowRadioButton = new RadioButton(); lowRadioButton.GroupName = _lomoVignettingGroup; textBlock = new TextBlock(); 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; }
/// <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; }
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; }