renamed gimp_drawable_bytes() to gimp_drawable_bpp() because all other

2003-12-05  Michael Natterer  <mitch@gimp.org>

	* 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  <mitch@gimp.org>

	* libgimp/libgimp-sections.txt
	* libgimp/tmpl/gimpdrawable.sgml: s/drawable_bytes/drawable_bpp/.
This commit is contained in:
Michael Natterer 2003-12-05 14:51:11 +00:00 committed by Michael Natterer
parent 972402eb7a
commit 2de8decd7e
16 changed files with 143 additions and 127 deletions

View file

@ -1,3 +1,20 @@
2003-12-05 Michael Natterer <mitch@gimp.org>
* 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 <mitch@gimp.org>
* tools/pdbgen/pdb/image.pdb: removed gimp_image_undo_*() functions...

View file

@ -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 *

View file

@ -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" },

View file

@ -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" },

View file

@ -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" },

View file

@ -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" },

View file

@ -1,3 +1,8 @@
2003-12-05 Michael Natterer <mitch@gimp.org>
* libgimp/libgimp-sections.txt
* libgimp/tmpl/gimpdrawable.sgml: s/drawable_bytes/drawable_bpp/.
2003-12-05 Michael Natterer <mitch@gimp.org>
* libgimp/libgimp-sections.txt

View file

@ -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

View file

@ -321,7 +321,7 @@ Functions to manipulate drawables.
@Returns:
<!-- ##### FUNCTION gimp_drawable_bytes ##### -->
<!-- ##### FUNCTION gimp_drawable_bpp ##### -->
<para>
</para>
@ -399,14 +399,6 @@ Functions to manipulate drawables.
@Returns:
<!-- ##### MACRO gimp_drawable_bpp ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gimp_drawable_parasite_find ##### -->
<para>

View file

@ -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

View file

@ -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
{

View file

@ -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;
}
/**

View file

@ -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,

View file

@ -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");

View file

@ -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++)
{

View file

@ -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