Sophie

Sophie

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

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: crop.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>crop.h File Reference</h1>
<p>
<div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dynsection">
</div>

<p>
<a href="crop_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>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="crop_8h.html#34a3b1a1cf40e0cc8ef3c30da641dac8">cropImage</a> (QString filename, QPoint <a class="el" href="redEye__internal_8h.html#6a9aebec61b1a6732045c187a6156f4f">topLeft</a>, QPoint <a class="el" href="redEye__internal_8h.html#75e80edb449bc9a0925be60719132bd0">bottomRight</a>)</td></tr>

</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="34a3b1a1cf40e0cc8ef3c30da641dac8"></a><!-- doxytag: member="crop.h::cropImage" ref="34a3b1a1cf40e0cc8ef3c30da641dac8" args="(QString filename, QPoint topLeft, QPoint bottomRight)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QImage* cropImage           </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">QPoint&nbsp;</td>
          <td class="paramname"> <em>topLeft</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QPoint&nbsp;</td>
          <td class="paramname"> <em>bottomRight</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="crop_8cpp_source.html#l00036">36</a> of file <a class="el" href="crop_8cpp_source.html">crop.cpp</a>.</p>

<p>Referenced by <a class="el" href="editingInterface_8cpp_source.html#l00626">EditingInterface::crop()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00037"></a>00037 {
<a name="l00038"></a>00038   <span class="comment">//load original image</span>
<a name="l00039"></a>00039   QImage origImage( filename );
<a name="l00040"></a>00040   
<a name="l00041"></a>00041   <span class="comment">//convert to 32-bit depth if necessary</span>
<a name="l00042"></a>00042   <span class="keywordflow">if</span>( origImage.depth() &lt; 32 ) { origImage = origImage.convertDepth( 32, Qt::AutoColor ); }
<a name="l00043"></a>00043   
<a name="l00044"></a>00044   <span class="comment">//construct cropped image</span>
<a name="l00045"></a>00045   QImage* croppedImage = <span class="keyword">new</span> QImage(<a class="code" href="redEye__internal_8h.html#75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x() - <a class="code" href="redEye__internal_8h.html#6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() + 1, 
<a name="l00046"></a>00046                                     <a class="code" href="redEye__internal_8h.html#75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y() - <a class="code" href="redEye__internal_8h.html#6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y() + 1,
<a name="l00047"></a>00047                                     origImage.depth());  
<a name="l00048"></a>00048   
<a name="l00049"></a>00049   <span class="comment">//iterate over each selected scanline </span>
<a name="l00050"></a>00050   <span class="keywordtype">int</span> xOrig, yOrig;
<a name="l00051"></a>00051   <span class="keywordtype">int</span> xCropped, yCropped;
<a name="l00052"></a>00052   uchar *origScanLine, *croppedScanLine;
<a name="l00053"></a>00053   
<a name="l00054"></a>00054   <span class="keywordflow">for</span>( yOrig=<a class="code" href="redEye__internal_8h.html#6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y(),yCropped=0;    yOrig&lt;=<a class="code" href="redEye__internal_8h.html#75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y();     yOrig++, yCropped++)
<a name="l00055"></a>00055   {   
<a name="l00056"></a>00056     <span class="comment">//iterate over each selected pixel in scanline</span>
<a name="l00057"></a>00057     origScanLine    = origImage.scanLine(yOrig);
<a name="l00058"></a>00058     croppedScanLine = croppedImage-&gt;scanLine(yCropped);
<a name="l00059"></a>00059     
<a name="l00060"></a>00060     <span class="keywordflow">for</span>( xOrig=<a class="code" href="redEye__internal_8h.html#6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x(),xCropped=0; xOrig&lt;=<a class="code" href="redEye__internal_8h.html#75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x(); xOrig++,xCropped++)
<a name="l00061"></a>00061     {
<a name="l00062"></a>00062       <span class="comment">//copy pixel color from original image to cropped image</span>
<a name="l00063"></a>00063       *((QRgb*)croppedScanLine+xCropped) = *((QRgb*)origScanLine+xOrig);      
<a name="l00064"></a>00064     }
<a name="l00065"></a>00065   }
<a name="l00066"></a>00066   
<a name="l00067"></a>00067   <span class="comment">//return pointer to cropped image</span>
<a name="l00068"></a>00068   <span class="keywordflow">return</span> croppedImage;  
<a name="l00069"></a>00069 }
</pre></div>
<p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 23 02:34:29 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>