Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 4f45e7bdfd4a5ff17f5f8eaab90d017f > files > 1382

albumshaper-2.1-6mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>AlbumShaper: mosaic.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</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>
    </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>
<div class="contents">
<h1>mosaic.h File Reference</h1><code>#include &quot;<a class="el" href="manipulationOptions_8h_source.html">manipulationOptions.h</a>&quot;</code><br>
<code>#include &lt;qsize.h&gt;</code><br>

<p>
<div class="dynheader">
Include dependency graph for mosaic.h:</div>
<div class="dynsection">
</div>

<p>
<div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dynsection">
</div>

<p>
<a href="mosaic_8h_source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMosaicOptions.html">MosaicOptions</a></td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QImage *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="mosaic_8h.html#012c297101e169545b4ec948ddac9b23">mosaicEffect</a> (QString filename, <a class="el" href="classMosaicOptions.html">MosaicOptions</a> *options)</td></tr>

</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="012c297101e169545b4ec948ddac9b23"></a><!-- doxytag: member="mosaic.h::mosaicEffect" ref="012c297101e169545b4ec948ddac9b23" args="(QString filename, MosaicOptions *options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QImage* mosaicEffect           </td>
          <td>(</td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classMosaicOptions.html">MosaicOptions</a> *&nbsp;</td>
          <td class="paramname"> <em>options</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="mosaic_8cpp_source.html#l00290">290</a> of file <a class="el" href="mosaic_8cpp_source.html">mosaic.cpp</a>.</p>

<p>References <a class="el" href="mosaic_8cpp_source.html#l00375">constructColorTiles()</a>, <a class="el" href="mosaic_8cpp_source.html#l00413">constructImageTiles()</a>, <a class="el" href="redEye__internal_8h_source.html#l00037">editedImage</a>, <a class="el" href="mosaic_8cpp_source.html#l00251">MosaicOptions::getFileList()</a>, <a class="el" href="manipulationOptions_8h_source.html#l00021">ManipulationOptions::getStatus()</a>, <a class="el" href="mosaic_8cpp_source.html#l00252">MosaicOptions::getTileSize()</a>, <a class="el" href="statusWidget_8cpp_source.html#l00119">StatusWidget::incrementProgress()</a>, <a class="el" href="redEye__internal_8h_source.html#l00031">newProgress</a>, <a class="el" href="statusWidget_8cpp_source.html#l00089">StatusWidget::showProgressBar()</a>, <a class="el" href="mosaic_8cpp_source.html#l00598">splatBestTile()</a>, <a class="el" href="redEye__internal_8h_source.html#l00021">status</a>, and <a class="el" href="redEye__internal_8h_source.html#l00028">updateIncrement</a>.</p>

<p>Referenced by <a class="el" href="editingInterface_8cpp_source.html#l00834">EditingInterface::applyEffect()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00291"></a>00291 {
<a name="l00292"></a>00292   <span class="comment">//load image</span>
<a name="l00293"></a>00293   QImage* <a class="code" href="redEye__internal_8h.html#63116a8b94b4ed0e99ddcb7f6f3bd919">editedImage</a> = <span class="keyword">new</span> QImage( filename );
<a name="l00294"></a>00294   
<a name="l00295"></a>00295   <span class="comment">//convert to 32-bit depth if necessary</span>
<a name="l00296"></a>00296   <span class="keywordflow">if</span>( editedImage-&gt;depth() &lt; 32 )
<a name="l00297"></a>00297   {
<a name="l00298"></a>00298     QImage* tmp = editedImage;
<a name="l00299"></a>00299     editedImage = <span class="keyword">new</span> QImage( tmp-&gt;convertDepth( 32, Qt::AutoColor ) );
<a name="l00300"></a>00300     <span class="keyword">delete</span> tmp; tmp=NULL;
<a name="l00301"></a>00301   }
<a name="l00302"></a>00302   
<a name="l00303"></a>00303   <span class="comment">//determine if busy indicators will be used</span>
<a name="l00304"></a>00304   <span class="keywordtype">bool</span> useBusyIndicators = <span class="keyword">false</span>;
<a name="l00305"></a>00305   <a class="code" href="classStatusWidget.html">StatusWidget</a>* <a class="code" href="redEye__internal_8h.html#65b682074aef9e63bb1dad48c3e9e9df">status</a> = NULL;
<a name="l00306"></a>00306   <span class="keywordflow">if</span>( options != NULL &amp;&amp; options-&gt;<a class="code" href="classManipulationOptions.html#9bc4d4123333012b705b599043406e68">getStatus</a>() != NULL )
<a name="l00307"></a>00307   {
<a name="l00308"></a>00308     useBusyIndicators = <span class="keyword">true</span>;
<a name="l00309"></a>00309     status = options-&gt;<a class="code" href="classManipulationOptions.html#9bc4d4123333012b705b599043406e68">getStatus</a>(); 
<a name="l00310"></a>00310   }
<a name="l00311"></a>00311   
<a name="l00312"></a>00312   <span class="comment">//intialize seed using current time</span>
<a name="l00313"></a>00313   srand( <span class="keywordtype">unsigned</span>(time(NULL)) );
<a name="l00314"></a>00314   
<a name="l00315"></a>00315   <span class="comment">//determine tile size</span>
<a name="l00316"></a>00316   QSize tileSize;
<a name="l00317"></a>00317   <span class="keywordflow">if</span>(options == NULL) tileSize = QSize(6,6); <span class="comment">//6 is big enough to be visible, but not so blocky the image looks bad</span>
<a name="l00318"></a>00318   <span class="keywordflow">else</span>                tileSize =options-&gt;<a class="code" href="classMosaicOptions.html#ef9c2a6b46ac2b1e90b5dc7c94d88c34">getTileSize</a>();
<a name="l00319"></a>00319   
<a name="l00320"></a>00320   <span class="comment">//construct tile set</span>
<a name="l00321"></a>00321   <a class="code" href="structTileSet.html">TileSet</a>* tileSet = NULL;
<a name="l00322"></a>00322   <span class="keywordflow">if</span>( options != NULL &amp;&amp; options-&gt;<a class="code" href="classMosaicOptions.html#b087719eafa81e81ee5d0591daf1786a">getFileList</a>().size() &gt; 0 )
<a name="l00323"></a>00323   {
<a name="l00324"></a>00324     <a class="code" href="mosaic_8cpp.html#baf87e675270cda9dbbdc911e4726f94">constructImageTiles</a>(options-&gt;<a class="code" href="classMosaicOptions.html#b087719eafa81e81ee5d0591daf1786a">getFileList</a>(), tileSize);
<a name="l00325"></a>00325     tileSet = &amp;<a class="code" href="mosaic_8cpp.html#15fb7a6ec3f4d512437d4ea50f0f02f4">imageTiles</a>;
<a name="l00326"></a>00326   }
<a name="l00327"></a>00327   <span class="keywordflow">else</span>
<a name="l00328"></a>00328   { 
<a name="l00329"></a>00329     <a class="code" href="mosaic_8cpp.html#dcff7718bf4fa9b179c469dbdfb1e7bf">constructColorTiles</a>(tileSize);
<a name="l00330"></a>00330     tileSet = &amp;<a class="code" href="mosaic_8cpp.html#eae592e14c25ef303dfbb2fa68598842">colorTiles</a>;
<a name="l00331"></a>00331   }
<a name="l00332"></a>00332 
<a name="l00333"></a>00333   <span class="comment">//setup progress bar</span>
<a name="l00334"></a>00334   <span class="keywordflow">if</span>(useBusyIndicators)
<a name="l00335"></a>00335   {
<a name="l00336"></a>00336     QString statusMessage = qApp-&gt;translate( <span class="stringliteral">"mosaicEffect"</span>, <span class="stringliteral">"Applying Mosaic Effect:"</span> );
<a name="l00337"></a>00337     status-&gt;<a class="code" href="classStatusWidget.html#57d461014070b9d651c36bd157cab9c1" title="Initializes the progress bar.">showProgressBar</a>( statusMessage, 100 );
<a name="l00338"></a>00338     qApp-&gt;processEvents();  
<a name="l00339"></a>00339   }
<a name="l00340"></a>00340 
<a name="l00341"></a>00341   <span class="comment">//update progress bar for every 1% of completion</span>
<a name="l00342"></a>00342   <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="redEye__internal_8h.html#32598f506d413f48cda8e1c930dae6b3">updateIncrement</a> = (int) ( (0.01 * editedImage-&gt;width() * editedImage-&gt;height()) / 
<a name="l00343"></a>00343                                       (tileSize.width() * tileSize.height()) );
<a name="l00344"></a>00344   <span class="keywordtype">int</span> <a class="code" href="redEye__internal_8h.html#caa08422437cae250a76ca488cbe1567">newProgress</a> = 0; 
<a name="l00345"></a>00345 
<a name="l00346"></a>00346   <span class="comment">//iterate over each selected scanline </span>
<a name="l00347"></a>00347   <span class="keywordtype">int</span> x, y;
<a name="l00348"></a>00348   <span class="keywordflow">for</span>(y=0; y&lt;editedImage-&gt;height(); y+=tileSize.height())
<a name="l00349"></a>00349   {
<a name="l00350"></a>00350     <span class="keywordflow">for</span>( x=0; x&lt;editedImage-&gt;width(); x+=tileSize.width())
<a name="l00351"></a>00351     {
<a name="l00352"></a>00352       <span class="comment">//splat the best tile</span>
<a name="l00353"></a>00353       <a class="code" href="mosaic_8cpp.html#01e2afa17839fbd21afc5397952270c7">splatBestTile</a>( editedImage, QPoint(x,y), tileSet );
<a name="l00354"></a>00354      
<a name="l00355"></a>00355       <span class="comment">//update status bar if significant progress has been made since last update</span>
<a name="l00356"></a>00356       <span class="keywordflow">if</span>(useBusyIndicators)
<a name="l00357"></a>00357       {
<a name="l00358"></a>00358         newProgress++;
<a name="l00359"></a>00359         <span class="keywordflow">if</span>(newProgress &gt;= updateIncrement)
<a name="l00360"></a>00360         {
<a name="l00361"></a>00361           newProgress = 0;
<a name="l00362"></a>00362           status-&gt;<a class="code" href="classStatusWidget.html#de18735223ae40506c32c96b9c9c5476" title="Updates the progress bar by one step.">incrementProgress</a>();
<a name="l00363"></a>00363           qApp-&gt;processEvents();  
<a name="l00364"></a>00364         }
<a name="l00365"></a>00365       }
<a name="l00366"></a>00366 
<a name="l00367"></a>00367     }
<a name="l00368"></a>00368   }
<a name="l00369"></a>00369    
<a name="l00370"></a>00370   <span class="comment">//return pointer to edited image</span>
<a name="l00371"></a>00371   <span class="keywordflow">return</span> editedImage;  
<a name="l00372"></a>00372 }
</pre></div>
<p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:31 2009 for AlbumShaper by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>