color_hsl.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 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 
33 namespace clan
34 {
37 
38 class Color;
39 class Colorf;
40 
44 template<typename Type, typename ColorType>
45 class ColorHSLx
46 {
49 
50 public:
53  ColorHSLx() : h((Type) 0), s((Type) 0), l((Type) 0), a((Type) 0) {}
54  ColorHSLx(Type h, Type s, Type l, Type a) : h(h), s(s), l(l), a(a) {}
55  ColorHSLx(const ColorHSLx<Type, ColorType> &copy) { h = copy.h; s = copy.s; l = copy.l; a = copy.a;}
56  ColorHSLx(const Color &color);
57  ColorHSLx(const Colorf &color);
58 
62 public:
63  Type h,s,l,a;
64 
68 
69 public:
70 
74 public:
75  operator ColorType();
76 
78  ColorHSLx<Type, ColorType> &operator = (const ColorHSLx<Type, ColorType>& copy) { h = copy.h; s = copy.s; l=copy.l; a=copy.a; return *this; }
79 
81  bool operator == (const ColorHSLx<Type, ColorType>& color) const {return ((h == color.h) && (s == color.s) && (l == color.l) && (a == color.a));}
82 
84  bool operator != (const ColorHSLx<Type, ColorType>& color) const {return ((h != color.h) || (s != color.s) || (l != color.l) || (a != color.a));}
85 
87 };
88 
92 
93 }
94 
96 
bool operator==(const ColorHSLx< Type, ColorType > &color) const
== operator.
Definition: color_hsl.h:81
ColorHSLx< double, Colorf > ColorHSLd
Definition: color_hsl.h:91
ColorHSLx(const Color &color)
Color HSL description class.
Definition: color_hsl.h:46
Floating point color description class (for float).
Definition: color.h:661
ColorHSLx< int, Color > ColorHSLi
Definition: color_hsl.h:89
ColorHSLx(Type h, Type s, Type l, Type a)
Definition: color_hsl.h:54
ColorHSLx(const ColorHSLx< Type, ColorType > &copy)
Definition: color_hsl.h:55
ColorHSLx< Type, ColorType > & operator=(const ColorHSLx< Type, ColorType > &copy)
= operator.
Definition: color_hsl.h:78
Color description class.
Definition: color.h:47
ColorHSLx()
Constructs a color.
Definition: color_hsl.h:53
Type a
Definition: color_hsl.h:63
Definition: clanapp.h:36
bool operator!=(const ColorHSLx< Type, ColorType > &color) const
!= operator.
Definition: color_hsl.h:84
Type l
Definition: color_hsl.h:63
Type h
Definition: color_hsl.h:63
ColorHSLx(const Colorf &color)
Type s
Definition: color_hsl.h:63
ColorHSLx< float, Colorf > ColorHSLf
Definition: color_hsl.h:90
@ color
value is an url