[maemo-commits] [maemo-commits] r11544 - in projects/haf/trunk/hildon-theme-tools: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed May 9 15:55:59 EEST 2007
Author: mdk
Date: 2007-05-09 15:55:58 +0300 (Wed, 09 May 2007)
New Revision: 11544

Modified:
   projects/haf/trunk/hildon-theme-tools/ChangeLog
   projects/haf/trunk/hildon-theme-tools/src/common.c
   projects/haf/trunk/hildon-theme-tools/src/common.h
   projects/haf/trunk/hildon-theme-tools/src/slicer.c
Log:
Replacing the 'separate_alpha' keywork with 'noalpha' keyword that enforces no-alpha save. Combined with 'alpha' keyword (that enforces alpha save) it can be used to achieve the desire effect.


Modified: projects/haf/trunk/hildon-theme-tools/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-theme-tools/ChangeLog	2007-05-09 12:36:17 UTC (rev 11543)
+++ projects/haf/trunk/hildon-theme-tools/ChangeLog	2007-05-09 12:55:58 UTC (rev 11544)
@@ -1,5 +1,14 @@
 2007-05-09  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
+	* src/common.c:
+	* src/common.h:
+	* src/slicer.c: Replacing the 'separate_alpha' keywork with 'noalpha'
+	keyword that enforces no-alpha save. Combined with 'alpha' keyword
+	(that enforces alpha save) it can be used to achieve the desire
+	effect.
+
+2007-05-09  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+
 	* COPYING: Updating the COPYING to talk about GPL instead of LGPL
 	license.
 

Modified: projects/haf/trunk/hildon-theme-tools/src/common.c
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/common.c	2007-05-09 12:36:17 UTC (rev 11543)
+++ projects/haf/trunk/hildon-theme-tools/src/common.c	2007-05-09 12:55:58 UTC (rev 11544)
@@ -204,11 +204,11 @@
         } else
                 element->ForcedAlpha = FALSE;
 
-        /* Primitive check for the 'separate_alpha' keyword */
-        if (size >= 5 && strcmp (vals [4], "separate_alpha") == 0) {
-                element->SeparateAlpha = TRUE;
+        /* Primitive check for the 'noalpha' keyword */
+        if (size >= 5 && strcmp (vals [4], "noalpha") == 0) {
+                element->NoAlpha = TRUE;
         } else
-                element->SeparateAlpha = FALSE;
+                element->NoAlpha = FALSE;
 
 Done:
         if (vals != NULL)

Modified: projects/haf/trunk/hildon-theme-tools/src/common.h
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/common.h	2007-05-09 12:36:17 UTC (rev 11543)
+++ projects/haf/trunk/hildon-theme-tools/src/common.h	2007-05-09 12:55:58 UTC (rev 11544)
@@ -39,7 +39,7 @@
         gint Width;
         gint Height;
         gboolean ForcedAlpha;
-        gboolean SeparateAlpha;
+        gboolean NoAlpha;
 } typedef                       Element;
 
 struct                          _Color

Modified: projects/haf/trunk/hildon-theme-tools/src/slicer.c
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/slicer.c	2007-05-09 12:36:17 UTC (rev 11543)
+++ projects/haf/trunk/hildon-theme-tools/src/slicer.c	2007-05-09 12:55:58 UTC (rev 11544)
@@ -178,31 +178,13 @@
                         else {
                                 gchar *fname = g_build_filename (directory, element->Name, NULL);
                              
-                                // Save alpha as a separate filename if that's required
-                                if (gdk_pixbuf_get_n_channels (sub) == 4 &&
-                                    element->SeparateAlpha == TRUE &&
-                                    strlen (fname) >= 4 && 
-                                    strcmp (fname + (strlen (fname) - 4), ".png") == 0) {
-
-                                        GdkPixbuf *alpha_pixbuf = extract_alpha_from_pixbuf (sub);
-                                        gchar *fname_alpha = g_strdup (fname);
-                                        fname_alpha [strlen (fname_alpha) - 4] = 0;
-                                        gchar *final_fname = g_strdup_printf ("%s_alpha.png", fname_alpha);
-                                        
-                                        g_print ("Saving separate alpha for %s to %s\n", element->Name, final_fname);
-                                        save_png (alpha_pixbuf, final_fname);
-
-                                        g_free (fname_alpha);
-                                        g_free (final_fname);
-                                        gdk_pixbuf_unref (alpha_pixbuf);
-                                }
-
                                 // FIXME This only covers one case (not stripping alpha when 
                                 // forced alpha == TRUE). We should also support a case when 
                                 // alpha needs to be added.
-                                if (gdk_pixbuf_get_n_channels (sub) == 4 && 
+                                if ((gdk_pixbuf_get_n_channels (sub) == 4 && 
                                     check_if_pixbuf_needs_alpha (sub) == FALSE &&
-                                    element->ForcedAlpha == FALSE) {
+                                    element->ForcedAlpha == FALSE) || 
+                                    element->NoAlpha == TRUE) {
                                         GdkPixbuf *oldy = sub;
                                         sub = strip_alpha_from_pixbuf (oldy);
                                         gdk_pixbuf_unref (oldy);


More information about the maemo-commits mailing list