Enlightenment CVS committal

Author  : atmosphere
Project : e17
Module  : libs/esmart

Dir     : e17/libs/esmart/src/lib/esmart_thumb


Modified Files:
        esmart_thumb.c 


Log Message:
auto orient thumbnails when exif is present
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_thumb/esmart_thumb.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- esmart_thumb.c      12 Jul 2004 04:18:09 -0000      1.3
+++ esmart_thumb.c      10 Oct 2004 00:23:15 -0000      1.4
@@ -31,6 +31,7 @@
 {
   char buf[PATH_MAX];
   Evas_Object *result = NULL;
+  Epsilon_Info *ei = NULL;
   if (file)
     {
       Esmart_Thumb *e = NULL;
@@ -67,9 +68,48 @@
                  esmart_thumb_free (result);
                  result = NULL;
                }
+             else if ((ei = epsilon_info_get (e->e)))
+               {
+                 Imlib_Image im = NULL;
+                 if ((im = imlib_load_image (epsilon_thumb_file_get (e->e))))
+                   {
+                     imlib_context_set_image (im);
+                     if (epsilon_info_exif_get (ei))
+                       {
+                         switch (epsilon_info_exif_props_as_int_get
+                                 (ei, 0x0112))
+                           {
+                           case 3:
+                             imlib_image_orientate (2);
+                           case 6:
+                             imlib_image_orientate (1);
+                           case 8:
+                             imlib_image_orientate (3);
+                           default:
+                             break;
+                           }
+                       }
+                     e->tw = imlib_image_get_width ();
+                     e->th = imlib_image_get_height ();
+                     evas_object_image_size_set (e->image, (int) e->tw,
+                                                 (int) e->th);
+                     evas_object_image_fill_set (e->image, (Evas_Coord) 0,
+                                                 (Evas_Coord) 0,
+                                                 (Evas_Coord) e->tw,
+                                                 (Evas_Coord) e->th);
+                     evas_object_image_data_copy_set (e->image,
+                                                      imlib_image_get_data
+                                                      ());
+                     imlib_free_image_and_decache ();
+                   }
+                 else
+                   {
+                     esmart_thumb_free (result);
+                     result = NULL;
+                   }
+               }
              else
                {
-                 e->image = evas_object_image_add (evas);
                  evas_object_image_file_set (e->image,
                                              epsilon_thumb_file_get (e->e),
                                              NULL);
@@ -80,9 +120,8 @@
                  else
                    {
                      esmart_thumb_free (result);
-                     e->image = NULL;
+                     result = NULL;
                    }
-
                }
 
            }
@@ -189,7 +228,8 @@
        {
          if (!e->info)
            e->info = epsilon_info_get (e->e);
-        if(!e->info) return NULL;
+         if (!e->info)
+           return NULL;
          return (e->info->mimetype);
        }
     }
@@ -251,6 +291,7 @@
   memset (e, 0, sizeof (Esmart_Thumb));
 
   evas_object_smart_data_set (o, e);
+  e->image = evas_object_image_add (evas_object_evas_get (o));
 }
 
 /**




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to