Rev | Line | |
---|
[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using Microsoft.Research.DynamicDataDisplay.Common.Auxiliary;
|
---|
| 6 | using System.ComponentModel;
|
---|
| 7 | using System.Windows.Media;
|
---|
| 8 |
|
---|
| 9 | namespace 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.