Sophie

Sophie

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

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: imageTools.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>imageTools.h File Reference</h1><code>#include &lt;qcolor.h&gt;</code><br>

<p>
<div class="dynheader">
Include dependency graph for imageTools.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="imageTools_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>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288">TRANSFORM_CODE</a> { <a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288685062467b0c1a3164556335b467c886">ROTATE_90</a>, 
<a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288554e734d2a23790b248c5ce39816c18f">ROTATE_270</a>, 
<a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288a02c13f8f08154ca2e58c488c922fbe5">FLIP_H</a>, 
<a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288127171d15d7e5849705973e163393c71">FLIP_V</a>
 }</td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#f483fb1d0e6d890227ff2fecd321aad2">isJpeg</a> (const char *filename)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Checks to see if an image is a valid jpg by seeing if the image dimensions can be read.  <a href="#f483fb1d0e6d890227ff2fecd321aad2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#b6483215237a72d6b725adc644d40f0b">calcScaledImageDimensions</a> (int origWidth, int origHeight, int idealWidth, int idealHeight, int &amp;<a class="el" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>, int &amp;<a class="el" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a>)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Computes scale of image dimensions while respecting aspect ratio, equivalent to a QImage::scaleMin without actually scaling any image.  <a href="#b6483215237a72d6b725adc644d40f0b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#136ce4737ac4d5dfa526d752ab8aab33">constructImages</a> (QString imageName, QImage &amp;slideshowImage, QImage &amp;thumbnailImage)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructs slideshow and thumbnail images for a full sized image.  <a href="#136ce4737ac4d5dfa526d752ab8aab33"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#c697bfb4e95bd96d949a4a61f0ce006e">transformImage</a> (QString fileIn, QString fileOut, <a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288">TRANSFORM_CODE</a> transformation)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Apply image transformation on image.  <a href="#c697bfb4e95bd96d949a4a61f0ce006e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#126e11984fb8124e78e3b1b68a24870c">scaleImage</a> (QString fileIn, QString fileOut, int newWidth, int newHeight)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Scale image and save copy to disk.  <a href="#126e11984fb8124e78e3b1b68a24870c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#e13dc53e70744de5d82aaccf48ea5dd6">scaleImage</a> (QString fileIn, QImage &amp;scaledImage, int targetWidth, int targetHeight)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Loaded scaled version of image.  <a href="#e13dc53e70744de5d82aaccf48ea5dd6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#2af7f0a9c4f931ad3213c36796e95288">getImageSize</a> (const char *filename, QSize &amp;size)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get image dimensions.  <a href="#2af7f0a9c4f931ad3213c36796e95288"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#8c935ae57a1aefd1b3506205eb5577a6">getImageSize</a> (const char *filename, int &amp;<a class="el" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>, int &amp;<a class="el" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a>)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get image dimensions.  <a href="#8c935ae57a1aefd1b3506205eb5577a6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#88f4928313fa9ef0e9232f3087189b65">RGBtoL</a> (QRgb *rgb)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">find luminance of a rgb color triplet  <a href="#88f4928313fa9ef0e9232f3087189b65"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#7769c25727d6caedf20321d238b3828d">RGBtoHSV</a> (double r, double g, double <a class="el" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a>, double *h, double *s, double *v)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Convert a RGB color triplet to HSV.  <a href="#7769c25727d6caedf20321d238b3828d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="imageTools_8h.html#a4ea508b635b1a7648bb5834132d4681">HSVtoRGB</a> (double *r, double *g, double *<a class="el" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a>, double h, double s, double v)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Convert a HSV color triplet to RGB.  <a href="#a4ea508b635b1a7648bb5834132d4681"></a><br></td></tr>
</table>
<hr><h2>Enumeration Type Documentation</h2>
<a class="anchor" name="d6b8916a355278afb7cd35f14afc9288"></a><!-- doxytag: member="imageTools.h::TRANSFORM_CODE" ref="d6b8916a355278afb7cd35f14afc9288" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288">TRANSFORM_CODE</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="d6b8916a355278afb7cd35f14afc9288685062467b0c1a3164556335b467c886"></a><!-- doxytag: member="ROTATE_90" ref="d6b8916a355278afb7cd35f14afc9288685062467b0c1a3164556335b467c886" args="" -->ROTATE_90</em>&nbsp;</td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="d6b8916a355278afb7cd35f14afc9288554e734d2a23790b248c5ce39816c18f"></a><!-- doxytag: member="ROTATE_270" ref="d6b8916a355278afb7cd35f14afc9288554e734d2a23790b248c5ce39816c18f" args="" -->ROTATE_270</em>&nbsp;</td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="d6b8916a355278afb7cd35f14afc9288a02c13f8f08154ca2e58c488c922fbe5"></a><!-- doxytag: member="FLIP_H" ref="d6b8916a355278afb7cd35f14afc9288a02c13f8f08154ca2e58c488c922fbe5" args="" -->FLIP_H</em>&nbsp;</td><td>
</td></tr>
<tr><td valign="top"><em><a class="anchor" name="d6b8916a355278afb7cd35f14afc9288127171d15d7e5849705973e163393c71"></a><!-- doxytag: member="FLIP_V" ref="d6b8916a355278afb7cd35f14afc9288127171d15d7e5849705973e163393c71" args="" -->FLIP_V</em>&nbsp;</td><td>
</td></tr>
</table>
</dl>

<p>Definition at line <a class="el" href="imageTools_8h_source.html#l00024">24</a> of file <a class="el" href="imageTools_8h_source.html">imageTools.h</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00025"></a>00025 {
<a name="l00026"></a>00026   <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288685062467b0c1a3164556335b467c886">ROTATE_90</a>,    <span class="comment">//rotate clockwise 90 degrees</span>
<a name="l00027"></a>00027   <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288554e734d2a23790b248c5ce39816c18f">ROTATE_270</a>,  <span class="comment">//rotate counter-clockwise 90 degrees</span>
<a name="l00028"></a>00028   <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288a02c13f8f08154ca2e58c488c922fbe5">FLIP_H</a>,              <span class="comment">//flip left-to-right</span>
<a name="l00029"></a>00029   <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288127171d15d7e5849705973e163393c71">FLIP_V</a>,              <span class="comment">//flip top-to-bottom</span>
<a name="l00030"></a>00030 } <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288">TRANSFORM_CODE</a>;
</pre></div>
<p>

</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="b6483215237a72d6b725adc644d40f0b"></a><!-- doxytag: member="imageTools.h::calcScaledImageDimensions" ref="b6483215237a72d6b725adc644d40f0b" args="(int origWidth, int origHeight, int idealWidth, int idealHeight, int &amp;width, int &amp;height)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void calcScaledImageDimensions           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>origWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>origHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>idealWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>idealHeight</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &amp;&nbsp;</td>
          <td class="paramname"> <em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &amp;&nbsp;</td>
          <td class="paramname"> <em>height</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Computes scale of image dimensions while respecting aspect ratio, equivalent to a QImage::scaleMin without actually scaling any image. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00039">39</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>Referenced by <a class="el" href="albumStatistics_8cpp_source.html#l00031">AlbumStatistics::AlbumStatistics()</a>, <a class="el" href="imageTools_8cpp_source.html#l00069">constructImages()</a>, <a class="el" href="subalbumPreviewWidget_8cpp_source.html#l00259">SubalbumPreviewWidget::createSubalbumPixmap()</a>, <a class="el" href="photoDescEdit_8cpp_source.html#l00047">PhotoDescEdit::PhotoDescEdit()</a>, <a class="el" href="editingInterface_8cpp_source.html#l01052">EditingInterface::rotateSelection()</a>, <a class="el" href="editingInterface_8cpp_source.html#l01117">EditingInterface::selectAspectRatio()</a>, <a class="el" href="subalbum_8cpp_source.html#l00124">Subalbum::setRepresentativeImage()</a>, and <a class="el" href="album_8cpp_source.html#l00186">Album::setRepresentativeImages()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00042"></a>00042 {
<a name="l00043"></a>00043   <span class="comment">//if original dimensions are within ideal new size then use</span>
<a name="l00044"></a>00044   <span class="comment">//original dimensions</span>
<a name="l00045"></a>00045   <span class="keywordflow">if</span>(origWidth &lt;= idealWidth &amp;&amp;
<a name="l00046"></a>00046      origHeight &lt;= idealHeight)
<a name="l00047"></a>00047   {
<a name="l00048"></a>00048     <a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a> = origWidth;
<a name="l00049"></a>00049     <a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a> = origHeight;
<a name="l00050"></a>00050     <span class="keywordflow">return</span>;
<a name="l00051"></a>00051   }
<a name="l00052"></a>00052 
<a name="l00053"></a>00053   <span class="comment">//else find dimension which is way over bounds</span>
<a name="l00054"></a>00054   <span class="keywordtype">float</span> widthRatio = ((float)idealWidth) / ((float)origWidth);
<a name="l00055"></a>00055   <span class="keywordtype">float</span> heightRatio = ((float)idealHeight) / ((float)origHeight);
<a name="l00056"></a>00056 
<a name="l00057"></a>00057   <span class="keywordflow">if</span>(widthRatio &lt; heightRatio)
<a name="l00058"></a>00058   {
<a name="l00059"></a>00059     <a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a> = idealWidth;
<a name="l00060"></a>00060     <a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a> = (int)((((<span class="keywordtype">float</span>)idealWidth) / ((<span class="keywordtype">float</span>)origWidth)) * ((float)origHeight));
<a name="l00061"></a>00061   }
<a name="l00062"></a>00062   <span class="keywordflow">else</span>
<a name="l00063"></a>00063   {
<a name="l00064"></a>00064     <a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a> = idealHeight;
<a name="l00065"></a>00065     <a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a> = (int)((((<span class="keywordtype">float</span>)idealHeight) / ((<span class="keywordtype">float</span>)origHeight)) * ((float)origWidth));
<a name="l00066"></a>00066   }
<a name="l00067"></a>00067 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="136ce4737ac4d5dfa526d752ab8aab33"></a><!-- doxytag: member="imageTools.h::constructImages" ref="136ce4737ac4d5dfa526d752ab8aab33" args="(QString imageName, QImage &amp;slideshowImage, QImage &amp;thumbnailImage)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void constructImages           </td>
          <td>(</td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>imageName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QImage &amp;&nbsp;</td>
          <td class="paramname"> <em>slideshowImage</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QImage &amp;&nbsp;</td>
          <td class="paramname"> <em>thumbnailImage</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Constructs slideshow and thumbnail images for a full sized image. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00069">69</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="imageTools_8cpp_source.html#l00039">calcScaledImageDimensions()</a>, <a class="el" href="imageTools_8cpp_source.html#l00192">getImageSize()</a>, <a class="el" href="imageTools_8cpp_source.html#l00157">scaleImage()</a>, <a class="el" href="config_8h_source.html#l00027">SLIDESHOW_HEIGHT</a>, <a class="el" href="config_8h_source.html#l00026">SLIDESHOW_WIDTH</a>, <a class="el" href="config_8h_source.html#l00025">THUMBNAIL_HEIGHT</a>, and <a class="el" href="config_8h_source.html#l00024">THUMBNAIL_WIDTH</a>.</p>

<p>Referenced by <a class="el" href="photo_8cpp_source.html#l00084">Photo::constructSmallerImages()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00071"></a>00071 {
<a name="l00072"></a>00072   <span class="comment">//---------------------------------------------------------</span>
<a name="l00073"></a>00073   <span class="comment">//obtain original image width and height</span>
<a name="l00074"></a>00074   <span class="keywordtype">int</span> origWidth, origHeight;
<a name="l00075"></a>00075   <a class="code" href="imageTools_8cpp.html#2af7f0a9c4f931ad3213c36796e95288" title="Get image dimensions.">getImageSize</a>( imageName, origWidth, origHeight );
<a name="l00076"></a>00076   
<a name="l00077"></a>00077   <span class="comment">//compute dimensions of unhapped scaled thumbnail and slideshow images</span>
<a name="l00078"></a>00078   <span class="keywordtype">int</span> thumbWidth, thumbHeight;
<a name="l00079"></a>00079   <a class="code" href="imageTools_8cpp.html#b6483215237a72d6b725adc644d40f0b" title="Computes scale of image dimensions while respecting aspect ratio, equivalent to a...">calcScaledImageDimensions</a>( origWidth, origHeight,
<a name="l00080"></a>00080                              <a class="code" href="config_8h.html#f562473223519f4a32c8b5428c19c71e">THUMBNAIL_WIDTH</a>, <a class="code" href="config_8h.html#9a75757764d4f913469df0670d255050">THUMBNAIL_HEIGHT</a>,
<a name="l00081"></a>00081                              thumbWidth, thumbHeight);
<a name="l00082"></a>00082   
<a name="l00083"></a>00083   <span class="keywordtype">int</span> slideWidth, slideHeight;
<a name="l00084"></a>00084   <a class="code" href="imageTools_8cpp.html#b6483215237a72d6b725adc644d40f0b" title="Computes scale of image dimensions while respecting aspect ratio, equivalent to a...">calcScaledImageDimensions</a>( origWidth, origHeight,
<a name="l00085"></a>00085                              <a class="code" href="config_8h.html#8834487e104b50fd93c1b837e31e7943">SLIDESHOW_WIDTH</a>, <a class="code" href="config_8h.html#b36d1daa336bc70618efadf1fd9deff0">SLIDESHOW_HEIGHT</a>,
<a name="l00086"></a>00086                              slideWidth, slideHeight);
<a name="l00087"></a>00087   <span class="comment">//---------------------------------------------------------</span>
<a name="l00088"></a>00088   <span class="comment">//create slide show image</span>
<a name="l00089"></a>00089   
<a name="l00090"></a>00090   <span class="comment">//first scale full image to unpadded dimensions</span>
<a name="l00091"></a>00091   QImage temp;
<a name="l00092"></a>00092   <a class="code" href="imageTools_8cpp.html#126e11984fb8124e78e3b1b68a24870c" title="Scale image and save copy to disk.">scaleImage</a>( imageName, temp, slideWidth, slideHeight );
<a name="l00093"></a>00093   slideWidth = temp.width();
<a name="l00094"></a>00094   slideHeight = temp.height();
<a name="l00095"></a>00095  
<a name="l00096"></a>00096   <span class="comment">//create slideshow image and fill with white</span>
<a name="l00097"></a>00097   slideshowImage.create( <a class="code" href="config_8h.html#8834487e104b50fd93c1b837e31e7943">SLIDESHOW_WIDTH</a>, <a class="code" href="config_8h.html#b36d1daa336bc70618efadf1fd9deff0">SLIDESHOW_HEIGHT</a>, 32 );
<a name="l00098"></a>00098   slideshowImage.fill( Qt::white.rgb() );
<a name="l00099"></a>00099   
<a name="l00100"></a>00100   <span class="comment">//paint unpadded scaled image</span>
<a name="l00101"></a>00101   <span class="keywordtype">int</span> xDiff = <a class="code" href="config_8h.html#8834487e104b50fd93c1b837e31e7943">SLIDESHOW_WIDTH</a> - slideWidth;
<a name="l00102"></a>00102   <span class="keywordtype">int</span> yDiff = <a class="code" href="config_8h.html#b36d1daa336bc70618efadf1fd9deff0">SLIDESHOW_HEIGHT</a> - slideHeight;
<a name="l00103"></a>00103   bitBlt( &amp;slideshowImage, xDiff/2, yDiff/2,
<a name="l00104"></a>00104           &amp;temp, 0, 0, slideWidth, slideHeight );
<a name="l00105"></a>00105    
<a name="l00106"></a>00106   <span class="comment">//---------------------------------------------------------</span>
<a name="l00107"></a>00107   <span class="comment">//create thumnail image</span>
<a name="l00108"></a>00108   <a class="code" href="imageTools_8cpp.html#126e11984fb8124e78e3b1b68a24870c" title="Scale image and save copy to disk.">scaleImage</a>( imageName, thumbnailImage, thumbWidth, thumbHeight );
<a name="l00109"></a>00109   <span class="comment">//---------------------------------------------------------</span>
<a name="l00110"></a>00110 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="8c935ae57a1aefd1b3506205eb5577a6"></a><!-- doxytag: member="imageTools.h::getImageSize" ref="8c935ae57a1aefd1b3506205eb5577a6" args="(const char *filename, int &amp;width, int &amp;height)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool getImageSize           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &amp;&nbsp;</td>
          <td class="paramname"> <em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int &amp;&nbsp;</td>
          <td class="paramname"> <em>height</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get image dimensions. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00201">201</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="jpegSize_8cpp_source.html#l00065">getJPEGSize()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00202"></a>00202 {
<a name="l00203"></a>00203   <span class="comment">//if file is jpeg use faster method</span>
<a name="l00204"></a>00204   QString extension = QFileInfo(filename).extension(<span class="keyword">false</span>).lower();
<a name="l00205"></a>00205   <span class="keywordflow">if</span>( extension.compare(<span class="stringliteral">"jpeg"</span>) == 0 ||
<a name="l00206"></a>00206       extension.compare(<span class="stringliteral">"jpg"</span>) == 0 )
<a name="l00207"></a>00207     <span class="keywordflow">return</span> <a class="code" href="jpegSize_8cpp.html#15dc90155bd20ad6b903b548af5690ae">getJPEGSize</a>( QFile::encodeName(filename),
<a name="l00208"></a>00208                         <a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a>, <a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a> );
<a name="l00209"></a>00209 
<a name="l00210"></a>00210   <span class="comment">//load entire image to qimage object in order to determine size</span>
<a name="l00211"></a>00211   QImage image(filename);
<a name="l00212"></a>00212   <a class="code" href="blur_8cpp.html#2474a5474cbff19523a51eb1de01cda4">width</a> = image.width();
<a name="l00213"></a>00213   <a class="code" href="blur_8cpp.html#d12fc34ce789bce6c8a05d8a17138534">height</a> = image.height();
<a name="l00214"></a>00214   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00215"></a>00215 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="2af7f0a9c4f931ad3213c36796e95288"></a><!-- doxytag: member="imageTools.h::getImageSize" ref="2af7f0a9c4f931ad3213c36796e95288" args="(const char *filename, QSize &amp;size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool getImageSize           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QSize &amp;&nbsp;</td>
          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Get image dimensions. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00192">192</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="imageTools_8cpp_source.html#l00192">getImageSize()</a>.</p>

<p>Referenced by <a class="el" href="mosaicOptionsDialog_8cpp_source.html#l00219">MosaicOptionsDialog::appendImagesInPath()</a>, <a class="el" href="editingInterface_8cpp_source.html#l00853">EditingInterface::applyImageUpdate()</a>, <a class="el" href="imageTools_8cpp_source.html#l00069">constructImages()</a>, <a class="el" href="mosaic_8cpp_source.html#l00413">constructImageTiles()</a>, <a class="el" href="imageTools_8cpp_source.html#l00192">getImageSize()</a>, <a class="el" href="grainEditor_8cpp_source.html#l00036">GrainEditor::GrainEditor()</a>, <a class="el" href="histogramInterface_8cpp_source.html#l00036">HistogramInterface::HistogramInterface()</a>, <a class="el" href="photoDescEdit_8cpp_source.html#l00047">PhotoDescEdit::PhotoDescEdit()</a>, <a class="el" href="editingInterface_8cpp_source.html#l01003">EditingInterface::revertCurrentPhoto()</a>, <a class="el" href="editingInterface_8cpp_source.html#l00567">EditingInterface::rotateFlip()</a>, <a class="el" href="addPhotosDialog_8cpp_source.html#l00094">GeneratePreviewThread::run()</a>, <a class="el" href="scaledPreviewInterface_8cpp_source.html#l00019">ScaledPreviewInterface::ScaledPreviewInterface()</a>, <a class="el" href="selectionPlacementInterface_8cpp_source.html#l00022">SelectionPlacementInterface::SelectionPlacementInterface()</a>, <a class="el" href="selectionInterface_8cpp_source.html#l00075">SelectionInterface::setPhoto()</a>, <a class="el" href="editingInterface_8cpp_source.html#l00432">EditingInterface::setPhoto()</a>, <a class="el" href="subalbum_8cpp_source.html#l00124">Subalbum::setRepresentativeImage()</a>, <a class="el" href="album_8cpp_source.html#l00186">Album::setRepresentativeImages()</a>, <a class="el" href="wallpaperTools_8cpp_source.html#l00034">setWallpaper()</a>, and <a class="el" href="editingInterface_8cpp_source.html#l00503">EditingInterface::showNextPrevFirstLastPhoto()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00193"></a>00193 {
<a name="l00194"></a>00194   <span class="keywordtype">int</span> w,h;
<a name="l00195"></a>00195   <span class="keywordtype">bool</span> result = <a class="code" href="imageTools_8cpp.html#2af7f0a9c4f931ad3213c36796e95288" title="Get image dimensions.">getImageSize</a>( filename, w, h );
<a name="l00196"></a>00196   size.setWidth( w );
<a name="l00197"></a>00197   size.setHeight( h );
<a name="l00198"></a>00198   <span class="keywordflow">return</span> result;
<a name="l00199"></a>00199 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="a4ea508b635b1a7648bb5834132d4681"></a><!-- doxytag: member="imageTools.h::HSVtoRGB" ref="a4ea508b635b1a7648bb5834132d4681" args="(double *r, double *g, double *b, double h, double s, double v)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HSVtoRGB           </td>
          <td>(</td>
          <td class="paramtype">double *&nbsp;</td>
          <td class="paramname"> <em>r</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&nbsp;</td>
          <td class="paramname"> <em>g</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&nbsp;</td>
          <td class="paramname"> <em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>h</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>v</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Convert a HSV color triplet to RGB. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00264">264</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="blur_8cpp_source.html#l00078">q</a>.</p>

<p>Referenced by <a class="el" href="histogramEditor_8cpp_source.html#l00295">HistogramEditor::adjustImage()</a>, <a class="el" href="selectionInterface_8cpp_source.html#l00117">SelectionInterface::constructDisplayImages()</a>, <a class="el" href="emboss_8cpp_source.html#l00082">embossEffect()</a>, <a class="el" href="contrast_8cpp_source.html#l00105">enhanceImageContrast()</a>, <a class="el" href="selectionPlacementInterface_8cpp_source.html#l00022">SelectionPlacementInterface::SelectionPlacementInterface()</a>, and <a class="el" href="sharpen_8cpp_source.html#l00092">sharpenImage()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00266"></a>00266 {
<a name="l00267"></a>00267         <span class="keywordtype">int</span> i;
<a name="l00268"></a>00268         <span class="keywordtype">double</span> f, p, <a class="code" href="blur_8cpp.html#0a19a0620af7373e3ddba0ce4e1058e1">q</a>, t;
<a name="l00269"></a>00269   
<a name="l00270"></a>00270         <span class="keywordflow">if</span>( s == 0 ) {
<a name="l00271"></a>00271                 <span class="comment">// achromatic (grey)</span>
<a name="l00272"></a>00272                 *r = *g = *<a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = v;
<a name="l00273"></a>00273                 <span class="keywordflow">return</span>;
<a name="l00274"></a>00274         }
<a name="l00275"></a>00275   
<a name="l00276"></a>00276         h /= 60;                        <span class="comment">// sector 0 to 5</span>
<a name="l00277"></a>00277         i = (int)floor( h );
<a name="l00278"></a>00278         f = h - i;                      <span class="comment">// factorial part of h</span>
<a name="l00279"></a>00279         p = v * ( 1 - s );
<a name="l00280"></a>00280         q = v * ( 1 - s * f );
<a name="l00281"></a>00281         t = v * ( 1 - s * ( 1 - f ) );
<a name="l00282"></a>00282   
<a name="l00283"></a>00283         <span class="keywordflow">switch</span>( i ) {
<a name="l00284"></a>00284                 <span class="keywordflow">case</span> 0:
<a name="l00285"></a>00285                         *r = v;
<a name="l00286"></a>00286                         *g = t;
<a name="l00287"></a>00287                         *<a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = p;
<a name="l00288"></a>00288                         <span class="keywordflow">break</span>;
<a name="l00289"></a>00289                 <span class="keywordflow">case</span> 1:
<a name="l00290"></a>00290                         *r = q;
<a name="l00291"></a>00291                         *g = v;
<a name="l00292"></a>00292                         *<a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = p;
<a name="l00293"></a>00293                         <span class="keywordflow">break</span>;
<a name="l00294"></a>00294                 <span class="keywordflow">case</span> 2:
<a name="l00295"></a>00295                         *r = p;
<a name="l00296"></a>00296                         *g = v;
<a name="l00297"></a>00297                         *<a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = t;
<a name="l00298"></a>00298                         <span class="keywordflow">break</span>;
<a name="l00299"></a>00299                 <span class="keywordflow">case</span> 3:
<a name="l00300"></a>00300                         *r = p;
<a name="l00301"></a>00301                         *g = q;
<a name="l00302"></a>00302                         *<a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = v;
<a name="l00303"></a>00303                         <span class="keywordflow">break</span>;
<a name="l00304"></a>00304                 <span class="keywordflow">case</span> 4:
<a name="l00305"></a>00305                         *r = t;
<a name="l00306"></a>00306                         *g = p;
<a name="l00307"></a>00307                         *<a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = v;
<a name="l00308"></a>00308                         <span class="keywordflow">break</span>;
<a name="l00309"></a>00309                 <span class="keywordflow">default</span>:                <span class="comment">// case 5:</span>
<a name="l00310"></a>00310                         *r = v;
<a name="l00311"></a>00311                         *g = p;
<a name="l00312"></a>00312                         *<a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = q;
<a name="l00313"></a>00313                         <span class="keywordflow">break</span>;
<a name="l00314"></a>00314         }  
<a name="l00315"></a>00315 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="f483fb1d0e6d890227ff2fecd321aad2"></a><!-- doxytag: member="imageTools.h::isJpeg" ref="f483fb1d0e6d890227ff2fecd321aad2" args="(const char *filename)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool isJpeg           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>filename</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Checks to see if an image is a valid jpg by seeing if the image dimensions can be read. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00033">33</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="jpegSize_8cpp_source.html#l00065">getJPEGSize()</a>.</p>

<p>Referenced by <a class="el" href="photo_8cpp_source.html#l00123">Photo::setImage()</a>, and <a class="el" href="imageTools_8cpp_source.html#l00112">transformImage()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00034"></a>00034 {
<a name="l00035"></a>00035   <span class="keywordtype">int</span> w,h;
<a name="l00036"></a>00036   <span class="keywordflow">return</span> <a class="code" href="jpegSize_8cpp.html#15dc90155bd20ad6b903b548af5690ae">getJPEGSize</a>( QFile::encodeName(filename), w, h );
<a name="l00037"></a>00037 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="7769c25727d6caedf20321d238b3828d"></a><!-- doxytag: member="imageTools.h::RGBtoHSV" ref="7769c25727d6caedf20321d238b3828d" args="(double r, double g, double b, double *h, double *s, double *v)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void RGBtoHSV           </td>
          <td>(</td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>r</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>g</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&nbsp;</td>
          <td class="paramname"> <em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&nbsp;</td>
          <td class="paramname"> <em>h</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&nbsp;</td>
          <td class="paramname"> <em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double *&nbsp;</td>
          <td class="paramname"> <em>v</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Convert a RGB color triplet to HSV. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00231">231</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>Referenced by <a class="el" href="histogramEditor_8cpp_source.html#l00295">HistogramEditor::adjustImage()</a>, <a class="el" href="selectionInterface_8cpp_source.html#l00117">SelectionInterface::constructDisplayImages()</a>, <a class="el" href="emboss_8cpp_source.html#l00082">embossEffect()</a>, <a class="el" href="contrast_8cpp_source.html#l00105">enhanceImageContrast()</a>, <a class="el" href="imageTools_8cpp_source.html#l00217">RGBtoL()</a>, <a class="el" href="selectionPlacementInterface_8cpp_source.html#l00022">SelectionPlacementInterface::SelectionPlacementInterface()</a>, and <a class="el" href="sharpen_8cpp_source.html#l00092">sharpenImage()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00233"></a>00233 {
<a name="l00234"></a>00234         <span class="keywordtype">double</span> min, max, delta;
<a name="l00235"></a>00235   
<a name="l00236"></a>00236         min = QMIN(QMIN( r, g), <a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> );
<a name="l00237"></a>00237         max = QMAX(QMAX( r, g), <a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> );
<a name="l00238"></a>00238         *v = max;                               <span class="comment">// v</span>
<a name="l00239"></a>00239   
<a name="l00240"></a>00240         delta = max - min;
<a name="l00241"></a>00241   
<a name="l00242"></a>00242         <span class="keywordflow">if</span>( max != 0 )
<a name="l00243"></a>00243                 *s = delta / max;               <span class="comment">// s</span>
<a name="l00244"></a>00244         <span class="keywordflow">else</span> {
<a name="l00245"></a>00245                 <span class="comment">// r = g = b = 0                // s = 0, v is undefined</span>
<a name="l00246"></a>00246                 *s = 0;
<a name="l00247"></a>00247                 *h = -1;
<a name="l00248"></a>00248                 <span class="keywordflow">return</span>;
<a name="l00249"></a>00249         }
<a name="l00250"></a>00250   
<a name="l00251"></a>00251         <span class="keywordflow">if</span>( r == max )
<a name="l00252"></a>00252                 *h = ( g - <a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> ) / delta;         <span class="comment">// between yellow &amp; magenta</span>
<a name="l00253"></a>00253         <span class="keywordflow">else</span> <span class="keywordflow">if</span>( g == max )
<a name="l00254"></a>00254                 *h = 2 + ( <a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> - r ) / delta;     <span class="comment">// between cyan &amp; yellow</span>
<a name="l00255"></a>00255         <span class="keywordflow">else</span>
<a name="l00256"></a>00256                 *h = 4 + ( r - g ) / delta;     <span class="comment">// between magenta &amp; cyan</span>
<a name="l00257"></a>00257   
<a name="l00258"></a>00258         *h *= 60;                               <span class="comment">// degrees</span>
<a name="l00259"></a>00259         <span class="keywordflow">if</span>( *h &lt; 0 )
<a name="l00260"></a>00260                 *h += 360;
<a name="l00261"></a>00261   
<a name="l00262"></a>00262 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="88f4928313fa9ef0e9232f3087189b65"></a><!-- doxytag: member="imageTools.h::RGBtoL" ref="88f4928313fa9ef0e9232f3087189b65" args="(QRgb *rgb)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double RGBtoL           </td>
          <td>(</td>
          <td class="paramtype">QRgb *&nbsp;</td>
          <td class="paramname"> <em>rgb</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
find luminance of a rgb color triplet 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00217">217</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="jpegInternal_8h_source.html#l00125">b</a>, and <a class="el" href="imageTools_8cpp_source.html#l00231">RGBtoHSV()</a>.</p>

<p>Referenced by <a class="el" href="contrast_8cpp_source.html#l00105">enhanceImageContrast()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00218"></a>00218 {
<a name="l00219"></a>00219   <span class="keywordtype">double</span> r = ((double)qRed(*rgb)   )/255.0;
<a name="l00220"></a>00220   <span class="keywordtype">double</span> g = ((double)qGreen(*rgb) )/255.0;
<a name="l00221"></a>00221   <span class="keywordtype">double</span> <a class="code" href="jpegInternal_8h.html#f320905358fa78701e4cc60b6135601f">b</a> = ((double)qBlue(*rgb)  )/255.0;
<a name="l00222"></a>00222 
<a name="l00223"></a>00223   <span class="keywordtype">double</span> h,s,v;
<a name="l00224"></a>00224   <a class="code" href="imageTools_8cpp.html#7769c25727d6caedf20321d238b3828d" title="Convert a RGB color triplet to HSV.">RGBtoHSV</a>(r,g,b,&amp;h,&amp;s,&amp;v);
<a name="l00225"></a>00225   <span class="keywordflow">return</span> 255.0*v;
<a name="l00226"></a>00226 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="e13dc53e70744de5d82aaccf48ea5dd6"></a><!-- doxytag: member="imageTools.h::scaleImage" ref="e13dc53e70744de5d82aaccf48ea5dd6" args="(QString fileIn, QImage &amp;scaledImage, int targetWidth, int targetHeight)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool scaleImage           </td>
          <td>(</td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>fileIn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QImage &amp;&nbsp;</td>
          <td class="paramname"> <em>scaledImage</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>targetWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>targetHeight</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Loaded scaled version of image. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00171">171</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="jpegTools_8cpp_source.html#l00054">scaleJPEG()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00172"></a>00172 {
<a name="l00173"></a>00173   <span class="comment">//if file is jpeg use faster method</span>
<a name="l00174"></a>00174   QString extension = QFileInfo(fileIn).extension(<span class="keyword">false</span>).lower();
<a name="l00175"></a>00175   <span class="keywordflow">if</span>( extension.compare(<span class="stringliteral">"jpeg"</span>) == 0 ||
<a name="l00176"></a>00176       extension.compare(<span class="stringliteral">"jpg"</span>) == 0 )
<a name="l00177"></a>00177     <span class="keywordflow">return</span> <a class="code" href="jpegTools_8cpp.html#36feb9ccaed70cf0eb75ebdc6b21e42b">scaleJPEG</a>( QFile::encodeName(fileIn), scaledImage, targetWidth, targetHeight );
<a name="l00178"></a>00178   
<a name="l00179"></a>00179   <span class="comment">//use slow smooth-scale method for scaling image.</span>
<a name="l00180"></a>00180   <span class="comment">//clamp scaling to &lt;= 2x</span>
<a name="l00181"></a>00181   QImage orig(fileIn);  
<a name="l00182"></a>00182   <span class="keywordflow">if</span>(QMIN( ((<span class="keywordtype">float</span>)targetWidth)/orig.width(), ((float)targetHeight)/orig.height() ) &gt; 2)    
<a name="l00183"></a>00183   {
<a name="l00184"></a>00184     targetWidth = 2*orig.width();
<a name="l00185"></a>00185     targetHeight = 2*orig.height();
<a name="l00186"></a>00186   }
<a name="l00187"></a>00187   
<a name="l00188"></a>00188   scaledImage = orig.smoothScale( targetWidth, targetHeight, QImage::ScaleMin );
<a name="l00189"></a>00189   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00190"></a>00190 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="126e11984fb8124e78e3b1b68a24870c"></a><!-- doxytag: member="imageTools.h::scaleImage" ref="126e11984fb8124e78e3b1b68a24870c" args="(QString fileIn, QString fileOut, int newWidth, int newHeight)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool scaleImage           </td>
          <td>(</td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>fileIn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>fileOut</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>newWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>newHeight</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Scale image and save copy to disk. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00157">157</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="imageTools_8cpp_source.html#l00157">scaleImage()</a>.</p>

<p>Referenced by <a class="el" href="editingInterface_8cpp_source.html#l00853">EditingInterface::applyImageUpdate()</a>, <a class="el" href="recentAlbumMenuItem_8cpp_source.html#l00028">RecentAlbumMenuItem::changeItem()</a>, <a class="el" href="imageTools_8cpp_source.html#l00069">constructImages()</a>, <a class="el" href="mosaic_8cpp_source.html#l00413">constructImageTiles()</a>, <a class="el" href="grainEditor_8cpp_source.html#l00036">GrainEditor::GrainEditor()</a>, <a class="el" href="histogramInterface_8cpp_source.html#l00036">HistogramInterface::HistogramInterface()</a>, <a class="el" href="presentationWidget_8cpp_source.html#l00389">SlideshowWidget::loadPhoto()</a>, <a class="el" href="titleWidget_8cpp_source.html#l01435">TitleWidget::refreshOpenRecentMenu()</a>, <a class="el" href="editingInterface_8cpp_source.html#l01003">EditingInterface::revertCurrentPhoto()</a>, <a class="el" href="editingInterface_8cpp_source.html#l00567">EditingInterface::rotateFlip()</a>, <a class="el" href="addPhotosDialog_8cpp_source.html#l00094">GeneratePreviewThread::run()</a>, <a class="el" href="scaledPreviewInterface_8cpp_source.html#l00019">ScaledPreviewInterface::ScaledPreviewInterface()</a>, <a class="el" href="imageTools_8cpp_source.html#l00157">scaleImage()</a>, <a class="el" href="selectionPlacementInterface_8cpp_source.html#l00022">SelectionPlacementInterface::SelectionPlacementInterface()</a>, <a class="el" href="selectionInterface_8cpp_source.html#l00075">SelectionInterface::setPhoto()</a>, <a class="el" href="editingInterface_8cpp_source.html#l00432">EditingInterface::setPhoto()</a>, <a class="el" href="subalbum_8cpp_source.html#l00124">Subalbum::setRepresentativeImage()</a>, <a class="el" href="album_8cpp_source.html#l00186">Album::setRepresentativeImages()</a>, <a class="el" href="wallpaperTools_8cpp_source.html#l00034">setWallpaper()</a>, and <a class="el" href="editingInterface_8cpp_source.html#l00503">EditingInterface::showNextPrevFirstLastPhoto()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00159"></a>00159 {
<a name="l00160"></a>00160   <span class="comment">//scale image</span>
<a name="l00161"></a>00161   QImage scaledImage;
<a name="l00162"></a>00162   <span class="keywordflow">if</span>( <a class="code" href="imageTools_8cpp.html#126e11984fb8124e78e3b1b68a24870c" title="Scale image and save copy to disk.">scaleImage</a>(fileIn, scaledImage, newWidth, newHeight ) )
<a name="l00163"></a>00163   {
<a name="l00164"></a>00164     scaledImage.save( fileOut, <span class="stringliteral">"JPEG"</span>, 95 );
<a name="l00165"></a>00165     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00166"></a>00166   }
<a name="l00167"></a>00167   <span class="keywordflow">else</span>
<a name="l00168"></a>00168     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00169"></a>00169 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="c697bfb4e95bd96d949a4a61f0ce006e"></a><!-- doxytag: member="imageTools.h::transformImage" ref="c697bfb4e95bd96d949a4a61f0ce006e" args="(QString fileIn, QString fileOut, TRANSFORM_CODE transformation)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool transformImage           </td>
          <td>(</td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>fileIn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QString&nbsp;</td>
          <td class="paramname"> <em>fileOut</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288">TRANSFORM_CODE</a>&nbsp;</td>
          <td class="paramname"> <em>transformation</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Apply image transformation on image. 
<p>

<p>Definition at line <a class="el" href="imageTools_8cpp_source.html#l00112">112</a> of file <a class="el" href="imageTools_8cpp_source.html">imageTools.cpp</a>.</p>

<p>References <a class="el" href="imageTools_8h_source.html#l00028">FLIP_H</a>, <a class="el" href="imageTools_8cpp_source.html#l00033">isJpeg()</a>, <a class="el" href="imageTools_8h_source.html#l00027">ROTATE_270</a>, <a class="el" href="imageTools_8h_source.html#l00026">ROTATE_90</a>, and <a class="el" href="jpegTools_8cpp_source.html#l00178">transformJPEG()</a>.</p>

<p>Referenced by <a class="el" href="photo_8cpp_source.html#l00475">Photo::applyTransformation()</a>, and <a class="el" href="editingInterface_8cpp_source.html#l00567">EditingInterface::rotateFlip()</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00113"></a>00113 {
<a name="l00114"></a>00114   <span class="comment">//if file is jpeg use faster method</span>
<a name="l00115"></a>00115   <span class="keywordflow">if</span>( <a class="code" href="imageTools_8cpp.html#f483fb1d0e6d890227ff2fecd321aad2" title="Checks to see if an image is a valid jpg by seeing if the image dimensions can be...">isJpeg</a>(fileIn) )
<a name="l00116"></a>00116     <span class="keywordflow">return</span> <a class="code" href="jpegTools_8cpp.html#fcce9106838e2c1f2ef66e18c8e4e160">transformJPEG</a>( fileIn, fileOut, transformation );
<a name="l00117"></a>00117   
<a name="l00118"></a>00118   <span class="comment">//load image</span>
<a name="l00119"></a>00119   QImage origImage(fileIn);
<a name="l00120"></a>00120   QImage transformedImage;
<a name="l00121"></a>00121   
<a name="l00122"></a>00122   <span class="comment">//transform image</span>
<a name="l00123"></a>00123   <span class="keywordflow">if</span>(transformation == <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288685062467b0c1a3164556335b467c886">ROTATE_90</a>)
<a name="l00124"></a>00124   {
<a name="l00125"></a>00125     <span class="keywordflow">if</span>(!transformedImage.create( origImage.height(), origImage.width(), origImage.depth() ) )
<a name="l00126"></a>00126       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00127"></a>00127     
<a name="l00128"></a>00128     <span class="keywordtype">int</span> x,y;
<a name="l00129"></a>00129     <span class="keywordflow">for</span>(x=0; x &lt; origImage.height(); x++)
<a name="l00130"></a>00130     {
<a name="l00131"></a>00131       <span class="keywordflow">for</span>(y=0; y &lt; origImage.width(); y++)
<a name="l00132"></a>00132         transformedImage.setPixel(origImage.height() - 1 - x, y, origImage.pixel(y, x) );
<a name="l00133"></a>00133     }
<a name="l00134"></a>00134   }
<a name="l00135"></a>00135   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(transformation == <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288554e734d2a23790b248c5ce39816c18f">ROTATE_270</a>)
<a name="l00136"></a>00136   {
<a name="l00137"></a>00137     <span class="keywordflow">if</span>(!transformedImage.create( origImage.height(), origImage.width(), origImage.depth() ) )
<a name="l00138"></a>00138       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00139"></a>00139     
<a name="l00140"></a>00140     <span class="keywordtype">int</span> x,y;
<a name="l00141"></a>00141     <span class="keywordflow">for</span>(x=0; x &lt; origImage.height(); x++)
<a name="l00142"></a>00142     {
<a name="l00143"></a>00143       <span class="keywordflow">for</span>(y=0; y &lt; origImage.width(); y++)
<a name="l00144"></a>00144           transformedImage.setPixel(x, origImage.width() - 1 - y, origImage.pixel(y, x) );
<a name="l00145"></a>00145     }
<a name="l00146"></a>00146   }
<a name="l00147"></a>00147   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(transformation == <a class="code" href="imageTools_8h.html#d6b8916a355278afb7cd35f14afc9288a02c13f8f08154ca2e58c488c922fbe5">FLIP_H</a>)
<a name="l00148"></a>00148   {  transformedImage = origImage.mirror(<span class="keyword">false</span>,<span class="keyword">true</span>); }
<a name="l00149"></a>00149   <span class="keywordflow">else</span>
<a name="l00150"></a>00150   {  transformedImage = origImage.mirror(<span class="keyword">true</span>,<span class="keyword">false</span>); }
<a name="l00151"></a>00151   
<a name="l00152"></a>00152   <span class="comment">//save out transformed image  </span>
<a name="l00153"></a>00153   transformedImage.save( fileOut, <span class="stringliteral">"JPEG"</span>, 95 );
<a name="l00154"></a>00154   <span class="keywordflow">return</span> <span class="keyword">true</span>;  
<a name="l00155"></a>00155 }
</pre></div>
<p>

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