gimp r27683 - in trunk: . plug-ins/script-fu plug-ins/script-fu/scripts



Author: neo
Date: Wed Nov 19 08:17:28 2008
New Revision: 27683
URL: http://svn.gnome.org/viewvc/gimp?rev=27683&view=rev

Log:
2008-11-19  Sven Neumann  <sven gimp org>

	Bug 558454 â Plugin Map Color Range disapears from GIMP

	* plug-ins/script-fu/scripts/Makefile.am

	* plug-ins/script-fu/scripts/plug-in-compat.init: new file
	providing compatibility with plug-ins from older GIMP
	versions. Contains a reimplementation of plug-in-color-map based
	on ideas and code from Eric Lamarque.

	* plug-ins/script-fu/scheme-wrapper.c (tinyscheme_init): load 
the
	plug-in-compat.init file.



Added:
   trunk/plug-ins/script-fu/scripts/plug-in-compat.init
Modified:
   trunk/ChangeLog
   trunk/plug-ins/script-fu/scheme-wrapper.c
   trunk/plug-ins/script-fu/scripts/Makefile.am

Modified: trunk/plug-ins/script-fu/scheme-wrapper.c
==============================================================================
--- trunk/plug-ins/script-fu/scheme-wrapper.c	(original)
+++ trunk/plug-ins/script-fu/scheme-wrapper.c	Wed Nov 19 08:17:28 2008
@@ -68,6 +68,8 @@
 static pointer  script_fu_nil_call               (scheme    *sc,
                                                   pointer    a);
 
+static gboolean ts_load_file                     (const gchar *dirname,
+                                                  const gchar *basename);
 
 typedef struct
 {
@@ -239,30 +241,17 @@
 
       for (list = dir_list; list; list = g_list_next (list))
         {
-          gchar *filename = g_build_filename (list->data,
-                                              "script-fu.init", NULL);
-          FILE  *fin      = g_fopen (filename, "rb");
-
-          g_free (filename);
-
-          if (fin)
+          if (ts_load_file (list->data, "script-fu.init"))
             {
-              scheme_load_file (&sc, fin);
-              fclose (fin);
-
               /*  To improve compatibility with older Script-Fu scripts,
                *  load script-fu-compat.init from the same directory.
                */
-              filename = g_build_filename (list->data,
-                                           "script-fu-compat.init", NULL);
-              fin = g_fopen (filename, "rb");
-              g_free (filename);
+              ts_load_file (list->data, "script-fu-compat.init");
 
-              if (fin)
-                {
-                  scheme_load_file (&sc, fin);
-                  fclose (fin);
-                }
+              /*  To improve compatibility with older GIMP version,
+               *  load plug-in-compat.init from the same directory.
+               */
+              ts_load_file (list->data, "plug-in-compat.init");
 
               break;
             }
@@ -578,6 +567,30 @@
   g_free (proc_list);
 }
 
+static gboolean
+ts_load_file (const gchar *dirname,
+              const gchar *basename)
+{
+  gchar *filename;
+  FILE  *fin;
+
+  filename = g_build_filename (dirname, basename, NULL);
+
+  fin = g_fopen (filename, "rb");
+
+  g_free (filename);
+
+  if (fin)
+    {
+      scheme_load_file (&sc, fin);
+      fclose (fin);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 static void
 convert_string (gchar *str)
 {

Modified: trunk/plug-ins/script-fu/scripts/Makefile.am
==============================================================================
--- trunk/plug-ins/script-fu/scripts/Makefile.am	(original)
+++ trunk/plug-ins/script-fu/scripts/Makefile.am	Wed Nov 19 08:17:28 2008
@@ -7,6 +7,7 @@
 scripts = \
 	script-fu.init			\
 	script-fu-compat.init		\
+	plug-in-compat.init		\
 	3d-outline.scm			\
 	3dTruchet.scm			\
 	add-bevel.scm			\

Added: trunk/plug-ins/script-fu/scripts/plug-in-compat.init
==============================================================================
--- (empty file)
+++ trunk/plug-ins/script-fu/scripts/plug-in-compat.init	Wed Nov 19 08:17:28 2008
@@ -0,0 +1,24 @@
+; The Scheme code in this file provides some compatibility with
+; scripts that were originally written for use with older versions of
+; GIMP.
+;
+; It provides PDB procedures that used to be provided by plug-ins that
+; were since then removed from the GIMP distribution. You should not
+; use these in newly written scripts as the functions defined here may
+; be removed at some later date.
+
+
+(define (plug-in-color-map run-mode img layer
+			   src-color-1 src-color-2 dest-color-1 dest-color-2
+			   map-mode)
+  (gimp-levels layer HISTOGRAM-RED
+	       (car src-color-1) (car src-color-2) 1.0
+	       (- 255 (car dest-color-1)) (- 255 (car dest-color-2)))
+  (gimp-levels layer  HISTOGRAM-GREEN
+	       (cadr 	src-color-1) (cadr src-color-2) 1.0
+	       (- 255 (cadr dest-color-1)) (- 255 (cadr dest-color-2)))
+  (gimp-levels layer HISTOGRAM-BLUE
+	       (caddr src-color-1) (caddr src-color-2) 1.0
+	       (- 255 (caddr dest-color-1)) (- 255 (caddr dest-color-2)))
+  (gimp-levels layer HISTOGRAM-VALUE 0 255 1.0 255 0)
+)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]