diff --git a/ChangeLog b/ChangeLog index 08f8286f1c..c8476f2a17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2003-12-04 Michael Natterer + + * tools/pdbgen/pdb/layer.pdb: renamed gimp_layer_mask() to + gimp_layer_get_mask(). + + * libgimp/gimplayer.h: removed gimp_layer_get_mask_id #define. + + * libgimp/gimpcompat.h: added old stuff. + + * app/pdb/layer_cmds.c + * libgimp/gimplayer_pdb.[ch]: regenerated. + + * libgimp/gimpexport.c + * plug-ins/common/curve_bend.c + * plug-ins/pygimp/pygimp-drawable.c + * plug-ins/script-fu/scripts/image-structure.scm + * plug-ins/xjt/xjt.c: changed accordingly. + 2003-12-04 Sven Neumann * libgimp/gimp.def: updated. diff --git a/app/pdb/layer_cmds.c b/app/pdb/layer_cmds.c index 0412489a4d..238a65b049 100644 --- a/app/pdb/layer_cmds.c +++ b/app/pdb/layer_cmds.c @@ -49,7 +49,7 @@ static ProcRecord layer_resize_to_image_size_proc; static ProcRecord layer_translate_proc; static ProcRecord layer_add_alpha_proc; static ProcRecord layer_set_offsets_proc; -static ProcRecord layer_mask_proc; +static ProcRecord layer_get_mask_proc; static ProcRecord layer_is_floating_sel_proc; static ProcRecord layer_new_from_drawable_proc; static ProcRecord layer_get_preserve_trans_proc; @@ -77,7 +77,7 @@ register_layer_procs (Gimp *gimp) procedural_db_register (gimp, &layer_translate_proc); procedural_db_register (gimp, &layer_add_alpha_proc); procedural_db_register (gimp, &layer_set_offsets_proc); - procedural_db_register (gimp, &layer_mask_proc); + procedural_db_register (gimp, &layer_get_mask_proc); procedural_db_register (gimp, &layer_is_floating_sel_proc); procedural_db_register (gimp, &layer_new_from_drawable_proc); procedural_db_register (gimp, &layer_get_preserve_trans_proc); @@ -813,8 +813,8 @@ static ProcRecord layer_set_offsets_proc = }; static Argument * -layer_mask_invoker (Gimp *gimp, - Argument *args) +layer_get_mask_invoker (Gimp *gimp, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -824,7 +824,7 @@ layer_mask_invoker (Gimp *gimp, if (! GIMP_IS_LAYER (layer)) success = FALSE; - return_args = procedural_db_return_args (&layer_mask_proc, success); + return_args = procedural_db_return_args (&layer_get_mask_proc, success); if (success) return_args[1].value.pdb_int = layer->mask ? gimp_item_get_ID (GIMP_ITEM (layer->mask)) : -1; @@ -832,7 +832,7 @@ layer_mask_invoker (Gimp *gimp, return return_args; } -static ProcArg layer_mask_inargs[] = +static ProcArg layer_get_mask_inargs[] = { { GIMP_PDB_LAYER, @@ -841,7 +841,7 @@ static ProcArg layer_mask_inargs[] = } }; -static ProcArg layer_mask_outargs[] = +static ProcArg layer_get_mask_outargs[] = { { GIMP_PDB_CHANNEL, @@ -850,9 +850,9 @@ static ProcArg layer_mask_outargs[] = } }; -static ProcRecord layer_mask_proc = +static ProcRecord layer_get_mask_proc = { - "gimp_layer_mask", + "gimp_layer_get_mask", "Get the specified layer's mask if it exists.", "This procedure returns the specified layer's mask, or -1 if none exists.", "Spencer Kimball & Peter Mattis", @@ -860,10 +860,10 @@ static ProcRecord layer_mask_proc = "1995-1996", GIMP_INTERNAL, 1, - layer_mask_inargs, + layer_get_mask_inargs, 1, - layer_mask_outargs, - { { layer_mask_invoker } } + layer_get_mask_outargs, + { { layer_get_mask_invoker } } }; static Argument * diff --git a/devel-docs/ChangeLog b/devel-docs/ChangeLog index 5ff8614ebe..ca4db83a44 100644 --- a/devel-docs/ChangeLog +++ b/devel-docs/ChangeLog @@ -1,3 +1,8 @@ +2003-12-04 Michael Natterer + + * libgimp/libgimp-sections.txt + * libgimp/tmpl/gimplayer.sgml: follow gimp_layer_get_mask() change. + 2003-12-04 Michael Natterer * libgimp/libgimp-sections.txt diff --git a/devel-docs/libgimp/libgimp-sections.txt b/devel-docs/libgimp/libgimp-sections.txt index 19bcfcc7cc..38a917efe3 100644 --- a/devel-docs/libgimp/libgimp-sections.txt +++ b/devel-docs/libgimp/libgimp-sections.txt @@ -393,7 +393,7 @@ gimp_layer_resize_to_image_size gimp_layer_translate gimp_layer_add_alpha gimp_layer_set_offsets -gimp_layer_mask +gimp_layer_get_mask gimp_layer_new_from_drawable gimp_layer_get_preserve_trans gimp_layer_set_preserve_trans @@ -407,7 +407,6 @@ gimp_layer_get_opacity gimp_layer_set_opacity gimp_layer_get_mode gimp_layer_set_mode -gimp_layer_get_mask_id gimp_layer_is_floating_sel gimp_layer_is_floating_selection gimp_layer_get_preserve_transparency diff --git a/devel-docs/libgimp/tmpl/gimplayer.sgml b/devel-docs/libgimp/tmpl/gimplayer.sgml index 8c78cd8a86..1bc00472b6 100644 --- a/devel-docs/libgimp/tmpl/gimplayer.sgml +++ b/devel-docs/libgimp/tmpl/gimplayer.sgml @@ -114,7 +114,7 @@ Operations on single layers. @Returns: - + @@ -247,14 +247,6 @@ Operations on single layers. @Returns: - - - - - -@Returns: - - diff --git a/libgimp/gimpcompat.h b/libgimp/gimpcompat.h index 2e9b33468c..6972b1128d 100644 --- a/libgimp/gimpcompat.h +++ b/libgimp/gimpcompat.h @@ -64,6 +64,9 @@ G_BEGIN_DECLS #define gimp_layer_get_tattoo gimp_drawable_get_tattoo #define gimp_layer_set_tattoo gimp_drawable_set_tattoo +#define gimp_layer_mask gimp_layer_get_mask +#define gimp_layer_get_mask_id gimp_layer_get_mask + #define gimp_drawable_image gimp_drawable_get_image #define gimp_drawable_image_id gimp_drawable_get_image #define gimp_drawable_name gimp_drawable_get_name diff --git a/libgimp/gimpexport.c b/libgimp/gimpexport.c index 89e84fab0e..57656e3f46 100644 --- a/libgimp/gimpexport.c +++ b/libgimp/gimpexport.c @@ -140,7 +140,7 @@ export_apply_masks (gint32 image_ID, for (i = 0; i < n_layers; i++) { - if (gimp_layer_mask (layers[i]) != -1) + if (gimp_layer_get_mask (layers[i]) != -1) gimp_image_remove_layer_mask (image_ID, layers[i], GIMP_MASK_APPLY); } @@ -716,7 +716,7 @@ gimp_export_image (gint32 *image_ID, { for (i = 0; i < n_layers; i++) { - if (gimp_layer_mask (layers[i]) != -1) + if (gimp_layer_get_mask (layers[i]) != -1) has_layer_masks = TRUE; } } diff --git a/libgimp/gimplayer.h b/libgimp/gimplayer.h index 591b45d384..fcc170b931 100644 --- a/libgimp/gimplayer.h +++ b/libgimp/gimplayer.h @@ -26,7 +26,6 @@ G_BEGIN_DECLS /* For information look into the C source or the html documentation */ -#define gimp_layer_get_mask_id gimp_layer_mask #define gimp_layer_is_floating_selection gimp_layer_is_floating_sel #define gimp_layer_get_preserve_transparency gimp_layer_get_preserve_trans #define gimp_layer_set_preserve_transparency gimp_layer_set_preserve_trans diff --git a/libgimp/gimplayer_pdb.c b/libgimp/gimplayer_pdb.c index d73a8392f5..0c7f1cbe53 100644 --- a/libgimp/gimplayer_pdb.c +++ b/libgimp/gimplayer_pdb.c @@ -386,7 +386,7 @@ gimp_layer_set_offsets (gint32 layer_ID, } /** - * gimp_layer_mask: + * gimp_layer_get_mask: * @layer_ID: The layer. * * Get the specified layer's mask if it exists. @@ -397,13 +397,13 @@ gimp_layer_set_offsets (gint32 layer_ID, * Returns: The layer mask. */ gint32 -gimp_layer_mask (gint32 layer_ID) +gimp_layer_get_mask (gint32 layer_ID) { GimpParam *return_vals; gint nreturn_vals; gint32 mask_ID = -1; - return_vals = gimp_run_procedure ("gimp_layer_mask", + return_vals = gimp_run_procedure ("gimp_layer_get_mask", &nreturn_vals, GIMP_PDB_LAYER, layer_ID, GIMP_PDB_END); diff --git a/libgimp/gimplayer_pdb.h b/libgimp/gimplayer_pdb.h index 1f2f2cf283..d0ba917637 100644 --- a/libgimp/gimplayer_pdb.h +++ b/libgimp/gimplayer_pdb.h @@ -57,7 +57,7 @@ gboolean gimp_layer_add_alpha (gint32 laye gboolean gimp_layer_set_offsets (gint32 layer_ID, gint offx, gint offy); -gint32 gimp_layer_mask (gint32 layer_ID); +gint32 gimp_layer_get_mask (gint32 layer_ID); gboolean gimp_layer_is_floating_sel (gint32 layer_ID); gint32 gimp_layer_new_from_drawable (gint32 drawable_ID, gint32 dest_image_ID); diff --git a/plug-ins/common/curve_bend.c b/plug-ins/common/curve_bend.c index 8b4e0dad64..2b14cbd367 100644 --- a/plug-ins/common/curve_bend.c +++ b/plug-ins/common/curve_bend.c @@ -370,12 +370,12 @@ p_pdb_procedure_available (const gchar *proc_name) &l_proc_type, &l_nparams, &l_nreturn_vals, &l_params, &l_return_vals)) - { - /* procedure found in PDB */ - return l_nparams; - } + { + /* procedure found in PDB */ + return l_nparams; + } - printf("Warning: Procedure %s not found.\n", proc_name); + g_printerr ("Warning: Procedure %s not found.\n", proc_name); return -1; } @@ -385,77 +385,79 @@ p_gimp_rotate (gint32 image_id, gint32 interpolation, gdouble angle_deg) { - static char *l_rotate_proc = "gimp_rotate"; - GimpParam *return_vals; - int nreturn_vals; - gdouble l_angle_rad; - int l_nparams; - int l_rc; + static gchar *l_rotate_proc = "gimp_rotate"; + GimpParam *return_vals; + gint nreturn_vals; + gdouble l_angle_rad; + gint l_nparams; + gint l_rc; #ifdef ROTATE_OPTIMIZE - static char *l_rotate_proc2 = "plug_in_rotate"; - gint32 l_angle_step; + static gchar *l_rotate_proc2 = "plug_in_rotate"; + gint32 l_angle_step; - if (angle_deg == 90.0) { l_angle_step = 1; } - else if(angle_deg == 180.0) { l_angle_step = 2; } - else if(angle_deg == 270.0) { l_angle_step = 3; } - else { l_angle_step = 0; } + if (angle_deg == 90.0) { l_angle_step = 1; } + else if(angle_deg == 180.0) { l_angle_step = 2; } + else if(angle_deg == 270.0) { l_angle_step = 3; } + else { l_angle_step = 0; } - if(l_angle_step != 0) - { - l_nparams = p_pdb_procedure_available(l_rotate_proc2); + if (l_angle_step != 0) + { + l_nparams = p_pdb_procedure_available (l_rotate_proc2); if (l_nparams == 5) - { - /* use faster rotate plugin on multiples of 90 degrees */ - return_vals = gimp_run_procedure (l_rotate_proc2, - &nreturn_vals, - GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE, - GIMP_PDB_IMAGE, image_id, - GIMP_PDB_DRAWABLE, drawable_id, - GIMP_PDB_INT32, l_angle_step, - GIMP_PDB_INT32, FALSE, /* dont rotate the whole image */ - GIMP_PDB_END); - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) { - return 0; + /* use faster rotate plugin on multiples of 90 degrees */ + return_vals = gimp_run_procedure (l_rotate_proc2, + &nreturn_vals, + GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE, + GIMP_PDB_IMAGE, image_id, + GIMP_PDB_DRAWABLE, drawable_id, + GIMP_PDB_INT32, l_angle_step, + GIMP_PDB_INT32, FALSE, /* dont rotate the whole image */ + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + { + return 0; + } } - - } - - } + } #endif - l_rc = -1; - l_angle_rad = (angle_deg * G_PI) / 180.0; + l_rc = -1; + l_angle_rad = (angle_deg * G_PI) / 180.0; - l_nparams = p_pdb_procedure_available(l_rotate_proc); - if (l_nparams >= 0) - { - /* use the new Interface (Gimp 1.1 style) - * (1.1 knows the image_id where the drawable belongs to) - */ - return_vals = gimp_run_procedure (l_rotate_proc, - &nreturn_vals, - GIMP_PDB_DRAWABLE, drawable_id, - GIMP_PDB_INT32, interpolation, - GIMP_PDB_FLOAT, l_angle_rad, - GIMP_PDB_END); - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - { - l_rc = 0; - } - else - { - printf("Error: %s call failed %d\n", l_rotate_proc, (int)return_vals[0].data.d_status); - } + l_nparams = p_pdb_procedure_available (l_rotate_proc); + if (l_nparams >= 0) + { + /* use the new Interface (Gimp 1.1 style) + * (1.1 knows the image_id where the drawable belongs to) + */ + return_vals = gimp_run_procedure (l_rotate_proc, + &nreturn_vals, + GIMP_PDB_DRAWABLE, drawable_id, + GIMP_PDB_INT32, interpolation, + GIMP_PDB_FLOAT, l_angle_rad, + GIMP_PDB_END); - gimp_destroy_params (return_vals, nreturn_vals); - } - else - { - printf("Error: Procedure %s not found.\n",l_rotate_proc); - } - return l_rc; + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + { + l_rc = 0; + } + else + { + g_printerr ("Error: %s call failed %d\n", + l_rotate_proc, return_vals[0].data.d_status); + } + + gimp_destroy_params (return_vals, nreturn_vals); + } + else + { + g_printerr ("Error: Procedure %s not found.\n", l_rotate_proc); + } + + return l_rc; } /* ============================================================================ @@ -594,10 +596,10 @@ run (const gchar *name, BenderDialog *cd; GimpDrawable *l_active_drawable = NULL; - gint32 l_image_id = -1; - gint32 l_layer_id = -1; - gint32 l_layer_mask_id = -1; - gint32 l_bent_layer_id = -1; + gint32 l_image_id = -1; + gint32 l_layer_id = -1; + gint32 l_layer_mask_id = -1; + gint32 l_bent_layer_id = -1; /* Get the runmode from the in-parameters */ GimpRunMode run_mode = param[0].data.d_int32; @@ -613,71 +615,76 @@ run (const gchar *name, cd = NULL; - l_env = g_getenv("BEND_DEBUG"); + l_env = g_getenv ("BEND_DEBUG"); if (l_env != NULL) - { - if((*l_env != 'n') && (*l_env != 'N')) gb_debug = 1; - } + { + if((*l_env != 'n') && (*l_env != 'N')) gb_debug = 1; + } - if(gb_debug) fprintf(stderr, "\n\nDEBUG: run %s\n", name); + if (gb_debug) g_printerr ("\n\nDEBUG: run %s\n", name); - /* initialize the return of the status */ - values[0].type = GIMP_PDB_STATUS; + values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; - values[1].type = GIMP_PDB_LAYER; + + values[1].type = GIMP_PDB_LAYER; values[1].data.d_int32 = -1; + *nreturn_vals = 2; - *return_vals = values; + *return_vals = values; if (strcmp (name, PLUG_IN_ITER_NAME) == 0) - { - gint32 len_struct; - gint32 total_steps; - gdouble current_step; - BenderValues bval; /* current values while iterating */ - BenderValues bval_from, bval_to; /* start and end values */ + { + gint32 len_struct; + gint32 total_steps; + gdouble current_step; + BenderValues bval; /* current values while iterating */ + BenderValues bval_from, bval_to; /* start and end values */ - /* Iterator procedure for animated calls is usually called from - * "plug_in_gap_layers_run_animfilter" - * (always run noninteractive) - */ - if ((run_mode == GIMP_RUN_NONINTERACTIVE) && (nparams == 4)) + /* Iterator procedure for animated calls is usually called from + * "plug_in_gap_layers_run_animfilter" + * (always run noninteractive) + */ + if ((run_mode == GIMP_RUN_NONINTERACTIVE) && (nparams == 4)) { total_steps = param[1].data.d_int32; current_step = param[2].data.d_float; len_struct = param[3].data.d_int32; - if(len_struct == sizeof(bval)) - { - /* get _FROM and _TO data, - * This data was stored by plug_in_gap_layers_run_animfilter - */ + if (len_struct == sizeof (bval)) + { + /* get _FROM and _TO data, + * This data was stored by plug_in_gap_layers_run_animfilter + */ + gimp_get_data (PLUG_IN_DATA_ITER_FROM, &bval_from); + gimp_get_data (PLUG_IN_DATA_ITER_TO, &bval_to); + bval = bval_from; + p_delta_gdouble (&bval.rotation, bval_from.rotation, + bval_to.rotation, total_steps, current_step); + /* note: iteration of curve and points arrays would not give useful results. + * (there might be different number of points in the from/to bender values ) + * the iteration is done later, (see p_bender_calculate_iter_curve) + * when the curve is calculated. + */ - gimp_get_data(PLUG_IN_DATA_ITER_FROM, &bval_from); - gimp_get_data(PLUG_IN_DATA_ITER_TO, &bval_to); - bval = bval_from; + bval.total_steps = total_steps; + bval.current_step = current_step; - p_delta_gdouble(&bval.rotation, bval_from.rotation, bval_to.rotation, total_steps, current_step); - /* note: iteration of curve and points arrays would not give useful results. - * (there might be different number of points in the from/to bender values ) - * the iteration is done later, (see p_bender_calculate_iter_curve) - * when the curve is calculated. - */ - - bval.total_steps = total_steps; - bval.current_step = current_step; - - - gimp_set_data(PLUG_IN_NAME, &bval, sizeof(bval)); - } - else status = GIMP_PDB_CALLING_ERROR; + gimp_set_data (PLUG_IN_NAME, &bval, sizeof (bval)); + } + else + { + status = GIMP_PDB_CALLING_ERROR; + } + } + else + { + status = GIMP_PDB_CALLING_ERROR; } - else status = GIMP_PDB_CALLING_ERROR; - values[0].data.d_status = status; - return; - } + values[0].data.d_status = status; + return; + } /* get image and drawable */ l_image_id = param[1].data.d_int32; @@ -685,118 +692,130 @@ run (const gchar *name, gimp_undo_push_group_start (l_image_id); - if (!gimp_drawable_is_layer(l_layer_id)) - { - gimp_message(_("CurveBend operates on layers only (but was called on channel or mask)")); - status = GIMP_PDB_EXECUTION_ERROR; - } + if (! gimp_drawable_is_layer (l_layer_id)) + { + g_message (_("CurveBend operates on layers only (but was called on channel or mask)")); + status = GIMP_PDB_EXECUTION_ERROR; + } + /* check for layermask */ - l_layer_mask_id = gimp_layer_get_mask_id(l_layer_id); - if(l_layer_mask_id >= 0) - { - /* apply the layermask - * some transitions (especially rotate) cant operate proper on - * layers with masks ! - */ - gimp_image_remove_layer_mask(l_image_id, l_layer_id, 0 /* 0==APPLY */ ); - } + l_layer_mask_id = gimp_layer_get_mask (l_layer_id); + if (l_layer_mask_id >= 0) + { + /* apply the layermask + * some transitions (especially rotate) cant operate proper on + * layers with masks ! + */ + gimp_image_remove_layer_mask (l_image_id, l_layer_id, 0 /* 0==APPLY */ ); + } /* if there is a selection, make it the floating selection layer */ - l_active_drawable = gimp_drawable_get (p_if_selection_float_it(l_image_id, l_layer_id)); + l_active_drawable = gimp_drawable_get (p_if_selection_float_it (l_image_id, + l_layer_id)); /* how are we running today? */ - if(status == GIMP_PDB_SUCCESS) - { - /* how are we running today? */ - switch (run_mode) - { - case GIMP_RUN_INTERACTIVE: - /* Possibly retrieve data from a previous run */ - /* gimp_get_data (PLUG_IN_NAME, &g_bndvals); */ - - /* Get information from the dialog */ - cd = do_dialog(l_active_drawable); - cd->show_progress = TRUE; - break; - - case GIMP_RUN_NONINTERACTIVE: - /* check to see if invoked with the correct number of parameters */ - if (nparams >= 20) + if (status == GIMP_PDB_SUCCESS) + { + /* how are we running today? */ + switch (run_mode) { - cd = g_new (BenderDialog, 1); - cd->run = TRUE; - cd->show_progress = FALSE; - cd->drawable = l_active_drawable; + case GIMP_RUN_INTERACTIVE: + /* Possibly retrieve data from a previous run */ + /* gimp_get_data (PLUG_IN_NAME, &g_bndvals); */ - cd->rotation = (gdouble) param[3].data.d_float; - cd->smoothing = (gint) param[4].data.d_int32; - cd->antialias = (gint) param[5].data.d_int32; - cd->work_on_copy = (gint) param[6].data.d_int32; - cd->curve_type = (int) param[7].data.d_int32; + /* Get information from the dialog */ + cd = do_dialog (l_active_drawable); + cd->show_progress = TRUE; + break; - p_copy_points(cd, OUTLINE_UPPER, 0, (int)param[8].data.d_int32, param[9].data.d_floatarray); - p_copy_points(cd, OUTLINE_UPPER, 1, (int)param[10].data.d_int32, param[11].data.d_floatarray); - p_copy_points(cd, OUTLINE_LOWER, 0, (int)param[12].data.d_int32, param[13].data.d_floatarray); - p_copy_points(cd, OUTLINE_LOWER, 1, (int)param[14].data.d_int32, param[15].data.d_floatarray); + case GIMP_RUN_NONINTERACTIVE: + /* check to see if invoked with the correct number of parameters */ + if (nparams >= 20) + { + cd = g_new (BenderDialog, 1); + cd->run = TRUE; + cd->show_progress = FALSE; + cd->drawable = l_active_drawable; - p_copy_yval(cd, OUTLINE_UPPER, (int)param[16].data.d_int32, param[17].data.d_int8array); - p_copy_yval(cd, OUTLINE_UPPER, (int)param[18].data.d_int32, param[19].data.d_int8array); + cd->rotation = (gdouble) param[3].data.d_float; + cd->smoothing = (gint) param[4].data.d_int32; + cd->antialias = (gint) param[5].data.d_int32; + cd->work_on_copy = (gint) param[6].data.d_int32; + cd->curve_type = (gint) param[7].data.d_int32; + p_copy_points (cd, OUTLINE_UPPER, 0, + param[8].data.d_int32, + param[9].data.d_floatarray); + p_copy_points (cd, OUTLINE_UPPER, 1, + param[10].data.d_int32, + param[11].data.d_floatarray); + p_copy_points (cd, OUTLINE_LOWER, 0, + param[12].data.d_int32, + param[13].data.d_floatarray); + p_copy_points (cd, OUTLINE_LOWER, 1, + param[14].data.d_int32, + param[15].data.d_floatarray); + + p_copy_yval (cd, OUTLINE_UPPER, + param[16].data.d_int32, + param[17].data.d_int8array); + p_copy_yval (cd, OUTLINE_UPPER, + param[18].data.d_int32, + param[19].data.d_int8array); + } + else + { + status = GIMP_PDB_CALLING_ERROR; + } + break; + + case GIMP_RUN_WITH_LAST_VALS: + cd = g_new (BenderDialog, 1); + cd->run = TRUE; + cd->show_progress = TRUE; + cd->drawable = l_active_drawable; + p_retrieve_values (cd); /* Possibly retrieve data from a previous run */ + break; + + default: + break; } - else - { - status = GIMP_PDB_CALLING_ERROR; - } - - break; - - case GIMP_RUN_WITH_LAST_VALS: - cd = g_new (BenderDialog, 1); - cd->run = TRUE; - cd->show_progress = TRUE; - cd->drawable = l_active_drawable; - p_retrieve_values(cd); /* Possibly retrieve data from a previous run */ - break; - - default: - break; } - } - if (!cd) - { - status = GIMP_PDB_EXECUTION_ERROR; - } + if (! cd) + { + status = GIMP_PDB_EXECUTION_ERROR; + } if (status == GIMP_PDB_SUCCESS) - { - /* Run the main function */ - - if (cd->run) - { - l_bent_layer_id = p_main_bend(cd, cd->drawable, cd->work_on_copy); - - /* Store variable states for next run */ - if (run_mode == GIMP_RUN_INTERACTIVE) - { - p_store_values(cd); - } - } - else { - status = GIMP_PDB_EXECUTION_ERROR; /* dialog ended with cancel button */ + /* Run the main function */ + + if (cd->run) + { + l_bent_layer_id = p_main_bend (cd, cd->drawable, cd->work_on_copy); + + /* Store variable states for next run */ + if (run_mode == GIMP_RUN_INTERACTIVE) + { + p_store_values (cd); + } + } + else + { + status = GIMP_PDB_CANCEL; + } + + gimp_undo_push_group_end (l_image_id); + + if (run_mode != GIMP_RUN_NONINTERACTIVE) + gimp_displays_flush (); + } + else + { + gimp_undo_push_group_end (l_image_id); } - gimp_undo_push_group_end (l_image_id); - - if (run_mode != GIMP_RUN_NONINTERACTIVE) - gimp_displays_flush (); - - } - else - { - gimp_undo_push_group_end (l_image_id); - } values[0].data.d_status = status; values[1].data.d_int32 = l_bent_layer_id; /* return the id of handled layer */ } @@ -3266,7 +3285,7 @@ p_main_bend (BenderDialog *cd, l_interpolation, (gdouble)(360.0 - cd->rotation)); /* TODO: here we should crop dst_drawable to cut off full transparent borderpixels */ - + } /* set offsets of the resulting new layer diff --git a/plug-ins/pygimp/pygimp-drawable.c b/plug-ins/pygimp/pygimp-drawable.c index 9aa0d7e5b6..68f556eb81 100644 --- a/plug-ins/pygimp/pygimp-drawable.c +++ b/plug-ins/pygimp/pygimp-drawable.c @@ -606,7 +606,7 @@ lay_get_is_floating_sel(PyGimpLayer *self, void *closure) static PyObject * lay_get_mask(PyGimpLayer *self, void *closure) { - gint32 id = gimp_layer_mask(self->ID); + gint32 id = gimp_layer_get_mask(self->ID); if (id == -1) { Py_INCREF(Py_None); return Py_None; diff --git a/plug-ins/script-fu/scripts/image-structure.scm b/plug-ins/script-fu/scripts/image-structure.scm index 828e9c8a98..238fefbb9c 100644 --- a/plug-ins/script-fu/scripts/image-structure.scm +++ b/plug-ins/script-fu/scripts/image-structure.scm @@ -74,7 +74,7 @@ (gimp-layer-add-alpha layer) (gimp-drawable-set-name layer "Original Background"))) (set! layer-names (cons (car (gimp-drawable-get-name layer)) layer-names)) - (if (not (= -1 (car (gimp-layer-mask layer)))) + (if (not (= -1 (car (gimp-layer-get-mask layer)))) (gimp-image-remove-layer-mask img layer (if (= TRUE apply-layer-mask?) MASK-APPLY diff --git a/plug-ins/xjt/xjt.c b/plug-ins/xjt/xjt.c index 08d54fe1e0..751f047eff 100644 --- a/plug-ins/xjt/xjt.c +++ b/plug-ins/xjt/xjt.c @@ -1772,7 +1772,7 @@ save_xjt_image (const gchar *filename, } /* check and save layer_mask channel */ - l_channel_id = gimp_layer_get_mask_id(l_layer_id); + l_channel_id = gimp_layer_get_mask (l_layer_id); if(l_channel_id >= 0) { l_jpg_file = g_strdup_printf("%s%clm%d.jpg", l_dirname, G_DIR_SEPARATOR, l_idx); diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb index d232e1bb49..a2e43050db 100644 --- a/tools/pdbgen/pdb/layer.pdb +++ b/tools/pdbgen/pdb/layer.pdb @@ -450,7 +450,7 @@ HELP } } -sub layer_mask { +sub layer_get_mask { $blurb = "Get the specified layer's mask if it exists."; $help = <<'HELP'; @@ -594,7 +594,8 @@ CODE2 unshift @procs, qw(layer_new layer_copy layer_create_mask layer_scale layer_resize layer_resize_to_image_size - layer_translate layer_add_alpha layer_set_offsets layer_mask + layer_translate layer_add_alpha layer_set_offsets + layer_get_mask layer_is_floating_sel layer_new_from_drawable); %exports = (app => [@procs], lib => [@procs]);