Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > 623999701586b0ea103ff2ccad7954a6 > files > 6141

boost-doc-1.44.0-1.fc14.noarch.rpm

<!-- Copyright 2008 Lubomir Bourdev and Hailin Jin

     Distributed under the Boost Software License, Version 1.0.
     (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)
  -->

<!--
    Copyright 2005-2007 Adobe Systems Incorporated
    Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
    or a copy at http://stlab.adobe.com/licenses.html)

    Some files are held under additional license.
    Please see "http://stlab.adobe.com/licenses.html" for more information.
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
    <TITLE>Generic Image Library: channel.hpp Source File</TITLE>
    <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
    <LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" style='width: 100%; margin: 0; padding: 0'><tr>
<td width="100%" valign="top" style='padding-left: 10px; padding-right: 10px; padding-bottom: 10px'>
<div class="qindex"><a class="qindex" href="index.html">Modules</a> 
                  | <a class="qindex" href="classes.html">Alphabetical List</a> 
                  | <a class="qindex" href="annotated.html">Class List</a> 
                  | <a class="qindex" href="dirs.html">Directories</a> 
                  | <a class="qindex" href="files.html">File List</a> 
                  | <a class="qindex" href="../index.html">GIL Home Page</a> 
</div>
<!-- End Header -->
<!-- Generated by Doxygen 1.5.6 -->
  <div class="navpath"><a class="el" href="g_i_l_0076.html">boost</a>&nbsp;&raquo&nbsp;<a class="el" href="g_i_l_0079.html">gil</a>
  </div>
<div class="contents">
<h1>channel.hpp</h1><a href="channel_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    Copyright 2005-2007 Adobe Systems Incorporated</span>
<a name="l00003"></a>00003 <span class="comment">   </span>
<a name="l00004"></a>00004 <span class="comment">    Use, modification and distribution are subject to the Boost Software License,</span>
<a name="l00005"></a>00005 <span class="comment">    Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at</span>
<a name="l00006"></a>00006 <span class="comment">    http://www.boost.org/LICENSE_1_0.txt).</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">    See http://stlab.adobe.com/gil for most recent version including documentation.</span>
<a name="l00009"></a>00009 <span class="comment">*/</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="comment">/*************************************************************************************************/</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="preprocessor">#ifndef GIL_CHANNEL_HPP</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define GIL_CHANNEL_HPP</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;limits&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;boost/cstdint.hpp&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="g_i_l_0094.html" title="GIL configuration file.">gil_config.hpp</a>"</span>
<a name="l00031"></a>00031 <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>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keyword">namespace </span>boost { <span class="keyword">namespace </span>gil {
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="keyword">namespace </span>detail {
<a name="l00052"></a>00052     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T, <span class="keywordtype">bool</span> is_<span class="keyword">class</span>&gt; <span class="keyword">struct </span>channel_traits_impl;
<a name="l00053"></a>00053 
<a name="l00054"></a>00054     <span class="comment">// channel traits for custom class</span>
<a name="l00055"></a>00055     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; 
<a name="l00056"></a>00056     <span class="keyword">struct </span>channel_traits_impl&lt;T, true&gt; {
<a name="l00057"></a>00057         <span class="keyword">typedef</span> <span class="keyword">typename</span> T::value_type      value_type;
<a name="l00058"></a>00058         <span class="keyword">typedef</span> <span class="keyword">typename</span> T::reference       reference;
<a name="l00059"></a>00059         <span class="keyword">typedef</span> <span class="keyword">typename</span> T::pointer         pointer;
<a name="l00060"></a>00060         <span class="keyword">typedef</span> <span class="keyword">typename</span> T::const_reference const_reference;
<a name="l00061"></a>00061         <span class="keyword">typedef</span> <span class="keyword">typename</span> T::const_pointer   const_pointer;
<a name="l00062"></a>00062         BOOST_STATIC_CONSTANT(<span class="keywordtype">bool</span>, is_mutable=T::is_mutable);
<a name="l00063"></a>00063         <span class="keyword">static</span> value_type min_value() { <span class="keywordflow">return</span> T::min_value(); }
<a name="l00064"></a>00064         <span class="keyword">static</span> value_type max_value() { <span class="keywordflow">return</span> T::max_value(); }
<a name="l00065"></a>00065     };
<a name="l00066"></a>00066 
<a name="l00067"></a>00067     <span class="comment">// channel traits implementation for built-in integral or floating point channel type</span>
<a name="l00068"></a>00068     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; 
<a name="l00069"></a>00069     <span class="keyword">struct </span>channel_traits_impl&lt;T, false&gt; {
<a name="l00070"></a>00070         <span class="keyword">typedef</span> T           value_type;
<a name="l00071"></a>00071         <span class="keyword">typedef</span> T&amp;          reference;
<a name="l00072"></a>00072         <span class="keyword">typedef</span> T*          pointer;
<a name="l00073"></a>00073         <span class="keyword">typedef</span> <span class="keyword">const</span> T&amp;    const_reference;
<a name="l00074"></a>00074         <span class="keyword">typedef</span> T <span class="keyword">const</span>*    const_pointer;
<a name="l00075"></a>00075         BOOST_STATIC_CONSTANT(<span class="keywordtype">bool</span>, is_mutable=<span class="keyword">true</span>);
<a name="l00076"></a>00076         <span class="keyword">static</span> value_type min_value() { <span class="keywordflow">return</span> (std::numeric_limits&lt;T&gt;::min)(); }
<a name="l00077"></a>00077         <span class="keyword">static</span> value_type max_value() { <span class="keywordflow">return</span> (std::numeric_limits&lt;T&gt;::max)(); }
<a name="l00078"></a>00078     };
<a name="l00079"></a>00079 
<a name="l00080"></a>00080     <span class="comment">// channel traits implementation for constant built-in scalar or floating point type</span>
<a name="l00081"></a>00081     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; 
<a name="l00082"></a>00082     <span class="keyword">struct </span>channel_traits_impl&lt;const T, false&gt; : <span class="keyword">public</span> channel_traits_impl&lt;T, false&gt; {
<a name="l00083"></a>00083         <span class="keyword">typedef</span> <span class="keyword">const</span> T&amp;    reference;
<a name="l00084"></a>00084         <span class="keyword">typedef</span> <span class="keyword">const</span> T*    pointer;
<a name="l00085"></a>00085         BOOST_STATIC_CONSTANT(<span class="keywordtype">bool</span>, is_mutable=<span class="keyword">false</span>);
<a name="l00086"></a>00086     };
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 
<a name="l00107"></a>00107 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;
<a name="l00108"></a><a class="code" href="g_i_l_0429.html">00108</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits</a> : <span class="keyword">public</span> detail::channel_traits_impl&lt;T, is_class&lt;T&gt;::value&gt; {};
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <span class="comment">// Channel traits for C++ reference type - remove the reference</span>
<a name="l00111"></a>00111 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">struct </span><a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits</a>&lt;      T&amp;&gt; : <span class="keyword">public</span> <a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits&lt;T&gt;</a> {};
<a name="l00112"></a>00112 
<a name="l00113"></a>00113 <span class="comment">// Channel traits for constant C++ reference type</span>
<a name="l00114"></a>00114 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">struct </span>channel_traits&lt;const T&amp;&gt; : <span class="keyword">public</span> channel_traits&lt;T&gt; {
<a name="l00115"></a>00115     <span class="keyword">typedef</span> <span class="keyword">typename</span> channel_traits&lt;T&gt;::const_reference reference;
<a name="l00116"></a>00116     <span class="keyword">typedef</span> <span class="keyword">typename</span> channel_traits&lt;T&gt;::const_pointer   pointer;
<a name="l00117"></a>00117     BOOST_STATIC_CONSTANT(<span class="keywordtype">bool</span>, is_mutable=<span class="keyword">false</span>);
<a name="l00118"></a>00118 };
<a name="l00119"></a>00119 
<a name="l00125"></a>00125 
<a name="l00146"></a>00146 
<a name="l00147"></a>00147 
<a name="l00148"></a>00148 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BaseChannelValue,        <span class="comment">// base channel (models ChannelValueConcept)</span>
<a name="l00149"></a>00149           <span class="keyword">typename</span> MinVal, <span class="keyword">typename</span> MaxVal&gt; <span class="comment">// classes with a static apply() function returning the minimum/maximum channel values</span>
<a name="l00150"></a><a class="code" href="g_i_l_0620.html">00150</a> <span class="keyword">struct </span><a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a> {
<a name="l00151"></a>00151     <span class="keyword">typedef</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>    <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">value_type</a>;
<a name="l00152"></a>00152     <span class="keyword">typedef</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">value_type</a>&amp;             <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">reference</a>;
<a name="l00153"></a>00153     <span class="keyword">typedef</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">value_type</a>*             <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">pointer</a>;
<a name="l00154"></a>00154     <span class="keyword">typedef</span> <span class="keyword">const</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">value_type</a>&amp;       <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">const_reference</a>;
<a name="l00155"></a>00155     <span class="keyword">typedef</span> <span class="keyword">const</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">value_type</a>*       <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">const_pointer</a>;
<a name="l00156"></a>00156     BOOST_STATIC_CONSTANT(<span class="keywordtype">bool</span>, is_mutable=<a class="code" href="g_i_l_0429.html" title="Traits for channels. Contains the following members:.">channel_traits&lt;BaseChannelValue&gt;::is_mutable</a>);
<a name="l00157"></a>00157 
<a name="l00158"></a>00158     <span class="keyword">static</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">value_type</a> min_value() { <span class="keywordflow">return</span> MinVal::apply(); }
<a name="l00159"></a>00159     <span class="keyword">static</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">value_type</a> max_value() { <span class="keywordflow">return</span> MaxVal::apply(); }
<a name="l00160"></a>00160 
<a name="l00161"></a>00161     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>() {}
<a name="l00162"></a>00162     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>(<span class="keyword">const</span> <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; c) : _value(c.<a class="code" href="g_i_l_0620.html#734cfc58c2d23ec05c26288f29070346">_value</a>) {}
<a name="l00163"></a>00163     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>(BaseChannelValue val) : _value(val) {}
<a name="l00164"></a>00164 
<a name="l00165"></a>00165     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; operator++() { ++_value; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00166"></a>00166     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; operator--() { --_value; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00167"></a>00167 
<a name="l00168"></a>00168     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a> operator++(<span class="keywordtype">int</span>) { <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a> tmp=*<span class="keyword">this</span>; this-&gt;operator++(); <span class="keywordflow">return</span> tmp; }
<a name="l00169"></a>00169     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a> operator--(<span class="keywordtype">int</span>) { <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a> tmp=*<span class="keyword">this</span>; this-&gt;operator--(); <span class="keywordflow">return</span> tmp; }
<a name="l00170"></a>00170 
<a name="l00171"></a>00171     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scalar2&gt; <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; operator+=(Scalar2 v) { _value+=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00172"></a>00172     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scalar2&gt; <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; operator-=(Scalar2 v) { _value-=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00173"></a>00173     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scalar2&gt; <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; operator*=(Scalar2 v) { _value*=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00174"></a>00174     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Scalar2&gt; <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; operator/=(Scalar2 v) { _value/=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00175"></a>00175 
<a name="l00176"></a>00176     <a class="code" href="g_i_l_0620.html" title="A channel adaptor that modifies the range of the source channel. Models: ChannelValueConcept...">scoped_channel_value</a>&amp; operator=(BaseChannelValue v) { _value=v; <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00177"></a>00177     operator BaseChannelValue()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _value; }
<a name="l00178"></a>00178 <span class="keyword">private</span>:
<a name="l00179"></a>00179     BaseChannelValue _value;
<a name="l00180"></a>00180 };
<a name="l00181"></a>00181 
<a name="l00182"></a>00182 <span class="keyword">struct </span>float_zero { <span class="keyword">static</span> <span class="keywordtype">float</span> apply() { <span class="keywordflow">return</span> 0.0f; } };
<a name="l00183"></a>00183 <span class="keyword">struct </span>float_one  { <span class="keyword">static</span> <span class="keywordtype">float</span> apply() { <span class="keywordflow">return</span> 1.0f; } };
<a name="l00184"></a>00184 
<a name="l00185"></a>00185 
<a name="l00191"></a>00191 
<a name="l00192"></a>00192 <span class="comment">// It is necessary for packed channels to have their own value type. They cannot simply use an integral large enough to store the data. Here is why:</span>
<a name="l00193"></a>00193 <span class="comment">// - Any operation that requires returning the result by value will otherwise return the built-in integral type, which will have incorrect range</span>
<a name="l00194"></a>00194 <span class="comment">//   That means that after getting the value of the channel we cannot properly do channel_convert, channel_invert, etc.</span>
<a name="l00195"></a>00195 <span class="comment">// - Two channels are declared compatible if they have the same value type. That means that a packed channel is incorrectly declared compatible with an integral type</span>
<a name="l00196"></a>00196 <span class="keyword">namespace </span>detail {
<a name="l00197"></a>00197     <span class="comment">// returns the smallest fast unsigned integral type that has at least NumBits bits</span>
<a name="l00198"></a>00198     <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> NumBits&gt;
<a name="l00199"></a>00199     <span class="keyword">struct </span>min_fast_uint : <span class="keyword">public</span> mpl::if_c&lt; (NumBits&lt;=8), 
<a name="l00200"></a>00200             uint_least8_t, 
<a name="l00201"></a>00201             typename mpl::if_c&lt; (NumBits&lt;=16), 
<a name="l00202"></a>00202                     uint_least16_t, 
<a name="l00203"></a>00203                     typename mpl::if_c&lt; (NumBits&lt;=32), 
<a name="l00204"></a>00204                             uint_least32_t, 
<a name="l00205"></a>00205                             uintmax_t
<a name="l00206"></a>00206                     &gt;::type
<a name="l00207"></a>00207             &gt;::type
<a name="l00208"></a>00208           &gt; {};
<a name="l00209"></a>00209 }
<a name="l00210"></a>00210 
<a name="l00227"></a>00227 
<a name="l00228"></a>00228 
<a name="l00229"></a>00229 template &lt;int NumBits&gt;
<a name="l00230"></a><a class="code" href="g_i_l_0052.html">00230</a> class packed_channel_value {
<a name="l00231"></a>00231     static const std::size_t num_values = 1&lt;&lt;NumBits;
<a name="l00232"></a>00232 public:
<a name="l00233"></a>00233     typedef typename detail::min_fast_uint&lt;NumBits&gt;::type integer_t;
<a name="l00234"></a>00234 
<a name="l00235"></a>00235     typedef packed_channel_value   value_type;
<a name="l00236"></a>00236     typedef value_type&amp;            reference;
<a name="l00237"></a>00237     typedef const value_type&amp;      const_reference;
<a name="l00238"></a>00238     typedef value_type*            pointer;
<a name="l00239"></a>00239     typedef const value_type*      const_pointer;
<a name="l00240"></a>00240 
<a name="l00241"></a>00241     static value_type min_value() { return value_type(0); }
<a name="l00242"></a>00242     static value_type max_value() { return value_type(num_values-1); }
<a name="l00243"></a>00243     BOOST_STATIC_CONSTANT(bool, is_mutable=true);
<a name="l00244"></a>00244 
<a name="l00245"></a>00245     packed_channel_value() {}
<a name="l00246"></a>00246     packed_channel_value(integer_t v) : _value(v % num_values) {}
<a name="l00247"></a>00247     packed_channel_value(const packed_channel_value&amp; v) : _value(v._value) {}
<a name="l00248"></a>00248     template &lt;typename Scalar&gt; packed_channel_value(Scalar v) : _value(integer_t(v) % num_values) {}     <span class="comment">// suppress GCC implicit conversion warnings in channel regression file </span>
<a name="l00249"></a>00249 
<a name="l00250"></a>00250     operator integer_t() const { return _value; }
<a name="l00251"></a>00251 private:
<a name="l00252"></a>00252     integer_t _value;
<a name="l00253"></a>00253 };
<a name="l00254"></a>00254 
<a name="l00255"></a>00255 namespace detail {
<a name="l00256"></a>00256 
<a name="l00257"></a>00257 template &lt;std::size_t K&gt;
<a name="l00258"></a>00258 struct static_copy_bytes {
<a name="l00259"></a>00259     void operator()(const unsigned char* from, unsigned char* to) const {
<a name="l00260"></a>00260         *to = *from;
<a name="l00261"></a>00261         static_copy_bytes&lt;K-1&gt;()(++from,++to);
<a name="l00262"></a>00262     }
<a name="l00263"></a>00263 };
<a name="l00264"></a>00264 
<a name="l00265"></a>00265 template &lt;&gt;
<a name="l00266"></a>00266 struct static_copy_bytes&lt;0&gt; {
<a name="l00267"></a>00267     void operator()(const unsigned char* , unsigned char*) const {}
<a name="l00268"></a>00268 };
<a name="l00269"></a>00269 
<a name="l00270"></a>00270 template &lt;typename Derived, typename BitField, int NumBits, bool Mutable&gt;
<a name="l00271"></a>00271 class packed_channel_reference_base {
<a name="l00272"></a>00272 protected:
<a name="l00273"></a>00273     typedef typename mpl::if_c&lt;Mutable,void*,const void*&gt;::type data_ptr_t;
<a name="l00274"></a>00274 public:
<a name="l00275"></a>00275     data_ptr_t _data_ptr;   <span class="comment">// void* pointer to the first byte of the bit range</span>
<a name="l00276"></a>00276 
<a name="l00277"></a>00277     typedef packed_channel_value&lt;NumBits&gt;   value_type;
<a name="l00278"></a>00278     typedef const Derived                   reference;
<a name="l00279"></a>00279     typedef value_type*                     pointer;
<a name="l00280"></a>00280     typedef const value_type*               const_pointer;
<a name="l00281"></a>00281     BOOST_STATIC_CONSTANT(int,  num_bits=NumBits);
<a name="l00282"></a>00282     BOOST_STATIC_CONSTANT(bool, is_mutable=Mutable);
<a name="l00283"></a>00283 
<a name="l00284"></a>00284     static value_type min_value()       { return channel_traits&lt;value_type&gt;::min_value(); }
<a name="l00285"></a>00285     static value_type max_value()       { return channel_traits&lt;value_type&gt;::max_value(); }
<a name="l00286"></a>00286 
<a name="l00287"></a>00287     typedef BitField                       bitfield_t;
<a name="l00288"></a>00288     typedef typename value_type::integer_t integer_t;
<a name="l00289"></a>00289 
<a name="l00290"></a>00290     packed_channel_reference_base(data_ptr_t data_ptr) : _data_ptr(data_ptr) {}
<a name="l00291"></a>00291     packed_channel_reference_base(const packed_channel_reference_base&amp; ref) : _data_ptr(ref._data_ptr) {}
<a name="l00292"></a>00292     const Derived&amp; operator=(integer_t v) const { set(v); return derived(); }
<a name="l00293"></a>00293 
<a name="l00294"></a>00294     const Derived&amp; operator++() const { set(get()+1); return derived(); }
<a name="l00295"></a>00295     const Derived&amp; operator--() const { set(get()-1); return derived(); }
<a name="l00296"></a>00296 
<a name="l00297"></a>00297     Derived operator++(int) const { Derived tmp=derived(); this-&gt;operator++(); return tmp; }
<a name="l00298"></a>00298     Derived operator--(int) const { Derived tmp=derived(); this-&gt;operator--(); return tmp; }
<a name="l00299"></a>00299 
<a name="l00300"></a>00300     template &lt;typename Scalar2&gt; const Derived&amp; operator+=(Scalar2 v) const { set(get()+v); return derived(); }
<a name="l00301"></a>00301     template &lt;typename Scalar2&gt; const Derived&amp; operator-=(Scalar2 v) const { set(get()-v); return derived(); }
<a name="l00302"></a>00302     template &lt;typename Scalar2&gt; const Derived&amp; operator*=(Scalar2 v) const { set(get()*v); return derived(); }
<a name="l00303"></a>00303     template &lt;typename Scalar2&gt; const Derived&amp; operator/=(Scalar2 v) const { set(get()/v); return derived(); }
<a name="l00304"></a>00304 
<a name="l00305"></a>00305     operator integer_t() const { return get(); }
<a name="l00306"></a>00306     data_ptr_t operator &amp;() const {return _data_ptr;}
<a name="l00307"></a>00307 protected:
<a name="l00308"></a>00308     static const integer_t max_val    = (1&lt;&lt;NumBits) - 1;
<a name="l00309"></a>00309 
<a name="l00310"></a>00310 #ifdef GIL_NONWORD_POINTER_ALIGNMENT_SUPPORTED
<a name="l00311"></a>00311     const bitfield_t&amp; get_data()                      const { return *static_cast&lt;const bitfield_t*&gt;(_data_ptr); }
<a name="l00312"></a>00312     void              set_data(const bitfield_t&amp; val) const {        *static_cast&lt;      bitfield_t*&gt;(_data_ptr) = val; }
<a name="l00313"></a>00313 #else
<a name="l00314"></a>00314     bitfield_t get_data() const {
<a name="l00315"></a>00315         bitfield_t ret;
<a name="l00316"></a>00316         static_copy_bytes&lt;sizeof(bitfield_t) &gt;()(gil_reinterpret_cast_c&lt;const unsigned char*&gt;(_data_ptr),gil_reinterpret_cast&lt;unsigned char*&gt;(&amp;ret));
<a name="l00317"></a>00317         return ret;
<a name="l00318"></a>00318     }
<a name="l00319"></a>00319     void set_data(const bitfield_t&amp; val) const {
<a name="l00320"></a>00320         static_copy_bytes&lt;sizeof(bitfield_t) &gt;()(gil_reinterpret_cast_c&lt;const unsigned char*&gt;(&amp;val),gil_reinterpret_cast&lt;unsigned char*&gt;(_data_ptr));
<a name="l00321"></a>00321     }
<a name="l00322"></a>00322 #endif
<a name="l00323"></a>00323 
<a name="l00324"></a>00324 private:
<a name="l00325"></a>00325     void set(integer_t value) const {     <span class="comment">// can this be done faster??</span>
<a name="l00326"></a>00326         const integer_t num_values = max_val+1;
<a name="l00327"></a>00327         this-&gt;derived().set_unsafe(((value % num_values) + num_values) % num_values); 
<a name="l00328"></a>00328     }
<a name="l00329"></a>00329     integer_t get() const { return derived().get(); }
<a name="l00330"></a>00330     const Derived&amp; derived() const { return static_cast&lt;const Derived&amp;&gt;(*this); }
<a name="l00331"></a>00331 };
<a name="l00332"></a>00332 }   <span class="comment">// namespace detail</span>
<a name="l00333"></a>00333 
<a name="l00350"></a>00350 template &lt;typename BitField,        <span class="comment">// A type that holds the bits of the pixel from which the channel is referenced. Typically an integral type, like boost::uint16_t</span>
<a name="l00351"></a>00351           int FirstBit, int NumBits,<span class="comment">// Defines the sequence of bits in the data value that contain the channel </span>
<a name="l00352"></a>00352           bool Mutable&gt;             <span class="comment">// true if the reference is mutable </span>
<a name="l00353"></a>00353 class packed_channel_reference;
<a name="l00354"></a>00354 
<a name="l00355"></a>00355 template &lt;typename BitField,        <span class="comment">// A type that holds the bits of the pixel from which the channel is referenced. Typically an integral type, like boost::uint16_t</span>
<a name="l00356"></a>00356           int NumBits,              <span class="comment">// Defines the sequence of bits in the data value that contain the channel </span>
<a name="l00357"></a>00357           bool Mutable&gt;             <span class="comment">// true if the reference is mutable </span>
<a name="l00358"></a>00358 class packed_dynamic_channel_reference;
<a name="l00359"></a>00359 
<a name="l00362"></a>00362 template &lt;typename BitField, int FirstBit, int NumBits&gt;
<a name="l00363"></a><a class="code" href="g_i_l_0048.html">00363</a> class packed_channel_reference&lt;BitField,FirstBit,NumBits,false&gt; 
<a name="l00364"></a>00364    : public detail::packed_channel_reference_base&lt;packed_channel_reference&lt;BitField,FirstBit,NumBits,false&gt;,BitField,NumBits,false&gt; {
<a name="l00365"></a>00365     typedef detail::packed_channel_reference_base&lt;packed_channel_reference&lt;BitField,FirstBit,NumBits,false&gt;,BitField,NumBits,false&gt; parent_t;
<a name="l00366"></a>00366     friend class packed_channel_reference&lt;BitField,FirstBit,NumBits,true&gt;;
<a name="l00367"></a>00367 
<a name="l00368"></a>00368     static const BitField channel_mask = parent_t::max_val&lt;&lt;FirstBit;
<a name="l00369"></a>00369     void operator=(const packed_channel_reference&amp;);
<a name="l00370"></a>00370 public:
<a name="l00371"></a>00371     typedef const packed_channel_reference&lt;BitField,FirstBit,NumBits,false&gt; const_reference;
<a name="l00372"></a>00372     typedef const packed_channel_reference&lt;BitField,FirstBit,NumBits,true&gt;  mutable_reference;
<a name="l00373"></a>00373     typedef typename parent_t::integer_t                           integer_t;
<a name="l00374"></a>00374 
<a name="l00375"></a>00375     explicit packed_channel_reference(const void* data_ptr) : parent_t(data_ptr) {}
<a name="l00376"></a>00376     packed_channel_reference(const packed_channel_reference&amp; ref) : parent_t(ref._data_ptr) {}
<a name="l00377"></a>00377     packed_channel_reference(const mutable_reference&amp; ref) : parent_t(ref._data_ptr) {}
<a name="l00378"></a>00378 
<a name="l00379"></a>00379     unsigned first_bit() const { return FirstBit; }
<a name="l00380"></a>00380 
<a name="l00381"></a>00381     integer_t get() const { return integer_t((this-&gt;get_data()&amp;channel_mask) &gt;&gt; FirstBit); }
<a name="l00382"></a>00382 };
<a name="l00383"></a>00383 
<a name="l00386"></a>00386 template &lt;typename BitField, int FirstBit, int NumBits&gt;
<a name="l00387"></a><a class="code" href="g_i_l_0050.html">00387</a> class packed_channel_reference&lt;BitField,FirstBit,NumBits,true&gt; 
<a name="l00388"></a>00388    : public detail::packed_channel_reference_base&lt;packed_channel_reference&lt;BitField,FirstBit,NumBits,true&gt;,BitField,NumBits,true&gt; {
<a name="l00389"></a>00389     typedef detail::packed_channel_reference_base&lt;packed_channel_reference&lt;BitField,FirstBit,NumBits,true&gt;,BitField,NumBits,true&gt; parent_t;
<a name="l00390"></a>00390     friend class packed_channel_reference&lt;BitField,FirstBit,NumBits,false&gt;;
<a name="l00391"></a>00391 
<a name="l00392"></a>00392     static const BitField channel_mask = parent_t::max_val&lt;&lt;FirstBit;
<a name="l00393"></a>00393 public:
<a name="l00394"></a>00394     typedef const packed_channel_reference&lt;BitField,FirstBit,NumBits,false&gt; const_reference;
<a name="l00395"></a>00395     typedef const packed_channel_reference&lt;BitField,FirstBit,NumBits,true&gt;  mutable_reference;
<a name="l00396"></a>00396     typedef typename parent_t::integer_t                           integer_t;
<a name="l00397"></a>00397 
<a name="l00398"></a>00398     explicit packed_channel_reference(void* data_ptr) : parent_t(data_ptr) {}
<a name="l00399"></a>00399     packed_channel_reference(const packed_channel_reference&amp; ref) : parent_t(ref._data_ptr) {}
<a name="l00400"></a>00400 
<a name="l00401"></a>00401     const packed_channel_reference&amp; operator=(integer_t value) const { assert(value&lt;=parent_t::max_val); set_unsafe(value); return *this; }
<a name="l00402"></a>00402     const packed_channel_reference&amp; operator=(const mutable_reference&amp; ref) const { set_from_reference(ref.get_data()); return *this; }
<a name="l00403"></a>00403     const packed_channel_reference&amp; operator=(const const_reference&amp;   ref) const { set_from_reference(ref.get_data()); return *this; }
<a name="l00404"></a>00404 
<a name="l00405"></a>00405     template &lt;bool Mutable1&gt;
<a name="l00406"></a>00406     const packed_channel_reference&amp; operator=(const packed_dynamic_channel_reference&lt;BitField,NumBits,Mutable1&gt;&amp; ref) const { set_unsafe(ref.get()); return *this; }
<a name="l00407"></a>00407 
<a name="l00408"></a>00408     unsigned first_bit() const { return FirstBit; }
<a name="l00409"></a>00409 
<a name="l00410"></a>00410     integer_t get()                               const { return integer_t((this-&gt;get_data()&amp;channel_mask) &gt;&gt; FirstBit); }
<a name="l00411"></a>00411     void set_unsafe(integer_t value)              const { this-&gt;set_data((this-&gt;get_data() &amp; ~channel_mask) | (value&lt;&lt;FirstBit)); }
<a name="l00412"></a>00412 private:
<a name="l00413"></a>00413     void set_from_reference(const BitField&amp; other_bits) const { this-&gt;set_data((this-&gt;get_data() &amp; ~channel_mask) | (other_bits &amp; channel_mask)); }
<a name="l00414"></a>00414 };
<a name="l00415"></a>00415 
<a name="l00416"></a>00416 } }  <span class="comment">// namespace boost::gil</span>
<a name="l00417"></a>00417 
<a name="l00418"></a>00418 namespace std {
<a name="l00419"></a>00419 <span class="comment">// We are forced to define swap inside std namespace because on some platforms (Visual Studio 8) STL calls swap qualified.</span>
<a name="l00420"></a>00420 <span class="comment">// swap with 'left bias': </span>
<a name="l00421"></a>00421 <span class="comment">// - swap between proxy and anything</span>
<a name="l00422"></a>00422 <span class="comment">// - swap between value type and proxy</span>
<a name="l00423"></a>00423 <span class="comment">// - swap between proxy and proxy</span>
<a name="l00424"></a>00424 
<a name="l00427"></a>00427 template &lt;typename BF, int FB, int NB, bool M, typename R&gt; inline
<a name="l00428"></a><a class="code" href="g_i_l_0176.html#g80e89636c0d110249fedf6ea14a477f7">00428</a> void swap(const boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt; x, R&amp; y) { 
<a name="l00429"></a>00429     boost::gil::swap_proxy&lt;typename boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt;::value_type&gt;(x,y); 
<a name="l00430"></a>00430 }
<a name="l00431"></a>00431 
<a name="l00432"></a>00432 
<a name="l00435"></a>00435 template &lt;typename BF, int FB, int NB, bool M&gt; inline
<a name="l00436"></a><a class="code" href="g_i_l_0176.html#g9541bc0769202d632e1b869e1cf217e0">00436</a> void swap(typename boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt;::value_type&amp; x, const boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt; y) { 
<a name="l00437"></a>00437     boost::gil::swap_proxy&lt;typename boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt;::value_type&gt;(x,y); 
<a name="l00438"></a>00438 }
<a name="l00439"></a>00439 
<a name="l00440"></a>00440 
<a name="l00443"></a>00443 template &lt;typename BF, int FB, int NB, bool M&gt; inline
<a name="l00444"></a><a class="code" href="g_i_l_0176.html#g20a753330c605ac59c89aa784ab89eca">00444</a> void swap(const boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt; x, const boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt; y) { 
<a name="l00445"></a>00445     boost::gil::swap_proxy&lt;typename boost::gil::packed_channel_reference&lt;BF,FB,NB,M&gt;::value_type&gt;(x,y); 
<a name="l00446"></a>00446 }
<a name="l00447"></a>00447 }   <span class="comment">// namespace std</span>
<a name="l00448"></a>00448 
<a name="l00449"></a>00449 namespace boost { namespace gil {
<a name="l00450"></a>00450 
<a name="l00468"></a>00468 
<a name="l00469"></a>00469 
<a name="l00470"></a>00470 
<a name="l00471"></a>00471 template &lt;typename BitField, int NumBits&gt; 
<a name="l00472"></a><a class="code" href="g_i_l_0054.html">00472</a> class packed_dynamic_channel_reference&lt;BitField,NumBits,false&gt;
<a name="l00473"></a>00473    : public detail::packed_channel_reference_base&lt;packed_dynamic_channel_reference&lt;BitField,NumBits,false&gt;,BitField,NumBits,false&gt; {
<a name="l00474"></a>00474     typedef detail::packed_channel_reference_base&lt;packed_dynamic_channel_reference&lt;BitField,NumBits,false&gt;,BitField,NumBits,false&gt; parent_t;
<a name="l00475"></a>00475     friend class packed_dynamic_channel_reference&lt;BitField,NumBits,true&gt;;
<a name="l00476"></a>00476 
<a name="l00477"></a>00477     unsigned _first_bit;     <span class="comment">// 0..7</span>
<a name="l00478"></a>00478 
<a name="l00479"></a>00479     void operator=(const packed_dynamic_channel_reference&amp;);
<a name="l00480"></a>00480 public:
<a name="l00481"></a>00481     typedef const packed_dynamic_channel_reference&lt;BitField,NumBits,false&gt; const_reference;
<a name="l00482"></a>00482     typedef const packed_dynamic_channel_reference&lt;BitField,NumBits,true&gt;  mutable_reference;
<a name="l00483"></a>00483     typedef typename parent_t::integer_t                          integer_t;
<a name="l00484"></a>00484 
<a name="l00485"></a>00485     packed_dynamic_channel_reference(const void* data_ptr, unsigned first_bit) : parent_t(data_ptr), _first_bit(first_bit) {}
<a name="l00486"></a>00486     packed_dynamic_channel_reference(const const_reference&amp;   ref) : parent_t(ref._data_ptr), _first_bit(ref._first_bit) {}
<a name="l00487"></a>00487     packed_dynamic_channel_reference(const mutable_reference&amp; ref) : parent_t(ref._data_ptr), _first_bit(ref._first_bit) {}
<a name="l00488"></a>00488 
<a name="l00489"></a>00489     unsigned first_bit() const { return _first_bit; }
<a name="l00490"></a>00490 
<a name="l00491"></a>00491     integer_t get() const { 
<a name="l00492"></a>00492         const BitField channel_mask = parent_t::max_val&lt;&lt;_first_bit;
<a name="l00493"></a>00493         return (this-&gt;get_data()&amp;channel_mask) &gt;&gt; _first_bit; 
<a name="l00494"></a>00494     }
<a name="l00495"></a>00495 };
<a name="l00496"></a>00496 
<a name="l00500"></a>00500 template &lt;typename BitField, int NumBits&gt; 
<a name="l00501"></a><a class="code" href="g_i_l_0056.html">00501</a> class packed_dynamic_channel_reference&lt;BitField,NumBits,true&gt;
<a name="l00502"></a>00502    : <span class="keyword">public</span> detail::packed_channel_reference_base&lt;packed_dynamic_channel_reference&lt;BitField,NumBits,true&gt;,BitField,NumBits,true&gt; {
<a name="l00503"></a>00503     <span class="keyword">typedef</span> detail::packed_channel_reference_base&lt;packed_dynamic_channel_reference&lt;BitField,NumBits,true&gt;,BitField,NumBits,<span class="keyword">true</span>&gt; parent_t;
<a name="l00504"></a>00504     <span class="keyword">friend</span> <span class="keyword">class </span>packed_dynamic_channel_reference&lt;BitField,NumBits,false&gt;;
<a name="l00505"></a>00505 
<a name="l00506"></a>00506     <span class="keywordtype">unsigned</span> _first_bit;
<a name="l00507"></a>00507 
<a name="l00508"></a>00508 <span class="keyword">public</span>:
<a name="l00509"></a>00509     <span class="keyword">typedef</span> <span class="keyword">const</span> packed_dynamic_channel_reference&lt;BitField,NumBits,false&gt; <a class="code" href="g_i_l_0054.html" title="Models a constant subbyte channel reference whose bit offset is a runtime parameter...">const_reference</a>;
<a name="l00510"></a>00510     <span class="keyword">typedef</span> <span class="keyword">const</span> packed_dynamic_channel_reference&lt;BitField,NumBits,true&gt;  <a class="code" href="g_i_l_0056.html" title="Models a mutable subbyte channel reference whose bit offset is a runtime parameter...">mutable_reference</a>;
<a name="l00511"></a>00511     <span class="keyword">typedef</span> <span class="keyword">typename</span> parent_t::integer_t                          integer_t;
<a name="l00512"></a>00512 
<a name="l00513"></a>00513     packed_dynamic_channel_reference(<span class="keywordtype">void</span>* data_ptr, <span class="keywordtype">unsigned</span> first_bit) : parent_t(data_ptr), _first_bit(first_bit) {}
<a name="l00514"></a>00514     packed_dynamic_channel_reference(<span class="keyword">const</span> packed_dynamic_channel_reference&amp; ref) : parent_t(ref._data_ptr), _first_bit(ref._first_bit) {}
<a name="l00515"></a>00515 
<a name="l00516"></a>00516     <span class="keyword">const</span> packed_dynamic_channel_reference&amp; operator=(integer_t value)<span class="keyword"> const </span>{ assert(value&lt;=parent_t::max_val); set_unsafe(value); <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00517"></a>00517     <span class="keyword">const</span> packed_dynamic_channel_reference&amp; operator=(<span class="keyword">const</span> <a class="code" href="g_i_l_0056.html" title="Models a mutable subbyte channel reference whose bit offset is a runtime parameter...">mutable_reference</a>&amp; ref)<span class="keyword"> const </span>{  set_unsafe(ref.<a class="code" href="g_i_l_0056.html#acb80df4b55e284a1e5cc442604aedea">get</a>()); <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00518"></a>00518     <span class="keyword">const</span> packed_dynamic_channel_reference&amp; operator=(<span class="keyword">const</span> <a class="code" href="g_i_l_0054.html" title="Models a constant subbyte channel reference whose bit offset is a runtime parameter...">const_reference</a>&amp;   ref)<span class="keyword"> const </span>{  set_unsafe(ref.<a class="code" href="g_i_l_0054.html#acb80df4b55e284a1e5cc442604aedea">get</a>()); <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00519"></a>00519 
<a name="l00520"></a>00520     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BitField1, <span class="keywordtype">int</span> FirstBit1, <span class="keywordtype">bool</span> Mutable1&gt;
<a name="l00521"></a>00521     <span class="keyword">const</span> packed_dynamic_channel_reference&amp; operator=(<span class="keyword">const</span> packed_channel_reference&lt;BitField1, FirstBit1, NumBits, Mutable1&gt;&amp; ref)<span class="keyword"> const </span>
<a name="l00522"></a>00522 <span class="keyword">        </span>{  set_unsafe(ref.get()); <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00523"></a>00523 
<a name="l00524"></a>00524     <span class="keywordtype">unsigned</span> first_bit()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _first_bit; }
<a name="l00525"></a>00525 
<a name="l00526"></a>00526     integer_t <span class="keyword">get</span>() <span class="keyword">const</span> { 
<a name="l00527"></a>00527         <span class="keyword">const</span> BitField channel_mask = parent_t::max_val&lt;&lt;_first_bit;
<a name="l00528"></a>00528         <span class="keywordflow">return</span> (this-&gt;get_data()&amp;channel_mask) &gt;&gt; _first_bit; 
<a name="l00529"></a>00529     }
<a name="l00530"></a>00530     <span class="keywordtype">void</span> set_unsafe(integer_t value)<span class="keyword"> const </span>{ 
<a name="l00531"></a>00531         <span class="keyword">const</span> BitField channel_mask = parent_t::max_val&lt;&lt;_first_bit;
<a name="l00532"></a>00532         this-&gt;set_data((this-&gt;get_data() &amp; ~channel_mask) | value&lt;&lt;_first_bit); 
<a name="l00533"></a>00533     }
<a name="l00534"></a>00534 };
<a name="l00535"></a>00535 } }  <span class="comment">// namespace boost::gil</span>
<a name="l00536"></a>00536 
<a name="l00537"></a>00537 <span class="keyword">namespace </span>std {
<a name="l00538"></a>00538 <span class="comment">// We are forced to define swap inside std namespace because on some platforms (Visual Studio 8) STL calls swap qualified.</span>
<a name="l00539"></a>00539 <span class="comment">// swap with 'left bias': </span>
<a name="l00540"></a>00540 <span class="comment">// - swap between proxy and anything</span>
<a name="l00541"></a>00541 <span class="comment">// - swap between value type and proxy</span>
<a name="l00542"></a>00542 <span class="comment">// - swap between proxy and proxy</span>
<a name="l00543"></a>00543 
<a name="l00544"></a>00544 
<a name="l00547"></a>00547 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BF, <span class="keywordtype">int</span> NB, <span class="keywordtype">bool</span> M, <span class="keyword">typename</span> R&gt; <span class="keyword">inline</span>
<a name="l00548"></a><a class="code" href="g_i_l_0175.html#g45affd7c290ef9a24ac79edbd6f9ca7f">00548</a> <span class="keywordtype">void</span> swap(<span class="keyword">const</span> boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt; x, R&amp; y) { 
<a name="l00549"></a>00549     boost::gil::swap_proxy&lt;typename boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt;::value_type&gt;(x,y); 
<a name="l00550"></a>00550 }
<a name="l00551"></a>00551 
<a name="l00552"></a>00552 
<a name="l00555"></a>00555 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BF, <span class="keywordtype">int</span> NB, <span class="keywordtype">bool</span> M&gt; <span class="keyword">inline</span>
<a name="l00556"></a><a class="code" href="g_i_l_0175.html#gc25302c1ae9ad02851565565fd95e03e">00556</a> <span class="keywordtype">void</span> swap(<span class="keyword">typename</span> boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt;::value_type&amp; x, <span class="keyword">const</span> boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt; y) { 
<a name="l00557"></a>00557     boost::gil::swap_proxy&lt;typename boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt;::value_type&gt;(x,y); 
<a name="l00558"></a>00558 }
<a name="l00559"></a>00559 
<a name="l00560"></a>00560 
<a name="l00563"></a>00563 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BF, <span class="keywordtype">int</span> NB, <span class="keywordtype">bool</span> M&gt; <span class="keyword">inline</span>
<a name="l00564"></a><a class="code" href="g_i_l_0175.html#gd5c9bdabc34d65825f30d2ae71cb07dc">00564</a> <span class="keywordtype">void</span> swap(<span class="keyword">const</span> boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt; x, <span class="keyword">const</span> boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt; y) { 
<a name="l00565"></a>00565     boost::gil::swap_proxy&lt;typename boost::gil::packed_dynamic_channel_reference&lt;BF,NB,M&gt;::value_type&gt;(x,y); 
<a name="l00566"></a>00566 }
<a name="l00567"></a>00567 }   <span class="comment">// namespace std</span>
<a name="l00568"></a>00568 
<a name="l00569"></a>00569 <span class="keyword">namespace </span>boost { <span class="keyword">namespace </span>gil {
<a name="l00575"></a>00575 
<a name="l00579"></a>00579 
<a name="l00581"></a>00581 <span class="keyword">typedef</span> uint8_t  bits8;
<a name="l00582"></a>00582 
<a name="l00586"></a>00586 
<a name="l00588"></a>00588 <span class="keyword">typedef</span> uint16_t bits16;
<a name="l00589"></a>00589 
<a name="l00593"></a>00593 
<a name="l00595"></a>00595 <span class="keyword">typedef</span> uint32_t bits32;
<a name="l00596"></a>00596 
<a name="l00600"></a>00600 
<a name="l00602"></a>00602 <span class="keyword">typedef</span> int8_t   bits8s;
<a name="l00603"></a>00603 
<a name="l00607"></a>00607 
<a name="l00609"></a>00609 <span class="keyword">typedef</span> int16_t  bits16s;
<a name="l00610"></a>00610 
<a name="l00614"></a>00614 
<a name="l00616"></a>00616 <span class="keyword">typedef</span> int32_t  bits32s;
<a name="l00617"></a>00617 
<a name="l00621"></a>00621 
<a name="l00623"></a>00623 <span class="keyword">typedef</span> scoped_channel_value&lt;float,float_zero,float_one&gt; bits32f;
<a name="l00624"></a>00624 
<a name="l00625"></a>00625 } }  <span class="comment">// namespace boost::gil</span>
<a name="l00626"></a>00626 
<a name="l00627"></a>00627 <span class="keyword">namespace </span>boost {
<a name="l00628"></a>00628 
<a name="l00629"></a>00629 <span class="keyword">template</span> &lt;<span class="keywordtype">int</span> NumBits&gt;
<a name="l00630"></a>00630 <span class="keyword">struct </span>is_integral&lt;gil::packed_channel_value&lt;NumBits&gt; &gt; : <span class="keyword">public</span> mpl::true_ {};
<a name="l00631"></a>00631 
<a name="l00632"></a>00632 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BitField, <span class="keywordtype">int</span> FirstBit, <span class="keywordtype">int</span> NumBits, <span class="keywordtype">bool</span> IsMutable&gt;
<a name="l00633"></a>00633 <span class="keyword">struct </span>is_integral&lt;gil::packed_channel_reference&lt;BitField,FirstBit,NumBits,IsMutable&gt; &gt; : <span class="keyword">public</span> mpl::true_ {};
<a name="l00634"></a>00634 
<a name="l00635"></a>00635 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BitField, <span class="keywordtype">int</span> NumBits, <span class="keywordtype">bool</span> IsMutable&gt;
<a name="l00636"></a>00636 <span class="keyword">struct </span>is_integral&lt;gil::packed_dynamic_channel_reference&lt;BitField,NumBits,IsMutable&gt; &gt; : <span class="keyword">public</span> mpl::true_ {};
<a name="l00637"></a>00637 
<a name="l00638"></a>00638 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> BaseChannelValue, <span class="keyword">typename</span> MinVal, <span class="keyword">typename</span> MaxVal&gt; 
<a name="l00639"></a>00639 <span class="keyword">struct </span>is_integral&lt;gil::scoped_channel_value&lt;BaseChannelValue,MinVal,MaxVal&gt; &gt; : <span class="keyword">public</span> is_integral&lt;BaseChannelValue&gt; {};
<a name="l00640"></a>00640 
<a name="l00641"></a>00641 }
<a name="l00642"></a>00642 
<a name="l00643"></a>00643 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sat May 2 13:50:13 2009 for Generic Image Library by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>