From cb7d5a179fccf9dd8748da1a8546cc556b3eaf69 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Fri, 25 Aug 2000 15:38:38 +0000 Subject: [PATCH] tools/pdbgen/pdb/fileops.pdb added a few more PDB wrappers 2000-08-25 Sven Neumann * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/selection.pdb: added a few more PDB wrappers * tools/pdbgen/pdb/image.pdb: tweaked the help and blurb strings * app/image_cmds.c * libgimp/gimpfileops_pdb.[ch] * libgimp/gimpimage_pdb.c * libgimp/gimpselection_pdb.[ch]: regenerated * plug-ins/common/bz2.c * plug-ins/common/gz.c * plug-ins/common/mail.c * plug-ins/common/screenshot.c * plug-ins/common/url.c * plug-ins/gdyntext/gdyntext.c * plug-ins/gfig/gfig.c: use new PDB wrappers. For GDynText this change fixes a bug since it used to use the wrong number of arguments for gimp_selection_load(). * plug-ins/flame/rect.[ch]: removed compiler warning --- ChangeLog | 24 ++ app/image_cmds.c | 46 +-- devel-docs/ChangeLog | 7 + devel-docs/libgimp/libgimp-decl.txt | 86 ++++- devel-docs/libgimp/libgimp-sections.txt | 20 +- devel-docs/libgimp/tmpl/gimpfileops.sgml | 33 ++ devel-docs/libgimp/tmpl/gimpselection.sgml | 157 +++++++- libgimp/gimpfileops_pdb.c | 118 ++++++ libgimp/gimpfileops_pdb.h | 29 +- libgimp/gimpimage_pdb.c | 55 ++- libgimp/gimpselection_pdb.c | 430 +++++++++++++++++++++ libgimp/gimpselection_pdb.h | 43 ++- plug-ins/common/bz2.c | 114 ++---- plug-ins/common/compressor.c | 92 ++--- plug-ins/common/gz.c | 92 ++--- plug-ins/common/mail.c | 64 +-- plug-ins/common/screenshot.c | 7 +- plug-ins/common/url.c | 42 +- plug-ins/flame/rect.c | 2 +- plug-ins/flame/rect.h | 2 +- plug-ins/gdyntext/gdyntext.c | 14 +- plug-ins/gfig/gfig.c | 38 +- plug-ins/uri/uri-backend-wget.c | 42 +- plug-ins/uri/uri.c | 42 +- tools/pdbgen/pdb/fileops.pdb | 2 +- tools/pdbgen/pdb/image.pdb | 32 +- tools/pdbgen/pdb/selection.pdb | 2 +- 27 files changed, 1149 insertions(+), 486 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6f3ca6080..9b92d98051 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2000-08-25 Sven Neumann + + * tools/pdbgen/pdb/fileops.pdb + * tools/pdbgen/pdb/selection.pdb: added a few more PDB wrappers + + * tools/pdbgen/pdb/image.pdb: tweaked the help and blurb strings + + * app/image_cmds.c + * libgimp/gimpfileops_pdb.[ch] + * libgimp/gimpimage_pdb.c + * libgimp/gimpselection_pdb.[ch]: regenerated + + * plug-ins/common/bz2.c + * plug-ins/common/gz.c + * plug-ins/common/mail.c + * plug-ins/common/screenshot.c + * plug-ins/common/url.c + * plug-ins/gdyntext/gdyntext.c + * plug-ins/gfig/gfig.c: use new PDB wrappers. + For GDynText this change fixes a bug since it used to use the + wrong number of arguments for gimp_selection_load(). + + * plug-ins/flame/rect.[ch]: removed compiler warning + 2000-08-25 Sven Neumann * libgimp/gimpchannel.c diff --git a/app/image_cmds.c b/app/image_cmds.c index 27f80410a8..217f38d400 100644 --- a/app/image_cmds.c +++ b/app/image_cmds.c @@ -2487,7 +2487,7 @@ static ProcRecord image_thumbnail_proc = { "gimp_image_thumbnail", "Get a thumbnail of an image.", - "This function gets data from which a thumbnail of an image preview can be created. Maximum x or y dimension is 128 pixels. The pixles are returned in the RGB[A] format. The bpp return value gives the number of bytes in the image. The alpha channel also returned if the image has one.", + "This function gets data from which a thumbnail of an image preview can be created. Maximum x or y dimension is 128 pixels. The pixels are returned in the RGB[A] format. The bpp return value gives the number of bits per pixel in the image. If the image has an alpha channel, it is also returned.", "Andy Thomas", "Andy Thomas", "1999", @@ -2759,7 +2759,7 @@ static ProcArg image_get_active_layer_outargs[] = static ProcRecord image_get_active_layer_proc = { "gimp_image_get_active_layer", - "Returns if the specified image's active layer.", + "Returns the specified image's active layer.", "If there is an active layer, its ID will be returned, otherwise, -1. If a channel is currently active, then no layer will be. If a layer mask is active, then this will return the associated layer.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", @@ -2810,7 +2810,7 @@ static ProcArg image_set_active_layer_inargs[] = static ProcRecord image_set_active_layer_proc = { "gimp_image_set_active_layer", - "Sets if the specified image's active layer.", + "Sets the specified image's active layer.", "If the layer exists, it is set as the active layer in the image. Any previous active layer or channel is set to inactive. An exception is a previously existing floating selection, in which case this procedure will return an execution error.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", @@ -2867,7 +2867,7 @@ static ProcArg image_get_active_channel_outargs[] = static ProcRecord image_get_active_channel_proc = { "gimp_image_get_active_channel", - "Returns if the specified image's active channel.", + "Returns the specified image's active channel.", "If there is an active channel, this will return the channel ID, otherwise, -1.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", @@ -2918,7 +2918,7 @@ static ProcArg image_set_active_channel_inargs[] = static ProcRecord image_set_active_channel_proc = { "gimp_image_set_active_channel", - "Sets if the specified image's active channel.", + "Sets the specified image's active channel.", "If the channel exists, it is set as the active channel in the image. Any previous active channel or channel is set to inactive. An exception is a previously existing floating selection, in which case this procedure will return an execution error.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", @@ -2975,8 +2975,8 @@ static ProcArg image_get_selection_outargs[] = static ProcRecord image_get_selection_proc = { "gimp_image_get_selection", - "Returns if the specified image's selection.", - "This will always return a valid ID for a selection--which is represented as a channel internally.", + "Returns the specified image's selection.", + "This will always return a valid ID for a selection -- which is represented as a channel internally.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3049,7 +3049,7 @@ static ProcRecord image_get_component_active_proc = { "gimp_image_get_component_active", "Returns if the specified image's image component is active.", - "This procedure returns if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is active or inactive--whether or not it can be modified. If the specified component is not valid for the image type, an error is returned.", + "This procedure returns if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is active or inactive -- whether or not it can be modified. If the specified component is not valid for the image type, an error is returned.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3118,7 +3118,7 @@ static ProcRecord image_set_component_active_proc = { "gimp_image_set_component_active", "Sets if the specified image's image component is active.", - "This procedure sets if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is active or inactive--whether or not it can be modified. If the specified component is not valid for the image type, an error is returned.", + "This procedure sets if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is active or inactive -- whether or not it can be modified. If the specified component is not valid for the image type, an error is returned.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3191,7 +3191,7 @@ static ProcRecord image_get_component_visible_proc = { "gimp_image_get_component_visible", "Returns if the specified image's image component is visible.", - "This procedure returns if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is visible or invisible--whether or not it can be seen. If the specified component is not valid for the image type, an error is returned.", + "This procedure returns if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is visible or invisible -- whether or not it can be seen. If the specified component is not valid for the image type, an error is returned.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3260,7 +3260,7 @@ static ProcRecord image_set_component_visible_proc = { "gimp_image_set_component_visible", "Sets if the specified image's image component is visible.", - "This procedure sets if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is visible or invisible--whether or not it can be seen. If the specified component is not valid for the image type, an error is returned.", + "This procedure sets if the specified image's image component (i.e. Red, Green, Blue intensity channels in an RGB image) is visible or invisible -- whether or not it can be seen. If the specified component is not valid for the image type, an error is returned.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3312,8 +3312,8 @@ static ProcArg image_get_filename_outargs[] = static ProcRecord image_get_filename_proc = { "gimp_image_get_filename", - "Returns if the specified image's filename.", - "This procedure returns if the specified image's filename--if it was loaded or has since been saved. Otherwise, returns NULL.", + "Returns the specified image's filename.", + "This procedure returns the specified image's filename -- if it was loaded or has since been saved. Otherwise, returns NULL.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3363,8 +3363,8 @@ static ProcArg image_set_filename_inargs[] = static ProcRecord image_set_filename_proc = { "gimp_image_set_filename", - "Sets if the specified image's filename.", - "This procedure sets if the specified image's filename.", + "Sets the specified image's filename.", + "This procedure sets the specified image's filename.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1995-1996", @@ -3424,8 +3424,8 @@ static ProcArg image_get_resolution_outargs[] = static ProcRecord image_get_resolution_proc = { "gimp_image_get_resolution", - "Returns if the specified image's resolution.", - "This procedure returns if the specified image's resolution in dots per inch. This value is independent of any of the layers in this image.", + "Returns the specified image's resolution.", + "This procedure returns the specified image's resolution in dots per inch. This value is independent of any of the layers in this image.", "Austin Donnelly", "Austin Donnelly", "1998", @@ -3496,8 +3496,8 @@ static ProcArg image_set_resolution_inargs[] = static ProcRecord image_set_resolution_proc = { "gimp_image_set_resolution", - "Sets if the specified image's resolution.", - "This procedure sets if the specified image's resolution in dots per inch. This value is independent of any of the layers in this image. No scaling or resizing is performed.", + "Sets the specified image's resolution.", + "This procedure sets the specified image's resolution in dots per inch. This value is independent of any of the layers in this image. No scaling or resizing is performed.", "Austin Donnelly", "Austin Donnelly", "1998", @@ -3549,8 +3549,8 @@ static ProcArg image_get_unit_outargs[] = static ProcRecord image_get_unit_proc = { "gimp_image_get_unit", - "Returns if the specified image's unit.", - "This procedure returns if the specified image's unit. This value is independent of any of the layers in this image. See the gimp_unit_* procedure definitions for the valid range of unit IDs and a description of the unit system.", + "Returns the specified image's unit.", + "This procedure returns the specified image's unit. This value is independent of any of the layers in this image. See the gimp_unit_* procedure definitions for the valid range of unit IDs and a description of the unit system.", "Michael Natterer", "Michael Natterer", "1998", @@ -3600,8 +3600,8 @@ static ProcArg image_set_unit_inargs[] = static ProcRecord image_set_unit_proc = { "gimp_image_set_unit", - "Sets if the specified image's unit.", - "This procedure sets if the specified image's unit. No scaling or resizing is performed. This value is independent of any of the layers in this image. See the gimp_unit_* procedure definitions for the valid range of unit IDs and a description of the unit system.", + "Sets the specified image's unit.", + "This procedure sets the specified image's unit. No scaling or resizing is performed. This value is independent of any of the layers in this image. See the gimp_unit_* procedure definitions for the valid range of unit IDs and a description of the unit system.", "Michael Natterer", "Michael Natterer", "1998", diff --git a/devel-docs/ChangeLog b/devel-docs/ChangeLog index 4b99ace0d1..66f8adf4a2 100644 --- a/devel-docs/ChangeLog +++ b/devel-docs/ChangeLog @@ -1,3 +1,10 @@ +2000-08-25 Sven Neumann + + * libgimp/libgimp-decl.txt + * libgimp/libgimp-sections.txt + * libgimp/tmpl/gimpfileops.sgml + * libgimp/tmpl/gimpselection.sgml: updated + 2000-08-24 Sven Neumann * libgimp/*: updated after libgimp API cleanup, moved all diff --git a/devel-docs/libgimp/libgimp-decl.txt b/devel-docs/libgimp/libgimp-decl.txt index bfd0ffdfd0..73cac091d2 100644 --- a/devel-docs/libgimp/libgimp-decl.txt +++ b/devel-docs/libgimp/libgimp-decl.txt @@ -2105,19 +2105,34 @@ typedef enum gint32 *image_ID,gint32 *drawable_ID,gchar *format_name,GimpExportCapabilities capabilities +gimp_file_load +gint32 +GimpRunModeType run_mode,gchar *filename,gchar *raw_filename + + +gimp_file_save +gboolean +GimpRunModeType run_mode,gint32 image_ID,gint32 drawable_ID,gchar *filename,gchar *raw_filename + + +gimp_temp_name +gchar * +gchar *extension + + gimp_register_magic_load_handler gboolean -gchar *procedure_name,gchar *extensions,gchar *prefixes,gchar *magics +gchar *procedure_name,gchar *extensions,gchar *prefixes,gchar *magics gimp_register_load_handler gboolean -gchar *procedure_name,gchar *extensions,gchar *prefixes +gchar *procedure_name,gchar *extensions,gchar *prefixes gimp_register_save_handler gboolean -gchar *procedure_name,gchar *extensions,gchar *prefixes +gchar *procedure_name,gchar *extensions,gchar *prefixes GIMP_TYPE_FILE_SELECTION @@ -4127,15 +4142,80 @@ gint32 image_ID,gint32 drawable_ID,gint offx,gint offy gint32 image_ID,gboolean *non_empty,gint *x1,gint *y1,gint *x2,gint *y2 +gimp_selection_value +gint +gint32 image_ID,gint x,gint y + + gimp_selection_is_empty gboolean gint32 image_ID +gimp_selection_translate +gboolean +gint32 image_ID,gint offx,gint offy + + +gimp_selection_clear +gboolean +gint32 image_ID + + +gimp_selection_invert +gboolean +gint32 image_ID + + +gimp_selection_sharpen +gboolean +gint32 image_ID + + +gimp_selection_all +gboolean +gint32 image_ID + + gimp_selection_none gboolean gint32 image_ID + +gimp_selection_feather +gboolean +gint32 image_ID,gdouble radius + + +gimp_selection_border +gboolean +gint32 image_ID,gint radius + + +gimp_selection_grow +gboolean +gint32 image_ID,gint steps + + +gimp_selection_shrink +gboolean +gint32 image_ID,gint radius + + +gimp_selection_layer_alpha +gboolean +gint32 layer_ID + + +gimp_selection_load +gboolean +gint32 channel_ID + + +gimp_selection_save +gint32 +gint32 image_ID + SA_RESTART #define SA_RESTART SA_SYSV diff --git a/devel-docs/libgimp/libgimp-sections.txt b/devel-docs/libgimp/libgimp-sections.txt index 5167b1fe31..e6db7fd9f1 100644 --- a/devel-docs/libgimp/libgimp-sections.txt +++ b/devel-docs/libgimp/libgimp-sections.txt @@ -641,6 +641,9 @@ gimp_edit_stroke
gimpfileops +gimp_temp_name +gimp_file_load +gimp_file_save gimp_register_magic_load_handler gimp_register_load_handler gimp_register_save_handler @@ -887,10 +890,23 @@ gimp_procedural_db_get_data_size
gimpselection -gimp_selection_float gimp_selection_bounds -gimp_selection_is_empty +gimp_selection_all gimp_selection_none +gimp_selection_clear +gimp_selection_is_empty +gimp_selection_float +gimp_selection_load +gimp_selection_save +gimp_selection_value +gimp_selection_grow +gimp_selection_shrink +gimp_selection_invert +gimp_selection_feather +gimp_selection_sharpen +gimp_selection_border +gimp_selection_translate +gimp_selection_layer_alpha
diff --git a/devel-docs/libgimp/tmpl/gimpfileops.sgml b/devel-docs/libgimp/tmpl/gimpfileops.sgml index 4753a6fcbe..233c7639dc 100644 --- a/devel-docs/libgimp/tmpl/gimpfileops.sgml +++ b/devel-docs/libgimp/tmpl/gimpfileops.sgml @@ -14,6 +14,39 @@ gimpfileops + + + + + +@extension: +@Returns: + + + + + + + +@run_mode: +@filename: +@raw_filename: +@Returns: + + + + + + + +@run_mode: +@image_ID: +@drawable_ID: +@filename: +@raw_filename: +@Returns: + + diff --git a/devel-docs/libgimp/tmpl/gimpselection.sgml b/devel-docs/libgimp/tmpl/gimpselection.sgml index 68b53adb8b..0762ca9b77 100644 --- a/devel-docs/libgimp/tmpl/gimpselection.sgml +++ b/devel-docs/libgimp/tmpl/gimpselection.sgml @@ -14,21 +14,6 @@ gimpselection - - - - - -@image_ID: -@drawable_ID: -@offx: -@offy: -@Returns: - -@x_offset: -@y_offset: - - @@ -45,7 +30,7 @@ gimpselection @none_empty: - + @@ -63,3 +48,143 @@ gimpselection @Returns: + + + + + +@image_ID: +@Returns: + + + + + + + +@image_ID: +@Returns: + + + + + + + +@image_ID: +@drawable_ID: +@offx: +@offy: +@Returns: + +@x_offset: +@y_offset: + + + + + + + +@channel_ID: +@Returns: + + + + + + + +@image_ID: +@Returns: + + + + + + + +@image_ID: +@x: +@y: +@Returns: + + + + + + + +@image_ID: +@steps: +@Returns: + + + + + + + +@image_ID: +@radius: +@Returns: + + + + + + + +@image_ID: +@Returns: + + + + + + + +@image_ID: +@radius: +@Returns: + + + + + + + +@image_ID: +@Returns: + + + + + + + +@image_ID: +@radius: +@Returns: + + + + + + + +@image_ID: +@offx: +@offy: +@Returns: + + + + + + + +@layer_ID: +@Returns: + + diff --git a/libgimp/gimpfileops_pdb.c b/libgimp/gimpfileops_pdb.c index 4b42e94899..7c05356b6c 100644 --- a/libgimp/gimpfileops_pdb.c +++ b/libgimp/gimpfileops_pdb.c @@ -23,6 +23,124 @@ #include "gimp.h" +/** + * gimp_file_load: + * @run_mode: The run mode. + * @filename: The name of the file to load. + * @raw_filename: The name entered. + * + * Loads a file by extension. + * + * This procedure invokes the correct file load handler according to + * the file's extension and/or prefix. The name of the file to load is + * typically a full pathname, and the name entered is what the user + * actually typed before prepending a directory path. The reason for + * this is that if the user types http://www.xcf/~gimp/ he wants to + * fetch a URL, and the full pathname will not look like a URL. + * + * Returns: The output image. + */ +gint32 +gimp_file_load (GimpRunModeType run_mode, + gchar *filename, + gchar *raw_filename) +{ + GimpParam *return_vals; + gint nreturn_vals; + gint32 image_ID = -1; + + return_vals = gimp_run_procedure ("gimp_file_load", + &nreturn_vals, + GIMP_PDB_INT32, run_mode, + GIMP_PDB_STRING, filename, + GIMP_PDB_STRING, raw_filename, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + image_ID = return_vals[1].data.d_image; + + gimp_destroy_params (return_vals, nreturn_vals); + + return image_ID; +} + +/** + * gimp_file_save: + * @run_mode: The run mode. + * @image_ID: Input image. + * @drawable_ID: Drawable to save. + * @filename: The name of the file to save the image in. + * @raw_filename: The name of the file to save the image in. + * + * Saves a file by extension. + * + * This procedure invokes the correct file save handler according to + * the file's extension and/or prefix. The name of the file to save is + * typically a full pathname, and the name entered is what the user + * actually typed before prepending a directory path. The reason for + * this is that if the user types http://www.xcf/~gimp/ she wants to + * fetch a URL, and the full pathname will not look like a URL. + * + * Returns: TRUE on success. + */ +gboolean +gimp_file_save (GimpRunModeType run_mode, + gint32 image_ID, + gint32 drawable_ID, + gchar *filename, + gchar *raw_filename) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_file_save", + &nreturn_vals, + GIMP_PDB_INT32, run_mode, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_DRAWABLE, drawable_ID, + GIMP_PDB_STRING, filename, + GIMP_PDB_STRING, raw_filename, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_temp_name: + * @extension: The extension the file will have. + * + * Generates a unique filename. + * + * Generates a unique filename using the temp path supplied in the + * user's gimprc. + * + * Returns: The new temp filename. + */ +gchar * +gimp_temp_name (gchar *extension) +{ + GimpParam *return_vals; + gint nreturn_vals; + gchar *name = NULL; + + return_vals = gimp_run_procedure ("gimp_temp_name", + &nreturn_vals, + GIMP_PDB_STRING, extension, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + name = g_strdup (return_vals[1].data.d_string); + + gimp_destroy_params (return_vals, nreturn_vals); + + return name; +} + /** * gimp_register_magic_load_handler: * @procedure_name: The name of the procedure to be used for loading. diff --git a/libgimp/gimpfileops_pdb.h b/libgimp/gimpfileops_pdb.h index 81f15d01cd..a05286c414 100644 --- a/libgimp/gimpfileops_pdb.h +++ b/libgimp/gimpfileops_pdb.h @@ -31,16 +31,25 @@ extern "C" { /* For information look into the C source or the html documentation */ -gboolean gimp_register_magic_load_handler (gchar *procedure_name, - gchar *extensions, - gchar *prefixes, - gchar *magics); -gboolean gimp_register_load_handler (gchar *procedure_name, - gchar *extensions, - gchar *prefixes); -gboolean gimp_register_save_handler (gchar *procedure_name, - gchar *extensions, - gchar *prefixes); +gint32 gimp_file_load (GimpRunModeType run_mode, + gchar *filename, + gchar *raw_filename); +gboolean gimp_file_save (GimpRunModeType run_mode, + gint32 image_ID, + gint32 drawable_ID, + gchar *filename, + gchar *raw_filename); +gchar* gimp_temp_name (gchar *extension); +gboolean gimp_register_magic_load_handler (gchar *procedure_name, + gchar *extensions, + gchar *prefixes, + gchar *magics); +gboolean gimp_register_load_handler (gchar *procedure_name, + gchar *extensions, + gchar *prefixes); +gboolean gimp_register_save_handler (gchar *procedure_name, + gchar *extensions, + gchar *prefixes); #ifdef __cplusplus diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c index 7e344ebbe0..7cc5642823 100644 --- a/libgimp/gimpimage_pdb.c +++ b/libgimp/gimpimage_pdb.c @@ -1384,10 +1384,10 @@ gimp_image_floating_sel_attached_to (gint32 image_ID) * Get a thumbnail of an image. * * This function gets data from which a thumbnail of an image preview - * can be created. Maximum x or y dimension is 128 pixels. The pixles + * can be created. Maximum x or y dimension is 128 pixels. The pixels * are returned in the RGB[A] format. The bpp return value gives the - * number of bytes in the image. The alpha channel also returned if the - * image has one. + * number of bits per pixel in the image. If the image has an alpha + * channel, it is also returned. * * Returns: TRUE on success. */ @@ -1577,7 +1577,7 @@ gimp_image_height (gint32 image_ID) * gimp_image_get_active_layer: * @image_ID: The image. * - * Returns if the specified image's active layer. + * Returns the specified image's active layer. * * If there is an active layer, its ID will be returned, otherwise, -1. * If a channel is currently active, then no layer will be. If a layer @@ -1610,7 +1610,7 @@ gimp_image_get_active_layer (gint32 image_ID) * @image_ID: The image. * @active_layer_ID: The new image active layer. * - * Sets if the specified image's active layer. + * Sets the specified image's active layer. * * If the layer exists, it is set as the active layer in the image. Any * previous active layer or channel is set to inactive. An exception is @@ -1644,7 +1644,7 @@ gimp_image_set_active_layer (gint32 image_ID, * gimp_image_get_active_channel: * @image_ID: The image. * - * Returns if the specified image's active channel. + * Returns the specified image's active channel. * * If there is an active channel, this will return the channel ID, * otherwise, -1. @@ -1676,7 +1676,7 @@ gimp_image_get_active_channel (gint32 image_ID) * @image_ID: The image. * @active_channel_ID: The new image active channel. * - * Sets if the specified image's active channel. + * Sets the specified image's active channel. * * If the channel exists, it is set as the active channel in the image. * Any previous active channel or channel is set to inactive. An @@ -1710,9 +1710,9 @@ gimp_image_set_active_channel (gint32 image_ID, * gimp_image_get_selection: * @image_ID: The image. * - * Returns if the specified image's selection. + * Returns the specified image's selection. * - * This will always return a valid ID for a selection--which is + * This will always return a valid ID for a selection -- which is * represented as a channel internally. * * Returns: The selection channel. @@ -1746,7 +1746,7 @@ gimp_image_get_selection (gint32 image_ID) * * This procedure returns if the specified image's image component * (i.e. Red, Green, Blue intensity channels in an RGB image) is active - * or inactive--whether or not it can be modified. If the specified + * or inactive -- whether or not it can be modified. If the specified * component is not valid for the image type, an error is returned. * * Returns: Component is active. @@ -1783,7 +1783,7 @@ gimp_image_get_component_active (gint32 image_ID, * * This procedure sets if the specified image's image component (i.e. * Red, Green, Blue intensity channels in an RGB image) is active or - * inactive--whether or not it can be modified. If the specified + * inactive -- whether or not it can be modified. If the specified * component is not valid for the image type, an error is returned. * * Returns: TRUE on success. @@ -1820,7 +1820,7 @@ gimp_image_set_component_active (gint32 image_ID, * * This procedure returns if the specified image's image component * (i.e. Red, Green, Blue intensity channels in an RGB image) is - * visible or invisible--whether or not it can be seen. If the + * visible or invisible -- whether or not it can be seen. If the * specified component is not valid for the image type, an error is * returned. * @@ -1858,8 +1858,8 @@ gimp_image_get_component_visible (gint32 image_ID, * * This procedure sets if the specified image's image component (i.e. * Red, Green, Blue intensity channels in an RGB image) is visible or - * invisible--whether or not it can be seen. If the specified component - * is not valid for the image type, an error is returned. + * invisible -- whether or not it can be seen. If the specified + * component is not valid for the image type, an error is returned. * * Returns: TRUE on success. */ @@ -1890,9 +1890,9 @@ gimp_image_set_component_visible (gint32 image_ID, * gimp_image_get_filename: * @image_ID: The image. * - * Returns if the specified image's filename. + * Returns the specified image's filename. * - * This procedure returns if the specified image's filename--if it was + * This procedure returns the specified image's filename -- if it was * loaded or has since been saved. Otherwise, returns NULL. * * Returns: The filename. @@ -1922,9 +1922,9 @@ gimp_image_get_filename (gint32 image_ID) * @image_ID: The image. * @filename: The new image filename. * - * Sets if the specified image's filename. + * Sets the specified image's filename. * - * This procedure sets if the specified image's filename. + * This procedure sets the specified image's filename. * * Returns: TRUE on success. */ @@ -1955,11 +1955,10 @@ gimp_image_set_filename (gint32 image_ID, * @xresolution: The resolutionin the x-axis, in dots per inch. * @yresolution: The resolutionin the y-axis, in dots per inch. * - * Returns if the specified image's resolution. + * Returns the specified image's resolution. * - * This procedure returns if the specified image's resolution in dots - * per inch. This value is independent of any of the layers in this - * image. + * This procedure returns the specified image's resolution in dots per + * inch. This value is independent of any of the layers in this image. * * Returns: TRUE on success. */ @@ -1999,9 +1998,9 @@ gimp_image_get_resolution (gint32 image_ID, * @xresolution: The new image resolution in the x-axis, in dots per inch. * @yresolution: The new image resolution in the y-axis, in dots per inch. * - * Sets if the specified image's resolution. + * Sets the specified image's resolution. * - * This procedure sets if the specified image's resolution in dots per + * This procedure sets the specified image's resolution in dots per * inch. This value is independent of any of the layers in this image. * No scaling or resizing is performed. * @@ -2034,9 +2033,9 @@ gimp_image_set_resolution (gint32 image_ID, * gimp_image_get_unit: * @image_ID: The image. * - * Returns if the specified image's unit. + * Returns the specified image's unit. * - * This procedure returns if the specified image's unit. This value is + * This procedure returns the specified image's unit. This value is * independent of any of the layers in this image. See the gimp_unit_* * procedure definitions for the valid range of unit IDs and a * description of the unit system. @@ -2068,9 +2067,9 @@ gimp_image_get_unit (gint32 image_ID) * @image_ID: The image. * @unit: The new image unit. * - * Sets if the specified image's unit. + * Sets the specified image's unit. * - * This procedure sets if the specified image's unit. No scaling or + * This procedure sets the specified image's unit. No scaling or * resizing is performed. This value is independent of any of the * layers in this image. See the gimp_unit_* procedure definitions for * the valid range of unit IDs and a description of the unit system. diff --git a/libgimp/gimpselection_pdb.c b/libgimp/gimpselection_pdb.c index d49326be7f..fc5dfd6fdc 100644 --- a/libgimp/gimpselection_pdb.c +++ b/libgimp/gimpselection_pdb.c @@ -80,6 +80,43 @@ gimp_selection_bounds (gint32 image_ID, return success; } +/** + * gimp_selection_value: + * @image_ID: The image. + * @x: x coordinate of value. + * @y: y coordinate of value. + * + * Find the value of the selection at the specified coordinates. + * + * This procedure returns the value of the selection at the specified + * coordinates. If the coordinates lie out of bounds, 0 is returned. + * + * Returns: Value of the selection. + */ +gint +gimp_selection_value (gint32 image_ID, + gint x, + gint y) +{ + GimpParam *return_vals; + gint nreturn_vals; + gint value = 0; + + return_vals = gimp_run_procedure ("gimp_selection_value", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, x, + GIMP_PDB_INT32, y, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + value = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return value; +} + /** * gimp_selection_is_empty: * @image_ID: The image. @@ -111,6 +148,45 @@ gimp_selection_is_empty (gint32 image_ID) return is_empty; } +/** + * gimp_selection_translate: + * @image_ID: The image. + * @offx: x offset for translation. + * @offy: y offset for translation. + * + * Translate the selection by the specified offsets. + * + * This procedure actually translates the selection for the specified + * image by the specified offsets. Regions that are translated from + * beyond the bounds of the image are set to empty. Valid regions of + * the selection which are translated beyond the bounds of the image + * because of this call are lost. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_translate (gint32 image_ID, + gint offx, + gint offy) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_translate", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, offx, + GIMP_PDB_INT32, offy, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + /** * _gimp_selection_float: * @drawable_ID: The drawable from which to float selection. @@ -152,6 +228,128 @@ _gimp_selection_float (gint32 drawable_ID, return layer_ID; } +/** + * gimp_selection_clear: + * @image_ID: The image. + * + * Set the selection to none, clearing all previous content. + * + * This procedure sets the selection mask to empty, assigning the value + * 0 to every pixel in the selection channel. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_clear (gint32 image_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_clear", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_invert: + * @image_ID: The image. + * + * Invert the selection mask. + * + * This procedure inverts the selection mask. For every pixel in the + * selection channel, its new value is calculated as (255 - old_value). + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_invert (gint32 image_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_invert", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_sharpen: + * @image_ID: The image. + * + * Sharpen the selection mask. + * + * This procedure sharpens the selection mask. For every pixel in the + * selection channel, if the value is > 0, the new pixel is assigned a + * value of 255. This removes any \"anti-aliasing\" that might exist in + * the selection mask's boundary. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_sharpen (gint32 image_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_sharpen", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_all: + * @image_ID: The image. + * + * Select all of the image. + * + * This procedure sets the selection mask to completely encompass the + * image. Every pixel in the selection channel is set to 255. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_all (gint32 image_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_all", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + /** * gimp_selection_none: * @image_ID: The image. @@ -181,3 +379,235 @@ gimp_selection_none (gint32 image_ID) return success; } + +/** + * gimp_selection_feather: + * @image_ID: The image. + * @radius: Radius of feather (in pixels). + * + * Feather the image's selection + * + * This procedure feathers the selection. Feathering is implemented + * using a gaussian blur. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_feather (gint32 image_ID, + gdouble radius) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_feather", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_FLOAT, radius, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_border: + * @image_ID: The image. + * @radius: Radius of border (in pixels). + * + * Border the image's selection + * + * This procedure borders the selection. Bordering creates a new + * selection which is defined along the boundary of the previous + * selection at every point within the specified radius. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_border (gint32 image_ID, + gint radius) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_border", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, radius, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_grow: + * @image_ID: The image. + * @steps: Steps of grow (in pixels). + * + * Grow the image's selection + * + * This procedure grows the selection. Growing involves expanding the + * boundary in all directions by the specified pixel amount. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_grow (gint32 image_ID, + gint steps) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_grow", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, steps, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_shrink: + * @image_ID: The image. + * @radius: Radius of shrink (in pixels). + * + * Shrink the image's selection + * + * This procedure shrinks the selection. Shrinking invovles trimming + * the existing selection boundary on all sides by the specified number + * of pixels. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_shrink (gint32 image_ID, + gint radius) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_shrink", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_INT32, radius, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_layer_alpha: + * @layer_ID: Layer with alpha. + * + * Transfer the specified layer's alpha channel to the selection mask. + * + * This procedure requires a layer with an alpha channel. The alpha + * channel information is used to create a selection mask such that for + * any pixel in the image defined in the specified layer, that layer + * pixel's alpha value is transferred to the selection mask. If the + * layer is undefined at a particular image pixel, the associated + * selection mask value is set to 0. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_layer_alpha (gint32 layer_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_layer_alpha", + &nreturn_vals, + GIMP_PDB_LAYER, layer_ID, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_load: + * @channel_ID: The channel. + * + * Transfer the specified channel to the selection mask. + * + * This procedure loads the specified channel into the selection mask. + * This essentially involves a copy of the channel's content in to the + * selection mask. Therefore, the channel must have the same width and + * height of the image, or an error is returned. + * + * Returns: TRUE on success. + */ +gboolean +gimp_selection_load (gint32 channel_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gboolean success = TRUE; + + return_vals = gimp_run_procedure ("gimp_selection_load", + &nreturn_vals, + GIMP_PDB_CHANNEL, channel_ID, + GIMP_PDB_END); + + success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; + + gimp_destroy_params (return_vals, nreturn_vals); + + return success; +} + +/** + * gimp_selection_save: + * @image_ID: The image. + * + * Copy the selection mask to a new channel. + * + * This procedure copies the selection mask and stores the content in a + * new channel. The new channel is automatically inserted into the + * image's list of channels. + * + * Returns: The new channel. + */ +gint32 +gimp_selection_save (gint32 image_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + gint32 channel_ID = -1; + + return_vals = gimp_run_procedure ("gimp_selection_save", + &nreturn_vals, + GIMP_PDB_IMAGE, image_ID, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + channel_ID = return_vals[1].data.d_channel; + + gimp_destroy_params (return_vals, nreturn_vals); + + return channel_ID; +} diff --git a/libgimp/gimpselection_pdb.h b/libgimp/gimpselection_pdb.h index 501966099a..9e5241a918 100644 --- a/libgimp/gimpselection_pdb.h +++ b/libgimp/gimpselection_pdb.h @@ -31,17 +31,38 @@ extern "C" { /* For information look into the C source or the html documentation */ -gboolean gimp_selection_bounds (gint32 image_ID, - gboolean *non_empty, - gint *x1, - gint *y1, - gint *x2, - gint *y2); -gboolean gimp_selection_is_empty (gint32 image_ID); -gint32 _gimp_selection_float (gint32 drawable_ID, - gint offx, - gint offy); -gboolean gimp_selection_none (gint32 image_ID); +gboolean gimp_selection_bounds (gint32 image_ID, + gboolean *non_empty, + gint *x1, + gint *y1, + gint *x2, + gint *y2); +gint gimp_selection_value (gint32 image_ID, + gint x, + gint y); +gboolean gimp_selection_is_empty (gint32 image_ID); +gboolean gimp_selection_translate (gint32 image_ID, + gint offx, + gint offy); +gint32 _gimp_selection_float (gint32 drawable_ID, + gint offx, + gint offy); +gboolean gimp_selection_clear (gint32 image_ID); +gboolean gimp_selection_invert (gint32 image_ID); +gboolean gimp_selection_sharpen (gint32 image_ID); +gboolean gimp_selection_all (gint32 image_ID); +gboolean gimp_selection_none (gint32 image_ID); +gboolean gimp_selection_feather (gint32 image_ID, + gdouble radius); +gboolean gimp_selection_border (gint32 image_ID, + gint radius); +gboolean gimp_selection_grow (gint32 image_ID, + gint steps); +gboolean gimp_selection_shrink (gint32 image_ID, + gint radius); +gboolean gimp_selection_layer_alpha (gint32 layer_ID); +gboolean gimp_selection_load (gint32 channel_ID); +gint32 gimp_selection_save (gint32 image_ID); #ifdef __cplusplus diff --git a/plug-ins/common/bz2.c b/plug-ins/common/bz2.c index f31c93c7e0..bc34d8cfb5 100644 --- a/plug-ins/common/bz2.c +++ b/plug-ins/common/bz2.c @@ -56,17 +56,17 @@ static void query (void); static void run (gchar *name, gint nparams, - GimpParam *param, + GimpParam *param, gint *nreturn_vals, - GimpParam **return_vals); + GimpParam **return_vals); static gint32 load_image (gchar *filename, gint32 run_mode, GimpPDBStatusType *status /* return value */); -static GimpPDBStatusType save_image (gchar *filename, - gint32 image_ID, - gint32 drawable_ID, - gint32 run_mode); +static GimpPDBStatusType save_image (gchar *filename, + gint32 image_ID, + gint32 drawable_ID, + gint32 run_mode); static gboolean valid_file (gchar *filename); static gchar * find_extension (gchar *filename); @@ -142,16 +142,16 @@ query (void) } static void -run (gchar *name, - gint nparams, +run (gchar *name, + gint nparams, GimpParam *param, - gint *nreturn_vals, + gint *nreturn_vals, GimpParam **return_vals) { - static GimpParam values[2]; - GimpRunModeType run_mode; - GimpPDBStatusType status = GIMP_PDB_SUCCESS; - gint32 image_ID; + static GimpParam values[2]; + GimpRunModeType run_mode; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + gint32 image_ID; run_mode = param[0].data.d_int32; @@ -256,13 +256,11 @@ save_image (gchar *filename, gint32 drawable_ID, gint32 run_mode) { - FILE *f; - GimpParam *params; - gint retvals; + FILE *f; gchar *ext; gchar *tmpname; - gint pid; - gint status; + gint pid; + gint status; if (NULL == (ext = find_extension (filename))) { @@ -272,37 +270,19 @@ save_image (gchar *filename, } /* get a temp name with the right extension and save into it. */ - - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); - - params = gimp_run_procedure ("gimp_file_save", - &retvals, - GIMP_PDB_INT32, run_mode, - GIMP_PDB_IMAGE, image_ID, - GIMP_PDB_DRAWABLE, drawable_ID, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); - - if (!valid_file (tmpname) || - params[0].data.d_status != GIMP_PDB_SUCCESS) + tmpname = gimp_temp_name (ext + 1); + + if (! (gimp_file_save (run_mode, + image_ID, + drawable_ID, + tmpname, + tmpname) && valid_file (tmpname)) ) { unlink (tmpname); g_free (tmpname); - return params[0].data.d_status; + return GIMP_PDB_EXECUTION_ERROR; } -/* if (! file_save(image_ID, tmpname, tmpname)) { */ -/* unlink (tmpname); */ -/* return -1; */ -/* } */ - #ifndef __EMX__ /* fork off a bzip2 process */ if ((pid = fork ()) < 0) @@ -357,16 +337,15 @@ save_image (gchar *filename, } static gint32 -load_image (gchar *filename, - gint32 run_mode, +load_image (gchar *filename, + gint32 run_mode, GimpPDBStatusType *status /* return value */) { - GimpParam *params; - gint retvals; - gchar *ext; - gchar *tmpname; - gint pid; - gint process_status; + gint32 image_ID; + gchar *ext; + gchar *tmpname; + gint pid; + gint process_status; if (NULL == (ext = find_extension (filename))) { @@ -377,13 +356,7 @@ load_image (gchar *filename, } /* find a temp name */ - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name (ext + 1); #ifndef __EMX__ /* fork off a g(un)zip and wait for it */ @@ -438,27 +411,20 @@ load_image (gchar *filename, /* now that we un-bzip2ed it, load the temp file */ - params = gimp_run_procedure ("gimp_file_load", - &retvals, - GIMP_PDB_INT32, run_mode, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); - + image_ID = gimp_file_load (run_mode, tmpname, tmpname); + unlink (tmpname); g_free (tmpname); - *status = params[0].data.d_status; - - if (params[0].data.d_status != GIMP_PDB_SUCCESS) + if (image_ID != -1) { - return -1; + *status = GIMP_PDB_SUCCESS; + gimp_image_set_filename (image_ID, filename); } else - { - gimp_image_set_filename (params[1].data.d_int32, filename); - return params[1].data.d_int32; - } + *status = GIMP_PDB_EXECUTION_ERROR; + + return image_ID; } static gboolean diff --git a/plug-ins/common/compressor.c b/plug-ins/common/compressor.c index 54a2bf2b67..2c0c0234c2 100644 --- a/plug-ins/common/compressor.c +++ b/plug-ins/common/compressor.c @@ -305,17 +305,15 @@ save_image (gchar *filename, gint32 drawable_ID, gint32 run_mode) { - GimpParam* params; - gint retvals; gchar *ext; gchar *tmpname; #ifndef G_OS_WIN32 - FILE *f; - gint pid; - gint status; + FILE *f; + gint pid; + gint status; #else - FILE *in, *out; - STARTUPINFO startupinfo; + FILE *in, *out; + STARTUPINFO startupinfo; PROCESS_INFORMATION processinfo; #endif @@ -327,36 +325,19 @@ save_image (gchar *filename, /* get a temp name with the right extension and save into it. */ - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); + tmpname = gimp_temp_name (ext + 1); - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); - - params = gimp_run_procedure ("gimp_file_save", - &retvals, - GIMP_PDB_INT32, run_mode, - GIMP_PDB_IMAGE, image_ID, - GIMP_PDB_DRAWABLE, drawable_ID, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); - - if (!valid_file (tmpname) || - params[0].data.d_status != GIMP_PDB_SUCCESS) + if (! (gimp_file_save (run_mode, + image_ID, + drawable_ID, + tmpname, + tmpname) && valid_file (tmpname)) ) { unlink (tmpname); g_free (tmpname); - return params[0].data.d_status; + return GIMP_PDB_EXECUTION_ERROR; } -/* if (! file_save(image_ID, tmpname, tmpname)) { */ -/* unlink (tmpname); */ -/* return -1; */ -/* } */ - #ifndef G_OS_WIN32 #ifndef __EMX__ /* fork off a gzip process */ @@ -441,21 +422,20 @@ save_image (gchar *filename, } static gint32 -load_image (gchar *filename, - gint32 run_mode, +load_image (gchar *filename, + gint32 run_mode, GimpPDBStatusType *status /* return value */) { - GimpParam* params; - gint retvals; - gchar *ext; - gchar *tmpname; + gint32 image_ID; + gchar *ext; + gchar *tmpname; #ifndef G_OS_WIN32 - gint pid; - gint process_status; + gint pid; + gint process_status; #else - FILE *in, *out; + FILE *in, *out; SECURITY_ATTRIBUTES secattr; - STARTUPINFO startupinfo; + STARTUPINFO startupinfo; PROCESS_INFORMATION processinfo; #endif @@ -465,13 +445,7 @@ load_image (gchar *filename, } /* find a temp name */ - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name (ext + 1); #ifndef G_OS_WIN32 #ifndef __EMX__ @@ -560,26 +534,20 @@ load_image (gchar *filename, /* now that we un-gziped it, load the temp file */ - params = gimp_run_procedure ("gimp_file_load", - &retvals, - GIMP_PDB_INT32, run_mode, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); + image_ID = gimp_file_load (run_mode, tmpname, tmpname); + unlink (tmpname); g_free (tmpname); - *status = params[0].data.d_status; - - if (params[0].data.d_status != GIMP_PDB_SUCCESS) + if (image_ID != -1) { - return -1; + *status = GIMP_PDB_SUCCESS; + gimp_image_set_filename (image_ID, filename); } else - { - gimp_image_set_filename (params[1].data.d_int32, filename); - return params[1].data.d_int32; - } + *status = GIMP_PDB_EXECUTION_ERROR; + + return image_ID; } static gboolean diff --git a/plug-ins/common/gz.c b/plug-ins/common/gz.c index 54a2bf2b67..2c0c0234c2 100644 --- a/plug-ins/common/gz.c +++ b/plug-ins/common/gz.c @@ -305,17 +305,15 @@ save_image (gchar *filename, gint32 drawable_ID, gint32 run_mode) { - GimpParam* params; - gint retvals; gchar *ext; gchar *tmpname; #ifndef G_OS_WIN32 - FILE *f; - gint pid; - gint status; + FILE *f; + gint pid; + gint status; #else - FILE *in, *out; - STARTUPINFO startupinfo; + FILE *in, *out; + STARTUPINFO startupinfo; PROCESS_INFORMATION processinfo; #endif @@ -327,36 +325,19 @@ save_image (gchar *filename, /* get a temp name with the right extension and save into it. */ - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); + tmpname = gimp_temp_name (ext + 1); - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); - - params = gimp_run_procedure ("gimp_file_save", - &retvals, - GIMP_PDB_INT32, run_mode, - GIMP_PDB_IMAGE, image_ID, - GIMP_PDB_DRAWABLE, drawable_ID, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); - - if (!valid_file (tmpname) || - params[0].data.d_status != GIMP_PDB_SUCCESS) + if (! (gimp_file_save (run_mode, + image_ID, + drawable_ID, + tmpname, + tmpname) && valid_file (tmpname)) ) { unlink (tmpname); g_free (tmpname); - return params[0].data.d_status; + return GIMP_PDB_EXECUTION_ERROR; } -/* if (! file_save(image_ID, tmpname, tmpname)) { */ -/* unlink (tmpname); */ -/* return -1; */ -/* } */ - #ifndef G_OS_WIN32 #ifndef __EMX__ /* fork off a gzip process */ @@ -441,21 +422,20 @@ save_image (gchar *filename, } static gint32 -load_image (gchar *filename, - gint32 run_mode, +load_image (gchar *filename, + gint32 run_mode, GimpPDBStatusType *status /* return value */) { - GimpParam* params; - gint retvals; - gchar *ext; - gchar *tmpname; + gint32 image_ID; + gchar *ext; + gchar *tmpname; #ifndef G_OS_WIN32 - gint pid; - gint process_status; + gint pid; + gint process_status; #else - FILE *in, *out; + FILE *in, *out; SECURITY_ATTRIBUTES secattr; - STARTUPINFO startupinfo; + STARTUPINFO startupinfo; PROCESS_INFORMATION processinfo; #endif @@ -465,13 +445,7 @@ load_image (gchar *filename, } /* find a temp name */ - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name (ext + 1); #ifndef G_OS_WIN32 #ifndef __EMX__ @@ -560,26 +534,20 @@ load_image (gchar *filename, /* now that we un-gziped it, load the temp file */ - params = gimp_run_procedure ("gimp_file_load", - &retvals, - GIMP_PDB_INT32, run_mode, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); + image_ID = gimp_file_load (run_mode, tmpname, tmpname); + unlink (tmpname); g_free (tmpname); - *status = params[0].data.d_status; - - if (params[0].data.d_status != GIMP_PDB_SUCCESS) + if (image_ID != -1) { - return -1; + *status = GIMP_PDB_SUCCESS; + gimp_image_set_filename (image_ID, filename); } else - { - gimp_image_set_filename (params[1].data.d_int32, filename); - return params[1].data.d_int32; - } + *status = GIMP_PDB_EXECUTION_ERROR; + + return image_ID; } static gboolean diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c index b8710542f4..931dea7fa2 100644 --- a/plug-ins/common/mail.c +++ b/plug-ins/common/mail.c @@ -128,16 +128,16 @@ static void query (void); -static void run (gchar *name, - gint nparams, +static void run (gchar *name, + gint nparams, GimpParam *param, - gint *nreturn_vals, + gint *nreturn_vals, GimpParam **return_vals); static GimpPDBStatusType save_image (gchar *filename, - gint32 image_ID, - gint32 drawable_ID, - gint32 run_mode); + gint32 image_ID, + gint32 drawable_ID, + gint32 run_mode); static gint save_dialog (void); static void ok_callback (GtkWidget *widget, @@ -225,17 +225,17 @@ query (void) } static void -run (gchar *name, - gint nparams, +run (gchar *name, + gint nparams, GimpParam *param, - gint *nreturn_vals, + gint *nreturn_vals, GimpParam **return_vals) { - static GimpParam values[2]; - GimpRunModeType run_mode; - GimpPDBStatusType status = GIMP_PDB_SUCCESS; - gint32 image_ID; - gint32 drawable_ID; + static GimpParam values[2]; + GimpRunModeType run_mode; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + gint32 image_ID; + gint32 drawable_ID; INIT_I18N_UI(); @@ -309,13 +309,10 @@ save_image (gchar *filename, gint32 drawable_ID, gint32 run_mode) { - GimpParam *params; - gint retvals; gchar *ext; gchar *tmpname; gchar mailcmdline[512]; gint pid; - gint status; gint process_status; FILE *mailpipe; FILE *infile; @@ -324,13 +321,7 @@ save_image (gchar *filename, return GIMP_PDB_CALLING_ERROR; /* get a temp name with the right extension and save into it. */ - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name (ext + 1); /* construct the "sendmail user@location" line */ strcpy (mailcmdline, MAILER); @@ -348,28 +339,15 @@ save_image (gchar *filename, /* This is necessary to make the comments and headers work correctly. Not real sure why */ fflush (mailpipe); - params = gimp_run_procedure ("gimp_file_save", - &retvals, - GIMP_PDB_INT32, run_mode, - GIMP_PDB_IMAGE, image_ID, - GIMP_PDB_DRAWABLE, drawable_ID, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); - - - /* need to figure a way to make sure the user is trying to save - * in an approriate format but this can wait.... - */ - - status = params[0].data.d_status; - - if (! valid_file (tmpname) || - status != GIMP_PDB_SUCCESS) + if (! (gimp_file_save (run_mode, + image_ID, + drawable_ID, + tmpname, + tmpname) && valid_file (tmpname)) ) { unlink (tmpname); g_free (tmpname); - return status; + return GIMP_PDB_EXECUTION_ERROR; } if (mail_info.encapsulation == ENCAPSULATION_UUENCODE) diff --git a/plug-ins/common/screenshot.c b/plug-ins/common/screenshot.c index 6543eef82e..0c0453b268 100644 --- a/plug-ins/common/screenshot.c +++ b/plug-ins/common/screenshot.c @@ -255,12 +255,7 @@ shoot (void) gint i = 0; /* get a temp name with the right extension and save into it. */ - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, "xwd", - GIMP_PDB_END); - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name ("xwd"); /* construct the xwd arguments */ xwdargv[i++] = XWD; diff --git a/plug-ins/common/url.c b/plug-ins/common/url.c index a9c1219d21..feb02b7c89 100644 --- a/plug-ins/common/url.c +++ b/plug-ins/common/url.c @@ -142,13 +142,12 @@ load_image (gchar *filename, GimpRunModeType run_mode, GimpPDBStatusType *status) { - GimpParam *params; - gint retvals; - gchar *ext = strrchr (filename, '.'); - gchar *tmpname; - gint pid; - gint process_status; - gint p[2]; + gint32 image_ID; + gchar *ext = strrchr (filename, '.'); + gchar *tmpname; + gint pid; + gint process_status; + gint p[2]; if (!ext || ext[1] == 0 || strchr(ext, '/')) { @@ -157,13 +156,7 @@ load_image (gchar *filename, return -1; } - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name (ext + 1); #ifndef __EMX__ if (pipe (p) != 0) @@ -425,25 +418,18 @@ load_image (gchar *filename, } #endif - params = gimp_run_procedure ("gimp_file_load", - &retvals, - GIMP_PDB_INT32, 0, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); + image_ID = gimp_file_load (GIMP_RUN_INTERACTIVE, tmpname, tmpname); unlink (tmpname); g_free (tmpname); - *status = params[0].data.d_status; - - if (params[0].data.d_status != GIMP_PDB_SUCCESS) + if (image_ID != -1) { - return -1; + *status = GIMP_PDB_SUCCESS; + gimp_image_set_filename (image_ID, filename); } else - { - gimp_image_set_filename (params[1].data.d_int32, filename); - return params[1].data.d_int32; - } + *status = GIMP_PDB_EXECUTION_ERROR; + + return image_ID; } diff --git a/plug-ins/flame/rect.c b/plug-ins/flame/rect.c index 51e2fe19a5..cd2084d5d9 100644 --- a/plug-ins/flame/rect.c +++ b/plug-ins/flame/rect.c @@ -88,7 +88,7 @@ void render_rectangle(spec, out, out_width, field, nchan, progress) int out_width; int field; int nchan; - void progress(double); + int progress(double); { int i, j, k, nsamples, nbuckets, batch_size, batch_num, sub_batch; bucket *buckets; diff --git a/plug-ins/flame/rect.h b/plug-ins/flame/rect.h index c59889ca64..3c880c9fb9 100644 --- a/plug-ins/flame/rect.h +++ b/plug-ins/flame/rect.h @@ -38,5 +38,5 @@ typedef struct { extern void render_rectangle(frame_spec *spec, unsigned char *out, int out_width, int field, int nchan, - void progress(double)); + int progress(double)); diff --git a/plug-ins/gdyntext/gdyntext.c b/plug-ins/gdyntext/gdyntext.c index 954e0b6de5..3723ef9da7 100644 --- a/plug-ins/gdyntext/gdyntext.c +++ b/plug-ins/gdyntext/gdyntext.c @@ -335,7 +335,7 @@ void gdt_render_text_p (GdtVals *data, gboolean show_progress) { - gint layer_ox, layer_oy, i, nret_vals, xoffs; + gint layer_ox, layer_oy, i, xoffs; gint32 layer_f, selection_empty, selection_channel = -1; gint32 text_width, text_height = 0; gint32 text_ascent, text_descent; @@ -346,7 +346,6 @@ gdt_render_text_p (GdtVals *data, gint32 font_size_type; gchar **text_xlfd, **text_lines; gint32 *text_lines_w; - GimpParam *ret_vals; GimpParamColor old_color, text_color; if (show_progress) @@ -360,11 +359,7 @@ gdt_render_text_p (GdtVals *data, if (!selection_empty) { /* there is an active selection to save */ - ret_vals = gimp_run_procedure ("gimp_selection_save", &nret_vals, - GIMP_PDB_IMAGE, data->image_id, GIMP_PDB_END); - selection_channel = ret_vals[1].data.d_int32; - gimp_destroy_params (ret_vals, nret_vals); - + selection_channel = gimp_selection_save (data->image_id); gimp_selection_none (data->image_id); } @@ -578,10 +573,7 @@ gdt_render_text_p (GdtVals *data, /* restore old selection if any */ if (selection_empty == FALSE) { - ret_vals = gimp_run_procedure ("gimp_selection_load", &nret_vals, - GIMP_PDB_IMAGE, data->image_id, - GIMP_PDB_CHANNEL, selection_channel, GIMP_PDB_END); - gimp_destroy_params (ret_vals, nret_vals); + gimp_selection_load (selection_channel); gimp_image_remove_channel (data->image_id, selection_channel); } diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index 1cb13a2e7f..329512a362 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -138,7 +138,6 @@ static void run (gchar *name, GimpParam **return_vals); static gint gfig_dialog (void); -static void gfig_clear_selection (gint32 ID); static void gfig_ok_callback (GtkWidget *widget, gpointer data); static void gfig_paint_callback (GtkWidget *widget, @@ -707,7 +706,7 @@ run (gchar *name, tile_height = gimp_tile_height (); /* TMP Hack - clear any selections */ - gfig_clear_selection (gfig_image); + gimp_selection_clear (gfig_image); gimp_drawable_mask_bounds (drawable->id, &sel_x1, &sel_y1, &sel_x2, &sel_y2); @@ -786,23 +785,6 @@ run (gchar *name, gimp_drawable_detach (drawable); } -static void -gfig_clear_selection (gint32 image_ID) -{ - GimpParam *return_vals; - gint nreturn_vals; - - /* Clear any selection - needed because drawing circles/ellipses - * uses the selection method and will confuse the output. - */ - return_vals = gimp_run_procedure ("gimp_selection_clear", - &nreturn_vals, - GIMP_PDB_IMAGE, image_ID, - GIMP_PDB_END); - - gimp_destroy_params (return_vals, nreturn_vals); -} - /* * Query gimprc for gfig-path, and parse it. */ @@ -7174,8 +7156,6 @@ d_draw_circle (Dobject * obj) static void d_paint_circle (Dobject *obj) { - GimpParam *return_vals; - gint nreturn_vals; DobjPoints * center_pnt; DobjPoints * edge_pnt; gint radius; @@ -7238,12 +7218,7 @@ d_paint_circle (Dobject *obj) gimp_edit_stroke (gfig_drawable); - return_vals = gimp_run_procedure ("gimp_selection_clear", &nreturn_vals, - GIMP_PDB_IMAGE, gfig_image, - GIMP_PDB_END); - - gimp_destroy_params (return_vals, nreturn_vals); - + gimp_selection_clear (gfig_image); } static Dobject * @@ -7644,8 +7619,6 @@ d_paint_approx_ellipse (Dobject *obj) static void d_paint_ellipse (Dobject *obj) { - GimpParam *return_vals; - gint nreturn_vals; DobjPoints * center_pnt; DobjPoints * edge_pnt; gint bound_wx; @@ -7721,12 +7694,7 @@ d_paint_ellipse (Dobject *obj) gimp_edit_stroke (gfig_drawable); - return_vals = gimp_run_procedure ("gimp_selection_clear", &nreturn_vals, - GIMP_PDB_IMAGE, gfig_image, - GIMP_PDB_END); - - gimp_destroy_params (return_vals, nreturn_vals); - + gimp_selection_clear (gfig_image); } static Dobject * diff --git a/plug-ins/uri/uri-backend-wget.c b/plug-ins/uri/uri-backend-wget.c index a9c1219d21..feb02b7c89 100644 --- a/plug-ins/uri/uri-backend-wget.c +++ b/plug-ins/uri/uri-backend-wget.c @@ -142,13 +142,12 @@ load_image (gchar *filename, GimpRunModeType run_mode, GimpPDBStatusType *status) { - GimpParam *params; - gint retvals; - gchar *ext = strrchr (filename, '.'); - gchar *tmpname; - gint pid; - gint process_status; - gint p[2]; + gint32 image_ID; + gchar *ext = strrchr (filename, '.'); + gchar *tmpname; + gint pid; + gint process_status; + gint p[2]; if (!ext || ext[1] == 0 || strchr(ext, '/')) { @@ -157,13 +156,7 @@ load_image (gchar *filename, return -1; } - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name (ext + 1); #ifndef __EMX__ if (pipe (p) != 0) @@ -425,25 +418,18 @@ load_image (gchar *filename, } #endif - params = gimp_run_procedure ("gimp_file_load", - &retvals, - GIMP_PDB_INT32, 0, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); + image_ID = gimp_file_load (GIMP_RUN_INTERACTIVE, tmpname, tmpname); unlink (tmpname); g_free (tmpname); - *status = params[0].data.d_status; - - if (params[0].data.d_status != GIMP_PDB_SUCCESS) + if (image_ID != -1) { - return -1; + *status = GIMP_PDB_SUCCESS; + gimp_image_set_filename (image_ID, filename); } else - { - gimp_image_set_filename (params[1].data.d_int32, filename); - return params[1].data.d_int32; - } + *status = GIMP_PDB_EXECUTION_ERROR; + + return image_ID; } diff --git a/plug-ins/uri/uri.c b/plug-ins/uri/uri.c index a9c1219d21..feb02b7c89 100644 --- a/plug-ins/uri/uri.c +++ b/plug-ins/uri/uri.c @@ -142,13 +142,12 @@ load_image (gchar *filename, GimpRunModeType run_mode, GimpPDBStatusType *status) { - GimpParam *params; - gint retvals; - gchar *ext = strrchr (filename, '.'); - gchar *tmpname; - gint pid; - gint process_status; - gint p[2]; + gint32 image_ID; + gchar *ext = strrchr (filename, '.'); + gchar *tmpname; + gint pid; + gint process_status; + gint p[2]; if (!ext || ext[1] == 0 || strchr(ext, '/')) { @@ -157,13 +156,7 @@ load_image (gchar *filename, return -1; } - params = gimp_run_procedure ("gimp_temp_name", - &retvals, - GIMP_PDB_STRING, ext + 1, - GIMP_PDB_END); - - tmpname = g_strdup (params[1].data.d_string); - gimp_destroy_params (params, retvals); + tmpname = gimp_temp_name (ext + 1); #ifndef __EMX__ if (pipe (p) != 0) @@ -425,25 +418,18 @@ load_image (gchar *filename, } #endif - params = gimp_run_procedure ("gimp_file_load", - &retvals, - GIMP_PDB_INT32, 0, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_STRING, tmpname, - GIMP_PDB_END); + image_ID = gimp_file_load (GIMP_RUN_INTERACTIVE, tmpname, tmpname); unlink (tmpname); g_free (tmpname); - *status = params[0].data.d_status; - - if (params[0].data.d_status != GIMP_PDB_SUCCESS) + if (image_ID != -1) { - return -1; + *status = GIMP_PDB_SUCCESS; + gimp_image_set_filename (image_ID, filename); } else - { - gimp_image_set_filename (params[1].data.d_int32, filename); - return params[1].data.d_int32; - } + *status = GIMP_PDB_EXECUTION_ERROR; + + return image_ID; } diff --git a/tools/pdbgen/pdb/fileops.pdb b/tools/pdbgen/pdb/fileops.pdb index 8ff5e8d2b0..9f620c9025 100644 --- a/tools/pdbgen/pdb/fileops.pdb +++ b/tools/pdbgen/pdb/fileops.pdb @@ -417,7 +417,7 @@ CODE @procs = qw(file_load file_save file_load_thumbnail file_save_thumbnail temp_name register_magic_load_handler register_load_handler register_save_handler); -%exports = (app => [@procs], lib => [@procs[5..7]]); +%exports = (app => [@procs], lib => [@procs[0,1,4..7]]); $desc = 'File Operations'; diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index 35431eb715..cfe8d09d12 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -114,9 +114,13 @@ HELP sub image_get_prop_proc { my ($prop, $type, $desc, $func) = @_; - $blurb = "Returns if the specified image's $desc."; - - $help = "This procedure returns if the specified image's $desc. "; + if ($desc =~ /\bis\b/) { + $blurb = "Returns if the specified image's $desc."; + $help = "This procedure returns if the specified image's $desc. "; + } else { + $blurb = "Returns the specified image's $desc."; + $help = "This procedure returns the specified image's $desc. "; + } &std_pdb_misc; @@ -148,9 +152,13 @@ sub image_get_prop_proc { sub image_set_prop_proc { my ($prop, $type, $desc, $func) = @_; - $blurb = "Sets if the specified image's $desc."; - - $help = "This procedure sets if the specified image's $desc. "; + if ($desc =~ /\bis\b/) { + $blurb = "Sets if the specified image's $desc."; + $help = "This procedure sets if the specified image's $desc. "; + } else { + $blurb = "Sets the specified image's $desc."; + $help = "This procedure sets the specified image's $desc. "; + } &std_pdb_misc; @@ -1093,7 +1101,7 @@ CODE2 $outargs[0]->{init} = 1; $help = <<'HELP'; -This will always return a valid ID for a selection--which is represented as a +This will always return a valid ID for a selection -- which is represented as a channel internally. HELP CODE @@ -1121,7 +1129,7 @@ my $comp_help = <<'CODE'; in an RGB image)/; $help =~ s/\. $/ /; $help .= <{alias} =~ s/get_//; @@ -1299,9 +1307,9 @@ sub image_thumbnail { $help = <<'HELP'; This function gets data from which a thumbnail of an image preview can be -created. Maximum x or y dimension is 128 pixels. The pixles are returned in the -RGB[A] format. The bpp return value gives the number of bytes in the image. The -alpha channel also returned if the image has one. +created. Maximum x or y dimension is 128 pixels. The pixels are returned in the +RGB[A] format. The bpp return value gives the number of bits per pixel in the +image. If the image has an alpha channel, it is also returned. HELP $author = $copyright = 'Andy Thomas'; diff --git a/tools/pdbgen/pdb/selection.pdb b/tools/pdbgen/pdb/selection.pdb index d73bda038d..3b4667a44a 100644 --- a/tools/pdbgen/pdb/selection.pdb +++ b/tools/pdbgen/pdb/selection.pdb @@ -364,7 +364,7 @@ HELP selection_invert selection_sharpen selection_all selection_none selection_feather selection_border selection_grow selection_shrink selection_layer_alpha selection_load selection_save); -%exports = (app => [@procs], lib => [@procs[0,2,4,9]]); +%exports = (app => [@procs], lib => [@procs]); $desc = 'Image mask';