color_hsv.h Source File - ClanLib SDK
Description: color_hsv.h Source File

color_hsv.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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#pragma once
30
31namespace clan
32{
35
36 class Color;
37 class Colorf;
38
42 template<typename Type, typename ColorType>
43 class ColorHSVx
44 {
45 public:
48 ColorHSVx() : h((Type)0), s((Type)0), v((Type)0), a((Type)0) {}
49 ColorHSVx(Type h, Type s, Type v, Type a) : h(h), s(s), v(v), a(a) {}
50 ColorHSVx(const ColorHSVx<Type, ColorType> &copy) { h = copy.h; s = copy.s; v = copy.v; a = copy.a; }
51 ColorHSVx(const Color &color);
52 ColorHSVx(const Colorf &color);
53
54 Type h, s, v, a;
55
56 operator ColorType();
57
59 ColorHSVx<Type, ColorType> &operator = (const ColorHSVx<Type, ColorType>& copy) { h = copy.h; s = copy.s; v = copy.v; a = copy.a; return *this; }
60
62 bool operator == (const ColorHSVx<Type, ColorType>& color) const { return ((h == color.h) && (s == color.s) && (v == color.v) && (a == color.a)); }
63
65 bool operator != (const ColorHSVx<Type, ColorType>& color) const { return ((h != color.h) || (s != color.s) || (v != color.v) || (a != color.a)); }
66 };
67
68 typedef ColorHSVx<int, Color> ColorHSVi;
69 typedef ColorHSVx<float, Colorf> ColorHSVf;
70 typedef ColorHSVx<double, Colorf> ColorHSVd;
71
73}
clan::ColorHSVx
Color HSV description class.
Definition color_hsv.h:44
clan::ColorHSVx::ColorHSVx
ColorHSVx(const ColorHSVx< Type, ColorType > &copy)
Definition color_hsv.h:50
clan::ColorHSVx::ColorHSVx
ColorHSVx()
Constructs a color.
Definition color_hsv.h:48
clan::ColorHSVx::operator!=
bool operator!=(const ColorHSVx< Type, ColorType > &color) const
!= operator.
Definition color_hsv.h:65
clan::ColorHSVx::h
Type h
Definition color_hsv.h:54
clan::ColorHSVx::operator==
bool operator==(const ColorHSVx< Type, ColorType > &color) const
== operator.
Definition color_hsv.h:62
clan::ColorHSVx::ColorHSVx
ColorHSVx(const Color &color)
clan::ColorHSVx::s
Type s
Definition color_hsv.h:54
clan::ColorHSVx::ColorHSVx
ColorHSVx(Type h, Type s, Type v, Type a)
Definition color_hsv.h:49
clan::ColorHSVx::operator=
ColorHSVx< Type, ColorType > & operator=(const ColorHSVx< Type, ColorType > &copy)
= operator.
Definition color_hsv.h:59
clan::ColorHSVx::v
Type v
Definition color_hsv.h:54
clan::ColorHSVx::a
Type a
Definition color_hsv.h:54
clan::ColorHSVx::ColorHSVx
ColorHSVx(const Colorf &color)
clan::Color
Color description class.
Definition color.h:46
clan::Colorf
Floating point color description class (for float).
Definition color.h:799
clan::ColorHSVi
ColorHSVx< int, Color > ColorHSVi
Definition color_hsv.h:68
clan::ColorHSVf
ColorHSVx< float, Colorf > ColorHSVf
Definition color_hsv.h:69
clan::ColorHSVd
ColorHSVx< double, Colorf > ColorHSVd
Definition color_hsv.h:70
clan
Definition clanapp.h:36
clan::StyleValueType::color
@ color
value is an url