]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <!-- Copyright 2008 Lubomir Bourdev and Hailin Jin |
2 | ||
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt) | |
6 | --> | |
7 | ||
8 | <!-- | |
9 | Copyright 2005-2007 Adobe Systems Incorporated | |
10 | Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt | |
11 | or a copy at http://stlab.adobe.com/licenses.html) | |
12 | ||
13 | Some files are held under additional license. | |
14 | Please see "http://stlab.adobe.com/licenses.html" for more information. | |
15 | --> | |
16 | ||
17 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
18 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
19 | <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | |
20 | ||
21 | <head> | |
22 | <TITLE>Generic Image Library: color_convert.hpp Source File</TITLE> | |
23 | <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/> | |
24 | <LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/> | |
25 | </head> | |
26 | <body> | |
27 | <table border="0" cellspacing="0" cellpadding="0" style='width: 100%; margin: 0; padding: 0'><tr> | |
28 | <td width="100%" valign="top" style='padding-left: 10px; padding-right: 10px; padding-bottom: 10px'> | |
29 | <div class="qindex"><a class="qindex" href="index.html">Modules</a> | |
30 | | <a class="qindex" href="classes.html">Alphabetical List</a> | |
31 | | <a class="qindex" href="annotated.html">Class List</a> | |
32 | | <a class="qindex" href="dirs.html">Directories</a> | |
33 | | <a class="qindex" href="files.html">File List</a> | |
34 | | <a class="qindex" href="../index.html">GIL Home Page</a> | |
35 | </div> | |
36 | <!-- End Header --> | |
37 | <!-- Generated by Doxygen 1.5.6 --> | |
38 | <div class="navpath"><a class="el" href="g_i_l_0076.html">boost</a> » <a class="el" href="g_i_l_0079.html">gil</a> | |
39 | </div> | |
40 | <div class="contents"> | |
41 | <h1>color_convert.hpp</h1><a href="g_i_l_0071.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> | |
42 | <a name="l00002"></a>00002 <span class="comment"> Copyright 2005-2007 Adobe Systems Incorporated</span> | |
43 | <a name="l00003"></a>00003 <span class="comment"> </span> | |
44 | <a name="l00004"></a>00004 <span class="comment"> Use, modification and distribution are subject to the Boost Software License,</span> | |
45 | <a name="l00005"></a>00005 <span class="comment"> Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at</span> | |
46 | <a name="l00006"></a>00006 <span class="comment"> http://www.boost.org/LICENSE_1_0.txt).</span> | |
47 | <a name="l00007"></a>00007 <span class="comment"></span> | |
48 | <a name="l00008"></a>00008 <span class="comment"> See http://opensource.adobe.com/gil for most recent version including documentation.</span> | |
49 | <a name="l00009"></a>00009 <span class="comment">*/</span> | |
50 | <a name="l00010"></a>00010 <span class="comment">/*************************************************************************************************/</span> | |
51 | <a name="l00011"></a>00011 | |
52 | <a name="l00012"></a>00012 <span class="preprocessor">#ifndef GIL_COLOR_CONVERT_HPP</span> | |
53 | <a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#define GIL_COLOR_CONVERT_HPP</span> | |
54 | <a name="l00014"></a>00014 <span class="preprocessor"></span> | |
55 | <a name="l00026"></a>00026 | |
56 | <a name="l00027"></a>00027 <span class="preprocessor">#include <functional></span> | |
57 | <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="g_i_l_0094.html" title="GIL configuration file.">gil_config.hpp</a>"</span> | |
58 | <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="g_i_l_0016.html" title="Channel algorithms.">channel_algorithm.hpp</a>"</span> | |
59 | <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="pixel_8hpp.html" title="pixel class and related utilities">pixel.hpp</a>"</span> | |
60 | <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="gray_8hpp.html" title="Support for grayscale color space and variants.">gray.hpp</a>"</span> | |
61 | <a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="rgb_8hpp.html" title="Support for RGB color space and variants.">rgb.hpp</a>"</span> | |
62 | <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="rgba_8hpp.html" title="Support for RGBA color space and variants.">rgba.hpp</a>"</span> | |
63 | <a name="l00034"></a>00034 <span class="preprocessor">#include "<a class="code" href="cmyk_8hpp.html" title="Support for CMYK color space and variants.">cmyk.hpp</a>"</span> | |
64 | <a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="g_i_l_0238.html" title="metafunctions that construct types or return type properties">metafunctions.hpp</a>"</span> | |
65 | <a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="utilities_8hpp.html" title="Various utilities not specific to the image library. Some are non-standard STL extensions...">utilities.hpp</a>"</span> | |
66 | <a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="g_i_l_0069.html" title="pixel related algorithms">color_base_algorithm.hpp</a>"</span> | |
67 | <a name="l00038"></a>00038 | |
68 | <a name="l00039"></a>00039 <span class="keyword">namespace </span>boost { <span class="keyword">namespace </span>gil { | |
69 | <a name="l00040"></a>00040 | |
70 | <a name="l00041"></a>00041 <span class="comment">// Forward-declare</span> | |
71 | <a name="l00042"></a>00042 <span class="keyword">template</span> <<span class="keyword">typename</span> P> <span class="keyword">struct </span>channel_type; | |
72 | <a name="l00043"></a>00043 | |
73 | <a name="l00049"></a>00049 | |
74 | <a name="l00052"></a>00052 <span class="keyword">template</span> <<span class="keyword">typename</span> C1, <span class="keyword">typename</span> C2> | |
75 | <a name="l00053"></a><a class="code" href="g_i_l_0453.html">00053</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a> {}; | |
76 | <a name="l00054"></a>00054 | |
77 | <a name="l00057"></a>00057 <span class="keyword">template</span> <<span class="keyword">typename</span> C> | |
78 | <a name="l00058"></a><a class="code" href="g_i_l_0457.html">00058</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><C,C> { | |
79 | <a name="l00059"></a>00059 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
80 | <a name="l00060"></a>00060 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
81 | <a name="l00061"></a>00061 static_for_each(src,dst,<a class="code" href="g_i_l_0450.html" title="Same as channel_converter, except it takes the destination channel by reference,...">default_channel_converter</a>()); | |
82 | <a name="l00062"></a>00062 } | |
83 | <a name="l00063"></a>00063 }; | |
84 | <a name="l00064"></a>00064 | |
85 | <a name="l00065"></a>00065 <span class="keyword">namespace </span>detail { | |
86 | <a name="l00066"></a>00066 | |
87 | <a name="l00068"></a>00068 | |
88 | <a name="l00069"></a>00069 <span class="comment">// The default implementation of to_luminance uses float0..1 as the intermediate channel type</span> | |
89 | <a name="l00070"></a>00070 <span class="keyword">template</span> <<span class="keyword">typename</span> RedChannel, <span class="keyword">typename</span> GreenChannel, <span class="keyword">typename</span> BlueChannel, <span class="keyword">typename</span> GrayChannelValue> | |
90 | <a name="l00071"></a><a class="code" href="g_i_l_0519.html">00071</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0519.html" title="red * .3 + green * .59 + blue * .11 + .5">rgb_to_luminance_fn</a> { | |
91 | <a name="l00072"></a>00072 GrayChannelValue operator()(<span class="keyword">const</span> RedChannel& red, <span class="keyword">const</span> GreenChannel& green, <span class="keyword">const</span> BlueChannel& blue)<span class="keyword"> const </span>{ | |
92 | <a name="l00073"></a>00073 <span class="keywordflow">return</span> channel_convert<GrayChannelValue>( <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">bits32f</a>( | |
93 | <a name="l00074"></a>00074 channel_convert<bits32f>(red )*0.30f + | |
94 | <a name="l00075"></a>00075 channel_convert<bits32f>(green)*0.59f + | |
95 | <a name="l00076"></a>00076 channel_convert<bits32f>(blue )*0.11f) ); | |
96 | <a name="l00077"></a>00077 } | |
97 | <a name="l00078"></a>00078 }; | |
98 | <a name="l00079"></a>00079 | |
99 | <a name="l00080"></a>00080 <span class="comment">// performance specialization for unsigned char</span> | |
100 | <a name="l00081"></a>00081 <span class="keyword">template</span> <<span class="keyword">typename</span> GrayChannelValue> | |
101 | <a name="l00082"></a>00082 <span class="keyword">struct </span><a class="code" href="g_i_l_0519.html" title="red * .3 + green * .59 + blue * .11 + .5">rgb_to_luminance_fn</a><uint8_t,uint8_t,uint8_t, GrayChannelValue> { | |
102 | <a name="l00083"></a>00083 GrayChannelValue operator()(uint8_t red, uint8_t green, uint8_t blue)<span class="keyword"> const </span>{ | |
103 | <a name="l00084"></a>00084 <span class="keywordflow">return</span> channel_convert<GrayChannelValue>(uint8_t( | |
104 | <a name="l00085"></a>00085 ((uint32_t(red )*4915 + uint32_t(green)*9667 + uint32_t(blue )*1802) + 8192) >> 14)); | |
105 | <a name="l00086"></a>00086 } | |
106 | <a name="l00087"></a>00087 }; | |
107 | <a name="l00088"></a>00088 | |
108 | <a name="l00089"></a>00089 <span class="keyword">template</span> <<span class="keyword">typename</span> GrayChannel, <span class="keyword">typename</span> RedChannel, <span class="keyword">typename</span> GreenChannel, <span class="keyword">typename</span> BlueChannel> | |
109 | <a name="l00090"></a>00090 <span class="keyword">typename</span> channel_traits<GrayChannel>::value_type rgb_to_luminance(<span class="keyword">const</span> RedChannel& red, <span class="keyword">const</span> GreenChannel& green, <span class="keyword">const</span> BlueChannel& blue) { | |
110 | <a name="l00091"></a>00091 <span class="keywordflow">return</span> rgb_to_luminance_fn<RedChannel,GreenChannel,BlueChannel, | |
111 | <a name="l00092"></a>00092 <span class="keyword">typename</span> channel_traits<GrayChannel>::value_type>()(red,green,blue); | |
112 | <a name="l00093"></a>00093 } | |
113 | <a name="l00094"></a>00094 | |
114 | <a name="l00095"></a>00095 } <span class="comment">// namespace detail</span> | |
115 | <a name="l00096"></a>00096 | |
116 | <a name="l00099"></a>00099 <span class="keyword">template</span> <> | |
117 | <a name="l00100"></a><a class="code" href="g_i_l_0465.html">00100</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><gray_t,rgb_t> { | |
118 | <a name="l00101"></a>00101 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
119 | <a name="l00102"></a>00102 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
120 | <a name="l00103"></a>00103 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0618.html" title="Red.">red_t</a>()) = | |
121 | <a name="l00104"></a>00104 channel_convert<typename color_element_type<P2, red_t >::type>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0536.html" title="Gray.">gray_color_t</a>())); | |
122 | <a name="l00105"></a>00105 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0537.html" title="Green.">green_t</a>())= | |
123 | <a name="l00106"></a>00106 channel_convert<typename color_element_type<P2, green_t>::type>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0536.html" title="Gray.">gray_color_t</a>())); | |
124 | <a name="l00107"></a>00107 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0405.html" title="Blue.">blue_t</a>()) = | |
125 | <a name="l00108"></a>00108 channel_convert<typename color_element_type<P2, blue_t >::type>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0536.html" title="Gray.">gray_color_t</a>())); | |
126 | <a name="l00109"></a>00109 } | |
127 | <a name="l00110"></a>00110 }; | |
128 | <a name="l00111"></a>00111 | |
129 | <a name="l00114"></a>00114 <span class="keyword">template</span> <> | |
130 | <a name="l00115"></a><a class="code" href="g_i_l_0463.html">00115</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><gray_t,cmyk_t> { | |
131 | <a name="l00116"></a>00116 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
132 | <a name="l00117"></a>00117 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
133 | <a name="l00118"></a>00118 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>())= | |
134 | <a name="l00119"></a>00119 <a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<typename color_element_type<P2, cyan_t >::type</a>>::min_value(); | |
135 | <a name="l00120"></a>00120 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>())= | |
136 | <a name="l00121"></a>00121 <a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<typename color_element_type<P2, magenta_t>::type</a>>::min_value(); | |
137 | <a name="l00122"></a>00122 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>())= | |
138 | <a name="l00123"></a>00123 <a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<typename color_element_type<P2, yellow_t >::type</a>>::min_value(); | |
139 | <a name="l00124"></a>00124 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>())= | |
140 | <a name="l00125"></a>00125 channel_convert<typename color_element_type<P2, black_t >::type>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0536.html" title="Gray.">gray_color_t</a>())); | |
141 | <a name="l00126"></a>00126 } | |
142 | <a name="l00127"></a>00127 }; | |
143 | <a name="l00128"></a>00128 | |
144 | <a name="l00131"></a>00131 <span class="keyword">template</span> <> | |
145 | <a name="l00132"></a><a class="code" href="g_i_l_0469.html">00132</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><rgb_t,gray_t> { | |
146 | <a name="l00133"></a>00133 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
147 | <a name="l00134"></a>00134 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
148 | <a name="l00135"></a>00135 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0536.html" title="Gray.">gray_color_t</a>()) = | |
149 | <a name="l00136"></a>00136 detail::rgb_to_luminance<typename color_element_type<P2,gray_color_t>::type>( | |
150 | <a name="l00137"></a>00137 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0618.html" title="Red.">red_t</a>()), <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0537.html" title="Green.">green_t</a>()), <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0405.html" title="Blue.">blue_t</a>()) | |
151 | <a name="l00138"></a>00138 ); | |
152 | <a name="l00139"></a>00139 } | |
153 | <a name="l00140"></a>00140 }; | |
154 | <a name="l00141"></a>00141 | |
155 | <a name="l00142"></a>00142 | |
156 | <a name="l00150"></a>00150 <span class="keyword">template</span> <> | |
157 | <a name="l00151"></a><a class="code" href="g_i_l_0467.html">00151</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><rgb_t,cmyk_t> { | |
158 | <a name="l00152"></a>00152 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
159 | <a name="l00153"></a>00153 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
160 | <a name="l00154"></a>00154 <span class="keyword">typedef</span> <span class="keyword">typename</span> channel_type<P2>::type T2; | |
161 | <a name="l00155"></a>00155 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>()) = <a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>(channel_convert<T2>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0618.html" title="Red.">red_t</a>()))); <span class="comment">// c = 1 - r</span> | |
162 | <a name="l00156"></a>00156 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>()) = <a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>(channel_convert<T2>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0537.html" title="Green.">green_t</a>()))); <span class="comment">// m = 1 - g</span> | |
163 | <a name="l00157"></a>00157 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>()) = <a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>(channel_convert<T2>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0405.html" title="Blue.">blue_t</a>()))); <span class="comment">// y = 1 - b</span> | |
164 | <a name="l00158"></a>00158 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()) = (std::min)(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>()), | |
165 | <a name="l00159"></a>00159 (std::min)(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>()), | |
166 | <a name="l00160"></a>00160 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>()))); <span class="comment">// k = minimum(c, m, y)</span> | |
167 | <a name="l00161"></a>00161 T2 x = <a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<T2>::max_value</a>()-<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()); <span class="comment">// x = 1 - k</span> | |
168 | <a name="l00162"></a>00162 <span class="keywordflow">if</span> (x>0.0001f) { | |
169 | <a name="l00163"></a>00163 <span class="keywordtype">float</span> x1 = <a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<T2>::max_value</a>()/float(x); | |
170 | <a name="l00164"></a>00164 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>()) = (T2)((<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>()) - <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))*x1); <span class="comment">// c = (c - k) / x</span> | |
171 | <a name="l00165"></a>00165 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>()) = (T2)((<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>()) - <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))*x1); <span class="comment">// m = (m - k) / x</span> | |
172 | <a name="l00166"></a>00166 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>()) = (T2)((<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>()) - <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))*x1); <span class="comment">// y = (y - k) / x</span> | |
173 | <a name="l00167"></a>00167 } <span class="keywordflow">else</span> { | |
174 | <a name="l00168"></a>00168 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>())=<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>())=<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>())=0; | |
175 | <a name="l00169"></a>00169 } | |
176 | <a name="l00170"></a>00170 } | |
177 | <a name="l00171"></a>00171 }; | |
178 | <a name="l00172"></a>00172 | |
179 | <a name="l00179"></a>00179 <span class="keyword">template</span> <> | |
180 | <a name="l00180"></a><a class="code" href="g_i_l_0461.html">00180</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><cmyk_t,rgb_t> { | |
181 | <a name="l00181"></a>00181 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
182 | <a name="l00182"></a>00182 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
183 | <a name="l00183"></a>00183 <span class="keyword">typedef</span> <span class="keyword">typename</span> channel_type<P1>::type T1; | |
184 | <a name="l00184"></a>00184 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0618.html" title="Red.">red_t</a>()) = | |
185 | <a name="l00185"></a>00185 channel_convert<typename color_element_type<P2,red_t>::type>( | |
186 | <a name="l00186"></a>00186 channel_invert<T1>( | |
187 | <a name="l00187"></a>00187 (std::min)(<a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<T1>::max_value</a>(), | |
188 | <a name="l00188"></a>00188 T1(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>())*<a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))+<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))))); | |
189 | <a name="l00189"></a>00189 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0537.html" title="Green.">green_t</a>())= | |
190 | <a name="l00190"></a>00190 channel_convert<typename color_element_type<P2,green_t>::type>( | |
191 | <a name="l00191"></a>00191 channel_invert<T1>( | |
192 | <a name="l00192"></a>00192 (std::min)(<a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<T1>::max_value</a>(), | |
193 | <a name="l00193"></a>00193 T1(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>())*<a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))+<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))))); | |
194 | <a name="l00194"></a>00194 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0405.html" title="Blue.">blue_t</a>()) = | |
195 | <a name="l00195"></a>00195 channel_convert<typename color_element_type<P2,blue_t>::type>( | |
196 | <a name="l00196"></a>00196 channel_invert<T1>( | |
197 | <a name="l00197"></a>00197 (std::min)(<a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits<T1>::max_value</a>(), | |
198 | <a name="l00198"></a>00198 T1(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>())*<a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))+<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>()))))); | |
199 | <a name="l00199"></a>00199 } | |
200 | <a name="l00200"></a>00200 }; | |
201 | <a name="l00201"></a>00201 | |
202 | <a name="l00202"></a>00202 | |
203 | <a name="l00207"></a>00207 <span class="keyword">template</span> <> | |
204 | <a name="l00208"></a><a class="code" href="g_i_l_0459.html">00208</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><cmyk_t,gray_t> { | |
205 | <a name="l00209"></a>00209 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
206 | <a name="l00210"></a>00210 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
207 | <a name="l00211"></a>00211 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0536.html" title="Gray.">gray_color_t</a>())= | |
208 | <a name="l00212"></a>00212 channel_convert<typename color_element_type<P2,gray_t>::type>( | |
209 | <a name="l00213"></a>00213 <a class="code" href="g_i_l_0103.html#gf73b2a47a7877767534df0eee46dda17" title="A function multiplying two channels. result = a * b / max_value.">channel_multiply</a>( | |
210 | <a name="l00214"></a>00214 <a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>( | |
211 | <a name="l00215"></a>00215 detail::rgb_to_luminance<<span class="keyword">typename</span> <a class="code" href="g_i_l_0444.html" title="Specifies the type of the element associated with a given color tag.">color_element_type<P1,black_t>::type</a>>( | |
212 | <a name="l00216"></a>00216 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0448.html" title="Cyan.">cyan_t</a>()), | |
213 | <a name="l00217"></a>00217 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0574.html" title="Magenta.">magenta_t</a>()), | |
214 | <a name="l00218"></a>00218 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0637.html" title="Yellow.">yellow_t</a>()) | |
215 | <a name="l00219"></a>00219 ) | |
216 | <a name="l00220"></a>00220 ), | |
217 | <a name="l00221"></a>00221 <a class="code" href="g_i_l_0101.html#ge2e0267865f89610ef26148874a04bb5" title="Default implementation. Provide overloads for performance.">channel_invert</a>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0404.html" title="Black.">black_t</a>())))); | |
218 | <a name="l00222"></a>00222 } | |
219 | <a name="l00223"></a>00223 }; | |
220 | <a name="l00224"></a>00224 | |
221 | <a name="l00225"></a>00225 <span class="keyword">namespace </span>detail { | |
222 | <a name="l00226"></a>00226 <span class="keyword">template</span> <<span class="keyword">typename</span> Pixel> | |
223 | <a name="l00227"></a>00227 <span class="keyword">typename</span> channel_type<Pixel>::type alpha_or_max_impl(<span class="keyword">const</span> Pixel& p, mpl::true_) { | |
224 | <a name="l00228"></a>00228 <span class="keywordflow">return</span> <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(p,<a class="code" href="g_i_l_0385.html" title="Alpha.">alpha_t</a>()); | |
225 | <a name="l00229"></a>00229 } | |
226 | <a name="l00230"></a>00230 <span class="keyword">template</span> <<span class="keyword">typename</span> Pixel> | |
227 | <a name="l00231"></a>00231 <span class="keyword">typename</span> channel_type<Pixel>::type alpha_or_max_impl(<span class="keyword">const</span> Pixel& , mpl::false_) { | |
228 | <a name="l00232"></a>00232 <span class="keywordflow">return</span> channel_traits<typename channel_type<Pixel>::type>::max_value(); | |
229 | <a name="l00233"></a>00233 } | |
230 | <a name="l00234"></a>00234 } <span class="comment">// namespace detail</span> | |
231 | <a name="l00235"></a>00235 | |
232 | <a name="l00236"></a>00236 <span class="comment">// Returns max_value if the pixel has no alpha channel. Otherwise returns the alpha.</span> | |
233 | <a name="l00237"></a>00237 <span class="keyword">template</span> <<span class="keyword">typename</span> Pixel> | |
234 | <a name="l00238"></a>00238 <span class="keyword">typename</span> channel_type<Pixel>::type alpha_or_max(<span class="keyword">const</span> Pixel& p) { | |
235 | <a name="l00239"></a>00239 <span class="keywordflow">return</span> detail::alpha_or_max_impl(p, mpl::contains<<span class="keyword">typename</span> color_space_type<Pixel>::type,alpha_t>()); | |
236 | <a name="l00240"></a>00240 } | |
237 | <a name="l00241"></a>00241 | |
238 | <a name="l00242"></a>00242 | |
239 | <a name="l00245"></a>00245 <span class="keyword">template</span> <<span class="keyword">typename</span> C1> | |
240 | <a name="l00246"></a><a class="code" href="g_i_l_0455.html">00246</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><C1,rgba_t> { | |
241 | <a name="l00247"></a>00247 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
242 | <a name="l00248"></a>00248 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
243 | <a name="l00249"></a>00249 <span class="keyword">typedef</span> <span class="keyword">typename</span> channel_type<P2>::type T2; | |
244 | <a name="l00250"></a>00250 <a class="code" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel<T2,rgb_layout_t></a> tmp; | |
245 | <a name="l00251"></a>00251 <a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl<C1,rgb_t></a>()(src,tmp); | |
246 | <a name="l00252"></a>00252 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0618.html" title="Red.">red_t</a>()) =<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(tmp,<a class="code" href="g_i_l_0618.html" title="Red.">red_t</a>()); | |
247 | <a name="l00253"></a>00253 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0537.html" title="Green.">green_t</a>())=<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(tmp,<a class="code" href="g_i_l_0537.html" title="Green.">green_t</a>()); | |
248 | <a name="l00254"></a>00254 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0405.html" title="Blue.">blue_t</a>()) =<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(tmp,<a class="code" href="g_i_l_0405.html" title="Blue.">blue_t</a>()); | |
249 | <a name="l00255"></a>00255 <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(dst,<a class="code" href="g_i_l_0385.html" title="Alpha.">alpha_t</a>())=channel_convert<T2>(alpha_or_max(src)); | |
250 | <a name="l00256"></a>00256 } | |
251 | <a name="l00257"></a>00257 }; | |
252 | <a name="l00258"></a>00258 | |
253 | <a name="l00265"></a>00265 <span class="keyword">template</span> <<span class="keyword">typename</span> C2> | |
254 | <a name="l00266"></a><a class="code" href="g_i_l_0471.html">00266</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><rgba_t,C2> { | |
255 | <a name="l00267"></a>00267 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
256 | <a name="l00268"></a>00268 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
257 | <a name="l00269"></a>00269 <span class="keyword">typedef</span> <span class="keyword">typename</span> channel_type<P1>::type T1; | |
258 | <a name="l00270"></a>00270 <a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl<rgb_t,C2></a>()( | |
259 | <a name="l00271"></a>00271 <a class="code" href="g_i_l_0599.html" title="Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept...">pixel<T1,rgb_layout_t></a>(<a class="code" href="g_i_l_0103.html#gf73b2a47a7877767534df0eee46dda17" title="A function multiplying two channels. result = a * b / max_value.">channel_multiply</a>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0618.html" title="Red.">red_t</a>()), <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0385.html" title="Alpha.">alpha_t</a>())), | |
260 | <a name="l00272"></a>00272 <a class="code" href="g_i_l_0103.html#gf73b2a47a7877767534df0eee46dda17" title="A function multiplying two channels. result = a * b / max_value.">channel_multiply</a>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0537.html" title="Green.">green_t</a>()),<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0385.html" title="Alpha.">alpha_t</a>())), | |
261 | <a name="l00273"></a>00273 <a class="code" href="g_i_l_0103.html#gf73b2a47a7877767534df0eee46dda17" title="A function multiplying two channels. result = a * b / max_value.">channel_multiply</a>(<a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0405.html" title="Blue.">blue_t</a>()), <a class="code" href="g_i_l_0106.html#g4b9fe0ec8239047ac50842800de872b9" title="Constant accessor to the element associated with a given color name.">get_color</a>(src,<a class="code" href="g_i_l_0385.html" title="Alpha.">alpha_t</a>()))) | |
262 | <a name="l00274"></a>00274 ,dst); | |
263 | <a name="l00275"></a>00275 } | |
264 | <a name="l00276"></a>00276 }; | |
265 | <a name="l00277"></a>00277 | |
266 | <a name="l00280"></a>00280 <span class="keyword">template</span> <> | |
267 | <a name="l00281"></a><a class="code" href="g_i_l_0473.html">00281</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl</a><rgba_t,rgba_t> { | |
268 | <a name="l00282"></a>00282 <span class="keyword">template</span> <<span class="keyword">typename</span> P1, <span class="keyword">typename</span> P2> | |
269 | <a name="l00283"></a>00283 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> P1& src, P2& dst)<span class="keyword"> const </span>{ | |
270 | <a name="l00284"></a>00284 static_for_each(src,dst,<a class="code" href="g_i_l_0450.html" title="Same as channel_converter, except it takes the destination channel by reference,...">default_channel_converter</a>()); | |
271 | <a name="l00285"></a>00285 } | |
272 | <a name="l00286"></a>00286 }; | |
273 | <a name="l00287"></a>00287 | |
274 | <a name="l00291"></a>00291 | |
275 | <a name="l00294"></a><a class="code" href="g_i_l_0452.html">00294</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0452.html" title="class for color-converting one pixel to another">default_color_converter</a> { | |
276 | <a name="l00295"></a>00295 <span class="keyword">template</span> <<span class="keyword">typename</span> SrcP, <span class="keyword">typename</span> DstP> | |
277 | <a name="l00296"></a>00296 <span class="keywordtype">void</span> operator()(<span class="keyword">const</span> SrcP& src,DstP& dst)<span class="keyword"> const </span>{ | |
278 | <a name="l00297"></a>00297 <span class="keyword">typedef</span> <span class="keyword">typename</span> color_space_type<SrcP>::type SrcColorSpace; | |
279 | <a name="l00298"></a>00298 <span class="keyword">typedef</span> <span class="keyword">typename</span> color_space_type<DstP>::type DstColorSpace; | |
280 | <a name="l00299"></a>00299 <a class="code" href="g_i_l_0453.html" title="Color Convertion function object. To be specialized for every src/dst color space...">default_color_converter_impl<SrcColorSpace,DstColorSpace></a>()(src,dst); | |
281 | <a name="l00300"></a>00300 } | |
282 | <a name="l00301"></a>00301 }; | |
283 | <a name="l00302"></a>00302 | |
284 | <a name="l00307"></a>00307 <span class="keyword">template</span> <<span class="keyword">typename</span> SrcP, <span class="keyword">typename</span> DstP> | |
285 | <a name="l00308"></a><a class="code" href="g_i_l_0178.html#gaa258d34eafbf9d9e34a2a2ad6131af2">00308</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="g_i_l_0178.html#gaa258d34eafbf9d9e34a2a2ad6131af2" title="helper function for converting one pixel to another using GIL default color-converters...">color_convert</a>(<span class="keyword">const</span> SrcP& src, DstP& dst) { | |
286 | <a name="l00309"></a>00309 <a class="code" href="g_i_l_0452.html" title="class for color-converting one pixel to another">default_color_converter</a>()(src,dst); | |
287 | <a name="l00310"></a>00310 } | |
288 | <a name="l00311"></a>00311 | |
289 | <a name="l00312"></a>00312 } } <span class="comment">// namespace boost::gil</span> | |
290 | <a name="l00313"></a>00313 | |
291 | <a name="l00314"></a>00314 <span class="preprocessor">#endif</span> | |
292 | </pre></div></div> | |
293 | <hr size="1"><address style="text-align: right;"><small>Generated on Sat May 2 13:50:13 2009 for Generic Image Library by | |
294 | <a href="http://www.doxygen.org/index.html"> | |
295 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> | |
296 | </body> | |
297 | </html> |