Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 4272c97b1af3db3f39a3b697bcba7e48 > files > 938

albumshaper-2.1-7mdv2010.1.x86_64.rpm

<!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">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>AlbumShaper: crop.cpp 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.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="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.cpp File Reference</h1><code>#include &lt;qimage.h&gt;</code><br/>
<code>#include &lt;qstring.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="crop_8h_source.html">crop.h</a>&quot;</code><br/>
<div class="dynheader">
Include dependency graph for crop.cpp:</div>
<div class="dynsection">
</div>

<p><a href="crop_8cpp_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QImage *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="crop_8cpp.html#a34a3b1a1cf40e0cc8ef3c30da641dac8">cropImage</a> (QString filename, QPoint <a class="el" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>, QPoint <a class="el" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>)</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a34a3b1a1cf40e0cc8ef3c30da641dac8"></a><!-- doxytag: member="crop.cpp::cropImage" ref="a34a3b1a1cf40e0cc8ef3c30da641dac8" 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>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>

<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#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.x() - <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x() + 1, 
<a name="l00046"></a>00046                                     <a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">bottomRight</a>.y() - <a class="code" href="redEye__internal_8h.html#a6a9aebec61b1a6732045c187a6156f4f">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#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.y(),yCropped=0;    yOrig&lt;=<a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">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#a6a9aebec61b1a6732045c187a6156f4f">topLeft</a>.x(),xCropped=0; xOrig&lt;=<a class="code" href="redEye__internal_8h.html#a75e80edb449bc9a0925be60719132bd0">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>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>