Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > eebc325dc36bd6e3b09b9b45133e42f8 > files > 287

HippoDraw-devel-docs-1.21.1-10.fc13.i686.rpm

<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>HippoDraw Class Library</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="hippoApp.ico">
</head><body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_e91d7d57230b93275afa36a649c1c346.html">colorreps</a>
  </div>
</div>
<div class="contents">
<h1>BinToGreyScale.cxx</h1><a href="BinToGreyScale_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;<a class="code" href="BinToGreyScale_8h.html" title="BinToGreyScale class interface.">BinToGreyScale.h</a>&quot;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="keyword">using namespace </span>hippodraw;
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 BinToGreyScale::
<a name="l00017"></a><a class="code" href="classhippodraw_1_1BinToGreyScale.html#a27a4d8b56e63ae6969e6d7e086c8b219">00017</a> BinToGreyScale ( <span class="keyword">const</span> <span class="keywordtype">char</span> * name )
<a name="l00018"></a>00018   : <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> ( name )
<a name="l00019"></a>00019 {
<a name="l00020"></a>00020 }
<a name="l00021"></a>00021 
<a name="l00022"></a><a class="code" href="classhippodraw_1_1BinToGreyScale.html#af2b6548e36220a55d17ff1f9f294a14d">00022</a> <a class="code" href="classhippodraw_1_1BinToGreyScale.html#a27a4d8b56e63ae6969e6d7e086c8b219" title="The constructor.">BinToGreyScale::BinToGreyScale</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1BinToGreyScale.html" title="The class derived from the BinToColor class.">BinToGreyScale</a> &amp; bin_to_color )
<a name="l00023"></a>00023   : <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> ( bin_to_color )
<a name="l00024"></a>00024 {
<a name="l00025"></a>00025 }
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="classhippodraw_1_1BinToGreyScale.html#acf2d9ae0de44b8efbce24084b3ea5184">00027</a> <a class="code" href="classhippodraw_1_1BinToColor.html" title="The base class for the value to the color transformation.">BinToColor</a> * <a class="code" href="classhippodraw_1_1BinToGreyScale.html#acf2d9ae0de44b8efbce24084b3ea5184" title="Creates a copy of itself.">BinToGreyScale::clone</a> ()<span class="keyword"> const</span>
<a name="l00028"></a>00028 <span class="keyword"></span>{
<a name="l00029"></a>00029   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classhippodraw_1_1BinToGreyScale.html#a27a4d8b56e63ae6969e6d7e086c8b219" title="The constructor.">BinToGreyScale</a> ( *<span class="keyword">this</span> );
<a name="l00030"></a>00030 }
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keywordtype">void</span>
<a name="l00033"></a>00033 <a class="code" href="classhippodraw_1_1BinToGreyScale.html#a63a596c7bccb4282016c1a5a4f0cf8a0" title="This function does the actual calculation that transforms the given value into a...">BinToGreyScale::</a>
<a name="l00034"></a><a class="code" href="classhippodraw_1_1BinToGreyScale.html#a63a596c7bccb4282016c1a5a4f0cf8a0">00034</a> <a class="code" href="classhippodraw_1_1BinToGreyScale.html#a63a596c7bccb4282016c1a5a4f0cf8a0" title="This function does the actual calculation that transforms the given value into a...">doubleToColor</a> ( <span class="keywordtype">double</span> value, <a class="code" href="classhippodraw_1_1Color.html" title="A Color class for creating the color object following the standard RGB color space...">Color</a> &amp; color )<span class="keyword"> const</span>
<a name="l00035"></a>00035 <span class="keyword"></span>{ 
<a name="l00036"></a>00036   <span class="keywordtype">int</span> red=color.<a class="code" href="classhippodraw_1_1Color.html#a554f0bc3f055386ee8d8af3bed2270e0">getRed</a>();
<a name="l00037"></a>00037   <span class="keywordtype">int</span> green=color.<a class="code" href="classhippodraw_1_1Color.html#a2f7edccf0a09b1eb61bdca066be488ce">getGreen</a>();
<a name="l00038"></a>00038   <span class="keywordtype">int</span> blue=color.<a class="code" href="classhippodraw_1_1Color.html#a6ef3a4782f8f919620728bc62e80f1e1">getBlue</a>();
<a name="l00039"></a>00039 
<a name="l00040"></a>00040   <span class="keywordtype">double</span> tmp = ( value - <a class="code" href="classhippodraw_1_1BinToColor.html#a48e433b9625c7e774073dce89c270905" title="The minimum value expected.">m_vmin</a> ) / <a class="code" href="classhippodraw_1_1BinToColor.html#ae9fd181c15aa94a45d97274d011e7b26" title="The distance of the expected values, i.e.">m_dv</a> ;
<a name="l00041"></a>00041   <span class="keywordtype">double</span> red_tmp   = 255. - tmp * ( 255. - static_cast &lt; <span class="keywordtype">double</span> &gt; ( red) );
<a name="l00042"></a>00042   <span class="keywordtype">double</span> green_tmp = 255. - tmp * ( 255. - static_cast &lt; <span class="keywordtype">double</span> &gt; ( green ) );
<a name="l00043"></a>00043   <span class="keywordtype">double</span> blue_tmp  = 255. - tmp * ( 255. - static_cast &lt; <span class="keywordtype">double</span> &gt; ( blue ) ); 
<a name="l00044"></a>00044 
<a name="l00045"></a>00045   <span class="keywordtype">int</span> ired_tmp = <span class="keyword">static_cast&lt;</span> <span class="keywordtype">int</span><span class="keyword">&gt;</span> ( red_tmp );
<a name="l00046"></a>00046   <span class="keywordtype">int</span> igreen_tmp = <span class="keyword">static_cast&lt;</span> <span class="keywordtype">int</span><span class="keyword">&gt;</span> ( green_tmp );
<a name="l00047"></a>00047   <span class="keywordtype">int</span> iblue_tmp = <span class="keyword">static_cast&lt;</span> <span class="keywordtype">int</span><span class="keyword">&gt;</span> ( blue_tmp );
<a name="l00048"></a>00048 
<a name="l00049"></a>00049   color.<a class="code" href="classhippodraw_1_1Color.html#aff0b32998d700c5a25a89f1b0304b035" title="Sets the color.">setColor</a> ( ired_tmp, igreen_tmp, iblue_tmp );
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 <span class="keywordtype">bool</span>
<a name="l00053"></a>00053 <a class="code" href="classhippodraw_1_1BinToGreyScale.html#a7bac923c9e9891d5f395654c6b9d72f0" title="Returns true if object can accept changing color,i.e.">BinToGreyScale::</a>
<a name="l00054"></a><a class="code" href="classhippodraw_1_1BinToGreyScale.html#a7bac923c9e9891d5f395654c6b9d72f0">00054</a> <a class="code" href="classhippodraw_1_1BinToGreyScale.html#a7bac923c9e9891d5f395654c6b9d72f0" title="Returns true if object can accept changing color,i.e.">acceptChangeColor</a> ()<span class="keyword"> const</span>
<a name="l00055"></a>00055 <span class="keyword"></span>{ 
<a name="l00056"></a>00056         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00057"></a>00057 }
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
</a> </small></address>
</body>
</html>