diff --git a/app/pdb/channel-cmds.c b/app/pdb/channel-cmds.c index f65f1b7f0c..281399405d 100644 --- a/app/pdb/channel-cmds.c +++ b/app/pdb/channel-cmds.c @@ -57,17 +57,17 @@ channel_new_invoker (GimpProcedure *procedure, gboolean success = TRUE; GimpValueArray *return_vals; GimpImage *image; + const gchar *name; gint width; gint height; - const gchar *name; gdouble opacity; GeglColor *color; GimpChannel *channel = NULL; image = g_value_get_object (gimp_value_array_index (args, 0)); - width = g_value_get_int (gimp_value_array_index (args, 1)); - height = g_value_get_int (gimp_value_array_index (args, 2)); - name = g_value_get_string (gimp_value_array_index (args, 3)); + name = g_value_get_string (gimp_value_array_index (args, 1)); + width = g_value_get_int (gimp_value_array_index (args, 2)); + height = g_value_get_int (gimp_value_array_index (args, 3)); opacity = g_value_get_double (gimp_value_array_index (args, 4)); color = g_value_get_object (gimp_value_array_index (args, 5)); @@ -382,8 +382,12 @@ register_channel_procs (GimpPDB *pdb) "gimp-channel-new"); gimp_procedure_set_static_help (procedure, "Create a new channel.", - "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" + "This procedure creates a new channel with the specified @width, @height, @name, @opacity and @color.\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.", NULL); gimp_procedure_set_static_attribution (procedure, @@ -396,6 +400,13 @@ register_channel_procs (GimpPDB *pdb) "The image to which to add the channel", FALSE, 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, g_param_spec_int ("width", "width", @@ -408,13 +419,6 @@ register_channel_procs (GimpPDB *pdb) "The channel height", 1, GIMP_MAX_IMAGE_SIZE, 1, 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, g_param_spec_double ("opacity", "opacity", diff --git a/libgimp/gimpchannel.c b/libgimp/gimpchannel.c index cdd955855c..188bebb990 100644 --- a/libgimp/gimpchannel.c +++ b/libgimp/gimpchannel.c @@ -63,41 +63,3 @@ gimp_channel_get_by_id (gint32 channel_id) 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); -} diff --git a/libgimp/gimpchannel.h b/libgimp/gimpchannel.h index 79867e8e1b..83c1a6546b 100644 --- a/libgimp/gimpchannel.h +++ b/libgimp/gimpchannel.h @@ -54,13 +54,6 @@ struct _GimpChannelClass 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 diff --git a/libgimp/gimpchannel_pdb.c b/libgimp/gimpchannel_pdb.c index 44cb78a21c..e1a16734fe 100644 --- a/libgimp/gimpchannel_pdb.c +++ b/libgimp/gimpchannel_pdb.c @@ -37,33 +37,37 @@ /** - * _gimp_channel_new: + * gimp_channel_new: * @image: The image to which to add the channel. + * @name: The channel name. * @width: The channel width. * @height: The channel height. - * @name: The channel name. * @opacity: The channel opacity. * @color: The channel compositing color. * * Create a new channel. * - * This procedure creates a new channel with the specified width, - * 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(). + * This procedure creates a new channel with the specified @width, + * @height, @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 + * automatic. Add the new channel with + * [method@Gimp.Image.insert_channel]. + * * The channel's contents are undefined initially. * * Returns: (transfer none): The newly created channel. **/ GimpChannel * -_gimp_channel_new (GimpImage *image, - gint width, - gint height, - const gchar *name, - gdouble opacity, - GeglColor *color) +gimp_channel_new (GimpImage *image, + const gchar *name, + gint width, + gint height, + gdouble opacity, + GeglColor *color) { GimpValueArray *args; GimpValueArray *return_vals; @@ -71,9 +75,9 @@ _gimp_channel_new (GimpImage *image, args = gimp_value_array_new_from_types (NULL, GIMP_TYPE_IMAGE, image, + G_TYPE_STRING, name, G_TYPE_INT, width, G_TYPE_INT, height, - G_TYPE_STRING, name, G_TYPE_DOUBLE, opacity, GEGL_TYPE_COLOR, color, G_TYPE_NONE); diff --git a/libgimp/gimpchannel_pdb.h b/libgimp/gimpchannel_pdb.h index d6ad14d9ad..c358bc5312 100644 --- a/libgimp/gimpchannel_pdb.h +++ b/libgimp/gimpchannel_pdb.h @@ -32,30 +32,30 @@ G_BEGIN_DECLS /* For information look into the C source or the html documentation */ -G_GNUC_INTERNAL GimpChannel* _gimp_channel_new (GimpImage *image, - gint width, - gint height, - const gchar *name, - gdouble opacity, - GeglColor *color); -GimpChannel* gimp_channel_new_from_component (GimpImage *image, - GimpChannelType component, - const gchar *name); -GimpChannel* gimp_channel_copy (GimpChannel *channel); -gboolean gimp_channel_combine_masks (GimpChannel *channel1, - GimpChannel *channel2, - GimpChannelOps operation, - gint offx, - gint offy); -gboolean gimp_channel_get_show_masked (GimpChannel *channel); -gboolean gimp_channel_set_show_masked (GimpChannel *channel, - gboolean show_masked); -gdouble gimp_channel_get_opacity (GimpChannel *channel); -gboolean gimp_channel_set_opacity (GimpChannel *channel, - gdouble opacity); -GeglColor* gimp_channel_get_color (GimpChannel *channel); -gboolean gimp_channel_set_color (GimpChannel *channel, - GeglColor *color); +GimpChannel* gimp_channel_new (GimpImage *image, + const gchar *name, + gint width, + gint height, + gdouble opacity, + GeglColor *color); +GimpChannel* gimp_channel_new_from_component (GimpImage *image, + GimpChannelType component, + const gchar *name); +GimpChannel* gimp_channel_copy (GimpChannel *channel); +gboolean gimp_channel_combine_masks (GimpChannel *channel1, + GimpChannel *channel2, + GimpChannelOps operation, + gint offx, + gint offy); +gboolean gimp_channel_get_show_masked (GimpChannel *channel); +gboolean gimp_channel_set_show_masked (GimpChannel *channel, + gboolean show_masked); +gdouble gimp_channel_get_opacity (GimpChannel *channel); +gboolean gimp_channel_set_opacity (GimpChannel *channel, + gdouble opacity); +GeglColor* gimp_channel_get_color (GimpChannel *channel); +gboolean gimp_channel_set_color (GimpChannel *channel, + GeglColor *color); G_END_DECLS diff --git a/pdb/groups/channel.pdb b/pdb/groups/channel.pdb index cf076077af..616a9f24d1 100644 --- a/pdb/groups/channel.pdb +++ b/pdb/groups/channel.pdb @@ -20,30 +20,32 @@ sub channel_new { $blurb = 'Create a new channel.'; $help = <<'HELP'; -This procedure creates a new channel with the specified width, height, -name, opacity and color. +This procedure creates a new channel with the specified @width, @height, +@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 -automatic. Add the new channel with gimp_image_insert_channel(). Other -attributes, such as channel visibility, should be set with explicit -procedure calls. +automatic. Add the new channel with [method@Gimp.Image.insert_channel]. + The channel's contents are undefined initially. HELP &std_pdb_misc; - $lib_private = 1; - @inargs = ( { name => 'image', type => 'image', 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', desc => 'The channel width' }, { name => 'height', type => '1 <= int32 <= GIMP_MAX_IMAGE_SIZE', desc => 'The channel height' }, - { name => 'name', type => 'string', - desc => 'The channel name' }, { name => 'opacity', type => '0 <= float <= 100', desc => 'The channel opacity' }, { name => 'color', type => 'geglcolor', diff --git a/plug-ins/script-fu/scripts/carve-it.scm b/plug-ins/script-fu/scripts/carve-it.scm index b53bb15d97..67bcbe6250 100644 --- a/plug-ins/script-fu/scripts/carve-it.scm +++ b/plug-ins/script-fu/scripts/carve-it.scm @@ -55,7 +55,7 @@ (feather (carve-scale size 0.3)) (brush-size (carve-scale size 0.3)) (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)) (mask-fat 0) (mask-emboss 0) diff --git a/plug-ins/script-fu/scripts/chrome-it.scm b/plug-ins/script-fu/scripts/chrome-it.scm index 8fc746af2b..dcc51db793 100644 --- a/plug-ins/script-fu/scripts/chrome-it.scm +++ b/plug-ins/script-fu/scripts/chrome-it.scm @@ -149,7 +149,7 @@ (feather (sota-scale size 0.5 chrome-factor)) (brush-size (sota-scale size 0.5 chrome-factor)) (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)) (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)) diff --git a/plug-ins/script-fu/test/tests/PDB/channel/channel-attributes.scm b/plug-ins/script-fu/test/tests/PDB/channel/channel-attributes.scm index 934536e3b1..57b9edd668 100644 --- a/plug-ins/script-fu/test/tests/PDB/channel/channel-attributes.scm +++ b/plug-ins/script-fu/test/tests/PDB/channel/channel-attributes.scm @@ -11,9 +11,9 @@ (define testChannel (gimp-channel-new - testImage ; image - 23 24 ; width, height + testImage ; image "Test Channel" ; name + 23 24 ; width, height 50.0 ; opacity "red" )) ; compositing color @@ -85,4 +85,4 @@ ; TODO other item methods -(script-fu-use-v2) \ No newline at end of file +(script-fu-use-v2) diff --git a/plug-ins/script-fu/test/tests/PDB/channel/channel-new.scm b/plug-ins/script-fu/test/tests/PDB/channel/channel-new.scm index 66b217ebfe..b63532f3e9 100644 --- a/plug-ins/script-fu/test/tests/PDB/channel/channel-new.scm +++ b/plug-ins/script-fu/test/tests/PDB/channel/channel-new.scm @@ -14,9 +14,9 @@ ; setup (not in an assert and not quoted) ; vectors-new succeeds (define testChannel (car (gimp-channel-new - testImage ; image - 23 24 ; width, height + testImage ; image "Test Channel" ; name + 23 24 ; width, height 50.0 ; opacity "red" ))) ; compositing color @@ -91,9 +91,9 @@ ; Can delete a new channel not yet added to image (define testChannel2 (car (gimp-channel-new - testImage ; image - 23 24 ; width, height + testImage ; image "Test Channel" ; name + 23 24 ; width, height 50.0 ; opacity "red" ))) ; compositing color diff --git a/plug-ins/script-fu/test/tests/PDB/image/image-set-selected.scm b/plug-ins/script-fu/test/tests/PDB/image/image-set-selected.scm index 9ff9257332..06124a8c30 100644 --- a/plug-ins/script-fu/test/tests/PDB/image/image-set-selected.scm +++ b/plug-ins/script-fu/test/tests/PDB/image/image-set-selected.scm @@ -26,9 +26,9 @@ ; create test channel ; The test image has no channels (RGB are not considered channels.) (define testChannel (car (gimp-channel-new - testImage ; image - 23 24 ; width, height + testImage ; image "Test Channel" ; name + 23 24 ; width, height 50.0 ; opacity "red" ))) ; compositing color ; a new channel is not in the image until added diff --git a/plug-ins/script-fu/test/tests/PDB/item/item.scm b/plug-ins/script-fu/test/tests/PDB/item/item.scm index 2774f4638a..a045b2a6d2 100644 --- a/plug-ins/script-fu/test/tests/PDB/item/item.scm +++ b/plug-ins/script-fu/test/tests/PDB/item/item.scm @@ -148,9 +148,9 @@ 31 ; fontsize testFont ))) (define testChannel (car (gimp-channel-new - testImage ; image - 23 24 ; width, height + testImage ; image "Test Channel" ; name + 23 24 ; width, height 50.0 ; opacity "red" ))) ; compositing color ; must add to image