~mir-team/mir/in-process-egl+input-conglomeration

« back to all changes in this revision

Viewing changes to 3rd_party/glm/glm/gtx/color_cast.hpp

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
///////////////////////////////////////////////////////////////////////////////////
2
 
/// OpenGL Mathematics (glm.g-truc.net)
3
 
///
4
 
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
5
 
/// Permission is hereby granted, free of charge, to any person obtaining a copy
6
 
/// of this software and associated documentation files (the "Software"), to deal
7
 
/// in the Software without restriction, including without limitation the rights
8
 
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 
/// copies of the Software, and to permit persons to whom the Software is
10
 
/// furnished to do so, subject to the following conditions:
11
 
/// 
12
 
/// The above copyright notice and this permission notice shall be included in
13
 
/// all copies or substantial portions of the Software.
14
 
/// 
15
 
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 
/// THE SOFTWARE.
22
 
///
23
 
/// @ref gtx_color_cast
24
 
/// @file glm/gtx/color_cast.hpp
25
 
/// @date 2007-06-21 / 2011-06-07
26
 
/// @author Christophe Riccio
27
 
///
28
 
/// @see core (dependence)
29
 
/// @see gtx_number_precision (dependence)
30
 
///
31
 
/// @defgroup gtx_color_cast GLM_GTX_color_cast: Color conversion
32
 
/// @ingroup gtx
33
 
///
34
 
/// @brief Conversion between two color types.
35
 
/// 
36
 
/// <glm/gtx/color_cast.hpp> need to be included to use these functionalities.
37
 
///////////////////////////////////////////////////////////////////////////////////
38
 
 
39
 
#ifndef GLM_GTX_color_cast
40
 
#define GLM_GTX_color_cast GLM_VERSION
41
 
 
42
 
// Dependency:
43
 
#include "../glm.hpp"
44
 
#include "../gtx/number_precision.hpp"
45
 
 
46
 
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
47
 
#       pragma message("GLM: GLM_GTX_color_cast extension included")
48
 
#endif
49
 
 
50
 
namespace glm
51
 
{
52
 
        /// @addtogroup gtx_color_cast
53
 
        /// @{
54
 
 
55
 
        //! Conversion of a floating value into a 8bit unsigned int value. 
56
 
        /// @see gtx_color_cast
57
 
        template <typename valType> uint8 u8channel_cast(valType a);
58
 
 
59
 
        /// Conversion of a floating value into a 16bit unsigned int value. 
60
 
        /// @see gtx_color_cast
61
 
        template <typename valType>     uint16 u16channel_cast(valType a);
62
 
 
63
 
        template <typename T> uint32 u32_rgbx_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
64
 
        template <typename T> uint32 u32_xrgb_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
65
 
        template <typename T> uint32 u32_bgrx_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
66
 
        template <typename T> uint32 u32_xbgr_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
67
 
 
68
 
        template <typename T> uint32 u32_rgba_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
69
 
        template <typename T> uint32 u32_argb_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
70
 
        template <typename T> uint32 u32_bgra_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
71
 
        template <typename T> uint32 u32_abgr_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension)
72
 
 
73
 
        template <typename T> uint64 u64_rgbx_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
74
 
        template <typename T> uint64 u64_xrgb_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
75
 
        template <typename T> uint64 u64_bgrx_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
76
 
        template <typename T> uint64 u64_xbgr_cast(const detail::tvec3<T>& c);          //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
77
 
 
78
 
        template <typename T> uint64 u64_rgba_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
79
 
        template <typename T> uint64 u64_argb_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
80
 
        template <typename T> uint64 u64_bgra_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
81
 
        template <typename T> uint64 u64_abgr_cast(const detail::tvec4<T>& c);          //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension)
82
 
 
83
 
        template <typename T> f16 f16_channel_cast(T a);        //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
84
 
 
85
 
        template <typename T> f16vec3 f16_rgbx_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
86
 
        template <typename T> f16vec3 f16_xrgb_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
87
 
        template <typename T> f16vec3 f16_bgrx_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
88
 
        template <typename T> f16vec3 f16_xbgr_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
89
 
 
90
 
        template <typename T> f16vec4 f16_rgba_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
91
 
        template <typename T> f16vec4 f16_argb_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
92
 
        template <typename T> f16vec4 f16_bgra_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
93
 
        template <typename T> f16vec4 f16_abgr_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
94
 
 
95
 
        template <typename T> f32 f32_channel_cast(T a);                //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
96
 
 
97
 
        template <typename T> f32vec3 f32_rgbx_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
98
 
        template <typename T> f32vec3 f32_xrgb_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
99
 
        template <typename T> f32vec3 f32_bgrx_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
100
 
        template <typename T> f32vec3 f32_xbgr_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
101
 
 
102
 
        template <typename T> f32vec4 f32_rgba_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
103
 
        template <typename T> f32vec4 f32_argb_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
104
 
        template <typename T> f32vec4 f32_bgra_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
105
 
        template <typename T> f32vec4 f32_abgr_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
106
 
 
107
 
        template <typename T> f64 f64_channel_cast(T a);                //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension)
108
 
 
109
 
        template <typename T> f64vec3 f64_rgbx_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
110
 
        template <typename T> f64vec3 f64_xrgb_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
111
 
        template <typename T> f64vec3 f64_bgrx_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
112
 
        template <typename T> f64vec3 f64_xbgr_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension)
113
 
 
114
 
        template <typename T> f64vec4 f64_rgba_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
115
 
        template <typename T> f64vec4 f64_argb_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
116
 
        template <typename T> f64vec4 f64_bgra_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
117
 
        template <typename T> f64vec4 f64_abgr_cast(T c);               //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension)
118
 
 
119
 
        /// @}
120
 
}//namespace glm
121
 
 
122
 
#include "color_cast.inl"
123
 
 
124
 
#endif//GLM_GTX_color_cast