Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/bin


Modified Files:
        Makefile.am edje_cc.c edje_cc.h edje_cc_out.c edje_decc.c 
        edje_decc.h edje_thumb.c edje_thumb.h 


Log Message:


edje no longer needs imlib2.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/Makefile.am,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- Makefile.am 3 Sep 2005 22:15:07 -0000       1.29
+++ Makefile.am 11 Nov 2005 06:49:57 -0000      1.30
@@ -7,7 +7,6 @@
 @EET_CFLAGS@ \
 @EVAS_CFLAGS@ \
 @ECORE_CFLAGS@ \
[EMAIL PROTECTED]@ \
 @EMBRYO_CFLAGS@
 
 bin_SCRIPTS = \
@@ -49,8 +48,7 @@
 edje_cc_sources.c
 
 edje_cc_LDADD = \
-$(top_builddir)/src/lib/libedje.la \
[EMAIL PROTECTED]@
+$(top_builddir)/src/lib/libedje.la
 
 edje_cc_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
 
@@ -62,8 +60,7 @@
 edje_cc_sources.c
 
 edje_decc_LDADD = \
-$(top_builddir)/src/lib/libedje.la \
[EMAIL PROTECTED]@
+$(top_builddir)/src/lib/libedje.la
 
 edje_decc_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
 
@@ -73,8 +70,7 @@
 edje_thumb.h
 
 edje_thumb_LDADD = \
-$(top_builddir)/src/lib/libedje.la \
[EMAIL PROTECTED]@
+$(top_builddir)/src/lib/libedje.la
 
 edje_thumb_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- edje_cc.c   22 Mar 2005 19:29:04 -0000      1.26
+++ edje_cc.c   11 Nov 2005 06:49:57 -0000      1.27
@@ -19,9 +19,6 @@
 int        no_raw = 0;
 int        min_quality = 0;
 int        max_quality = 100;
-int        scale_lossy = 100;
-int        scale_comp = 100;
-int        scale_raw = 100;
 
 static void
 main_help(void)
@@ -40,9 +37,6 @@
       "-no-raw                  Do NOT allow images to be stored with zero 
compression (raw)\n"
       "-min-quality VAL         Do NOT allow lossy images with quality < VAL 
(0-100)\n"
       "-max-quality VAL         Do NOT allow lossy images with quality > VAL 
(0-100)\n"
-      "-scale-lossy VAL         Scale lossy image pixels by this percentage 
factor (0 - 100)\n"
-      "-scale-comp VAL          Scale lossless compressed image pixels by this 
percentage factor (0 - 100)\n"
-      "-scale-raw VAL           Scale uncompressed (raw) image pixels by this 
percentage factor (0 - 100)\n"
       "-Ddefine_val=to          CPP style define to define input macro 
definitions to the .edc source\n"
       ,progname);
 }
@@ -104,27 +98,6 @@
             if (max_quality < 0) max_quality = 0;
             if (max_quality > 100) max_quality = 100;
          }
-       else if ((!strcmp(argv[i], "-scale-lossy")) && (i < (argc - 1)))
-         {
-            i++;
-            scale_lossy = atoi(argv[i]);
-            if (scale_lossy < 0) scale_lossy = 0;
-            if (scale_lossy > 100) scale_lossy = 100;
-         }
-       else if ((!strcmp(argv[i], "-scale-comp")) && (i < (argc - 1)))
-         {
-            i++;
-            scale_comp = atoi(argv[i]);
-            if (scale_comp < 0) scale_comp = 0;
-            if (scale_comp > 100) scale_comp = 100;
-         }
-       else if ((!strcmp(argv[i], "-scale-raw")) && (i < (argc - 1)))
-         {
-            i++;
-            scale_raw = atoi(argv[i]);
-            if (scale_raw < 0) scale_raw = 0;
-            if (scale_raw > 100) scale_raw = 100;
-         }
        else if (!strncmp(argv[i], "-D", 2))
          {
             defines = evas_list_append(defines, mem_strdup(argv[i]));
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- edje_cc.h   29 Oct 2004 17:45:07 -0000      1.24
+++ edje_cc.h   11 Nov 2005 06:49:57 -0000      1.25
@@ -2,10 +2,6 @@
 #define EDJE_CC_H
 
 #include "edje_main.h"
-/* Imlib2 stuff for loading up input images */
-#define X_DISPLAY_MISSING
-#include <Imlib2.h>
-/* done Imlib2 stuff */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -136,9 +132,6 @@
 extern int                    no_raw;
 extern int                    min_quality;
 extern int                    max_quality;
-extern int                    scale_lossy;
-extern int                    scale_comp;
-extern int                    scale_raw;
 extern int                    line;
 extern Evas_List             *stack;
 extern Evas_List             *params;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc_out.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- edje_cc_out.c       29 Apr 2005 18:46:41 -0000      1.42
+++ edje_cc_out.c       11 Nov 2005 06:49:57 -0000      1.43
@@ -308,9 +308,15 @@
             free(fdata);
          }
      }
-#ifdef HAVE_IMLIB
    if ((edje_file) && (edje_file->image_dir))
      {
+       Ecore_Evas *ee;
+       Evas *evas;
+       
+       ecore_init();
+       ecore_evas_init();
+       ee = ecore_evas_buffer_new(1, 1);
+       evas = ecore_evas_get(ee);
        for (l = edje_file->image_dir->entries; l; l = l->next)
          {
             Edje_Image_Directory_Entry *img;
@@ -318,70 +324,53 @@
             img = l->data;     
             if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
               {
-                 Imlib_Image im;
-                 Evas_List *l;
+                 Evas_Object *im;
+                 Evas_List *ll;
                  
                  im = NULL;
-                 imlib_set_cache_size(0);           
-                 for (l = img_dirs; l; l = l->next)
+                 for (ll = img_dirs; ll; ll = ll->next)
                    {
                       char buf[4096];
                       
                       snprintf(buf, sizeof(buf), "%s/%s", 
-                               (char *)(l->data), img->entry);
-                      im = imlib_load_image(buf);
-                      if (im) break;
+                               (char *)(ll->data), img->entry);
+                      im = evas_object_image_add(evas);
+                      if (im)
+                        {
+                           evas_object_image_file_set(im, buf, NULL);
+                           if (evas_object_image_load_error_get(im) == 
+                               EVAS_LOAD_ERROR_NONE)
+                             {
+                                break;
+                             }
+                           evas_object_del(im);
+                           im = NULL;
+                        }
+                   }
+                 if (!im)
+                   {
+                      im = evas_object_image_add(evas);
+                      if (im)
+                        {
+                           evas_object_image_file_set(im, img->entry, NULL);
+                           if (evas_object_image_load_error_get(im) != 
+                               EVAS_LOAD_ERROR_NONE)
+                             {
+                                evas_object_del(im);
+                                im = NULL;
+                             }
+                        }
                    }
-                 if (!im) im = imlib_load_image(img->entry);
                  if (im)
                    {
-                      DATA32 *im_data;
+                      void *im_data;
                       int  im_w, im_h;
                       int  im_alpha;
                       char buf[256];
                       
-                      imlib_context_set_image(im);
-                      im_w = imlib_image_get_width();
-                      im_h = imlib_image_get_height();
-                      if ((img->source_type == 
EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
-                          (img->source_param == 0) &&
-                          (scale_raw != 100))
-                        {
-                           im = imlib_create_cropped_scaled_image(0, 0,
-                                                                  im_w, im_h,
-                                                                  (im_w * 
scale_raw) / 100,
-                                                                  (im_h * 
scale_raw) / 100);
-                           imlib_free_image();
-                           imlib_context_set_image(im);
-                           im_w = imlib_image_get_width();
-                           im_h = imlib_image_get_height();
-                        }
-                      else if ((img->source_type == 
EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
-                               (img->source_param == 1) &&
-                               (scale_comp != 100))
-                        {
-                           im = imlib_create_cropped_scaled_image(0, 0,
-                                                                  im_w, im_h,
-                                                                  (im_w * 
scale_comp) / 100,
-                                                                  (im_h * 
scale_comp) / 100);
-                           imlib_free_image();
-                           imlib_context_set_image(im);
-                           im_w = imlib_image_get_width();
-                           im_h = imlib_image_get_height();
-                        }
-                      else if (scale_lossy != 100)
-                        {
-                           im = imlib_create_cropped_scaled_image(0, 0,
-                                                                  im_w, im_h,
-                                                                  (im_w * 
scale_lossy) / 100,
-                                                                  (im_h * 
scale_lossy) / 100);
-                           imlib_free_image();
-                           imlib_context_set_image(im);
-                           im_w = imlib_image_get_width();
-                           im_h = imlib_image_get_height();
-                        }
-                      im_alpha = imlib_image_has_alpha();
-                      im_data = imlib_image_get_data_for_reading_only();
+                      evas_object_image_size_get(im, &im_w, &im_h);
+                      im_alpha = evas_object_image_alpha_get(im);
+                      im_data = evas_object_image_data_get(im, 0);
                       if ((im_data) && (im_w > 0) && (im_h > 0))
                         {
                            int mode, qual;
@@ -454,8 +443,10 @@
                       if (verbose)
                         {
                            struct stat st;
+                           char *file = NULL;
                       
-                           if (stat(imlib_image_get_filename(), &st) != 0)
+                           evas_object_image_file_get(im, &file, NULL);
+                           if ((file) && (stat(file, &st) != 0))
                              st.st_size = 0;
                            input_bytes += st.st_size;
                            input_raw_bytes += im_w * im_h * 4;
@@ -465,8 +456,7 @@
                                   100 - (100 * (double)bytes) / 
((double)(st.st_size))
                                   );
                         }
-                      if (im_data) imlib_image_put_back_data(im_data);
-                      imlib_free_image();
+                      evas_object_del(im);
                    }
                  else
                    {
@@ -476,8 +466,10 @@
                    }
               }
          }
+       ecore_evas_free(ee);
+       ecore_evas_shutdown();
+       ecore_shutdown();
      }
-#endif
 
    /* sanity checks for parts and programs */
    for (l = edje_collections; l; l = l->next)
@@ -487,64 +479,9 @@
        
        pc = l->data;
        for (ll = pc->parts; ll; ll = ll->next)
-         {
-            check_part (pc, ll->data, ef);
-
-/*
-            Edje_Part *ep = ll->data;
-            Edje_Part_Description *epd = ep->default_desc;
-
-            if (epd->text.font)
-              {
-                 Evas_List *lll;
-                 
-                 for (lll = fonts; lll; lll = lll->next)
-                   {
-                      Font *fn;
-                      
-                      fn = lll->data;
-                      if (!strcmp(fn->name, epd->text.font))
-                        {
-                           char *s;
-                           
-                           s = malloc(strlen(epd->text.font) + 
strlen("fonts/") + 1);
-                           strcpy(s, "fonts/");
-                           strcat(s, epd->text.font);
-                           free(epd->text.font);
-                           epd->text.font = s;
-                        }
-                   }
-              }
-            for (l3 = ep->other_desc; l3; l3 = l3->next)
-              {
-                 epd = l3->data;
-                 if (epd->text.font)
-                   {
-                      Evas_List *lll;
-                      
-                      for (lll = fonts; lll; lll = lll->next)
-                        {
-                           Font *fn;
-                           
-                           fn = lll->data;
-                           if (!strcmp(fn->name, epd->text.font))
-                             {
-                                char *s;
-                                
-                                s = malloc(strlen(epd->text.font) + 
strlen("fonts/") + 1);
-                                strcpy(s, "fonts/");
-                                strcat(s, epd->text.font);
-                                free(epd->text.font);
-                                epd->text.font = s;
-                             }
-                        }
-                   }
-              }
- */
-         }
-
+         check_part (pc, ll->data, ef);
        for (ll = pc->programs; ll; ll = ll->next)
-            check_program (pc, ll->data, ef);
+         check_program (pc, ll->data, ef);
      }
    for (l = edje_collections; l; l = l->next)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_decc.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- edje_decc.c 22 Mar 2005 19:29:04 -0000      1.14
+++ edje_decc.c 11 Nov 2005 06:49:57 -0000      1.15
@@ -132,7 +132,6 @@
    
    ef = eet_open(file_in, EET_FILE_MODE_READ);
 
-#ifdef HAVE_IMLIB
    if (edje_file->image_dir)
      {
        for (l = edje_file->image_dir->entries; l; l = l->next)
@@ -142,56 +141,40 @@
             ei = l->data;
             if ((ei->source_type) && (ei->entry))
               {
-                 DATA32 *pix;
-                 int w, h, alpha, comp, qual, lossy;
+                 Ecore_Evas *ee;
+                 Evas *evas;
+                 Evas_Object *im;
                  char buf[4096];
+                 char out[4096];
+                 char *pp;
                  
+                 ecore_init();
+                 ecore_evas_init();
+                 ee = ecore_evas_buffer_new(1, 1);
+                 evas = ecore_evas_get(ee);
+                 im = evas_object_image_add(evas);
                  snprintf(buf, sizeof(buf), "images/%i", ei->id);
-                 pix = eet_data_image_read(ef, buf, &w, &h, &alpha, &comp, 
&qual, &lossy);
-                 if (pix)
+                 evas_object_image_file_set(im, file_in, buf);
+                 snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
+                 printf("Output Image: %s\n", out);
+                 pp = strdup(out);
+                 p = strrchr(pp, '/');
+                 *p = 0;
+                 if (strstr(pp, "../"))
                    {
-                      Imlib_Image im;
-                      char out[4096];
-                      char *pp;
-                      
-                      snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
-                      printf("Output Image: %s\n", out);
-                      pp = strdup(out);
-                      p = strrchr(pp, '/');
-                      *p = 0;
-                      if (strstr(pp, "../"))
-                        {
-                           printf("ERROR: potential security violation. 
attempt to write in parent dir.\n");
-                           exit (-1);
-                        }
-                      e_file_mkpath(pp);
-                      free(pp);
-                      im = imlib_create_image_using_data(w, h, pix);
-                      imlib_context_set_image(im);
-                      if (alpha)
-                        imlib_image_set_has_alpha(1);
-                      if ((lossy) && (!alpha))
-                        {
-                           imlib_image_set_format("jpg");
-                           imlib_image_attach_data_value("quality", NULL, 
qual, NULL);
-                        }
-                      else
-                        {
-                           imlib_image_set_format("png");
-                        }
-                      if (strstr(out, "../"))
-                        {
-                           printf("ERROR: potential security violation. 
attempt to write in parent dir.\n");
-                           exit (-1);
-                        }
-                      imlib_save_image(out);
-                      imlib_free_image();
-                      free(pix);
+                      printf("ERROR: potential security violation. attempt to 
write in parent dir.\n");
+                      exit (-1);
                    }
+                 e_file_mkpath(pp);
+                 free(pp);
+                 evas_object_image_save(im, out, NULL, "quality=100 
compress=9");
+                 evas_object_del(im);
+                 ecore_evas_free(ee);
+                 ecore_evas_shutdown();
+                 ecore_shutdown();
               }
          }
      }
-#endif
 
    for (l = srcfiles->list; l; l = l->next)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_decc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- edje_decc.h 29 Oct 2004 14:01:24 -0000      1.2
+++ edje_decc.h 11 Nov 2005 06:49:57 -0000      1.3
@@ -2,10 +2,6 @@
 #define EDJE_DECC_H
 
 #include "edje_main.h"
-/* Imlib2 stuff for loading up input images */
-#define X_DISPLAY_MISSING
-#include <Imlib2.h>
-/* done Imlib2 stuff */
 
 #include <stdio.h>
 #include <stdlib.h>
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_thumb.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- edje_thumb.c        20 Mar 2005 21:56:40 -0000      1.2
+++ edje_thumb.c        11 Nov 2005 06:49:57 -0000      1.3
@@ -1,14 +1,13 @@
 #include "edje_thumb.h"
 
-static void save_pixels(const int *pixels, int w, int h, char *out);
 static void args_parse(void);
 static void help_show(void);
 static int signal_exit(void *data, int ev_type, void *ev);
 static int frame_grab(void *data);
 
-Ecore_Evas *ee = NULL;
-Evas *evas = NULL;
-Evas_Object *edje = NULL;
+Ecore_Evas *ee = NULL, *ee_im = NULL, *ee_im2 = NULL;
+Evas *evas = NULL, *evas_im = NULL, *evas_im2 = NULL;
+Evas_Object *edje = NULL, *im = NULL, *im2 = NULL;
 char *file = NULL;
 char *group = NULL;
 char *outfile = NULL;
@@ -31,15 +30,28 @@
 
    args_parse();
    
-   ee = ecore_evas_buffer_new(w, h);
-   if (!ee)
-     {
-       printf("Cannot create buffer canvas! ERROR!\n");
-       exit(-1);
-     }
+   ee = ecore_evas_buffer_new(outw, outh);
    evas = ecore_evas_get(ee);
    
-   edje = edje_object_add(evas);
+   im = ecore_evas_object_image_new(ee);
+   evas_object_move(im, 0, 0);
+   evas_object_resize(im, outw, outh);
+   evas_object_image_fill_set(im, 0, 0, outw, outh);
+   evas_object_show(im);
+   evas_object_image_size_set(im, outw, outh);
+   ee_im = evas_object_data_get(im, "Ecore_Evas");
+   evas_im = ecore_evas_get(ee_im);
+   
+   im2 = ecore_evas_object_image_new(ee_im);
+   evas_object_move(im2, 0, 0);
+   evas_object_resize(im2, outw, outh);
+   evas_object_image_fill_set(im2, 0, 0, outw, outh);
+   evas_object_show(im2);
+   evas_object_image_size_set(im2, w, h);
+   ee_im2 = evas_object_data_get(im2, "Ecore_Evas");
+   evas_im2 = ecore_evas_get(ee_im2);
+   
+   edje = edje_object_add(evas_im2);
    if (!edje_object_file_set(edje, file, group))
      {
        printf("Cannot load file %s, group %s\n", file, group);
@@ -58,10 +70,8 @@
      }
    else
      {
-       const int *pixels;
-
-       pixels = ecore_evas_buffer_pixels_get(ee);
-       save_pixels(pixels, w, h, outfile);
+       ecore_evas_buffer_pixels_get(ee);
+       evas_object_image_save(im, outfile, NULL, "quality=100 compress=9");
      }
    
    evas_object_del(edje);
@@ -73,27 +83,6 @@
 }
 
 static void
-save_pixels(const int *pixels, int w, int h, char *out)
-{
-   Imlib_Image im;
-   
-   im = imlib_create_image_using_data(w, h, (DATA32 *) pixels);
-   imlib_context_set_image(im);
-   imlib_image_set_irrelevant_alpha(0);
-   imlib_image_set_has_alpha(1);
-   if ((w != outw) || (h != outh))
-     {
-       Imlib_Image im2;
-       
-       im2 = imlib_create_cropped_scaled_image(0, 0, w, h, outw, outh);
-       imlib_free_image();
-       imlib_context_set_image(im2);
-     }
-   imlib_save_image(out);
-   imlib_free_image();
-}
-
-static void
 args_parse(void)
 {
    int argc;
@@ -202,11 +191,10 @@
 frame_grab(void *data)
 {
    char buf[4096];
-   const int *pixels;
    
-   pixels = ecore_evas_buffer_pixels_get(ee);
    snprintf(buf, sizeof(buf), outfile, frnum);
-   save_pixels(pixels, w, h, buf);
+   ecore_evas_buffer_pixels_get(ee);
+   evas_object_image_save(im, buf, NULL, "quality=100 compress=9");
    frnum++;
    if (frnum == frames)
      {
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_thumb.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- edje_thumb.h        5 Sep 2005 16:26:58 -0000       1.3
+++ edje_thumb.h        11 Nov 2005 06:49:57 -0000      1.4
@@ -14,9 +14,5 @@
 #include <Ecore_Evas.h>
 #include <Eet.h>
 #include "Edje.h"
-#define X_DISPLAY_MISSING
-#include <Imlib2.h>
-
-
 
 #endif




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to