don't require a non-NULL color parameter (just leave the default color

2005-01-15  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpchannel.c (gimp_channel_new*): don't require a
	non-NULL color parameter (just leave the default color untouched
	if NULL is passed).

	* app/actions/channels-commands.c
	* app/core/gimpchannel-select.c: pass NULL as color for temporary
	channels or channels where we used to pass black.
This commit is contained in:
Michael Natterer 2005-01-15 16:59:34 +00:00 committed by Michael Natterer
parent bfa7335635
commit d0a78f3bdb
4 changed files with 19 additions and 26 deletions

View File

@ -1,3 +1,13 @@
2005-01-15 Michael Natterer <mitch@gimp.org>
* app/core/gimpchannel.c (gimp_channel_new*): don't require a
non-NULL color parameter (just leave the default color untouched
if NULL is passed).
* app/actions/channels-commands.c
* app/core/gimpchannel-select.c: pass NULL as color for temporary
channels or channels where we used to pass black.
2005-01-15 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdnd.c: added gimp_dnd_get_component_icon().

View File

@ -230,14 +230,11 @@ channels_duplicate_cmd_callback (GtkAction *action,
if (GIMP_IS_COMPONENT_EDITOR (data))
{
GimpRGB color;
GimpChannelType component;
const gchar *desc;
gchar *name;
return_if_no_image (gimage, data);
gimp_rgba_set (&color, 0, 0, 0, 0.5);
component = GIMP_COMPONENT_EDITOR (data)->clicked_component;
gimp_enum_get_value (GIMP_TYPE_CHANNEL_TYPE, component,
@ -246,7 +243,7 @@ channels_duplicate_cmd_callback (GtkAction *action,
name = g_strdup_printf (_("%s Channel Copy"), desc);
new_channel = gimp_channel_new_from_component (gimage, component,
name, &color);
name, NULL);
/* copied components are invisible by default so subsequent copies
* of components don't affect each other

View File

@ -21,7 +21,6 @@
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "core-types.h"
@ -64,11 +63,9 @@ gimp_channel_select_rectangle (GimpChannel *channel,
*/
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpItem *item;
GimpItem *item = GIMP_ITEM (channel);
GimpChannel *add_on;
item = GIMP_ITEM (channel);
add_on = gimp_channel_new_mask (gimp_item_get_image (item),
gimp_item_width (item),
gimp_item_height (item));
@ -115,11 +112,9 @@ gimp_channel_select_ellipse (GimpChannel *channel,
*/
if (feather || op == GIMP_CHANNEL_OP_INTERSECT)
{
GimpItem *item;
GimpItem *item = GIMP_ITEM (channel);
GimpChannel *add_on;
item = GIMP_ITEM (channel);
add_on = gimp_channel_new_mask (gimp_item_get_image (item),
gimp_item_width (item),
gimp_item_height (item));
@ -350,12 +345,8 @@ gimp_channel_select_alpha (GimpChannel *channel,
if (gimp_drawable_has_alpha (drawable))
{
GimpRGB color;
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
add_on = gimp_channel_new_from_alpha (gimp_item_get_image (item),
drawable, NULL, &color);
drawable, NULL, NULL);
}
else
{
@ -388,19 +379,16 @@ gimp_channel_select_component (GimpChannel *channel,
{
GimpItem *item;
GimpChannel *add_on;
GimpRGB color;
const gchar *desc;
gchar *undo_desc;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
item = GIMP_ITEM (channel);
add_on = gimp_channel_new_from_component (gimp_item_get_image (item),
component, NULL, &color);
component, NULL, NULL);
if (feather)
gimp_channel_feather (add_on,

View File

@ -1419,7 +1419,6 @@ gimp_channel_new (GimpImage *gimage,
GimpChannel *channel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (color != NULL, NULL);
channel = g_object_new (GIMP_TYPE_CHANNEL, NULL);
@ -1428,7 +1427,9 @@ gimp_channel_new (GimpImage *gimage,
0, 0, width, height,
GIMP_GRAY_IMAGE, name);
channel->color = *color;
if (color)
channel->color = *color;
channel->show_masked = TRUE;
/* selection mask variables */
@ -1452,7 +1453,6 @@ gimp_channel_new_from_alpha (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (gimp_drawable_has_alpha (drawable), NULL);
g_return_val_if_fail (color != NULL, NULL);
width = gimp_item_width (GIMP_ITEM (drawable));
height = gimp_item_height (GIMP_ITEM (drawable));
@ -1488,7 +1488,6 @@ gimp_channel_new_from_component (GimpImage *gimage,
gint pixel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (color != NULL, NULL);
pixel = gimp_image_get_component_index (gimage, type);
@ -1635,13 +1634,12 @@ gimp_channel_new_mask (GimpImage *gimage,
gint width,
gint height)
{
GimpRGB black = { 0.0, 0.0, 0.0, 0.5 };
GimpChannel *new_channel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
new_channel = gimp_channel_new (gimage, width, height,
_("Selection Mask"), &black);
_("Selection Mask"), NULL);
tile_manager_set_validate_proc (GIMP_DRAWABLE (new_channel)->tiles,
gimp_channel_validate);