color_hsv.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Mark Page
27 */
28 
29 
30 #pragma once
31 
32 #include "../api_display.h"
33 
34 namespace clan
35 {
38 
39 class Color;
40 class Colorf;
41 
45 template<typename Type, typename ColorType>
46 class CL_API_DISPLAY ColorHSVx
47 {
50 
51 public:
54  ColorHSVx() : h((Type) 0), s((Type) 0), v((Type) 0), a((Type) 0) {}
55  ColorHSVx(Type h, Type s, Type v, Type a) : h(h), s(s), v(v), a(a) {}
56  ColorHSVx(const ColorHSVx<Type, ColorType> &copy) { h = copy.h; s = copy.s; v = copy.v; a = copy.a;}
57  ColorHSVx(const Color &color);
58  ColorHSVx(const Colorf &color);
59 
63 public:
64  Type h,s,v,a;
65 
69 
70 public:
71 
75 public:
76  operator ColorType();
77 
79  ColorHSVx<Type, ColorType> &operator = (const ColorHSVx<Type, ColorType>& copy) { h = copy.h; s = copy.s; v=copy.v; a=copy.a; return *this; }
80 
82  bool operator == (const ColorHSVx<Type, ColorType>& color) const {return ((h == color.h) && (s == color.s) && (v == color.v) && (a == color.a));}
83 
85  bool operator != (const ColorHSVx<Type, ColorType>& color) const {return ((h != color.h) || (s != color.s) || (v != color.v) || (a != color.a));}
86 
88 };
89 
93 
94 }
95 
97 
Floating point color description class (for float).
Definition: color.h:661
ColorHSVx(const ColorHSVx< Type, ColorType > &copy)
Definition: color_hsv.h:56
Type a
Definition: color_hsv.h:64
Type s
Definition: color_hsv.h:64
ColorHSVx< float, Colorf > ColorHSVf
Definition: color_hsv.h:91
ColorHSVx< int, Color > ColorHSVi
Definition: color_hsv.h:90
Type v
Definition: color_hsv.h:64
ColorHSVx()
Constructs a color.
Definition: color_hsv.h:54
Type h
Definition: color_hsv.h:64
Color HSV description class.
Definition: color_hsv.h:46
ColorHSVx(Type h, Type s, Type v, Type a)
Definition: color_hsv.h:55
Color description class.
Definition: color.h:47
ColorHSVx< double, Colorf > ColorHSVd
Definition: color_hsv.h:92