mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
app, libgimp, pdb, plug-ins: merge gimp_channel_new() in libgimp and PDB.
Why have 2 functions if one is basically just redirecting to the other. All we needed to do was to reorder the PDB args.
This commit is contained in:
parent
bd287d6f89
commit
3051796f3e
12 changed files with 82 additions and 117 deletions
|
@ -57,17 +57,17 @@ channel_new_invoker (GimpProcedure *procedure,
|
||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
GimpValueArray *return_vals;
|
GimpValueArray *return_vals;
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
|
const gchar *name;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
const gchar *name;
|
|
||||||
gdouble opacity;
|
gdouble opacity;
|
||||||
GeglColor *color;
|
GeglColor *color;
|
||||||
GimpChannel *channel = NULL;
|
GimpChannel *channel = NULL;
|
||||||
|
|
||||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||||
width = g_value_get_int (gimp_value_array_index (args, 1));
|
name = g_value_get_string (gimp_value_array_index (args, 1));
|
||||||
height = g_value_get_int (gimp_value_array_index (args, 2));
|
width = g_value_get_int (gimp_value_array_index (args, 2));
|
||||||
name = g_value_get_string (gimp_value_array_index (args, 3));
|
height = g_value_get_int (gimp_value_array_index (args, 3));
|
||||||
opacity = g_value_get_double (gimp_value_array_index (args, 4));
|
opacity = g_value_get_double (gimp_value_array_index (args, 4));
|
||||||
color = g_value_get_object (gimp_value_array_index (args, 5));
|
color = g_value_get_object (gimp_value_array_index (args, 5));
|
||||||
|
|
||||||
|
@ -382,8 +382,12 @@ register_channel_procs (GimpPDB *pdb)
|
||||||
"gimp-channel-new");
|
"gimp-channel-new");
|
||||||
gimp_procedure_set_static_help (procedure,
|
gimp_procedure_set_static_help (procedure,
|
||||||
"Create a new channel.",
|
"Create a new channel.",
|
||||||
"This procedure creates a new channel with the specified width, height, name, opacity and color.\n"
|
"This procedure creates a new channel with the specified @width, @height, @name, @opacity and @color.\n"
|
||||||
"The new channel still needs to be added to the image, as this is not automatic. Add the new channel with 'gimp-image-insert-channel'. Other attributes, such as channel visibility, should be set with explicit procedure calls.\n"
|
"\n"
|
||||||
|
"Other attributes, such as channel visibility, should be set with explicit procedure calls.\n"
|
||||||
|
"\n"
|
||||||
|
"The new channel still needs to be added to the image, as this is not automatic. Add the new channel with [method@Gimp.Image.insert_channel].\n"
|
||||||
|
"\n"
|
||||||
"The channel's contents are undefined initially.",
|
"The channel's contents are undefined initially.",
|
||||||
NULL);
|
NULL);
|
||||||
gimp_procedure_set_static_attribution (procedure,
|
gimp_procedure_set_static_attribution (procedure,
|
||||||
|
@ -396,6 +400,13 @@ register_channel_procs (GimpPDB *pdb)
|
||||||
"The image to which to add the channel",
|
"The image to which to add the channel",
|
||||||
FALSE,
|
FALSE,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_procedure_add_argument (procedure,
|
||||||
|
gimp_param_spec_string ("name",
|
||||||
|
"name",
|
||||||
|
"The channel name",
|
||||||
|
FALSE, FALSE, FALSE,
|
||||||
|
NULL,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_procedure_add_argument (procedure,
|
gimp_procedure_add_argument (procedure,
|
||||||
g_param_spec_int ("width",
|
g_param_spec_int ("width",
|
||||||
"width",
|
"width",
|
||||||
|
@ -408,13 +419,6 @@ register_channel_procs (GimpPDB *pdb)
|
||||||
"The channel height",
|
"The channel height",
|
||||||
1, GIMP_MAX_IMAGE_SIZE, 1,
|
1, GIMP_MAX_IMAGE_SIZE, 1,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_procedure_add_argument (procedure,
|
|
||||||
gimp_param_spec_string ("name",
|
|
||||||
"name",
|
|
||||||
"The channel name",
|
|
||||||
FALSE, FALSE, FALSE,
|
|
||||||
NULL,
|
|
||||||
GIMP_PARAM_READWRITE));
|
|
||||||
gimp_procedure_add_argument (procedure,
|
gimp_procedure_add_argument (procedure,
|
||||||
g_param_spec_double ("opacity",
|
g_param_spec_double ("opacity",
|
||||||
"opacity",
|
"opacity",
|
||||||
|
|
|
@ -63,41 +63,3 @@ gimp_channel_get_by_id (gint32 channel_id)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gimp_channel_new:
|
|
||||||
* @image: The image to which to add the channel.
|
|
||||||
* @name: The channel name.
|
|
||||||
* @width: The channel width.
|
|
||||||
* @height: The channel height.
|
|
||||||
* @opacity: The channel opacity.
|
|
||||||
* @color: The channel compositing color.
|
|
||||||
*
|
|
||||||
* Create a new channel.
|
|
||||||
*
|
|
||||||
* This procedure creates a new channel with the specified width and
|
|
||||||
* height. Name, opacity, and color are also supplied parameters. The
|
|
||||||
* new channel still needs to be added to the image, as this is not
|
|
||||||
* automatic. Add the new channel with the gimp_image_insert_channel()
|
|
||||||
* command. Other attributes such as channel show masked, should be
|
|
||||||
* set with explicit procedure calls. The channel's contents are
|
|
||||||
* undefined initially.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): The newly created channel.
|
|
||||||
* The object belongs to libgimp and you should not free it.
|
|
||||||
*/
|
|
||||||
GimpChannel *
|
|
||||||
gimp_channel_new (GimpImage *image,
|
|
||||||
const gchar *name,
|
|
||||||
guint width,
|
|
||||||
guint height,
|
|
||||||
gdouble opacity,
|
|
||||||
GeglColor *color)
|
|
||||||
{
|
|
||||||
return _gimp_channel_new (image,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
name,
|
|
||||||
opacity,
|
|
||||||
color);
|
|
||||||
}
|
|
||||||
|
|
|
@ -54,13 +54,6 @@ struct _GimpChannelClass
|
||||||
|
|
||||||
GimpChannel * gimp_channel_get_by_id (gint32 channel_id);
|
GimpChannel * gimp_channel_get_by_id (gint32 channel_id);
|
||||||
|
|
||||||
GimpChannel * gimp_channel_new (GimpImage *image,
|
|
||||||
const gchar *name,
|
|
||||||
guint width,
|
|
||||||
guint height,
|
|
||||||
gdouble opacity,
|
|
||||||
GeglColor *color);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -37,33 +37,37 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _gimp_channel_new:
|
* gimp_channel_new:
|
||||||
* @image: The image to which to add the channel.
|
* @image: The image to which to add the channel.
|
||||||
|
* @name: The channel name.
|
||||||
* @width: The channel width.
|
* @width: The channel width.
|
||||||
* @height: The channel height.
|
* @height: The channel height.
|
||||||
* @name: The channel name.
|
|
||||||
* @opacity: The channel opacity.
|
* @opacity: The channel opacity.
|
||||||
* @color: The channel compositing color.
|
* @color: The channel compositing color.
|
||||||
*
|
*
|
||||||
* Create a new channel.
|
* Create a new channel.
|
||||||
*
|
*
|
||||||
* This procedure creates a new channel with the specified width,
|
* This procedure creates a new channel with the specified @width,
|
||||||
* height, name, opacity and color.
|
* @height, @name, @opacity and @color.
|
||||||
* The new channel still needs to be added to the image, as this is not
|
*
|
||||||
* automatic. Add the new channel with gimp_image_insert_channel().
|
|
||||||
* Other attributes, such as channel visibility, should be set with
|
* Other attributes, such as channel visibility, should be set with
|
||||||
* explicit procedure calls.
|
* explicit procedure calls.
|
||||||
|
*
|
||||||
|
* The new channel still needs to be added to the image, as this is not
|
||||||
|
* automatic. Add the new channel with
|
||||||
|
* [method@Gimp.Image.insert_channel].
|
||||||
|
*
|
||||||
* The channel's contents are undefined initially.
|
* The channel's contents are undefined initially.
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): The newly created channel.
|
* Returns: (transfer none): The newly created channel.
|
||||||
**/
|
**/
|
||||||
GimpChannel *
|
GimpChannel *
|
||||||
_gimp_channel_new (GimpImage *image,
|
gimp_channel_new (GimpImage *image,
|
||||||
gint width,
|
const gchar *name,
|
||||||
gint height,
|
gint width,
|
||||||
const gchar *name,
|
gint height,
|
||||||
gdouble opacity,
|
gdouble opacity,
|
||||||
GeglColor *color)
|
GeglColor *color)
|
||||||
{
|
{
|
||||||
GimpValueArray *args;
|
GimpValueArray *args;
|
||||||
GimpValueArray *return_vals;
|
GimpValueArray *return_vals;
|
||||||
|
@ -71,9 +75,9 @@ _gimp_channel_new (GimpImage *image,
|
||||||
|
|
||||||
args = gimp_value_array_new_from_types (NULL,
|
args = gimp_value_array_new_from_types (NULL,
|
||||||
GIMP_TYPE_IMAGE, image,
|
GIMP_TYPE_IMAGE, image,
|
||||||
|
G_TYPE_STRING, name,
|
||||||
G_TYPE_INT, width,
|
G_TYPE_INT, width,
|
||||||
G_TYPE_INT, height,
|
G_TYPE_INT, height,
|
||||||
G_TYPE_STRING, name,
|
|
||||||
G_TYPE_DOUBLE, opacity,
|
G_TYPE_DOUBLE, opacity,
|
||||||
GEGL_TYPE_COLOR, color,
|
GEGL_TYPE_COLOR, color,
|
||||||
G_TYPE_NONE);
|
G_TYPE_NONE);
|
||||||
|
|
|
@ -32,30 +32,30 @@ G_BEGIN_DECLS
|
||||||
/* For information look into the C source or the html documentation */
|
/* For information look into the C source or the html documentation */
|
||||||
|
|
||||||
|
|
||||||
G_GNUC_INTERNAL GimpChannel* _gimp_channel_new (GimpImage *image,
|
GimpChannel* gimp_channel_new (GimpImage *image,
|
||||||
gint width,
|
const gchar *name,
|
||||||
gint height,
|
gint width,
|
||||||
const gchar *name,
|
gint height,
|
||||||
gdouble opacity,
|
gdouble opacity,
|
||||||
GeglColor *color);
|
GeglColor *color);
|
||||||
GimpChannel* gimp_channel_new_from_component (GimpImage *image,
|
GimpChannel* gimp_channel_new_from_component (GimpImage *image,
|
||||||
GimpChannelType component,
|
GimpChannelType component,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
GimpChannel* gimp_channel_copy (GimpChannel *channel);
|
GimpChannel* gimp_channel_copy (GimpChannel *channel);
|
||||||
gboolean gimp_channel_combine_masks (GimpChannel *channel1,
|
gboolean gimp_channel_combine_masks (GimpChannel *channel1,
|
||||||
GimpChannel *channel2,
|
GimpChannel *channel2,
|
||||||
GimpChannelOps operation,
|
GimpChannelOps operation,
|
||||||
gint offx,
|
gint offx,
|
||||||
gint offy);
|
gint offy);
|
||||||
gboolean gimp_channel_get_show_masked (GimpChannel *channel);
|
gboolean gimp_channel_get_show_masked (GimpChannel *channel);
|
||||||
gboolean gimp_channel_set_show_masked (GimpChannel *channel,
|
gboolean gimp_channel_set_show_masked (GimpChannel *channel,
|
||||||
gboolean show_masked);
|
gboolean show_masked);
|
||||||
gdouble gimp_channel_get_opacity (GimpChannel *channel);
|
gdouble gimp_channel_get_opacity (GimpChannel *channel);
|
||||||
gboolean gimp_channel_set_opacity (GimpChannel *channel,
|
gboolean gimp_channel_set_opacity (GimpChannel *channel,
|
||||||
gdouble opacity);
|
gdouble opacity);
|
||||||
GeglColor* gimp_channel_get_color (GimpChannel *channel);
|
GeglColor* gimp_channel_get_color (GimpChannel *channel);
|
||||||
gboolean gimp_channel_set_color (GimpChannel *channel,
|
gboolean gimp_channel_set_color (GimpChannel *channel,
|
||||||
GeglColor *color);
|
GeglColor *color);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -20,30 +20,32 @@ sub channel_new {
|
||||||
$blurb = 'Create a new channel.';
|
$blurb = 'Create a new channel.';
|
||||||
|
|
||||||
$help = <<'HELP';
|
$help = <<'HELP';
|
||||||
This procedure creates a new channel with the specified width, height,
|
This procedure creates a new channel with the specified @width, @height,
|
||||||
name, opacity and color.
|
@name, @opacity and @color.
|
||||||
|
|
||||||
|
|
||||||
|
Other attributes, such as channel visibility, should be set with
|
||||||
|
explicit procedure calls.
|
||||||
|
|
||||||
|
|
||||||
The new channel still needs to be added to the image, as this is not
|
The new channel still needs to be added to the image, as this is not
|
||||||
automatic. Add the new channel with gimp_image_insert_channel(). Other
|
automatic. Add the new channel with [method@Gimp.Image.insert_channel].
|
||||||
attributes, such as channel visibility, should be set with explicit
|
|
||||||
procedure calls.
|
|
||||||
|
|
||||||
The channel's contents are undefined initially.
|
The channel's contents are undefined initially.
|
||||||
HELP
|
HELP
|
||||||
|
|
||||||
&std_pdb_misc;
|
&std_pdb_misc;
|
||||||
|
|
||||||
$lib_private = 1;
|
|
||||||
|
|
||||||
@inargs = (
|
@inargs = (
|
||||||
{ name => 'image', type => 'image',
|
{ name => 'image', type => 'image',
|
||||||
desc => 'The image to which to add the channel' },
|
desc => 'The image to which to add the channel' },
|
||||||
|
{ name => 'name', type => 'string',
|
||||||
|
desc => 'The channel name' },
|
||||||
{ name => 'width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
|
{ name => 'width', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
|
||||||
desc => 'The channel width' },
|
desc => 'The channel width' },
|
||||||
{ name => 'height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
|
{ name => 'height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE',
|
||||||
desc => 'The channel height' },
|
desc => 'The channel height' },
|
||||||
{ name => 'name', type => 'string',
|
|
||||||
desc => 'The channel name' },
|
|
||||||
{ name => 'opacity', type => '0 <= float <= 100',
|
{ name => 'opacity', type => '0 <= float <= 100',
|
||||||
desc => 'The channel opacity' },
|
desc => 'The channel opacity' },
|
||||||
{ name => 'color', type => 'geglcolor',
|
{ name => 'color', type => 'geglcolor',
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
(feather (carve-scale size 0.3))
|
(feather (carve-scale size 0.3))
|
||||||
(brush-size (carve-scale size 0.3))
|
(brush-size (carve-scale size 0.3))
|
||||||
(brush (car (gimp-brush-new "Carve It")))
|
(brush (car (gimp-brush-new "Carve It")))
|
||||||
(mask (car (gimp-channel-new img width height "Engraving Mask" 50 '(0 0 0))))
|
(mask (car (gimp-channel-new img "Engraving Mask" width height 50 '(0 0 0))))
|
||||||
(inset-gamma (calculate-inset-gamma (car (gimp-item-get-image src-layer)) src-layer))
|
(inset-gamma (calculate-inset-gamma (car (gimp-item-get-image src-layer)) src-layer))
|
||||||
(mask-fat 0)
|
(mask-fat 0)
|
||||||
(mask-emboss 0)
|
(mask-emboss 0)
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
(feather (sota-scale size 0.5 chrome-factor))
|
(feather (sota-scale size 0.5 chrome-factor))
|
||||||
(brush-size (sota-scale size 0.5 chrome-factor))
|
(brush-size (sota-scale size 0.5 chrome-factor))
|
||||||
(brush (gimp-brush-new "Chrome It"))
|
(brush (gimp-brush-new "Chrome It"))
|
||||||
(mask (gimp-channel-new img width height "Chrome Stencil" 50 '(0 0 0)))
|
(mask (gimp-channel-new img "Chrome Stencil" width height 50 '(0 0 0)))
|
||||||
(bg-layer (gimp-layer-new img width height GRAY-IMAGE _"Background" 100 LAYER-MODE-NORMAL))
|
(bg-layer (gimp-layer-new img width height GRAY-IMAGE _"Background" 100 LAYER-MODE-NORMAL))
|
||||||
(layer1 (gimp-layer-new img banding-width banding-height banding-type _"Layer 1" 100 LAYER-MODE-NORMAL))
|
(layer1 (gimp-layer-new img banding-width banding-height banding-type _"Layer 1" 100 LAYER-MODE-NORMAL))
|
||||||
(layer2 (gimp-layer-new img width height GRAYA-IMAGE _"Layer 2" 100 LAYER-MODE-DIFFERENCE))
|
(layer2 (gimp-layer-new img width height GRAYA-IMAGE _"Layer 2" 100 LAYER-MODE-DIFFERENCE))
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
(define testChannel
|
(define testChannel
|
||||||
(gimp-channel-new
|
(gimp-channel-new
|
||||||
testImage ; image
|
testImage ; image
|
||||||
23 24 ; width, height
|
|
||||||
"Test Channel" ; name
|
"Test Channel" ; name
|
||||||
|
23 24 ; width, height
|
||||||
50.0 ; opacity
|
50.0 ; opacity
|
||||||
"red" )) ; compositing color
|
"red" )) ; compositing color
|
||||||
|
|
||||||
|
@ -85,4 +85,4 @@
|
||||||
|
|
||||||
; TODO other item methods
|
; TODO other item methods
|
||||||
|
|
||||||
(script-fu-use-v2)
|
(script-fu-use-v2)
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
; setup (not in an assert and not quoted)
|
; setup (not in an assert and not quoted)
|
||||||
; vectors-new succeeds
|
; vectors-new succeeds
|
||||||
(define testChannel (car (gimp-channel-new
|
(define testChannel (car (gimp-channel-new
|
||||||
testImage ; image
|
testImage ; image
|
||||||
23 24 ; width, height
|
|
||||||
"Test Channel" ; name
|
"Test Channel" ; name
|
||||||
|
23 24 ; width, height
|
||||||
50.0 ; opacity
|
50.0 ; opacity
|
||||||
"red" ))) ; compositing color
|
"red" ))) ; compositing color
|
||||||
|
|
||||||
|
@ -91,9 +91,9 @@
|
||||||
; Can delete a new channel not yet added to image
|
; Can delete a new channel not yet added to image
|
||||||
|
|
||||||
(define testChannel2 (car (gimp-channel-new
|
(define testChannel2 (car (gimp-channel-new
|
||||||
testImage ; image
|
testImage ; image
|
||||||
23 24 ; width, height
|
|
||||||
"Test Channel" ; name
|
"Test Channel" ; name
|
||||||
|
23 24 ; width, height
|
||||||
50.0 ; opacity
|
50.0 ; opacity
|
||||||
"red" ))) ; compositing color
|
"red" ))) ; compositing color
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
; create test channel
|
; create test channel
|
||||||
; The test image has no channels (RGB are not considered channels.)
|
; The test image has no channels (RGB are not considered channels.)
|
||||||
(define testChannel (car (gimp-channel-new
|
(define testChannel (car (gimp-channel-new
|
||||||
testImage ; image
|
testImage ; image
|
||||||
23 24 ; width, height
|
|
||||||
"Test Channel" ; name
|
"Test Channel" ; name
|
||||||
|
23 24 ; width, height
|
||||||
50.0 ; opacity
|
50.0 ; opacity
|
||||||
"red" ))) ; compositing color
|
"red" ))) ; compositing color
|
||||||
; a new channel is not in the image until added
|
; a new channel is not in the image until added
|
||||||
|
|
|
@ -148,9 +148,9 @@
|
||||||
31 ; fontsize
|
31 ; fontsize
|
||||||
testFont )))
|
testFont )))
|
||||||
(define testChannel (car (gimp-channel-new
|
(define testChannel (car (gimp-channel-new
|
||||||
testImage ; image
|
testImage ; image
|
||||||
23 24 ; width, height
|
|
||||||
"Test Channel" ; name
|
"Test Channel" ; name
|
||||||
|
23 24 ; width, height
|
||||||
50.0 ; opacity
|
50.0 ; opacity
|
||||||
"red" ))) ; compositing color
|
"red" ))) ; compositing color
|
||||||
; must add to image
|
; must add to image
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue