Color representation in h,s,v with h = [0 - 360], s,v = [0.0 - 1.0]. : Color « 2D Graphics « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » 2D Graphics » ColorScreenshots 
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
{
    /// <summary>
    /// Color representation in h,s,v with h = [0 - 360], s,v = [0.0 - 1.0].
    /// </summary>
    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 >= && 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].");
                }
            }
        }


    }
}

   
  
Related examples in the same category
1.Transparent colorTransparent color
2.List all known color in a systemList all known color in a system
3.Draw each of 100 cells with randomly chosen colorsDraw each of 100 cells with randomly chosen colors
4.Filled with the semi transparent and transparent colorFilled with the semi transparent and transparent color
5.All the colors that are supported in C# according
6.Color ChangerColor Changer
7.Known ColorsKnown Colors
8.Five yellow squares with different alpha values(Transparensy)
9.Create two color instances with different alpha components
10.Color.Chocolate
11.Use Color.FromArgb to create Color
12.Get all known color
13.Color representation in r,g,b with values [0.0 - 1.0].
14.Return a randomly-generated color
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.