Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/bin


Modified Files:
        edje_cc.c edje_cc.h edje_cc_out.c edje_decc.c edje_recc 


Log Message:


this should make a lot of themers happy.

edje_cc (and edje_recc) now support:

-no-lossy                Do NOT allow images to be lossy
-no-comp                 Do NOT allow images to be lossless compression
-no-raw                  Do NOT allow images to be zero compression
-min-quality VAL         Do NOT allow lossy images with quality > VAL (0-100)
-max-quality VAL         Do NOT allow lossy images with quality < VAL (0-100)

this lest you forcibly make a theme .eet that is full quality with NO
compression of images, or just lossless compression (recommended for
distribution as an "original" .eet) and then make lossy only ones with min
and max quality levels.... so u can make small small small themes by just
giving up quality :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- edje_cc.c   29 Aug 2004 11:03:19 -0000      1.14
+++ edje_cc.c   1 Sep 2004 05:41:25 -0000       1.15
@@ -9,6 +9,12 @@
 char      *progname = NULL;
 int        verbose = 0;
 
+int        no_lossy = 0;
+int        no_comp = 0;
+int        no_raw = 0;
+int        min_quality = 0;
+int        max_quality = 100;
+
 static void
 main_help(void)
 {
@@ -21,6 +27,11 @@
       "-id image/directory      Add a directory to look in for relative path images\n"
       "-fd font/directory       Add a directory to look in for relative path fonts\n"
       "-v                       Verbose output\n"
+      "-no-lossy                Do NOT allow images to be lossy\n"
+      "-no-comp                 Do NOT allow images to be lossless compression\n"
+      "-no-raw                  Do NOT allow images to be zero compression\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"
       ,progname);
 }
 
@@ -43,6 +54,18 @@
          {
             verbose = 1;
          }
+       else if (!strcmp(argv[i], "-no-lossy"))
+         {
+            no_lossy = 1;
+         }
+       else if (!strcmp(argv[i], "-no-comp"))
+         {
+            no_comp = 1;
+         }
+       else if (!strcmp(argv[i], "-no-raw"))
+         {
+            no_raw = 1;
+         }
        else if ((!strcmp(argv[i], "-id")) && (i < (argc - 1)))
          {
             i++;            
@@ -53,6 +76,20 @@
             i++;            
             fnt_dirs = evas_list_append(fnt_dirs, argv[i]);
          }
+       else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
+         {
+            i++;            
+            min_quality = atoi(argv[i]);
+            if (min_quality < 0) min_quality = 0;
+            if (min_quality > 100) min_quality = 100;
+         }
+       else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1)))
+         {
+            i++;            
+            max_quality = atoi(argv[i]);
+            if (max_quality < 0) max_quality = 0;
+            if (max_quality > 100) max_quality = 100;
+         }
        else if (!file_in)
          file_in = argv[i];
        else if (!file_out)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- edje_cc.h   29 Aug 2004 11:03:19 -0000      1.16
+++ edje_cc.h   1 Sep 2004 05:41:26 -0000       1.17
@@ -128,6 +128,11 @@
 extern char                  *file_out;
 extern char                  *progname;
 extern int                    verbose;
+extern int                    no_lossy;
+extern int                    no_comp;
+extern int                    no_raw;
+extern int                    min_quality;
+extern int                    max_quality;
 extern int                    line;
 extern Evas_List             *stack;
 extern Evas_List             *params;
@@ -138,4 +143,5 @@
 extern New_Object_Handler     object_handlers[];
 extern New_Statement_Handler  statement_handlers[];
 
+
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc_out.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- edje_cc_out.c       31 Aug 2004 04:00:14 -0000      1.22
+++ edje_cc_out.c       1 Sep 2004 05:41:26 -0000       1.23
@@ -265,17 +265,47 @@
                       im_data = imlib_image_get_data_for_reading_only();
                       if ((im_data) && (im_w > 0) && (im_h > 0))
                         {
+                           int mode, qual;
+                           
                            snprintf(buf, sizeof(buf), "images/%i", img->id);
-                           if (img->source_type == 
EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT)
+                           mode = 2;
+                           if ((img->source_type == 
EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
+                               (img->source_param == 0))
+                             mode = 0; /* RAW */
+                           else if ((img->source_type == 
EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
+                                    (img->source_param == 1))
+                             mode = 1; /* COMPRESS */
+                           else
+                             mode = 2; /* LOSSY */
+                           if ((mode == 0) && (no_raw)) mode = 1; /* promote 
compression */
+                           if ((mode == 2) && (no_lossy)) mode = 1; /* demote 
compression */
+                           if ((mode == 1) && (no_comp))
+                             {
+                                if (no_lossy) mode = 0; /* demote compression */
+                                else if (no_raw) mode = 2; /* no choice. lossy */
+                             }
+                           qual = 80;
+                           if (mode == 2)
+                             {
+                                qual = img->source_param;
+                                if (qual < min_quality) qual = min_quality;
+                                if (qual > max_quality) qual = max_quality;
+                             }
+                           if (mode == 0)
                              bytes = eet_data_image_write(ef, buf, 
                                                           im_data, im_w, im_h,
                                                           im_alpha, 
-                                                          img->source_param, 0, 0);
-                           else
+                                                          0, 0, 0);
+                           else if (mode == 1)
+                             bytes = eet_data_image_write(ef, buf, 
+                                                          im_data, im_w, im_h,
+                                                          im_alpha, 
+                                                          1, 0, 0);
+                           else if (mode == 2)
                              bytes = eet_data_image_write(ef, buf, 
                                                           im_data, im_w, im_h,
                                                           im_alpha,
-                                                          0, img->source_param, 1);
+                                                          0, qual, 1);
                            if (bytes <= 0)
                              {
                                 fprintf(stderr, "%s: Error. unable to write image 
part \"%s\" as \"%s\" part entry to %s \n",
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_decc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- edje_decc.c 29 Aug 2004 12:28:53 -0000      1.2
+++ edje_decc.c 1 Sep 2004 05:41:26 -0000       1.3
@@ -251,7 +251,7 @@
          }
        f = fopen(out, "w");
        fprintf(f, "#!/bin/sh\n");
-       fprintf(f, "edje_cc -id . -fd . main_edje_source.edc %s.eet\n", outdir);
+       fprintf(f, "edje_cc $@ -id . -fd . main_edje_source.edc %s.eet\n", outdir);
        fclose(f);
        chmod(out, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP);
      }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_recc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- edje_recc   31 Aug 2004 03:53:41 -0000      1.1
+++ edje_recc   1 Sep 2004 05:41:26 -0000       1.2
@@ -2,12 +2,58 @@
 
 set -e
 
-if [ $# -ne 1 ]; then
-  echo "Usage: edje_recc input_file.eet"
+usage () {
+  echo "Usage:"
+  echo "        edje_recc [OPTIONS] input_file.eet"
+  echo ""
+  echo "Where OPTIONS is one or more of:"
+  echo ""
+  echo "-v                       Verbose output"
+  echo "-no-lossy                Do NOT allow images to be lossy"
+  echo "-no-comp                 Do NOT allow images to be lossless compression"
+  echo "-no-raw                  Do NOT allow images to be zero compression"
+  echo "-min-quality VAL         Do NOT allow lossy images with quality > VAL (0-100)"
+  echo "-max-quality VAL         Do NOT allow lossy images with quality < VAL (0-100)"
   exit -1
+}
+
+if [ $# -lt 1 ]; then
+  usage
+fi
+
+OPT=""
+if [ $# -ge 1 ]; then
+  for I in $@; do
+    case "$I" in
+      -h)
+        usage
+      ;;
+      
+      -help)
+        usage
+      ;;
+      
+      --help)
+        usage
+      ;;
+      
+      *.eet)
+        IN=$I
+      ;;
+      
+      *)
+        OPT=$OPT" "$I
+      ;;
+    esac
+  done
+fi
+
+if [ -z "$IN" ]; then
+  echo "ERROR: NO input file.eet provided!"
+  echo ""
+  usage;
 fi
 
-IN=$1
 F=`basename $IN`
 B=`basename $F .eet`
 T="./...edje_tmp"
@@ -17,7 +63,7 @@
 cd $T
 edje_decc $F
 cd $B
-./build.sh
+./build.sh $OPT
 cd ../..
 mv $T/$B/$F $IN
 rm -rf $T




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to