From f539f8fb6213d4cca58b030b1eeb3660b6e34c51 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 14 Dec 2024 15:23:43 +0100 Subject: [PATCH] app, libgimp, pdb, plug-ins: plug-in-c-astretch compat PDB proc removed. For plug-in writers, here is how to replace it: - (plug-in-c-astretch RUN-NONINTERACTIVE img drawable) + (gimp-drawable-merge-new-filter drawable "gegl:stretch-contrast" 0 LAYER-MODE-REPLACE 1.0 "keep-colors" FALSE) --- app/pdb/internal-procs.c | 2 +- app/pdb/plug-in-compat-cmds.c | 74 ------------------- libgimp/gimp.c | 1 + pdb/groups/plug_in_compat.pdb | 49 ------------ plug-ins/script-fu/scripts/clothify.scm | 2 +- .../script-fu/scripts/test/clothify-v2.scm | 2 +- .../script-fu/scripts/test/clothify-v3.scm | 2 +- plug-ins/script-fu/scripts/test/test-v3.scm | 2 +- plug-ins/script-fu/scripts/weave.scm | 4 +- 9 files changed, 8 insertions(+), 130 deletions(-) diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c index 438ec0f7bc..b0c853ae17 100644 --- a/app/pdb/internal-procs.c +++ b/app/pdb/internal-procs.c @@ -30,7 +30,7 @@ #include "internal-procs.h" -/* 734 procedures registered total */ +/* 733 procedures registered total */ void internal_procs_init (GimpPDB *pdb) diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c index 050d313c9e..b37b035348 100644 --- a/app/pdb/plug-in-compat-cmds.c +++ b/app/pdb/plug-in-compat-cmds.c @@ -612,44 +612,6 @@ plug_in_bump_map_invoker (GimpProcedure *procedure, error ? *error : NULL); } -static GimpValueArray * -plug_in_c_astretch_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GimpValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GimpDrawable *drawable; - - drawable = g_value_get_object (gimp_value_array_index (args, 2)); - - if (success) - { - if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, - GIMP_PDB_ITEM_CONTENT, error) && - gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)) - { - GeglNode *node = - gegl_node_new_child (NULL, - "operation", "gegl:stretch-contrast", - "keep-colors", (gboolean) FALSE, - NULL); - - gimp_drawable_apply_operation (drawable, progress, - C_("undo-type", "Stretch Contrast"), - node); - g_object_unref (node); - } - else - success = FALSE; - } - - return gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); -} - static GimpValueArray * plug_in_cubism_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -1573,42 +1535,6 @@ register_plug_in_compat_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); - /* - * gimp-plug-in-c-astretch - */ - procedure = gimp_procedure_new (plug_in_c_astretch_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "plug-in-c-astretch"); - gimp_procedure_set_static_help (procedure, - "Stretch contrast to cover the maximum possible range", - "This simple plug-in does an automatic contrast stretch. For each channel in the image, it finds the minimum and maximum values... it uses those values to stretch the individual histograms to the full contrast range. For some images it may do just what you want; for others it may not work that well.", - NULL); - gimp_procedure_set_static_attribution (procedure, - "Compatibility procedure. Please see 'gegl:stretch-contrast' for credits.", - "Compatibility procedure. Please see 'gegl:stretch-contrast' for credits.", - "2013"); - gimp_procedure_add_argument (procedure, - g_param_spec_enum ("run-mode", - "run mode", - "The run mode", - GIMP_TYPE_RUN_MODE, - GIMP_RUN_INTERACTIVE, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_image ("image", - "image", - "Input image (unused)", - FALSE, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_drawable ("drawable", - "drawable", - "Input drawable", - FALSE, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - /* * gimp-plug-in-cubism */ diff --git a/libgimp/gimp.c b/libgimp/gimp.c index e2a9fa8374..9f4064b72c 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -432,6 +432,7 @@ gimp_main (GType plug_in_type, GIMP_TYPE_ARRAY, GIMP_TYPE_PARAM_ARRAY, GIMP_TYPE_INT32_ARRAY, GIMP_TYPE_PARAM_INT32_ARRAY, GIMP_TYPE_DOUBLE_ARRAY, GIMP_TYPE_PARAM_DOUBLE_ARRAY, + GIMP_TYPE_VALUE_ARRAY, GIMP_TYPE_PARAM_VALUE_ARRAY, GIMP_TYPE_CORE_OBJECT_ARRAY, GIMP_TYPE_PARAM_CORE_OBJECT_ARRAY, GIMP_TYPE_DISPLAY, GIMP_TYPE_PARAM_DISPLAY, diff --git a/pdb/groups/plug_in_compat.pdb b/pdb/groups/plug_in_compat.pdb index dfcef44de9..e3c4354fb9 100644 --- a/pdb/groups/plug_in_compat.pdb +++ b/pdb/groups/plug_in_compat.pdb @@ -225,54 +225,6 @@ CODE ); } -sub plug_in_c_astretch { - $blurb = 'Stretch contrast to cover the maximum possible range'; - - $help = <<'HELP'; -This simple plug-in does an automatic contrast stretch. For each -channel in the image, it finds the minimum and maximum values... it -uses those values to stretch the individual histograms to the full -contrast range. For some images it may do just what you want; for -others it may not work that well. -HELP - - &std_pdb_compat('gegl:stretch-contrast'); - $date = '2013'; - - @inargs = ( - { name => 'run_mode', type => 'enum GimpRunMode', dead => 1, - desc => 'The run mode' }, - { name => 'image', type => 'image', dead => 1, - desc => 'Input image (unused)' }, - { name => 'drawable', type => 'drawable', - desc => 'Input drawable' } - ); - - %invoke = ( - code => <<'CODE' -{ - if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, - GIMP_PDB_ITEM_CONTENT, error) && - gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error)) - { - GeglNode *node = - gegl_node_new_child (NULL, - "operation", "gegl:stretch-contrast", - "keep-colors", (gboolean) FALSE, - NULL); - - gimp_drawable_apply_operation (drawable, progress, - C_("undo-type", "Stretch Contrast"), - node); - g_object_unref (node); - } - else - success = FALSE; -} -CODE - ); -} - sub plug_in_cubism { $blurb = 'Convert the image into randomly rotated square blobs'; @@ -1517,7 +1469,6 @@ CODE @procs = qw(plug_in_autocrop plug_in_autocrop_layer plug_in_bump_map - plug_in_c_astretch plug_in_cubism plug_in_displace plug_in_edge diff --git a/plug-ins/script-fu/scripts/clothify.scm b/plug-ins/script-fu/scripts/clothify.scm index 10a7fc9b2b..b734999639 100644 --- a/plug-ins/script-fu/scripts/clothify.scm +++ b/plug-ins/script-fu/scripts/clothify.scm @@ -37,7 +37,7 @@ (gimp-image-flatten img) (set! bump-layer (vector-ref (car (gimp-image-get-selected-layers img)) 0)) - (plug-in-c-astretch RUN-NONINTERACTIVE img bump-layer) + (gimp-drawable-merge-new-filter bump-layer "gegl:stretch-contrast" 0 LAYER-MODE-REPLACE 1.0 "keep-colors" FALSE) (plug-in-noisify RUN-NONINTERACTIVE img bump-layer FALSE 0.2 0.2 0.2 0.2) (plug-in-bump-map RUN-NONINTERACTIVE img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0) diff --git a/plug-ins/script-fu/scripts/test/clothify-v2.scm b/plug-ins/script-fu/scripts/test/clothify-v2.scm index 4d4335f8e3..69cb2efd44 100644 --- a/plug-ins/script-fu/scripts/test/clothify-v2.scm +++ b/plug-ins/script-fu/scripts/test/clothify-v2.scm @@ -39,7 +39,7 @@ (gimp-image-flatten img) (set! bump-layer (vector-ref (cadr (gimp-image-get-selected-layers img)) 0)) - (plug-in-c-astretch RUN-NONINTERACTIVE img bump-layer) + (gimp-drawable-merge-new-filter bump-layer "gegl:stretch-contrast" 0 LAYER-MODE-REPLACE 1.0 "keep-colors" FALSE) (plug-in-noisify RUN-NONINTERACTIVE img bump-layer FALSE 0.2 0.2 0.2 0.2) (plug-in-bump-map RUN-NONINTERACTIVE img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0) diff --git a/plug-ins/script-fu/scripts/test/clothify-v3.scm b/plug-ins/script-fu/scripts/test/clothify-v3.scm index 23c93b04be..825dace823 100644 --- a/plug-ins/script-fu/scripts/test/clothify-v3.scm +++ b/plug-ins/script-fu/scripts/test/clothify-v3.scm @@ -40,7 +40,7 @@ (gimp-image-flatten img) (set! bump-layer (car (list (vector-ref (cadr (gimp-image-get-selected-layers img)) 0)))) - (plug-in-c-astretch RUN-NONINTERACTIVE img bump-layer) + (gimp-drawable-merge-new-filter bump-layer "gegl:stretch-contrast" 0 LAYER-MODE-REPLACE 1.0 "keep-colors" FALSE) (plug-in-noisify RUN-NONINTERACTIVE img bump-layer FALSE 0.2 0.2 0.2 0.2) (plug-in-bump-map RUN-NONINTERACTIVE img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0) diff --git a/plug-ins/script-fu/scripts/test/test-v3.scm b/plug-ins/script-fu/scripts/test/test-v3.scm index bcc908cf9b..db28d24032 100644 --- a/plug-ins/script-fu/scripts/test/test-v3.scm +++ b/plug-ins/script-fu/scripts/test/test-v3.scm @@ -46,7 +46,7 @@ ; We still need cadr even in v3 language (set! bump-layer (vector-ref (cadr (gimp-image-get-selected-layers img)) 0)) - (plug-in-c-astretch RUN-NONINTERACTIVE img bump-layer) + (gimp-drawable-merge-new-filter bump-layer "gegl:stretch-contrast" 0 LAYER-MODE-REPLACE 1.0 "keep-colors" FALSE) (plug-in-noisify RUN-NONINTERACTIVE img bump-layer FALSE 0.2 0.2 0.2 0.2) (plug-in-bump-map RUN-NONINTERACTIVE img tdrawable bump-layer azimuth elevation depth 0 0 0 0 FALSE FALSE 0) diff --git a/plug-ins/script-fu/scripts/weave.scm b/plug-ins/script-fu/scripts/weave.scm index 13022f64d8..0ea5e7125a 100644 --- a/plug-ins/script-fu/scripts/weave.scm +++ b/plug-ins/script-fu/scripts/weave.scm @@ -284,12 +284,12 @@ (gimp-context-set-background '(255 255 255)) (gimp-drawable-edit-fill drawable FILL-BACKGROUND) (plug-in-noisify RUN-NONINTERACTIVE img drawable FALSE dense dense dense dense) - (plug-in-c-astretch RUN-NONINTERACTIVE img drawable) + (gimp-drawable-merge-new-filter drawable "gegl:stretch-contrast" 0 LAYER-MODE-REPLACE 1.0 "keep-colors" FALSE) (cond ((eq? orientation 'horizontal) (plug-in-gauss RUN-NONINTERACTIVE img drawable (* 0.32 length) 0 0)) ((eq? orientation 'vertical) (plug-in-gauss RUN-NONINTERACTIVE img drawable 0 (* 0.32 length) 0))) - (plug-in-c-astretch RUN-NONINTERACTIVE img drawable) + (gimp-drawable-merge-new-filter drawable "gegl:stretch-contrast" 0 LAYER-MODE-REPLACE 1.0 "keep-colors" FALSE) drawable)) (define (create-complete-weave width