Crazy Eddie's GUI System 0.8.7
Loading...
Searching...
No Matches
Conversions.h
1/***********************************************************************
2created: 20th February 2010
3author: Lukas E Meindl
4
5purpose: Header of the class used to provide conversions between
6the ColourPicker colour types
7*************************************************************************/
8/***************************************************************************
9* Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
10*
11* Permission is hereby granted, free of charge, to any person obtaining
12* a copy of this software and associated documentation files (the
13* "Software"), to deal in the Software without restriction, including
14* without limitation the rights to use, copy, modify, merge, publish,
15* distribute, sublicense, and/or sell copies of the Software, and to
16* permit persons to whom the Software is furnished to do so, subject to
17* the following conditions:
18*
19* The above copyright notice and this permission notice shall be
20* included in all copies or substantial portions of the Software.
21*
22* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28* OTHER DEALINGS IN THE SOFTWARE.
29***************************************************************************/
30#ifndef _CEGUIColourPickerConversions_h_
31#define _CEGUIColourPickerConversions_h_
32
33#include "CEGUI/CommonDialogs/Module.h"
34#include "CEGUI/CommonDialogs/ColourPicker/Types.h"
35#include "CEGUI/Colour.h"
36
37#if defined(_MSC_VER)
38# pragma warning(push)
39# pragma warning(disable : 4251)
40#endif
41
42namespace CEGUI
43{
44
45class CEGUI_COMMONDIALOGS_API ColourPickerConversions
46{
47public:
49 static Lab_Colour toLab(RGB_Colour colour);
50
52 static HSV_Colour toHSV(RGB_Colour colour);
53
55 static RGB_Colour toRGB(const Lab_Colour& colour);
56
58 static RGB_Colour toRGB(float L, float a, float b);
59
61 static RGB_Colour toRGB(const CEGUI::Colour& colour);
62
64 static RGB_Colour toRGB(const HSV_Colour& colour);
65
67 static CEGUI::Colour toCeguiColour(const RGB_Colour& colourRGB);
68
70 static float toX(unsigned char R, unsigned char G, unsigned char B);
71
73 static float toY(unsigned char R, unsigned char G, unsigned char B);
74
76 static float toZ(unsigned char R, unsigned char G, unsigned char B);
77
79 static float toX(float R, float G, float B);
80
82 static float toY(float R, float G, float B);
83
85 static float toZ(float R, float G, float B);
86
88 static float toL(float Y);
89
91 static float toA(float X, float Y);
92
94 static float toB(float Y, float Z);
95
97 static RGB_Colour linearInterpolationRGB(float interPolBalance,
98 const RGB_Colour& start,
99 const RGB_Colour& end);
100
102 static unsigned char linearInterpolationAlpha(float interPolBalance,
103 unsigned char startAlpha,
104 unsigned char endAlpha);
105
107 static Lab_Colour linearInterpolationLab(float interPolBalance,
108 const Lab_Colour& start,
109 const Lab_Colour& end);
110
112 static HSV_Colour linearInterpolationHSV(float interPolBalance,
113 const HSV_Colour& start,
114 const HSV_Colour& end);
115
116private:
118 static void clampInterpolationValue(float& interPolBalance);
119
121 static float normCalc(float div);
122
124 static float XNormCalc(float X);
125
127 static float YNormCalc(float Y);
128
130 static float ZNormCalc(float Z);
131
133 static void clamp(float& value, float min_val, float max_val);
134
136 static const float Xn;
137 static const float Yn;
138 static const float Zn;
139
141 // values of P/Pn (P/Pn < LAB_COMPARE_VALUE_CONST)
142 static const float LAB_COMPARE_VALUE_CONST;
143};
144
145}
146
147#if defined(_MSC_VER)
148# pragma warning(pop)
149#endif
150
151
152#endif
153
Definition Conversions.h:46
static HSV_Colour linearInterpolationHSV(float interPolBalance, const HSV_Colour &start, const HSV_Colour &end)
Linear interpolation helper function for HSV_Colour.
static float toX(float R, float G, float B)
Function for calculating X based on the RGB components.
static RGB_Colour linearInterpolationRGB(float interPolBalance, const RGB_Colour &start, const RGB_Colour &end)
Linear interpolation helper function for RGB_Colour.
static CEGUI::Colour toCeguiColour(const RGB_Colour &colourRGB)
Conversion from RGB_Colour to CEGUI::Colour.
static float toY(unsigned char R, unsigned char G, unsigned char B)
Function for calculating Y based on the RGB components.
static RGB_Colour toRGB(float L, float a, float b)
Function for converting a Lab_Colour to an RGB_Colour.
static RGB_Colour toRGB(const Lab_Colour &colour)
Function for converting a Lab_Colour to an RGB_Colour.
static HSV_Colour toHSV(RGB_Colour colour)
Function for converting an RGB_Colour to an HSV_Colour.
static float toY(float R, float G, float B)
Function for calculating Y based on the RGB components.
static float toA(float X, float Y)
Function for calculating a (of CIELab) based on the X and Y components.
static RGB_Colour toRGB(const CEGUI::Colour &colour)
Function for converting a CEGUI Colour to an RGB_Colour.
static Lab_Colour linearInterpolationLab(float interPolBalance, const Lab_Colour &start, const Lab_Colour &end)
Linear interpolation helper function for Lab_Colour.
static float toX(unsigned char R, unsigned char G, unsigned char B)
Function for calculating X based on the RGB components.
static float toL(float Y)
Function for calculating L (of CIELab) based on the Y components.
static float toB(float Y, float Z)
Function for calculating b (of CIELab) based on the Y and Z components.
static Lab_Colour toLab(RGB_Colour colour)
Function for converting an RGB_Colour to a Lab_Colour.
static float toZ(unsigned char R, unsigned char G, unsigned char B)
Function for calculating Z based on the RGB components.
static RGB_Colour toRGB(const HSV_Colour &colour)
Function for converting a HSV to an RGB_Colour.
static unsigned char linearInterpolationAlpha(float interPolBalance, unsigned char startAlpha, unsigned char endAlpha)
Linear interpolation helper function for Alpha.
static float toZ(float R, float G, float B)
Function for calculating Z based on the RGB components.
Class representing colour values within the system.
Definition Colour.h:46
Class representing an HSV (hue, saturation and value) colour using floats.
Definition Types.h:113
Class representing a Colour according to the L*a*b* standard.
Definition Types.h:90
Class representing an RGB colour using unsigned chars.
Definition Types.h:65
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1