Bug 558454 – Plugin Map Color Range disapears from GIMP
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. svn path=/trunk/; revision=27683
This commit is contained in:

committed by
Sven Neumann

parent
d440e9c2c2
commit
d43a0fbf19
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
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.
|
||||
|
||||
2008-11-19 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* README: Remove reference to the inactive gimpwin-users mailing
|
||||
|
@ -68,6 +68,8 @@ static pointer script_fu_quit_call (scheme *sc,
|
||||
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 @@ tinyscheme_init (const gchar *path,
|
||||
|
||||
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 @@ ts_init_procedures (scheme *sc,
|
||||
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)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ scriptdatadir = $(gimpdatadir)/scripts
|
||||
scripts = \
|
||||
script-fu.init \
|
||||
script-fu-compat.init \
|
||||
plug-in-compat.init \
|
||||
3d-outline.scm \
|
||||
3dTruchet.scm \
|
||||
add-bevel.scm \
|
||||
|
24
plug-ins/script-fu/scripts/plug-in-compat.init
Normal file
24
plug-ins/script-fu/scripts/plug-in-compat.init
Normal file
@ -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)
|
||||
)
|
Reference in New Issue
Block a user