Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Converters/BrushHSBConverter.cs @ 13287

Last change on this file since 13287 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.1 KB
RevLine 
[12503]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Data;
6using System.Globalization;
7using System.Windows.Media;
8
9namespace Microsoft.Research.DynamicDataDisplay.Converters
10{
11  public sealed class BrushHSBConverter : IValueConverter
12  {
13    private double lightnessDelta = 1.0;
14    public double LightnessDelta
15    {
16      get { return lightnessDelta; }
17      set { lightnessDelta = value; }
18    }
19
20    private double saturationDelta = 1.0;
21    public double SaturationDelta
22    {
23      get { return saturationDelta; }
24      set { saturationDelta = value; }
25    }
26
27    #region IValueConverter Members
28
29    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
30    {
31      SolidColorBrush brush = value as SolidColorBrush;
32      if (brush != null)
33      {
34        SolidColorBrush result = brush.ChangeLightness(lightnessDelta).ChangeSaturation(saturationDelta);
35        return result;
36      }
37      else { return value; }
38    }
39
40    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
41    {
42      throw new NotImplementedException();
43    }
44
45    #endregion
46  }
47}
Note: See TracBrowser for help on using the repository browser.