Enlightenment CVS committal

Author  : zuluone
Project : e17
Module  : apps/entice

Dir     : e17/apps/entice/src/bin


Modified Files:
        image.c 


Log Message:
allow loading of file formats not supported by evas, using imlib
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- image.c     16 Aug 2003 13:35:19 -0000      1.17
+++ image.c     18 Aug 2003 10:01:31 -0000      1.18
@@ -673,6 +673,9 @@
    scroll_y = 0;
    scroll_sx = 0;
    scroll_sy = 0;
+   Imlib_Image im;
+   DATA32 *data;
+   int mustUseImlib = 0;
 
    e_turntable_reset();
    if (o_mini_image)
@@ -700,11 +703,29 @@
        evas_object_event_callback_add(o_image, EVAS_CALLBACK_MOUSE_MOVE,
                                       next_image_move, NULL);
        evas_object_show(o_image);
+       // if evas can't load the thing...
        if (evas_object_image_load_error_get(o_image) != EVAS_LOAD_ERROR_NONE)
          {
+           // try Imlib
+
+           mustUseImlib = 1;
+           im = imlib_load_image(((Image *)(current_image->data))->file);
+           if (im) {
+             int w, h;
+             enum active_state command = active_out;
+             
+             e_fade_logo(&command);
+             imlib_context_set_image(im);
+             w = imlib_image_get_width();
+             h = imlib_image_get_height();
+             data = imlib_image_get_data_for_reading_only();
+             evas_object_image_size_set(o_image, w, h);
+             evas_object_image_data_set(o_image, data);
+           } else { // we really can't load it
             enum active_state command = active_in;
+
             e_fade_logo(&command);
-            sprintf(txt_info[0], "Error LoadingFile: %s",
+            sprintf(txt_info[0], "Error Loading File: %s",
                     ((Image *) (current_image->data))->file);
             *txt_info[1] = '\0';
             sprintf(title, "Entice (Error Loading): %s",
@@ -712,11 +733,14 @@
             ecore_evas_title_set(ecore_evas, title);
             evas_object_del(o_image);
             o_image = NULL;
+           }
          }
        else
          {
             int                 w, h;
+            enum active_state command = active_out;
 
+            e_fade_logo(&command);
             evas_object_image_size_get(o_image, &w, &h);
             sprintf(txt_info[0], "File: %s",
                     ((Image *) (current_image->data))->file);
@@ -742,9 +766,16 @@
      {
        o_mini_image = evas_object_image_add(evas);
        evas_object_image_smooth_scale_set(o_mini_image, 0);
-       evas_object_image_file_set(o_mini_image,
-                                  ((Image *) (current_image->data))->file,
-                                  NULL);
+       if (mustUseImlib) {
+         evas_object_image_data_set(o_mini_image, data);
+         imlib_image_put_back_data(data);
+       } else {
+         evas_object_image_file_set(o_mini_image,
+                                     ((Image *) (current_image->data))->file,
+                                     NULL);
+       }
+       evas_object_show(o_mini_image);
+
      }
    e_handle_resize();
    e_fix_icons();




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to