[KimDaBa] patch to treat angles consistently

Robert L Krawitz rlk at alum.mit.edu
Thu Sep 23 20:49:31 CEST 2004


The following patch against the current snapshot treats equal angles
consistently.  The specific change in behavior is to normalize all
angles to the range (0,359); this way rotations of -90 and 270 degrees
become equal.

diff -ru kimdaba-2004-09-11-noi18n/kimdaba/imageinfo.cpp kimdaba-2004-09-11-noi18.new/kimdaba/imageinfo.cpp
--- kimdaba-2004-09-11-noi18n/kimdaba/imageinfo.cpp	2004-09-04 15:05:47.000000000 -0400
+++ kimdaba-2004-09-11-noi18.new/kimdaba/imageinfo.cpp	2004-09-11 08:40:20.000000000 -0400
@@ -485,7 +485,7 @@
             else if ( orientation == 3 || orientation == 4 )
                 _angle = 180;
             else if ( orientation == 5 || orientation == 8 )
-                _angle = -90;
+                _angle = 270;
             else if ( orientation == 6 || orientation == 7 )
                 _angle = 90;
         }
diff -ru kimdaba-2004-09-11-noi18n/kimdaba/util.cpp kimdaba-2004-09-11-noi18.new/kimdaba/util.cpp
--- kimdaba-2004-09-11-noi18n/kimdaba/util.cpp	2004-09-04 15:05:47.000000000 -0400
+++ kimdaba-2004-09-11-noi18.new/kimdaba/util.cpp	2004-09-11 08:46:40.000000000 -0400
@@ -346,6 +346,9 @@
 
 QString Util::getThumbnailFile( const QString& imageFile, int width, int height, int angle ) {
     QFileInfo info( imageFile );
+    while (angle < 0)
+      angle += 360;
+    angle %= 360;
     return info.dirPath() + QString::fromLatin1("/ThumbNails")+
            QString::fromLatin1("/%1x%2-%3-%4")
                                 .arg(width)

-- 
Robert Krawitz                                     <rlk at alum.mit.edu>

Tall Clubs International  --  http://www.tall.org/ or 1-888-IM-TALL-2
Member of the League for Programming Freedom -- mail lpf at uunet.uu.net
Project lead for Gimp Print   --    http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton



More information about the KimDaBa mailing list