tools/pdbgen/pdb/channel.pdb removed dim(), accessors(), get_prop() and

2006-03-15  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/channel.pdb
	* tools/pdbgen/pdb/layer.pdb: removed dim(), accessors(),
	get_prop() and set_prop() utility functions and expand everything
	to pdbgen boilerplate code. Use the real layer mask API instead of
	the crap from pdb_glue.h. Fixed some API docs.

	* app/pdb/channel_cmds.c
	* app/pdb/layer_cmds.c
	* libgimp/gimplayer_pdb.c: regenerated.

	* app/pdb/Makefile.am
	* app/pdb/pdb_glue.h: bye bye uglyness.
This commit is contained in:
Michael Natterer 2006-03-15 17:42:12 +00:00 committed by Michael Natterer
parent 04bf6d04f4
commit 711c191fc6
8 changed files with 770 additions and 426 deletions

View file

@ -1,9 +1,24 @@
2006-03-15 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: removed dim(), accessors(),
get_prop() and set_prop() utility functions and expand everything
to pdbgen boilerplate code. Use the real layer mask API instead of
the crap from pdb_glue.h. Fixed some API docs.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c
* libgimp/gimplayer_pdb.c: regenerated.
* app/pdb/Makefile.am
* app/pdb/pdb_glue.h: bye bye uglyness.
2006-03-15 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb.pl: define init values for all pdb types.
* tools/pdbgen/app.pl: unconditionally initialize all return
values, and no parameter.
values, and don't initialize any parameter.
* tools/pdbgen/pdb/*.pdb: removed init => 1 from all arguments
and return values.

View file

@ -4,7 +4,6 @@ noinst_LIBRARIES = libapppdb.a
libapppdb_a_SOURCES = \
pdb-types.h \
pdb_glue.h \
procedural_db.c \
procedural_db.h \
procedural-db-query.c \

View file

@ -424,15 +424,21 @@ channel_get_show_masked_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpChannel *channel;
gboolean show_masked = FALSE;
channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
success = FALSE;
if (success)
{
show_masked = gimp_channel_get_show_masked (channel);
}
return_args = procedural_db_return_args (&channel_get_show_masked_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_channel_get_show_masked (channel);
return_args[1].value.pdb_int = show_masked;
return return_args;
}
@ -490,7 +496,9 @@ channel_set_show_masked_invoker (Gimp *gimp,
show_masked = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
gimp_channel_set_show_masked (channel, show_masked);
{
gimp_channel_set_show_masked (channel, show_masked);
}
return procedural_db_return_args (&channel_set_show_masked_proc, success);
}
@ -536,15 +544,21 @@ channel_get_opacity_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpChannel *channel;
gdouble opacity = 0.0;
channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_CHANNEL (channel) && ! gimp_item_is_removed (GIMP_ITEM (channel))))
success = FALSE;
if (success)
{
opacity = gimp_channel_get_opacity (channel) * 100;
}
return_args = procedural_db_return_args (&channel_get_opacity_proc, success);
if (success)
return_args[1].value.pdb_float = gimp_channel_get_opacity (channel) * 100.0;
return_args[1].value.pdb_float = opacity;
return return_args;
}
@ -604,7 +618,9 @@ channel_set_opacity_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_set_opacity (channel, opacity / 100.0, TRUE);
{
gimp_channel_set_opacity (channel, opacity / 100.0, TRUE);
}
return procedural_db_return_args (&channel_set_opacity_proc, success);
}
@ -657,7 +673,9 @@ channel_get_color_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_channel_get_color (channel, &color);
{
gimp_channel_get_color (channel, &color);
}
return_args = procedural_db_return_args (&channel_get_color_proc, success);

View file

@ -28,7 +28,6 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage.h"
@ -36,7 +35,6 @@
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "gimp-intl.h"
#include "pdb_glue.h"
static ProcRecord layer_new_proc;
static ProcRecord layer_new_from_drawable_proc;
@ -398,7 +396,9 @@ layer_add_alpha_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_layer_add_alpha (layer);
{
gimp_layer_add_alpha (layer);
}
return procedural_db_return_args (&layer_add_alpha_proc, success);
}
@ -461,7 +461,9 @@ layer_scale_invoker (Gimp *gimp,
success = gimp_item_is_attached (GIMP_ITEM (layer));
if (success)
gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height, gimp->config->interpolation_type, NULL, local_origin);
gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
gimp->config->interpolation_type, NULL,
local_origin);
}
return procedural_db_return_args (&layer_scale_proc, success);
@ -496,7 +498,7 @@ static ProcRecord layer_scale_proc =
"gimp-layer-scale",
"gimp-layer-scale",
"Scale the layer to the specified extents.",
"This procedure scales the layer so that it's new width and height are equal to the supplied parameters. The \"local_origin\" parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image.",
"This procedure scales the layer so that its new width and height are equal to the supplied parameters. The \"local_origin\" parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -543,7 +545,8 @@ layer_resize_invoker (Gimp *gimp,
success = gimp_item_is_attached (GIMP_ITEM (layer));
if (success)
gimp_item_resize (GIMP_ITEM (layer), context, new_width, new_height, offx, offy);
gimp_item_resize (GIMP_ITEM (layer), context,
new_width, new_height, offx, offy);
}
return procedural_db_return_args (&layer_resize_proc, success);
@ -583,7 +586,7 @@ static ProcRecord layer_resize_proc =
"gimp-layer-resize",
"gimp-layer-resize",
"Resize the layer to the specified extents.",
"This procedure resizes the layer so that it's new width and height are equal to the supplied parameters. Offsets are also provided which describe the position of the previous layer's content. This operation only works if the layer has been added to an image.",
"This procedure resizes the layer so that its new width and height are equal to the supplied parameters. Offsets are also provided which describe the position of the previous layer's content. This operation only works if the layer has been added to an image.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -876,7 +879,7 @@ layer_get_mask_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpLayer *layer;
GimpChannel *mask = NULL;
GimpLayerMask *mask = NULL;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
@ -1190,15 +1193,21 @@ layer_get_lock_alpha_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpLayer *layer;
gboolean lock_alpha = FALSE;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
if (success)
{
lock_alpha = gimp_layer_get_lock_alpha (layer);
}
return_args = procedural_db_return_args (&layer_get_lock_alpha_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_layer_get_lock_alpha (layer);
return_args[1].value.pdb_int = lock_alpha;
return return_args;
}
@ -1256,7 +1265,9 @@ layer_set_lock_alpha_invoker (Gimp *gimp,
lock_alpha = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
gimp_layer_set_lock_alpha (layer, lock_alpha, TRUE);
{
gimp_layer_set_lock_alpha (layer, lock_alpha, TRUE);
}
return procedural_db_return_args (&layer_set_lock_alpha_proc, success);
}
@ -1302,15 +1313,24 @@ layer_get_apply_mask_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpLayer *layer;
gboolean apply_mask = FALSE;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
if (success)
{
if (layer->mask)
apply_mask = gimp_layer_mask_get_apply (layer->mask);
else
apply_mask = FALSE;
}
return_args = procedural_db_return_args (&layer_get_apply_mask_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_layer_get_apply_mask (layer);
return_args[1].value.pdb_int = apply_mask;
return return_args;
}
@ -1329,7 +1349,7 @@ static ProcArg layer_get_apply_mask_outargs[] =
{
GIMP_PDB_INT32,
"apply-mask",
"The layer apply mask"
"The layer's apply mask setting"
}
};
@ -1337,8 +1357,8 @@ static ProcRecord layer_get_apply_mask_proc =
{
"gimp-layer-get-apply-mask",
"gimp-layer-get-apply-mask",
"Get the apply mask of the specified layer.",
"This procedure returns the specified layer's apply mask. If the value is non-zero, then the layer mask for this layer is currently being composited with the layer's alpha channel.",
"Get the apply mask setting of the specified layer.",
"This procedure returns the specified layer's apply mask setting. If the value is non-zero, then the layer mask for this layer is currently being composited with the layer's alpha channel.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -1368,7 +1388,12 @@ layer_set_apply_mask_invoker (Gimp *gimp,
apply_mask = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
gimp_layer_set_apply_mask (layer, apply_mask);
{
if (layer->mask)
gimp_layer_mask_set_apply (layer->mask, apply_mask, TRUE);
else
success = FALSE;
}
return procedural_db_return_args (&layer_set_apply_mask_proc, success);
}
@ -1383,7 +1408,7 @@ static ProcArg layer_set_apply_mask_inargs[] =
{
GIMP_PDB_INT32,
"apply-mask",
"The new layer apply mask"
"The new layer's apply mask setting"
}
};
@ -1391,8 +1416,8 @@ static ProcRecord layer_set_apply_mask_proc =
{
"gimp-layer-set-apply-mask",
"gimp-layer-set-apply-mask",
"Set the apply mask of the specified layer.",
"This procedure sets the specified layer's apply mask. This controls whether the layer's mask is currently affecting the alpha channel. If there is no layer mask, this function will return an error.",
"Set the apply mask setting of the specified layer.",
"This procedure sets the specified layer's apply mask setting. This controls whether the layer's mask is currently affecting the alpha channel. If there is no layer mask, this function will return an error.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -1414,15 +1439,24 @@ layer_get_show_mask_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpLayer *layer;
gboolean show_mask = FALSE;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
if (success)
{
if (layer->mask)
show_mask = gimp_layer_mask_get_show (layer->mask);
else
show_mask = FALSE;
}
return_args = procedural_db_return_args (&layer_get_show_mask_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_layer_get_show_mask (layer);
return_args[1].value.pdb_int = show_mask;
return return_args;
}
@ -1441,7 +1475,7 @@ static ProcArg layer_get_show_mask_outargs[] =
{
GIMP_PDB_INT32,
"show-mask",
"The layer show mask"
"The layer's show mask setting"
}
};
@ -1449,8 +1483,8 @@ static ProcRecord layer_get_show_mask_proc =
{
"gimp-layer-get-show-mask",
"gimp-layer-get-show-mask",
"Get the show mask of the specified layer.",
"This procedure returns the specified layer's show mask. If the value is non-zero, then the layer mask for this layer is currently being shown instead of the layer.",
"Get the show mask setting of the specified layer.",
"This procedure returns the specified layer's show mask setting. This controls whether the layer or its mask is visible. Non-zero values indicate that the mask should be visible. If the layer has no mask, then this function returns an error.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -1480,7 +1514,12 @@ layer_set_show_mask_invoker (Gimp *gimp,
show_mask = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
gimp_layer_set_show_mask (layer, show_mask);
{
if (layer->mask)
gimp_layer_mask_set_show (layer->mask, show_mask, TRUE);
else
success = FALSE;
}
return procedural_db_return_args (&layer_set_show_mask_proc, success);
}
@ -1495,7 +1534,7 @@ static ProcArg layer_set_show_mask_inargs[] =
{
GIMP_PDB_INT32,
"show-mask",
"The new layer show mask"
"The new layer's show mask setting"
}
};
@ -1503,8 +1542,8 @@ static ProcRecord layer_set_show_mask_proc =
{
"gimp-layer-set-show-mask",
"gimp-layer-set-show-mask",
"Set the show mask of the specified layer.",
"This procedure sets the specified layer's show mask. This controls whether the layer or it's mask is visible. Non-zero values indicate that the mask should be visible. If the layer has no mask, then this function returns an error.",
"Set the show mask setting of the specified layer.",
"This procedure sets the specified layer's show mask setting. This controls whether the layer's mask is currently affecting the alpha channel. If there is no layer mask, this function will return an error.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -1526,15 +1565,24 @@ layer_get_edit_mask_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpLayer *layer;
gboolean edit_mask = FALSE;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
if (success)
{
if (layer->mask)
edit_mask = gimp_layer_mask_get_edit (layer->mask);
else
edit_mask = FALSE;
}
return_args = procedural_db_return_args (&layer_get_edit_mask_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_layer_get_edit_mask (layer);
return_args[1].value.pdb_int = edit_mask;
return return_args;
}
@ -1553,7 +1601,7 @@ static ProcArg layer_get_edit_mask_outargs[] =
{
GIMP_PDB_INT32,
"edit-mask",
"The layer edit mask"
"The layer's edit mask setting"
}
};
@ -1561,8 +1609,8 @@ static ProcRecord layer_get_edit_mask_proc =
{
"gimp-layer-get-edit-mask",
"gimp-layer-get-edit-mask",
"Get the edit mask of the specified layer.",
"This procedure returns the specified layer's edit mask. If the value is non-zero, then the layer mask for this layer is currently active, and not the layer.",
"Get the edit mask setting of the specified layer.",
"This procedure returns the specified layer's edit mask setting. If the value is non-zero, then the layer mask for this layer is currently active, and not the layer.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -1592,7 +1640,12 @@ layer_set_edit_mask_invoker (Gimp *gimp,
edit_mask = args[1].value.pdb_int ? TRUE : FALSE;
if (success)
gimp_layer_set_edit_mask (layer, edit_mask);
{
if (layer->mask)
gimp_layer_mask_set_edit (layer->mask, edit_mask);
else
success = FALSE;
}
return procedural_db_return_args (&layer_set_edit_mask_proc, success);
}
@ -1607,7 +1660,7 @@ static ProcArg layer_set_edit_mask_inargs[] =
{
GIMP_PDB_INT32,
"edit-mask",
"The new layer edit mask"
"The new layer's edit mask setting"
}
};
@ -1615,8 +1668,8 @@ static ProcRecord layer_set_edit_mask_proc =
{
"gimp-layer-set-edit-mask",
"gimp-layer-set-edit-mask",
"Set the edit mask of the specified layer.",
"This procedure sets the specified layer's edit mask. This controls whether the layer or it's mask is currently active for editing. If the specified layer has no layer mask, then this procedure will return an error.",
"Set the edit mask setting of the specified layer.",
"This procedure sets the specified layer's edit mask setting. This controls whether the layer or it's mask is currently active for editing. If the specified layer has no layer mask, then this procedure will return an error.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@ -1638,15 +1691,21 @@ layer_get_opacity_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpLayer *layer;
gdouble opacity = 0.0;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
if (success)
{
opacity = gimp_layer_get_opacity (layer) * 100.0;
}
return_args = procedural_db_return_args (&layer_get_opacity_proc, success);
if (success)
return_args[1].value.pdb_float = gimp_layer_get_opacity (layer) * 100.0;
return_args[1].value.pdb_float = opacity;
return return_args;
}
@ -1706,7 +1765,9 @@ layer_set_opacity_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_layer_set_opacity (layer, opacity / 100.0, TRUE);
{
gimp_layer_set_opacity (layer, opacity / 100.0, TRUE);
}
return procedural_db_return_args (&layer_set_opacity_proc, success);
}
@ -1752,15 +1813,21 @@ layer_get_mode_invoker (Gimp *gimp,
gboolean success = TRUE;
Argument *return_args;
GimpLayer *layer;
gint32 mode = 0;
layer = (GimpLayer *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
if (! (GIMP_IS_LAYER (layer) && ! gimp_item_is_removed (GIMP_ITEM (layer))))
success = FALSE;
if (success)
{
mode = gimp_layer_get_mode (layer);
}
return_args = procedural_db_return_args (&layer_get_mode_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_layer_get_mode (layer);
return_args[1].value.pdb_int = mode;
return return_args;
}
@ -1820,7 +1887,9 @@ layer_set_mode_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_layer_set_mode (layer, mode, TRUE);
{
gimp_layer_set_mode (layer, mode, TRUE);
}
return procedural_db_return_args (&layer_set_mode_proc, success);
}
@ -1835,7 +1904,7 @@ static ProcArg layer_set_mode_inargs[] =
{
GIMP_PDB_INT32,
"mode",
"The new layer combination mode"
"The new layer combination mode (GIMP_NORMAL_MODE (0), GIMP_DISSOLVE_MODE (1), GIMP_BEHIND_MODE (2), GIMP_MULTIPLY_MODE (3), GIMP_SCREEN_MODE (4), GIMP_OVERLAY_MODE (5), GIMP_DIFFERENCE_MODE (6), GIMP_ADDITION_MODE (7), GIMP_SUBTRACT_MODE (8), GIMP_DARKEN_ONLY_MODE (9), GIMP_LIGHTEN_ONLY_MODE (10), GIMP_HUE_MODE (11), GIMP_SATURATION_MODE (12), GIMP_COLOR_MODE (13), GIMP_VALUE_MODE (14), GIMP_DIVIDE_MODE (15), GIMP_DODGE_MODE (16), GIMP_BURN_MODE (17), GIMP_HARDLIGHT_MODE (18), GIMP_SOFTLIGHT_MODE (19), GIMP_GRAIN_EXTRACT_MODE (20), GIMP_GRAIN_MERGE_MODE (21), GIMP_COLOR_ERASE_MODE (22))"
}
};

View file

@ -1,32 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PDB_GLUE_H__
#define __PDB_GLUE_H__
#define gimp_layer_get_apply_mask(l) (l)->mask ? gimp_layer_mask_get_apply((l)->mask) : FALSE;
#define gimp_layer_get_show_mask(l) (l)->mask ? gimp_layer_mask_get_show((l)->mask) : FALSE;
#define gimp_layer_get_edit_mask(l) (l)->mask ? gimp_layer_mask_get_edit((l)->mask) : FALSE;
#define gimp_layer_set_apply_mask(l,a) { if((l)->mask) gimp_layer_mask_set_apply((l)->mask,(a),TRUE); else success = FALSE; }
#define gimp_layer_set_show_mask(l,s) { if((l)->mask) gimp_layer_mask_set_show((l)->mask,(s),TRUE); else success = FALSE; }
#define gimp_layer_set_edit_mask(l,e) { if((l)->mask) gimp_layer_mask_set_edit((l)->mask,(e)); else success = FALSE; }
#endif /* __PDB_GLUE_H__ */

View file

@ -196,8 +196,8 @@ gimp_layer_add_alpha (gint32 layer_ID)
*
* Scale the layer to the specified extents.
*
* This procedure scales the layer so that it's new width and height
* are equal to the supplied parameters. The \"local_origin\" parameter
* This procedure scales the layer so that its new width and height are
* equal to the supplied parameters. The \"local_origin\" parameter
* specifies whether to scale from the center of the layer, or from the
* image origin. This operation only works if the layer has been added
* to an image.
@ -239,7 +239,7 @@ gimp_layer_scale (gint32 layer_ID,
*
* Resize the layer to the specified extents.
*
* This procedure resizes the layer so that it's new width and height
* This procedure resizes the layer so that its new width and height
* are equal to the supplied parameters. Offsets are also provided
* which describe the position of the previous layer's content. This
* operation only works if the layer has been added to an image.
@ -446,7 +446,7 @@ gimp_layer_get_mask (gint32 layer_ID)
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
mask_ID = return_vals[1].data.d_channel;
mask_ID = return_vals[1].data.d_layer_mask;
gimp_destroy_params (return_vals, nreturn_vals);
@ -656,13 +656,13 @@ gimp_layer_set_lock_alpha (gint32 layer_ID,
* gimp_layer_get_apply_mask:
* @layer_ID: The layer.
*
* Get the apply mask of the specified layer.
* Get the apply mask setting of the specified layer.
*
* This procedure returns the specified layer's apply mask. If the
* value is non-zero, then the layer mask for this layer is currently
* being composited with the layer's alpha channel.
* This procedure returns the specified layer's apply mask setting. If
* the value is non-zero, then the layer mask for this layer is
* currently being composited with the layer's alpha channel.
*
* Returns: The layer apply mask.
* Returns: The layer's apply mask setting.
*/
gboolean
gimp_layer_get_apply_mask (gint32 layer_ID)
@ -687,13 +687,14 @@ gimp_layer_get_apply_mask (gint32 layer_ID)
/**
* gimp_layer_set_apply_mask:
* @layer_ID: The layer.
* @apply_mask: The new layer apply mask.
* @apply_mask: The new layer's apply mask setting.
*
* Set the apply mask of the specified layer.
* Set the apply mask setting of the specified layer.
*
* This procedure sets the specified layer's apply mask. This controls
* whether the layer's mask is currently affecting the alpha channel.
* If there is no layer mask, this function will return an error.
* This procedure sets the specified layer's apply mask setting. This
* controls whether the layer's mask is currently affecting the alpha
* channel. If there is no layer mask, this function will return an
* error.
*
* Returns: TRUE on success.
*/
@ -722,13 +723,14 @@ gimp_layer_set_apply_mask (gint32 layer_ID,
* gimp_layer_get_show_mask:
* @layer_ID: The layer.
*
* Get the show mask of the specified layer.
* Get the show mask setting of the specified layer.
*
* This procedure returns the specified layer's show mask. If the value
* is non-zero, then the layer mask for this layer is currently being
* shown instead of the layer.
* This procedure returns the specified layer's show mask setting. This
* controls whether the layer or its mask is visible. Non-zero values
* indicate that the mask should be visible. If the layer has no mask,
* then this function returns an error.
*
* Returns: The layer show mask.
* Returns: The layer's show mask setting.
*/
gboolean
gimp_layer_get_show_mask (gint32 layer_ID)
@ -753,14 +755,14 @@ gimp_layer_get_show_mask (gint32 layer_ID)
/**
* gimp_layer_set_show_mask:
* @layer_ID: The layer.
* @show_mask: The new layer show mask.
* @show_mask: The new layer's show mask setting.
*
* Set the show mask of the specified layer.
* Set the show mask setting of the specified layer.
*
* This procedure sets the specified layer's show mask. This controls
* whether the layer or it's mask is visible. Non-zero values indicate
* that the mask should be visible. If the layer has no mask, then this
* function returns an error.
* This procedure sets the specified layer's show mask setting. This
* controls whether the layer's mask is currently affecting the alpha
* channel. If there is no layer mask, this function will return an
* error.
*
* Returns: TRUE on success.
*/
@ -789,13 +791,13 @@ gimp_layer_set_show_mask (gint32 layer_ID,
* gimp_layer_get_edit_mask:
* @layer_ID: The layer.
*
* Get the edit mask of the specified layer.
* Get the edit mask setting of the specified layer.
*
* This procedure returns the specified layer's edit mask. If the value
* is non-zero, then the layer mask for this layer is currently active,
* and not the layer.
* This procedure returns the specified layer's edit mask setting. If
* the value is non-zero, then the layer mask for this layer is
* currently active, and not the layer.
*
* Returns: The layer edit mask.
* Returns: The layer's edit mask setting.
*/
gboolean
gimp_layer_get_edit_mask (gint32 layer_ID)
@ -820,14 +822,14 @@ gimp_layer_get_edit_mask (gint32 layer_ID)
/**
* gimp_layer_set_edit_mask:
* @layer_ID: The layer.
* @edit_mask: The new layer edit mask.
* @edit_mask: The new layer's edit mask setting.
*
* Set the edit mask of the specified layer.
* Set the edit mask setting of the specified layer.
*
* This procedure sets the specified layer's edit mask. This controls
* whether the layer or it's mask is currently active for editing. If
* the specified layer has no layer mask, then this procedure will
* return an error.
* This procedure sets the specified layer's edit mask setting. This
* controls whether the layer or it's mask is currently active for
* editing. If the specified layer has no layer mask, then this
* procedure will return an error.
*
* Returns: TRUE on success.
*/

View file

@ -17,102 +17,6 @@
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub channel_get_prop_proc {
my ($prop, $type, $desc, $undo, $core_type, $core_var) = @_;
$core_type = 'channel' unless $core_type;
$core_var = 'channel' unless $core_var;
$blurb = "Get the $desc of the specified channel.";
$help = "This procedure returns the specified channel's $desc. ";
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' }
);
@outargs = (
{ name => $prop, type => $type,
desc => "The channel $desc", no_declare => 1 }
);
my $alias = "gimp_${core_type}_get_$prop ($core_var)";
$alias = "g_strdup ($alias)" if $type eq 'string';
$outargs[0]->{alias} .= "$alias";
if ($type eq 'color') {
delete @{$outargs[0]}{qw(alias no_declare)};
$invoke{code} = 'gimp_channel_get_color (channel, &color);';
}
}
sub channel_set_prop_proc {
my ($prop, $type, $desc, $undo, $core_type, $core_var) = @_;
$core_type = 'channel' unless $core_type;
$core_var = 'channel' unless $core_var;
$blurb = "Set the $desc of the specified channel.";
$help = "This procedure sets the specified channel's $desc. ";
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' },
{ name => $prop, type => $type,
desc => "The new channel $desc" }
);
if ($type =~ /float/) {
$inargs[1]->{desc} .= ' (%%desc%%)';
}
$invoke{code} = $undo ? "gimp_${core_type}_set_$prop ($core_var, $prop, TRUE);"
: "gimp_${core_type}_set_$prop ($core_var, $prop);";
if ($type eq 'color') {
$invoke{code} = <<'CODE'
{
GimpRGB rgb_color = color;
rgb_color.a = channel->color.a;
gimp_channel_set_color (channel, &rgb_color, TRUE);
}
CODE
}
}
sub channel_accessors {
my ($prop, $type, $desc, $undo, $extra, $core_type, $core_var) = @_;
$core_type = 'channel' unless $core_type;
$core_var = 'channel' unless $core_var;
my (@extra, %extra); my $once = 0;
ref($extra) ? (@extra = @$extra) : (@extra = ($extra, $extra));
%extra = map { $once++ ? 'set' : 'get', $_ ? $_ : "" } @extra;
foreach (sort keys %extra) {
my $proc = "channel_${_}_$prop";
push @procs, $proc;
eval <<SUB;
sub @{[ scalar caller ]}::$proc {
\&channel_${_}_prop_proc('$prop', '$type', '$desc', $undo,
'$core_type', '$core_var');
$extra{$_}
}
SUB
}
}
sub channel_new {
$blurb = 'Create a new channel.';
@ -265,25 +169,177 @@ CODE
);
}
&channel_accessors('show_masked', 'boolean', 'composite method', 0,
<<'CODE');
$help .= <<'HELP'
If it is non-zero, then the channel is composited with the image so that masked
regions are shown. Otherwise, selected regions are shown.
sub channel_get_show_masked {
$blurb = "Get the composite method of the specified channel.";
$help = <<'HELP';
This procedure returns the specified channel's composite method. If
it is non-zero, then the channel is composited with the image so that
masked regions are shown. Otherwise, selected regions are shown.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' }
);
@outargs = (
{ name => 'show_masked', type => 'boolean',
desc => 'The channel composite method' }
);
%invoke = (
code => <<'CODE'
{
show_masked = gimp_channel_get_show_masked (channel);
}
CODE
);
}
&channel_accessors('opacity', '0 <= float <= 100', 'opacity', 1,
[ '$outargs[0]->{alias} =
"gimp_channel_get_opacity (channel) * 100.0"',
'$invoke{code} =~
s%opacity, %opacity / 100.0, %' ]);
sub channel_set_show_masked {
$blurb = "Set the composite method of the specified channel.";
&channel_accessors('color', 'color', 'compositing color', 0,
[ '$outargs[0]->{void_ret} = 1', '' ]);
$help = <<'HELP';
This procedure sets the specified channel's composite method. If
it is non-zero, then the channel is composited with the image so that
masked regions are shown. Otherwise, selected regions are shown.
HELP
unshift @procs, qw(channel_new channel_new_from_component channel_copy
channel_combine_masks);
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' },
{ name => 'show_masked', type => 'boolean',
desc => 'The new channel composite method' }
);
%invoke = (
code => <<'CODE'
{
gimp_channel_set_show_masked (channel, show_masked);
}
CODE
);
}
sub channel_get_opacity {
$blurb = "Get the opacity of the specified channel.";
$help = <<'HELP';
This procedure returns the specified channel's opacity.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' }
);
@outargs = (
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The channel opacity' }
);
%invoke = (
code => <<'CODE'
{
opacity = gimp_channel_get_opacity (channel) * 100;
}
CODE
);
}
sub channel_set_opacity {
$blurb = "Set the opacity of the specified channel.";
$help = <<'HELP';
This procedure sets the specified channel's opacity.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' },
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The new channel opacity (%%desc%%)' }
);
%invoke = (
code => <<'CODE'
{
gimp_channel_set_opacity (channel, opacity / 100.0, TRUE);
}
CODE
);
}
sub channel_get_color {
$blurb = "Get the compositing color of the specified channel.";
$help = <<'HELP';
This procedure returns the specified channel's compositing color.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' }
);
@outargs = (
{ name => 'color', type => 'color', void_ret => 1,
desc => 'The channel compositing color' }
);
%invoke = (
code => <<'CODE'
{
gimp_channel_get_color (channel, &color);
}
CODE
);
}
sub channel_set_color {
$blurb = "Set the compositing color of the specified channel.";
$help = <<'HELP';
This procedure sets the specified channel's compositing color.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'channel', type => 'channel',
desc => 'The channel' },
{ name => 'color', type => 'color',
desc => 'The new channel compositing color' }
);
%invoke = (
code => <<'CODE'
{
GimpRGB rgb_color = color;
rgb_color.a = channel->color.a;
gimp_channel_set_color (channel, &rgb_color, TRUE);
}
CODE
);
}
@procs = qw(channel_new channel_new_from_component channel_copy
channel_combine_masks
channel_get_show_masked channel_set_show_masked
channel_get_opacity channel_set_opacity
channel_get_color channel_set_color);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Channel';

View file

@ -17,142 +17,6 @@
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub layer_dim_proc {
my ($op, $morehelp, @args) = @_;
$blurb = "\u$op the layer to the specified extents.";
my $ops = $op =~ /e$/ ? "${op}s" : "${op}es";
$help = <<HELP;
This procedure $ops the layer so that it's new width and height are equal to
the supplied parameters. $morehelp This operation only works if the layer has
been added to an image.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'new_width', type => '0 < int32',
desc => 'New layer width: (%%desc%%)' },
{ name => 'new_height', type => '0 < int32',
desc => 'New layer height: (%%desc%%)' },
);
push @inargs, @args;
my $args = "";
my $call;
foreach (@args) {
$args .= ', ' if $args;
$args .= $_->{name};
}
if ($op eq 'scale') {
$call = "gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height, gimp->config->interpolation_type, NULL, $args);";
} else {
$call = "gimp_item_resize (GIMP_ITEM (layer), context, new_width, new_height, $args);";
}
$invoke{code} = <<"CODE";
{
success = gimp_item_is_attached (GIMP_ITEM (layer));
if (success)
$call
}
CODE
}
sub layer_get_prop_proc {
my ($prop, $type, $desc, $undo, $core_type, $core_var) = @_;
$core_type = 'layer' unless $core_type;
$core_var = 'layer' unless $core_var;
$blurb = "Get the $desc of the specified layer.";
$help = "This procedure returns the specified layer's $desc. ";
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' }
);
@outargs = (
{ name => $prop, type => $type,
desc => "The layer $desc", no_declare => 1 }
);
my $alias = "gimp_${core_type}_get_$prop ($core_var)";
$alias = "g_strdup ($alias)" if $type eq 'string';
$outargs[0]->{alias} .= "$alias";
}
sub layer_set_prop_proc {
my ($prop, $type, $desc, $undo, $core_type, $core_var) = @_;
$core_type = 'layer' unless $core_type;
$core_var = 'layer' unless $core_var;
$blurb = "Set the $desc of the specified layer.";
$help = "This procedure sets the specified layer's $desc. ";
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => $prop, type => $type,
desc => "The new layer $desc" }
);
if ($type =~ /float/) {
$inargs[1]->{desc} .= ' (%%desc%%)';
}
$invoke{code} = $undo ? "gimp_${core_type}_set_$prop ($core_var, $prop, TRUE);"
: "gimp_${core_type}_set_$prop ($core_var, $prop);";
}
sub layer_accessors {
my ($prop, $type, $desc, $setting, $undo, $extra, $core_type, $core_var) = @_;
$core_type = 'layer' unless $core_type;
$core_var = 'layer' unless $core_var;
my (@extra, %extra); my $once = 0;
my $change = "s/ ($desc)/'s \$1 setting/";
(my $common = "\n; foreach (\$blurb, \$help) { $change }") =~ s/'s//;
my %modify = (
get => "$common \$outargs[0]->{desc} =~ $change;",
set => "$common \$inargs[1]->{desc} =~ $change;",
);
ref($extra) ? (@extra = @$extra) : (@extra = ($extra, $extra));
%extra = map { $once++ ? 'set' : 'get', $_ ? $_ : "" } @extra;
foreach (sort keys %extra) {
my $proc = "layer_${_}_$prop";
push @procs, $proc;
eval <<SUB;
sub @{[ scalar caller ]}::$proc {
\&layer_${_}_prop_proc('$prop', '$type', '$desc', $undo,
'$core_type', '$core_var');
$extra{$_}
@{[ $setting ? $modify{$_} : "" ]}
}
SUB
}
}
sub layer_new {
$blurb = 'Create a new layer.';
@ -327,27 +191,81 @@ CODE
}
sub layer_scale {
my $arg = { name => 'local_origin', type => 'boolean',
desc => 'Use a local origin (as opposed to the image origin)' };
$blurb = 'Scale the layer to the specified extents.';
&layer_dim_proc('scale', <<'HELP', $arg);
The "local_origin" parameter specifies whether to scale from the center of the
layer, or from the image origin.
$help = <<'HELP';
This procedure scales the layer so that its new width and height are
equal to the supplied parameters. The "local_origin" parameter
specifies whether to scale from the center of the layer, or from the
image origin. This operation only works if the layer has been added to
an image.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'new_width', type => '0 < int32',
desc => 'New layer width: (%%desc%%)' },
{ name => 'new_height', type => '0 < int32',
desc => 'New layer height: (%%desc%%)' },
{ name => 'local_origin', type => 'boolean',
desc => 'Use a local origin (as opposed to the image origin)' }
);
%invoke = (
code => <<'CODE'
{
success = gimp_item_is_attached (GIMP_ITEM (layer));
if (success)
gimp_item_scale_by_origin (GIMP_ITEM (layer), new_width, new_height,
gimp->config->interpolation_type, NULL,
local_origin);
}
CODE
);
}
sub layer_resize {
my @args;
foreach (qw(x y)) {
push @args, { name => "off$_", type => 'int32',
desc => "$_ offset between upper left corner of old and
new layers: (old - new)" }
}
$blurb = 'Resize the layer to the specified extents.';
&layer_dim_proc('resize', <<'HELP', @args);
Offsets are also provided which describe the position of the previous layer's
content.
$help = <<'HELP';
This procedure resizes the layer so that its new width and height are
equal to the supplied parameters. Offsets are also provided which
describe the position of the previous layer's content. This operation
only works if the layer has been added to an image.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'new_width', type => '0 < int32',
desc => 'New layer width: (%%desc%%)' },
{ name => 'new_height', type => '0 < int32',
desc => 'New layer height: (%%desc%%)' },
{ name => 'offx', type => 'int32',
desc => 'x offset between upper left corner of old and
new layers: (old - new)' },
{ name => 'offy', type => 'int32',
desc => 'y offset between upper left corner of old and
new layers: (old - new)' }
);
%invoke = (
code => <<'CODE'
{
success = gimp_item_is_attached (GIMP_ITEM (layer));
if (success)
gimp_item_resize (GIMP_ITEM (layer), context,
new_width, new_height, offx, offy);
}
CODE
);
}
sub layer_resize_to_image_size {
@ -434,7 +352,12 @@ HELP
desc => 'The layer' }
);
%invoke = ( code => 'gimp_layer_add_alpha (layer);' );
%invoke = ( code => <<'CODE'
{
gimp_layer_add_alpha (layer);
}
CODE
);
}
sub layer_set_offsets {
@ -469,7 +392,7 @@ HELP
);
@outargs = (
{ name => 'mask', type => 'channel',
{ name => 'mask', type => 'layer_mask',
desc => 'The layer mask',
return_fail => -1 }
);
@ -492,7 +415,6 @@ HELP
$author = $copyright = 'Geert Jordaens';
$date = '2004';
$since = '2.2';
@inargs = (
@ -594,67 +516,362 @@ CODE
);
}
&layer_accessors('lock_alpha', 'boolean', 'lock alpha channel', 1, 1);
sub layer_get_lock_alpha {
$blurb = 'Get the lock alpha channel setting of the specified layer.';
&layer_accessors('apply_mask', 'boolean', 'apply mask', 0, 0,
[ <<'CODE1', <<'CODE2' ]);
$help .= <<'HELP';
If the value is non-zero, then the layer mask for this layer is currently being
composited with the layer's alpha channel.
$help = <<'HELP';
This procedure returns the specified layer's lock alpha channel setting.
HELP
CODE1
$help .= <<'HELP';
This controls whether the layer's mask is currently affecting the alpha
channel. If there is no layer mask, this function will return an error.
HELP
CODE2
&layer_accessors('show_mask', 'boolean', 'show mask', 0, 0,
[ <<'CODE1', <<'CODE2' ]);
$help .= <<'HELP';
If the value is non-zero, then the layer mask for this layer is currently being
shown instead of the layer.
HELP
CODE1
$help .= <<'HELP';
This controls whether the layer or it's mask is visible. Non-zero values
indicate that the mask should be visible. If the layer has no mask, then this
function returns an error.
HELP
CODE2
&std_pdb_misc;
&layer_accessors('edit_mask', 'boolean', 'edit mask', 0, 0,
[ <<'CODE1', <<'CODE2' ]);
$help .= <<'HELP';
If the value is non-zero, then the layer mask for this layer is currently
active, and not the layer.
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' }
);
@outargs = (
{ name => 'lock_alpha', type => 'boolean',
desc => 'The layer\'s lock alpha channel setting' }
);
%invoke = (
code => <<'CODE'
{
lock_alpha = gimp_layer_get_lock_alpha (layer);
}
CODE
);
}
sub layer_set_lock_alpha {
$blurb = 'Set the lock alpha channel setting of the specified layer.';
$help = <<'HELP';
This procedure sets the specified layer's lock alpha channel setting.
HELP
CODE1
$help .= <<'HELP';
This controls whether the layer or it's mask is currently active for editing.
If the specified layer has no layer mask, then this procedure will return an
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'lock_alpha', type => 'boolean',
desc => 'The new layer\'s lock alpha channel setting' }
);
%invoke = (
code => <<'CODE'
{
gimp_layer_set_lock_alpha (layer, lock_alpha, TRUE);
}
CODE
);
}
sub layer_get_apply_mask {
$blurb = 'Get the apply mask setting of the specified layer.';
$help = <<'HELP';
This procedure returns the specified layer's apply mask setting. If
the value is non-zero, then the layer mask for this layer is currently
being composited with the layer's alpha channel.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' }
);
@outargs = (
{ name => 'apply_mask', type => 'boolean',
desc => 'The layer\'s apply mask setting' }
);
%invoke = (
code => <<'CODE'
{
if (layer->mask)
apply_mask = gimp_layer_mask_get_apply (layer->mask);
else
apply_mask = FALSE;
}
CODE
);
}
sub layer_set_apply_mask {
$blurb = 'Set the apply mask setting of the specified layer.';
$help = <<'HELP';
This procedure sets the specified layer's apply mask setting. This
controls whether the layer's mask is currently affecting the alpha
channel. If there is no layer mask, this function will return an
error.
HELP
CODE2
&layer_accessors('opacity', '0 <= float <= 100', 'opacity', 0, 1,
[ '$outargs[0]->{alias} =
"gimp_layer_get_opacity (layer) * 100.0"',
'$invoke{code} =~
s%opacity, %opacity / 100.0, %' ]);
&std_pdb_misc;
&layer_accessors('mode', 'enum GimpLayerModeEffects', 'combination mode', 0, 1);
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'apply_mask', type => 'boolean',
desc => 'The new layer\'s apply mask setting' }
);
%invoke = (
code => <<'CODE'
{
if (layer->mask)
gimp_layer_mask_set_apply (layer->mask, apply_mask, TRUE);
else
success = FALSE;
}
CODE
);
}
sub layer_get_show_mask {
$blurb = 'Get the show mask setting of the specified layer.';
$help = <<'HELP';
This procedure returns the specified layer's show mask setting. This
controls whether the layer or its mask is visible. Non-zero values
indicate that the mask should be visible. If the layer has no mask,
then this function returns an error.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' }
);
@outargs = (
{ name => 'show_mask', type => 'boolean',
desc => 'The layer\'s show mask setting' }
);
%invoke = (
code => <<'CODE'
{
if (layer->mask)
show_mask = gimp_layer_mask_get_show (layer->mask);
else
show_mask = FALSE;
}
CODE
);
}
sub layer_set_show_mask {
$blurb = 'Set the show mask setting of the specified layer.';
$help = <<'HELP';
This procedure sets the specified layer's show mask setting. This
controls whether the layer's mask is currently affecting the alpha
channel. If there is no layer mask, this function will return an
error.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'show_mask', type => 'boolean',
desc => 'The new layer\'s show mask setting' }
);
%invoke = (
code => <<'CODE'
{
if (layer->mask)
gimp_layer_mask_set_show (layer->mask, show_mask, TRUE);
else
success = FALSE;
}
CODE
);
}
sub layer_get_edit_mask {
$blurb = 'Get the edit mask setting of the specified layer.';
$help = <<'HELP';
This procedure returns the specified layer's edit mask setting. If
the value is non-zero, then the layer mask for this layer is currently
active, and not the layer.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' }
);
@outargs = (
{ name => 'edit_mask', type => 'boolean',
desc => 'The layer\'s edit mask setting' }
);
%invoke = (
code => <<'CODE'
{
if (layer->mask)
edit_mask = gimp_layer_mask_get_edit (layer->mask);
else
edit_mask = FALSE;
}
CODE
);
}
sub layer_set_edit_mask {
$blurb = 'Set the edit mask setting of the specified layer.';
$help = <<'HELP';
This procedure sets the specified layer's edit mask setting. This
controls whether the layer or it's mask is currently active for
editing. If the specified layer has no layer mask, then this
procedure will return an error.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'edit_mask', type => 'boolean',
desc => 'The new layer\'s edit mask setting' }
);
%invoke = (
code => <<'CODE'
{
if (layer->mask)
gimp_layer_mask_set_edit (layer->mask, edit_mask);
else
success = FALSE;
}
CODE
);
}
sub layer_get_opacity {
$blurb = 'Get the opacity of the specified layer.';
$help = "This procedure returns the specified layer's opacity.";
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' }
);
@outargs = (
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The layer opacity' }
);
%invoke = (
code => <<'CODE'
{
opacity = gimp_layer_get_opacity (layer) * 100.0;
}
CODE
);
}
sub layer_set_opacity {
$blurb = 'Set the opacity of the specified layer.';
$help = "This procedure sets the specified layer's opacity.";
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The new layer opacity (%%desc%%)' }
);
%invoke = (
code => <<'CODE'
{
gimp_layer_set_opacity (layer, opacity / 100.0, TRUE);
}
CODE
);
}
sub layer_get_mode {
$blurb = 'Get the combination mode of the specified layer.';
$help = "This procedure returns the specified layer's combination mode.";
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' }
);
@outargs = (
{ name => 'mode', type => 'enum GimpLayerModeEffects',
desc => 'The layer combination mode' }
);
%invoke = (
code => <<'CODE'
{
mode = gimp_layer_get_mode (layer);
}
CODE
);
}
sub layer_set_mode {
$blurb = 'Set the combination mode of the specified layer.';
$help = "This procedure sets the specified layer's combination mode.";
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer' },
{ name => 'mode', type => 'enum GimpLayerModeEffects',
desc => 'The new layer combination mode (%%desc%%)' }
);
%invoke = (
code => <<'CODE'
{
gimp_layer_set_mode (layer, mode, TRUE);
}
CODE
);
}
@headers = qw("config/gimpcoreconfig.h" "core/gimp.h" "core/gimpimage-undo.h"
"core/gimpitem-linked.h" "pdb_glue.h" "gimp-intl.h");
"core/gimpitem-linked.h" "gimp-intl.h");
unshift @procs, qw(layer_new layer_new_from_drawable layer_copy
layer_add_alpha
layer_scale layer_resize layer_resize_to_image_size
layer_translate layer_set_offsets
layer_create_mask layer_get_mask layer_from_mask
layer_add_mask layer_remove_mask
layer_is_floating_sel);
@procs = qw(layer_new layer_new_from_drawable layer_copy
layer_add_alpha
layer_scale layer_resize layer_resize_to_image_size
layer_translate layer_set_offsets
layer_create_mask layer_get_mask layer_from_mask
layer_add_mask layer_remove_mask
layer_is_floating_sel
layer_get_lock_alpha layer_set_lock_alpha
layer_get_apply_mask layer_set_apply_mask
layer_get_show_mask layer_set_show_mask
layer_get_edit_mask layer_set_edit_mask
layer_get_opacity layer_set_opacity
layer_get_mode layer_set_mode);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Layer';