Commit e1c14d73 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

use gimp_image_get_component_index() instead of doing the switch()es

2003-03-23  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpchannel.c (gimp_channel_new_from_component): use
	gimp_image_get_component_index() instead of doing the switch()es
	manually.
parent 06a2f8b1
2003-03-23 Michael Natterer <mitch@gimp.org>
* app/core/gimpchannel.c (gimp_channel_new_from_component): use
gimp_image_get_component_index() instead of doing the switch()es
manually.
2003-03-22 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-preview.c
......@@ -47,7 +53,7 @@
got from gdk_get_current_event().
* app/widgets/gimpcontainerview.c: check view->hash_table for
being non-NULL before using it. Be prepared to be destroyed by as
being non-NULL before using it. Be prepared to be destroyed as
a result of calling gimp_context_set_foo(view->context, foo).
* app/widgets/gimpcontainertreeview.[ch]: added
......@@ -291,27 +291,12 @@ gimp_channel_new_from_component (GimpImage *gimage,
PixelRegion dest;
gint width;
gint height;
gint pixel = -1;
gint pixel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (color != NULL, NULL);
switch (type)
{
case GIMP_RED_CHANNEL: pixel = RED_PIX; break;
case GIMP_GREEN_CHANNEL: pixel = GREEN_PIX; break;
case GIMP_BLUE_CHANNEL: pixel = BLUE_PIX; break;
case GIMP_GRAY_CHANNEL: pixel = GRAY_PIX; break;
case GIMP_INDEXED_CHANNEL: pixel = INDEXED_PIX; break;
case GIMP_ALPHA_CHANNEL:
switch (gimp_image_base_type (gimage))
{
case GIMP_RGB: pixel = ALPHA_PIX; break;
case GIMP_GRAY: pixel = ALPHA_G_PIX; break;
case GIMP_INDEXED: pixel = ALPHA_I_PIX; break;
}
break;
}
pixel = gimp_image_get_component_index (gimage, type);
g_return_val_if_fail (pixel != -1, NULL);
......
......@@ -291,27 +291,12 @@ gimp_channel_new_from_component (GimpImage *gimage,
PixelRegion dest;
gint width;
gint height;
gint pixel = -1;
gint pixel;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
g_return_val_if_fail (color != NULL, NULL);
switch (type)
{
case GIMP_RED_CHANNEL: pixel = RED_PIX; break;
case GIMP_GREEN_CHANNEL: pixel = GREEN_PIX; break;
case GIMP_BLUE_CHANNEL: pixel = BLUE_PIX; break;
case GIMP_GRAY_CHANNEL: pixel = GRAY_PIX; break;
case GIMP_INDEXED_CHANNEL: pixel = INDEXED_PIX; break;
case GIMP_ALPHA_CHANNEL:
switch (gimp_image_base_type (gimage))
{
case GIMP_RGB: pixel = ALPHA_PIX; break;
case GIMP_GRAY: pixel = ALPHA_G_PIX; break;
case GIMP_INDEXED: pixel = ALPHA_I_PIX; break;
}
break;
}
pixel = gimp_image_get_component_index (gimage, type);
g_return_val_if_fail (pixel != -1, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment