Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/Palettes/HsbPalette.cs @ 13749

Last change on this file since 13749 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Research.DynamicDataDisplay.Common.Auxiliary;
6using System.ComponentModel;
7using System.Windows.Media;
8
9namespace Microsoft.Research.DynamicDataDisplay.Common.Palettes
10{
11  public sealed class HsbPalette : IPalette
12  {
13    /// <summary>
14    /// Initializes a new instance of the <see cref="HsbPalette"/> class.
15    /// </summary>
16    public HsbPalette() { }
17
18    private double start = 0;
19    [DefaultValue(0.0)]
20    public double Start
21    {
22      get { return start; }
23      set
24      {
25        if (start != value)
26        {
27          start = value;
28          Changed.Raise(this);
29        }
30      }
31    }
32
33    private double width = 360;
34    [DefaultValue(360.0)]
35    public double Width
36    {
37      get { return width; }
38      set
39      {
40        if (width != value)
41        {
42          width = value;
43          Changed.Raise(this);
44        }
45      }
46    }
47
48    #region IPalette Members
49
50    public Color GetColor(double t)
51    {
52      Verify.IsTrue(0 <= t && t <= 1);
53
54      return new HsbColor(start + t * width, 1, 1).ToArgbColor();
55    }
56
57    public event EventHandler Changed;
58
59    #endregion
60  }
61}
Note: See TracBrowser for help on using the repository browser.