From 2de8decd7e43e8db4f60656e190680bab01c1704 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 5 Dec 2003 14:51:11 +0000 Subject: [PATCH] renamed gimp_drawable_bytes() to gimp_drawable_bpp() because all other 2003-12-05 Michael Natterer * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_bytes() to gimp_drawable_bpp() because all other libgimp API speak in terms of "bpp" too. * libgimp/gimpdrawable.h: removed gimp_drawable_bpp #define. * app/pdb/procedural_db.c * libgimp/gimpcompat.h: added compat stuff. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * plug-ins/common/pix.c * plug-ins/common/psd_save.c: changed accordingly. 2003-12-05 Michael Natterer * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpdrawable.sgml: s/drawable_bytes/drawable_bpp/. --- ChangeLog | 17 +++ app/pdb/drawable_cmds.c | 138 +++++++++++----------- app/pdb/gimp-pdb.c | 1 + app/pdb/gimppdb.c | 1 + app/pdb/gimpprocedure.c | 1 + app/pdb/procedural_db.c | 1 + devel-docs/ChangeLog | 5 + devel-docs/libgimp/libgimp-sections.txt | 3 +- devel-docs/libgimp/tmpl/gimpdrawable.sgml | 10 +- libgimp/gimpcompat.h | 1 + libgimp/gimpdrawable.h | 2 - libgimp/gimpdrawable_pdb.c | 72 +++++------ libgimp/gimpdrawable_pdb.h | 4 +- plug-ins/common/pix.c | 2 +- plug-ins/common/psd_save.c | 2 +- tools/pdbgen/pdb/drawable.pdb | 10 +- 16 files changed, 143 insertions(+), 127 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd33ae6edd..cf60b17ff0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2003-12-05 Michael Natterer + + * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_bytes() to + gimp_drawable_bpp() because all other libgimp API speak in terms + of "bpp" too. + + * libgimp/gimpdrawable.h: removed gimp_drawable_bpp #define. + + * app/pdb/procedural_db.c + * libgimp/gimpcompat.h: added compat stuff. + + * app/pdb/drawable_cmds.c + * libgimp/gimpdrawable_pdb.[ch]: regenerated. + + * plug-ins/common/pix.c + * plug-ins/common/psd_save.c: changed accordingly. + 2003-12-05 Michael Natterer * tools/pdbgen/pdb/image.pdb: removed gimp_image_undo_*() functions... diff --git a/app/pdb/drawable_cmds.c b/app/pdb/drawable_cmds.c index 8ec1ff53ad..1df9d9a4f2 100644 --- a/app/pdb/drawable_cmds.c +++ b/app/pdb/drawable_cmds.c @@ -48,12 +48,12 @@ static ProcRecord drawable_mask_bounds_proc; static ProcRecord drawable_get_image_proc; static ProcRecord drawable_set_image_proc; static ProcRecord drawable_has_alpha_proc; -static ProcRecord drawable_type_with_alpha_proc; static ProcRecord drawable_type_proc; +static ProcRecord drawable_type_with_alpha_proc; static ProcRecord drawable_is_rgb_proc; static ProcRecord drawable_is_gray_proc; static ProcRecord drawable_is_indexed_proc; -static ProcRecord drawable_bytes_proc; +static ProcRecord drawable_bpp_proc; static ProcRecord drawable_width_proc; static ProcRecord drawable_height_proc; static ProcRecord drawable_offsets_proc; @@ -84,12 +84,12 @@ register_drawable_procs (Gimp *gimp) procedural_db_register (gimp, &drawable_get_image_proc); procedural_db_register (gimp, &drawable_set_image_proc); procedural_db_register (gimp, &drawable_has_alpha_proc); - procedural_db_register (gimp, &drawable_type_with_alpha_proc); procedural_db_register (gimp, &drawable_type_proc); + procedural_db_register (gimp, &drawable_type_with_alpha_proc); procedural_db_register (gimp, &drawable_is_rgb_proc); procedural_db_register (gimp, &drawable_is_gray_proc); procedural_db_register (gimp, &drawable_is_indexed_proc); - procedural_db_register (gimp, &drawable_bytes_proc); + procedural_db_register (gimp, &drawable_bpp_proc); procedural_db_register (gimp, &drawable_width_proc); procedural_db_register (gimp, &drawable_height_proc); procedural_db_register (gimp, &drawable_offsets_proc); @@ -550,60 +550,6 @@ static ProcRecord drawable_has_alpha_proc = { { drawable_has_alpha_invoker } } }; -static Argument * -drawable_type_with_alpha_invoker (Gimp *gimp, - Argument *args) -{ - gboolean success = TRUE; - Argument *return_args; - GimpDrawable *drawable; - - drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); - if (! GIMP_IS_DRAWABLE (drawable)) - success = FALSE; - - return_args = procedural_db_return_args (&drawable_type_with_alpha_proc, success); - - if (success) - return_args[1].value.pdb_int = gimp_drawable_type_with_alpha (drawable); - - return return_args; -} - -static ProcArg drawable_type_with_alpha_inargs[] = -{ - { - GIMP_PDB_DRAWABLE, - "drawable", - "The drawable" - } -}; - -static ProcArg drawable_type_with_alpha_outargs[] = -{ - { - GIMP_PDB_INT32, - "type_with_alpha", - "The drawable's type with alpha: { GIMP_RGB_IMAGE (0), GIMP_RGBA_IMAGE (1), GIMP_GRAY_IMAGE (2), GIMP_GRAYA_IMAGE (3), GIMP_INDEXED_IMAGE (4), GIMP_INDEXEDA_IMAGE (5) }" - } -}; - -static ProcRecord drawable_type_with_alpha_proc = -{ - "gimp_drawable_type_with_alpha", - "Returns the drawable's type with alpha.", - "This procedure returns the drawable's type if an alpha channel were added. If the type is currently Gray, for instance, the returned type would be GrayA. If the drawable already has an alpha channel, the drawable's type is simply returned.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1995-1996", - GIMP_INTERNAL, - 1, - drawable_type_with_alpha_inargs, - 1, - drawable_type_with_alpha_outargs, - { { drawable_type_with_alpha_invoker } } -}; - static Argument * drawable_type_invoker (Gimp *gimp, Argument *args) @@ -658,6 +604,60 @@ static ProcRecord drawable_type_proc = { { drawable_type_invoker } } }; +static Argument * +drawable_type_with_alpha_invoker (Gimp *gimp, + Argument *args) +{ + gboolean success = TRUE; + Argument *return_args; + GimpDrawable *drawable; + + drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); + if (! GIMP_IS_DRAWABLE (drawable)) + success = FALSE; + + return_args = procedural_db_return_args (&drawable_type_with_alpha_proc, success); + + if (success) + return_args[1].value.pdb_int = gimp_drawable_type_with_alpha (drawable); + + return return_args; +} + +static ProcArg drawable_type_with_alpha_inargs[] = +{ + { + GIMP_PDB_DRAWABLE, + "drawable", + "The drawable" + } +}; + +static ProcArg drawable_type_with_alpha_outargs[] = +{ + { + GIMP_PDB_INT32, + "type_with_alpha", + "The drawable's type with alpha: { GIMP_RGB_IMAGE (0), GIMP_RGBA_IMAGE (1), GIMP_GRAY_IMAGE (2), GIMP_GRAYA_IMAGE (3), GIMP_INDEXED_IMAGE (4), GIMP_INDEXEDA_IMAGE (5) }" + } +}; + +static ProcRecord drawable_type_with_alpha_proc = +{ + "gimp_drawable_type_with_alpha", + "Returns the drawable's type with alpha.", + "This procedure returns the drawable's type if an alpha channel were added. If the type is currently Gray, for instance, the returned type would be GrayA. If the drawable already has an alpha channel, the drawable's type is simply returned.", + "Spencer Kimball & Peter Mattis", + "Spencer Kimball & Peter Mattis", + "1995-1996", + GIMP_INTERNAL, + 1, + drawable_type_with_alpha_inargs, + 1, + drawable_type_with_alpha_outargs, + { { drawable_type_with_alpha_invoker } } +}; + static Argument * drawable_is_rgb_invoker (Gimp *gimp, Argument *args) @@ -821,8 +821,8 @@ static ProcRecord drawable_is_indexed_proc = }; static Argument * -drawable_bytes_invoker (Gimp *gimp, - Argument *args) +drawable_bpp_invoker (Gimp *gimp, + Argument *args) { gboolean success = TRUE; Argument *return_args; @@ -832,7 +832,7 @@ drawable_bytes_invoker (Gimp *gimp, if (! GIMP_IS_DRAWABLE (drawable)) success = FALSE; - return_args = procedural_db_return_args (&drawable_bytes_proc, success); + return_args = procedural_db_return_args (&drawable_bpp_proc, success); if (success) return_args[1].value.pdb_int = gimp_drawable_bytes (drawable); @@ -840,7 +840,7 @@ drawable_bytes_invoker (Gimp *gimp, return return_args; } -static ProcArg drawable_bytes_inargs[] = +static ProcArg drawable_bpp_inargs[] = { { GIMP_PDB_DRAWABLE, @@ -849,18 +849,18 @@ static ProcArg drawable_bytes_inargs[] = } }; -static ProcArg drawable_bytes_outargs[] = +static ProcArg drawable_bpp_outargs[] = { { GIMP_PDB_INT32, - "bytes", + "bpp", "Bytes per pixel" } }; -static ProcRecord drawable_bytes_proc = +static ProcRecord drawable_bpp_proc = { - "gimp_drawable_bytes", + "gimp_drawable_bpp", "Returns the bytes per pixel.", "This procedure returns the number of bytes per pixel (or the number of channels) for the specified drawable.", "Spencer Kimball & Peter Mattis", @@ -868,10 +868,10 @@ static ProcRecord drawable_bytes_proc = "1995-1996", GIMP_INTERNAL, 1, - drawable_bytes_inargs, + drawable_bpp_inargs, 1, - drawable_bytes_outargs, - { { drawable_bytes_invoker } } + drawable_bpp_outargs, + { { drawable_bpp_invoker } } }; static Argument * diff --git a/app/pdb/gimp-pdb.c b/app/pdb/gimp-pdb.c index 5b6d162a15..21cdf70041 100644 --- a/app/pdb/gimp-pdb.c +++ b/app/pdb/gimp-pdb.c @@ -130,6 +130,7 @@ procedural_db_init_procs (Gimp *gimp, { "gimp_convert_indexed", "gimp_image_convert_indexed" }, { "gimp_convert_rgb", "gimp_image_convert_rgb" }, { "gimp_crop", "gimp_image_crop" }, + { "gimp_drawable_bytes", "gimp_drawable_bpp" }, { "gimp_drawable_image", "gimp_drawable_get_image" }, { "gimp_gradients_get_active", "gimp_gradients_get_gradient" }, { "gimp_gradients_set_active", "gimp_gradients_set_gradient" }, diff --git a/app/pdb/gimppdb.c b/app/pdb/gimppdb.c index 5b6d162a15..21cdf70041 100644 --- a/app/pdb/gimppdb.c +++ b/app/pdb/gimppdb.c @@ -130,6 +130,7 @@ procedural_db_init_procs (Gimp *gimp, { "gimp_convert_indexed", "gimp_image_convert_indexed" }, { "gimp_convert_rgb", "gimp_image_convert_rgb" }, { "gimp_crop", "gimp_image_crop" }, + { "gimp_drawable_bytes", "gimp_drawable_bpp" }, { "gimp_drawable_image", "gimp_drawable_get_image" }, { "gimp_gradients_get_active", "gimp_gradients_get_gradient" }, { "gimp_gradients_set_active", "gimp_gradients_set_gradient" }, diff --git a/app/pdb/gimpprocedure.c b/app/pdb/gimpprocedure.c index 5b6d162a15..21cdf70041 100644 --- a/app/pdb/gimpprocedure.c +++ b/app/pdb/gimpprocedure.c @@ -130,6 +130,7 @@ procedural_db_init_procs (Gimp *gimp, { "gimp_convert_indexed", "gimp_image_convert_indexed" }, { "gimp_convert_rgb", "gimp_image_convert_rgb" }, { "gimp_crop", "gimp_image_crop" }, + { "gimp_drawable_bytes", "gimp_drawable_bpp" }, { "gimp_drawable_image", "gimp_drawable_get_image" }, { "gimp_gradients_get_active", "gimp_gradients_get_gradient" }, { "gimp_gradients_set_active", "gimp_gradients_set_gradient" }, diff --git a/app/pdb/procedural_db.c b/app/pdb/procedural_db.c index 5b6d162a15..21cdf70041 100644 --- a/app/pdb/procedural_db.c +++ b/app/pdb/procedural_db.c @@ -130,6 +130,7 @@ procedural_db_init_procs (Gimp *gimp, { "gimp_convert_indexed", "gimp_image_convert_indexed" }, { "gimp_convert_rgb", "gimp_image_convert_rgb" }, { "gimp_crop", "gimp_image_crop" }, + { "gimp_drawable_bytes", "gimp_drawable_bpp" }, { "gimp_drawable_image", "gimp_drawable_get_image" }, { "gimp_gradients_get_active", "gimp_gradients_get_gradient" }, { "gimp_gradients_set_active", "gimp_gradients_set_gradient" }, diff --git a/devel-docs/ChangeLog b/devel-docs/ChangeLog index 86654c2515..07da053c27 100644 --- a/devel-docs/ChangeLog +++ b/devel-docs/ChangeLog @@ -1,3 +1,8 @@ +2003-12-05 Michael Natterer + + * libgimp/libgimp-sections.txt + * libgimp/tmpl/gimpdrawable.sgml: s/drawable_bytes/drawable_bpp/. + 2003-12-05 Michael Natterer * libgimp/libgimp-sections.txt diff --git a/devel-docs/libgimp/libgimp-sections.txt b/devel-docs/libgimp/libgimp-sections.txt index 0deebef84d..05327a1d51 100644 --- a/devel-docs/libgimp/libgimp-sections.txt +++ b/devel-docs/libgimp/libgimp-sections.txt @@ -198,7 +198,7 @@ gimp_drawable_type gimp_drawable_is_rgb gimp_drawable_is_gray gimp_drawable_is_indexed -gimp_drawable_bytes +gimp_drawable_bpp gimp_drawable_width gimp_drawable_height gimp_drawable_offsets @@ -206,7 +206,6 @@ gimp_drawable_is_layer gimp_drawable_is_layer_mask gimp_drawable_is_channel gimp_drawable_offset -gimp_drawable_bpp gimp_drawable_parasite_find gimp_drawable_parasite_list gimp_drawable_parasite_attach diff --git a/devel-docs/libgimp/tmpl/gimpdrawable.sgml b/devel-docs/libgimp/tmpl/gimpdrawable.sgml index ed0af48a0d..e220f9559d 100644 --- a/devel-docs/libgimp/tmpl/gimpdrawable.sgml +++ b/devel-docs/libgimp/tmpl/gimpdrawable.sgml @@ -321,7 +321,7 @@ Functions to manipulate drawables. @Returns: - + @@ -399,14 +399,6 @@ Functions to manipulate drawables. @Returns: - - - - - -@Returns: - - diff --git a/libgimp/gimpcompat.h b/libgimp/gimpcompat.h index ce8b4daa06..525d7ac8ee 100644 --- a/libgimp/gimpcompat.h +++ b/libgimp/gimpcompat.h @@ -74,6 +74,7 @@ G_BEGIN_DECLS #define gimp_drawable_image_id gimp_drawable_get_image #define gimp_drawable_name gimp_drawable_get_name #define gimp_drawable_visible gimp_drawable_get_visible +#define gimp_drawable_bytes gimp_drawable_bpp #define gimp_gradients_get_active gimp_gradients_get_gradient #define gimp_gradients_set_active gimp_gradients_set_gradient diff --git a/libgimp/gimpdrawable.h b/libgimp/gimpdrawable.h index e74f49ef66..47346040ba 100644 --- a/libgimp/gimpdrawable.h +++ b/libgimp/gimpdrawable.h @@ -26,8 +26,6 @@ G_BEGIN_DECLS /* For information look into the C source or the html documentation */ -#define gimp_drawable_bpp gimp_drawable_bytes - struct _GimpDrawable { diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c index 6440e10284..592c0bda6f 100644 --- a/libgimp/gimpdrawable_pdb.c +++ b/libgimp/gimpdrawable_pdb.c @@ -293,6 +293,36 @@ gimp_drawable_has_alpha (gint32 drawable_ID) return has_alpha; } +/** + * gimp_drawable_type: + * @drawable_ID: The drawable. + * + * Returns the drawable's type. + * + * This procedure returns the drawable's type. + * + * Returns: The drawable's type. + */ +GimpImageType +gimp_drawable_type (gint32 drawable_ID) +{ + GimpParam *return_vals; + gint nreturn_vals; + GimpImageType type = 0; + + return_vals = gimp_run_procedure ("gimp_drawable_type", + &nreturn_vals, + GIMP_PDB_DRAWABLE, drawable_ID, + GIMP_PDB_END); + + if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) + type = return_vals[1].data.d_int32; + + gimp_destroy_params (return_vals, nreturn_vals); + + return type; +} + /** * gimp_drawable_type_with_alpha: * @drawable_ID: The drawable. @@ -326,36 +356,6 @@ gimp_drawable_type_with_alpha (gint32 drawable_ID) return type_with_alpha; } -/** - * gimp_drawable_type: - * @drawable_ID: The drawable. - * - * Returns the drawable's type. - * - * This procedure returns the drawable's type. - * - * Returns: The drawable's type. - */ -GimpImageType -gimp_drawable_type (gint32 drawable_ID) -{ - GimpParam *return_vals; - gint nreturn_vals; - GimpImageType type = 0; - - return_vals = gimp_run_procedure ("gimp_drawable_type", - &nreturn_vals, - GIMP_PDB_DRAWABLE, drawable_ID, - GIMP_PDB_END); - - if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - type = return_vals[1].data.d_int32; - - gimp_destroy_params (return_vals, nreturn_vals); - - return type; -} - /** * gimp_drawable_is_rgb: * @drawable_ID: The drawable. @@ -450,7 +450,7 @@ gimp_drawable_is_indexed (gint32 drawable_ID) } /** - * gimp_drawable_bytes: + * gimp_drawable_bpp: * @drawable_ID: The drawable. * * Returns the bytes per pixel. @@ -461,23 +461,23 @@ gimp_drawable_is_indexed (gint32 drawable_ID) * Returns: Bytes per pixel. */ gint -gimp_drawable_bytes (gint32 drawable_ID) +gimp_drawable_bpp (gint32 drawable_ID) { GimpParam *return_vals; gint nreturn_vals; - gint bytes = 0; + gint bpp = 0; - return_vals = gimp_run_procedure ("gimp_drawable_bytes", + return_vals = gimp_run_procedure ("gimp_drawable_bpp", &nreturn_vals, GIMP_PDB_DRAWABLE, drawable_ID, GIMP_PDB_END); if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) - bytes = return_vals[1].data.d_int32; + bpp = return_vals[1].data.d_int32; gimp_destroy_params (return_vals, nreturn_vals); - return bytes; + return bpp; } /** diff --git a/libgimp/gimpdrawable_pdb.h b/libgimp/gimpdrawable_pdb.h index a3a3818b7e..fc36734168 100644 --- a/libgimp/gimpdrawable_pdb.h +++ b/libgimp/gimpdrawable_pdb.h @@ -47,12 +47,12 @@ gint32 gimp_drawable_get_image (gint32 drawable_ID); gboolean gimp_drawable_set_image (gint32 drawable_ID, gint32 image_ID); gboolean gimp_drawable_has_alpha (gint32 drawable_ID); -GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID); GimpImageType gimp_drawable_type (gint32 drawable_ID); +GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID); gboolean gimp_drawable_is_rgb (gint32 drawable_ID); gboolean gimp_drawable_is_gray (gint32 drawable_ID); gboolean gimp_drawable_is_indexed (gint32 drawable_ID); -gint gimp_drawable_bytes (gint32 drawable_ID); +gint gimp_drawable_bpp (gint32 drawable_ID); gint gimp_drawable_width (gint32 drawable_ID); gint gimp_drawable_height (gint32 drawable_ID); gboolean gimp_drawable_offsets (gint32 drawable_ID, diff --git a/plug-ins/common/pix.c b/plug-ins/common/pix.c index 933a7d31a1..ff75a30074 100644 --- a/plug-ins/common/pix.c +++ b/plug-ins/common/pix.c @@ -506,7 +506,7 @@ save_image (const gchar *filename, drawable->height, FALSE, FALSE); savingColor = gimp_drawable_is_rgb (drawable_ID); - depth = gimp_drawable_bytes (drawable_ID); + depth = gimp_drawable_bpp (drawable_ID); /* Open the output file. */ file = fopen (filename, "wb"); diff --git a/plug-ins/common/psd_save.c b/plug-ins/common/psd_save.c index ab0d7ff3c3..50922a32c7 100644 --- a/plug-ins/common/psd_save.c +++ b/plug-ins/common/psd_save.c @@ -1105,7 +1105,7 @@ save_layer_and_mask (FILE *fd, gint32 image_id) ChannelLengthPos[i] = g_new (gint32, nChannelsLayer); - /* Try with gimp_drawable_bytes() */ + /* Try with gimp_drawable_bpp() */ for (j = 0; j < nChannelsLayer; j++) { diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb index 5210c83163..ed86a8b630 100644 --- a/tools/pdbgen/pdb/drawable.pdb +++ b/tools/pdbgen/pdb/drawable.pdb @@ -355,13 +355,13 @@ sub drawable_is_indexed { &drawable_type_proc('an indexed', 'Indexed, IndexedA', 'is_indexed'); } -sub drawable_bytes { +sub drawable_bpp { $help = <<'HELP'; This procedure returns the number of bytes per pixel (or the number of channels) for the specified drawable. HELP - &drawable_prop_proc('the bytes per pixel', 'bytes', 'int32', 'bytes', + &drawable_prop_proc('the bytes per pixel', 'bpp', 'int32', 'bytes', 'Bytes per pixel'); } @@ -700,9 +700,9 @@ CODE @procs = qw(drawable_merge_shadow drawable_fill drawable_update drawable_mask_bounds drawable_get_image drawable_set_image - drawable_has_alpha drawable_type_with_alpha - drawable_type drawable_is_rgb drawable_is_gray drawable_is_indexed - drawable_bytes drawable_width drawable_height drawable_offsets + drawable_has_alpha drawable_type drawable_type_with_alpha + drawable_is_rgb drawable_is_gray drawable_is_indexed + drawable_bpp drawable_width drawable_height drawable_offsets drawable_is_layer drawable_is_layer_mask drawable_is_channel drawable_get_name drawable_set_name drawable_get_visible drawable_set_visible