Crazy Eddie's GUI System  0.8.4
Conversions.h
00001 /***********************************************************************
00002 created:    20th February 2010
00003 author:     Lukas E Meindl
00004 
00005 purpose:    Header of the class used to provide conversions between
00006 the ColourPicker colour types
00007 *************************************************************************/
00008 /***************************************************************************
00009 *   Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
00010 *
00011 *   Permission is hereby granted, free of charge, to any person obtaining
00012 *   a copy of this software and associated documentation files (the
00013 *   "Software"), to deal in the Software without restriction, including
00014 *   without limitation the rights to use, copy, modify, merge, publish,
00015 *   distribute, sublicense, and/or sell copies of the Software, and to
00016 *   permit persons to whom the Software is furnished to do so, subject to
00017 *   the following conditions:
00018 *
00019 *   The above copyright notice and this permission notice shall be
00020 *   included in all copies or substantial portions of the Software.
00021 *
00022 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028 *   OTHER DEALINGS IN THE SOFTWARE.
00029 ***************************************************************************/
00030 #ifndef _CEGUIColourPickerConversions_h_
00031 #define _CEGUIColourPickerConversions_h_
00032 
00033 #include "CEGUI/CommonDialogs/Module.h"
00034 #include "CEGUI/CommonDialogs/ColourPicker/Types.h"
00035 #include "CEGUI/Colour.h"
00036 
00037 #if defined(_MSC_VER)
00038 #   pragma warning(push)
00039 #   pragma warning(disable : 4251)
00040 #endif
00041 
00042 namespace CEGUI
00043 {
00044 
00045 class CEGUI_COMMONDIALOGS_API ColourPickerConversions
00046 {
00047 public:
00049     static Lab_Colour toLab(RGB_Colour colour);
00050 
00052     static HSV_Colour toHSV(RGB_Colour colour);
00053 
00055     static RGB_Colour toRGB(const Lab_Colour& colour);
00056 
00058     static RGB_Colour toRGB(float L, float a, float b);
00059 
00061     static RGB_Colour toRGB(const CEGUI::Colour& colour);
00062 
00064     static RGB_Colour toRGB(const HSV_Colour& colour);
00065 
00067     static CEGUI::Colour toCeguiColour(const RGB_Colour& colourRGB);
00068 
00070     static float toX(unsigned char R, unsigned char G, unsigned char B);
00071 
00073     static float toY(unsigned char R, unsigned char G, unsigned char B);
00074 
00076     static float toZ(unsigned char R, unsigned char G, unsigned char B);
00077 
00079     static float toX(float R, float G, float B);
00080 
00082     static float toY(float R, float G, float B);
00083 
00085     static float toZ(float R, float G, float B);
00086 
00088     static float toL(float Y);
00089 
00091     static float toA(float X, float Y);
00092 
00094     static float toB(float Y, float Z);
00095 
00097     static RGB_Colour linearInterpolationRGB(float interPolBalance,
00098         const RGB_Colour& start,
00099         const RGB_Colour& end);
00100 
00102     static unsigned char linearInterpolationAlpha(float interPolBalance,
00103         unsigned char startAlpha,
00104         unsigned char endAlpha);
00105 
00107     static Lab_Colour linearInterpolationLab(float interPolBalance,
00108         const Lab_Colour& start,
00109         const Lab_Colour& end);
00110 
00112     static HSV_Colour linearInterpolationHSV(float interPolBalance,
00113         const HSV_Colour& start,
00114         const HSV_Colour& end);
00115 
00116 private:
00118     static void clampInterpolationValue(float& interPolBalance);
00119 
00121     static float normCalc(float div);
00122 
00124     static float XNormCalc(float X);
00125 
00127     static float YNormCalc(float Y);
00128 
00130     static float ZNormCalc(float Z);
00131 
00133     static void clamp(float& value, float min_val, float max_val);
00134 
00136     static const float Xn;
00137     static const float Yn;
00138     static const float Zn;
00139 
00141     // values of P/Pn (P/Pn < LAB_COMPARE_VALUE_CONST)
00142     static const float LAB_COMPARE_VALUE_CONST;
00143 };
00144 
00145 }
00146 
00147 #if defined(_MSC_VER)
00148 #   pragma warning(pop)
00149 #endif
00150 
00151 
00152 #endif
00153 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends