use gimp_image_mask_select_channel() instead of gimp_image_mask_load().
2003-08-21 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/selection.pdb (selection_load,combine): use gimp_image_mask_select_channel() instead of gimp_image_mask_load(). Removes the restriction that the channel to select has to have the same size as the image. Changed help texts accordingly. * app/pdb/selection_cmd.c * libgimp/gimpselection_pdb.c: regenerated.
This commit is contained in:
parent
044ea72c69
commit
1ab98d03ba
4 changed files with 55 additions and 66 deletions
11
ChangeLog
11
ChangeLog
|
|
@ -1,3 +1,14 @@
|
|||
2003-08-21 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/selection.pdb (selection_load,combine): use
|
||||
gimp_image_mask_select_channel() instead of
|
||||
gimp_image_mask_load(). Removes the restriction that the channel
|
||||
to select has to have the same size as the image. Changed help
|
||||
texts accordingly.
|
||||
|
||||
* app/pdb/selection_cmd.c
|
||||
* libgimp/gimpselection_pdb.c: regenerated.
|
||||
|
||||
2003-08-21 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/vectors/gimpstroke.[ch]: added _is_empty () that checks
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "gimp-intl.h"
|
||||
|
||||
static ProcRecord selection_bounds_proc;
|
||||
static ProcRecord selection_value_proc;
|
||||
|
|
@ -897,7 +898,6 @@ selection_load_invoker (Gimp *gimp,
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
GimpChannel *channel;
|
||||
GimpImage *gimage;
|
||||
|
||||
channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
|
||||
if (! GIMP_IS_CHANNEL (channel))
|
||||
|
|
@ -905,13 +905,16 @@ selection_load_invoker (Gimp *gimp,
|
|||
|
||||
if (success)
|
||||
{
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
GimpImage *gimage;
|
||||
gint off_x, off_y;
|
||||
|
||||
if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
|
||||
gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
|
||||
gimp_image_mask_load (gimage, channel);
|
||||
else
|
||||
success = FALSE;
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
gimp_item_offsets (GIMP_ITEM (channel), &off_x, &off_y);
|
||||
|
||||
gimp_image_mask_select_channel (gimage, _("Channel to Selection"),
|
||||
channel, GIMP_CHANNEL_OP_REPLACE,
|
||||
off_x, off_y,
|
||||
FALSE, 0.0, 0.0);
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&selection_load_proc, success);
|
||||
|
|
@ -930,7 +933,7 @@ static ProcRecord selection_load_proc =
|
|||
{
|
||||
"gimp_selection_load",
|
||||
"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.",
|
||||
"This procedure loads the specified channel into the selection mask.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
|
|
@ -1007,8 +1010,6 @@ selection_combine_invoker (Gimp *gimp,
|
|||
gboolean success = TRUE;
|
||||
GimpChannel *channel;
|
||||
gint32 operation;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *new_channel;
|
||||
|
||||
channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
|
||||
if (! GIMP_IS_CHANNEL (channel))
|
||||
|
|
@ -1020,23 +1021,16 @@ selection_combine_invoker (Gimp *gimp,
|
|||
|
||||
if (success)
|
||||
{
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
GimpImage *gimage;
|
||||
gint off_x, off_y;
|
||||
|
||||
if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
|
||||
gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
|
||||
{
|
||||
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (gimp_image_get_mask (gimage)),
|
||||
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),
|
||||
FALSE));
|
||||
gimp_channel_combine_mask (new_channel,
|
||||
channel,
|
||||
operation,
|
||||
0, 0); /* off x/y */
|
||||
gimp_image_mask_load (gimage, new_channel);
|
||||
g_object_unref (new_channel);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
gimp_item_offsets (GIMP_ITEM (channel), &off_x, &off_y);
|
||||
|
||||
gimp_image_mask_select_channel (gimage, _("Channel to Selection"),
|
||||
channel, operation,
|
||||
off_x, off_y,
|
||||
FALSE, 0.0, 0.0);
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&selection_combine_proc, success);
|
||||
|
|
@ -1060,7 +1054,7 @@ static ProcRecord selection_combine_proc =
|
|||
{
|
||||
"gimp_selection_combine",
|
||||
"Combines the specified channel with the selection mask.",
|
||||
"This procedure combines the specified channel into the selection mask. It essentially involves a transfer of the channel's content into the selection mask. Therefore, the channel must have the same width and height of the image, or an error is returned.",
|
||||
"This procedure combines the specified channel into the selection mask.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
|
|
|
|||
|
|
@ -561,9 +561,6 @@ gimp_selection_layer_alpha (gint32 layer_ID)
|
|||
* 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.
|
||||
*/
|
||||
|
|
@ -626,9 +623,7 @@ gimp_selection_save (gint32 image_ID)
|
|||
* Combines the specified channel with the selection mask.
|
||||
*
|
||||
* This procedure combines the specified channel into the selection
|
||||
* mask. It essentially involves a transfer of the channel's content
|
||||
* into the selection mask. Therefore, the channel must have the same
|
||||
* width and height of the image, or an error is returned.
|
||||
* mask.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -330,10 +330,7 @@ sub selection_load {
|
|||
$blurb = 'Transfer the specified channel to the selection mask.';
|
||||
|
||||
$help = <<'HELP';
|
||||
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.
|
||||
This procedure loads the specified channel into the selection mask.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
|
@ -341,16 +338,18 @@ HELP
|
|||
@inargs = ( &channel_arg );
|
||||
|
||||
%invoke = (
|
||||
vars => [ 'GimpImage *gimage' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
GimpImage *gimage;
|
||||
gint off_x, off_y;
|
||||
|
||||
if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
|
||||
gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
|
||||
gimp_image_mask_load (gimage, channel);
|
||||
else
|
||||
success = FALSE;
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
gimp_item_offsets (GIMP_ITEM (channel), &off_x, &off_y);
|
||||
|
||||
gimp_image_mask_select_channel (gimage, _("Channel to Selection"),
|
||||
channel, GIMP_CHANNEL_OP_REPLACE,
|
||||
off_x, off_y,
|
||||
FALSE, 0.0, 0.0);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
@ -360,10 +359,7 @@ sub selection_combine {
|
|||
$blurb = 'Combines the specified channel with the selection mask.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure combines the specified channel into the selection
|
||||
mask. It essentially involves a transfer of the channel's content into
|
||||
the selection mask. Therefore, the channel must have the same width
|
||||
and height of the image, or an error is returned.
|
||||
This procedure combines the specified channel into the selection mask.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
|
@ -371,26 +367,18 @@ HELP
|
|||
@inargs = ( &channel_arg, &operation_arg );
|
||||
|
||||
%invoke = (
|
||||
vars => [ 'GimpImage *gimage', 'GimpChannel *new_channel' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
GimpImage *gimage;
|
||||
gint off_x, off_y;
|
||||
|
||||
if (gimp_item_width (GIMP_ITEM (channel)) == gimage->width &&
|
||||
gimp_item_height (GIMP_ITEM (channel)) == gimage->height)
|
||||
{
|
||||
new_channel = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (gimp_image_get_mask (gimage)),
|
||||
G_TYPE_FROM_INSTANCE (gimp_image_get_mask (gimage)),
|
||||
FALSE));
|
||||
gimp_channel_combine_mask (new_channel,
|
||||
channel,
|
||||
operation,
|
||||
0, 0); /* off x/y */
|
||||
gimp_image_mask_load (gimage, new_channel);
|
||||
g_object_unref (new_channel);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (channel));
|
||||
gimp_item_offsets (GIMP_ITEM (channel), &off_x, &off_y);
|
||||
|
||||
gimp_image_mask_select_channel (gimage, _("Channel to Selection"),
|
||||
channel, operation,
|
||||
off_x, off_y,
|
||||
FALSE, 0.0, 0.0);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
@ -419,7 +407,8 @@ HELP
|
|||
);
|
||||
}
|
||||
|
||||
@headers = qw("core/gimpimage-mask.h" "core/gimpimage-mask-select.h");
|
||||
@headers = qw("core/gimpimage-mask.h" "core/gimpimage-mask-select.h"
|
||||
"gimp-intl.h");
|
||||
|
||||
@procs = qw(selection_bounds selection_value selection_is_empty
|
||||
selection_translate selection_float selection_clear
|
||||
|
|
|
|||
Loading…
Reference in a new issue