Color representation in h,s,v with h = [0 – 360], s,v = [0.0 – 1.0].

//GNU General Public License version 2 (GPLv2)
//http://dotwayutilities.codeplex.com/license

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dotway.WPF.Controls.Utilities
{
///

/// Color representation in h,s,v with h = [0 – 360], s,v = [0.0 – 1.0].
///

public struct HSV
{
public HSV(double hue, double saturation, double value)
{
h = 0.0;
s = 0.0;
v = 0.0;

H = hue;
S = saturation;
V = value;
}

private double h;
public double H
{
get { return h; }
set
{
if (value >= 0 && value <= 360) { h = value; } else { throw new ArgumentOutOfRangeException("H is not in the span [0, 360]."); } } } private double s; public double S { get { return s; } set { if (value >= 0.0 && value <= 1.0) { s = value; } else { throw new ArgumentOutOfRangeException("S is not in the span [0, 1]."); } } } private double v; public double V { get { return v; } set { if (value >= 0.0 && value <= 1.0) { v = value; } else { throw new ArgumentOutOfRangeException("V is not in the span [0, 1]."); } } } } } [/csharp]

This entry was posted in 2D Graphics. Bookmark the permalink.