mirror of https://github.com/GNOME/gimp.git
added gimp-layer-flatten. Fixes bug #477026. Fixed docs of
2007-09-15 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/layer.pdb: added gimp-layer-flatten. Fixes bug #477026. Fixed docs of gimp-layer-add-alpha. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch]: regenerated. * libgimp/gimp.def: changed accordingly. svn path=/trunk/; revision=23556
This commit is contained in:
parent
08d38cea82
commit
c1b9979db7
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2007-09-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/layer.pdb: added gimp-layer-flatten.
|
||||
Fixes bug #477026. Fixed docs of gimp-layer-add-alpha.
|
||||
|
||||
* app/pdb/internal_procs.c
|
||||
* app/pdb/layer_cmds.c
|
||||
* libgimp/gimplayer_pdb.[ch]: regenerated.
|
||||
* libgimp/gimp.def: changed accordingly.
|
||||
|
||||
2007-09-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Make layer masks work consistently on layers without alpha.
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "internal_procs.h"
|
||||
|
||||
|
||||
/* 551 procedures registered total */
|
||||
/* 552 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -184,6 +184,26 @@ layer_add_alpha_invoker (GimpProcedure *procedure,
|
|||
return gimp_procedure_get_return_values (procedure, success);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
layer_flatten_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpLayer *layer;
|
||||
|
||||
layer = gimp_value_get_layer (&args->values[0], gimp);
|
||||
|
||||
if (success)
|
||||
{
|
||||
gimp_layer_flatten (layer, context);
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
layer_scale_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
|
@ -977,7 +997,7 @@ register_layer_procs (GimpPDB *pdb)
|
|||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-layer-add-alpha",
|
||||
"Add an alpha channel to the layer if it doesn't already have one.",
|
||||
"This procedure adds an additional component to the specified layer if it does not already possess an alpha channel. An alpha channel makes it possible to move a layer from the bottom of the layer stack and to clear and erase to transparency, instead of the background color. This transforms images of type RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA.",
|
||||
"This procedure adds an additional component to the specified layer if it does not already possess an alpha channel. An alpha channel makes it possible to clear and erase to transparency, instead of the background color. This transforms layers of type RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
|
@ -991,6 +1011,28 @@ register_layer_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-layer-flatten
|
||||
*/
|
||||
procedure = gimp_procedure_new (layer_flatten_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-layer-flatten");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-layer-flatten",
|
||||
"Remove the alpha channel from the layer if it has one.",
|
||||
"This procedure removes the alpha channel from a layer, blending all (partially) transparent pixels in the layer against the background color. This transforms layers of type RGBA to RGB, GRAYA to GRAY, and INDEXEDA to INDEXED.",
|
||||
"Michael Natterer <mitch@gimp.org>",
|
||||
"Michael Natterer",
|
||||
"2007",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_layer_id ("layer",
|
||||
"layer",
|
||||
"The layer",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-layer-scale
|
||||
*/
|
||||
|
|
|
@ -405,6 +405,7 @@ EXPORTS
|
|||
gimp_layer_add_mask
|
||||
gimp_layer_copy
|
||||
gimp_layer_create_mask
|
||||
gimp_layer_flatten
|
||||
gimp_layer_from_mask
|
||||
gimp_layer_get_apply_mask
|
||||
gimp_layer_get_edit_mask
|
||||
|
|
|
@ -161,10 +161,9 @@ _gimp_layer_copy (gint32 layer_ID,
|
|||
*
|
||||
* This procedure adds an additional component to the specified layer
|
||||
* if it does not already possess an alpha channel. An alpha channel
|
||||
* makes it possible to move a layer from the bottom of the layer stack
|
||||
* and to clear and erase to transparency, instead of the background
|
||||
* color. This transforms images of type RGB to RGBA, GRAY to GRAYA,
|
||||
* and INDEXED to INDEXEDA.
|
||||
* makes it possible to clear and erase to transparency, instead of the
|
||||
* background color. This transforms layers of type RGB to RGBA, GRAY
|
||||
* to GRAYA, and INDEXED to INDEXEDA.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*/
|
||||
|
@ -187,6 +186,40 @@ gimp_layer_add_alpha (gint32 layer_ID)
|
|||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_layer_flatten:
|
||||
* @layer_ID: The layer.
|
||||
*
|
||||
* Remove the alpha channel from the layer if it has one.
|
||||
*
|
||||
* This procedure removes the alpha channel from a layer, blending all
|
||||
* (partially) transparent pixels in the layer against the background
|
||||
* color. This transforms layers of type RGBA to RGB, GRAYA to GRAY,
|
||||
* and INDEXEDA to INDEXED.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
*/
|
||||
gboolean
|
||||
gimp_layer_flatten (gint32 layer_ID)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gboolean success = TRUE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-layer-flatten",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_LAYER, layer_ID,
|
||||
GIMP_PDB_END);
|
||||
|
||||
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_layer_scale:
|
||||
* @layer_ID: The layer.
|
||||
|
|
|
@ -41,6 +41,7 @@ gint32 gimp_layer_new_from_drawable (gint32 dr
|
|||
G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
|
||||
gboolean add_alpha);
|
||||
gboolean gimp_layer_add_alpha (gint32 layer_ID);
|
||||
gboolean gimp_layer_flatten (gint32 layer_ID);
|
||||
gboolean gimp_layer_scale (gint32 layer_ID,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
|
|
|
@ -369,11 +369,11 @@ Add an alpha channel to the layer if it doesn't already have one.
|
|||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure adds an additional component to the specified layer if it does
|
||||
not already possess an alpha channel. An alpha channel makes it possible to
|
||||
move a layer from the bottom of the layer stack and to clear and erase to
|
||||
transparency, instead of the background color. This transforms images of type
|
||||
RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA.
|
||||
This procedure adds an additional component to the specified layer if
|
||||
it does not already possess an alpha channel. An alpha channel makes
|
||||
it possible to clear and erase to transparency, instead of the
|
||||
background color. This transforms layers of type RGB to RGBA, GRAY to
|
||||
GRAYA, and INDEXED to INDEXEDA.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
@ -392,6 +392,34 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub layer_flatten {
|
||||
$blurb = <<'BLURB';
|
||||
Remove the alpha channel from the layer if it has one.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure removes the alpha channel from a layer, blending all
|
||||
(partially) transparent pixels in the layer against the background
|
||||
color. This transforms layers of type RGBA to RGB, GRAYA to
|
||||
GRAY, and INDEXEDA to INDEXED.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2007', '2.4');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'layer', type => 'layer',
|
||||
desc => 'The layer' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimp_layer_flatten (layer, context);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub layer_set_offsets {
|
||||
$blurb = 'Set the layer offsets.';
|
||||
|
||||
|
@ -922,7 +950,7 @@ CODE
|
|||
"gimp-intl.h");
|
||||
|
||||
@procs = qw(layer_new layer_new_from_drawable layer_copy
|
||||
layer_add_alpha
|
||||
layer_add_alpha layer_flatten
|
||||
layer_scale layer_resize layer_resize_to_image_size
|
||||
layer_translate layer_set_offsets
|
||||
layer_create_mask layer_get_mask layer_from_mask
|
||||
|
|
Loading…
Reference in New Issue