Commit 65d3b34d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

removed gimp_layer_has_alpha(), use gimp_drawable_has_alpha() instead.

2002-01-31  Michael Natterer  <mitch@gimp.org>

	* app/core/gimplayer.[ch]: removed gimp_layer_has_alpha(), use
	gimp_drawable_has_alpha() instead.

	* app/core/gimpimage-convert.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-projection.c
	* app/display/gimpdisplayshell.c
	* app/gui/layers-commands.c: changed accordingly.

	* app/core/gimpimage.[ch]: added gimp_image_has_alphe(), made some
	variable names more verbose and use enum types instead of "gint"
	in functions calling initial_region() and combine_regions().

	* app/widgets/gimpchannellistview.c: show an alpha channel preview
	only if the image has alpha.

	* app/widgets/gimppreview.c: reordered functions,
	gimp_preview_render_and_flush(): fixed channel preview rendering,
	calculate the component byte offsets before entering the render
	loop instead of duplicating the render code for the gray/alpha
	case.
parent 4f033e68
2002-01-31 Michael Natterer <mitch@gimp.org>
* app/core/gimplayer.[ch]: removed gimp_layer_has_alpha(), use
gimp_drawable_has_alpha() instead.
* app/core/gimpimage-convert.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-projection.c
* app/display/gimpdisplayshell.c
* app/gui/layers-commands.c: changed accordingly.
* app/core/gimpimage.[ch]: added gimp_image_has_alphe(), made some
variable names more verbose and use enum types instead of "gint"
in functions calling initial_region() and combine_regions().
* app/widgets/gimpchannellistview.c: show an alpha channel preview
only if the image has alpha.
* app/widgets/gimppreview.c: reordered functions,
gimp_preview_render_and_flush(): fixed channel preview rendering,
calculate the component byte offsets before entering the render
loop instead of duplicating the render code for the gray/alpha
case.
2002-01-31 Sven Neumann <sven@gimp.org>
 
* app/widgets/gimpfontselection-dialog.c: use GtkTreeViews instead of
......
......@@ -1287,7 +1287,7 @@ layers_menu_update (GtkItemFactory *factory,
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
alpha = layer && gimp_layer_has_alpha (layer);
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lp = ! gimp_image_is_empty (gimage);
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
......@@ -1305,7 +1305,7 @@ layers_menu_update (GtkItemFactory *factory,
}
if (next)
next_alpha = gimp_layer_has_alpha (GIMP_LAYER (next->data));
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
......
......@@ -627,7 +627,7 @@ remap_indexed_layer (GimpLayer *layer,
unsigned char* src;
unsigned char* dest;
has_alpha = gimp_layer_has_alpha (layer) ? 1 : 0;
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) ? 1 : 0;
pixel_region_init (&srcPR,
GIMP_DRAWABLE(layer)->tiles, 0, 0,
GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height,
......@@ -804,7 +804,7 @@ gimp_image_convert (GimpImage *gimage,
new_layer_type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (new_type);
if (gimp_layer_has_alpha (layer))
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
new_layer_type = GIMP_IMAGE_TYPE_WITH_ALPHA (new_layer_type);
new_tiles = tile_manager_new (GIMP_DRAWABLE (layer)->width,
......@@ -1130,7 +1130,7 @@ generate_histogram_gray (CFHistogram histogram,
void *pr;
gboolean has_alpha;
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
for (pr = pixel_regions_register (1, &srcPR);
......@@ -1164,7 +1164,7 @@ generate_histogram_rgb (CFHistogram histogram,
int row, col, coledge;
int offsetx, offsety;
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &offsetx, &offsety);
......@@ -2505,7 +2505,8 @@ median_cut_pass2_no_dither_gray (QuantizeObj *quantobj,
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &offsetx, &offsety);
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
......@@ -2568,7 +2569,8 @@ median_cut_pass2_fixed_dither_gray (QuantizeObj *quantobj,
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &offsetx, &offsety);
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
......@@ -2653,7 +2655,8 @@ median_cut_pass2_no_dither_rgb (QuantizeObj *quantobj,
if (gimp_drawable_is_gray (GIMP_DRAWABLE(layer)))
red_pix = green_pix = blue_pix = GRAY_PIX;
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
......@@ -2730,7 +2733,8 @@ median_cut_pass2_fixed_dither_rgb (QuantizeObj *quantobj,
if (gimp_drawable_is_gray (GIMP_DRAWABLE (layer)))
red_pix = green_pix = blue_pix = GRAY_PIX;
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
......@@ -2829,7 +2833,8 @@ median_cut_pass2_nodestruct_dither_rgb (QuantizeObj *quantobj,
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &offsetx, &offsety);
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
......@@ -3013,7 +3018,8 @@ median_cut_pass2_fs_dither_gray (QuantizeObj *quantobj,
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &offsetx, &offsety);
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
src_bytes = GIMP_DRAWABLE(layer)->bytes;
......@@ -3223,7 +3229,8 @@ median_cut_pass2_fs_dither_rgb (QuantizeObj *quantobj,
if (gimp_drawable_is_gray (GIMP_DRAWABLE(layer)))
red_pix = green_pix = blue_pix = GRAY_PIX;
has_alpha = gimp_layer_has_alpha (layer);
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
src_bytes = GIMP_DRAWABLE(layer)->bytes;
......
......@@ -215,9 +215,9 @@ gimp_image_merge_layers (GimpImage *gimage,
gint count;
gint x1, y1, x2, y2;
gint x3, y3, x4, y4;
gint operation;
CombinationMode operation;
gint position;
gint active[MAX_CHANNELS] = {1, 1, 1, 1};
gboolean active[MAX_CHANNELS] = { TRUE, TRUE, TRUE, TRUE };
gint off_x, off_y;
gchar *name;
......
......@@ -543,7 +543,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) &&
(off_x <= x) &&
(off_y <= y) &&
(off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
......@@ -588,7 +588,7 @@ gimp_image_construct (GimpImage *gimage,
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
(gimp_drawable_has_alpha (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
......
......@@ -691,7 +691,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
gint x1, y1, x2, y2;
gint bytes;
gboolean construct_flag;
gint visible[MAX_CHANNELS] = { 1, 1, 1, 1 };
gboolean visible_components[MAX_CHANNELS] = { TRUE, TRUE, TRUE, TRUE };
gint off_x, off_y;
gimage = GIMP_IMAGE (viewable);
......@@ -815,23 +815,35 @@ gimp_image_get_new_preview (GimpViewable *viewable,
{
if (! construct_flag)
initial_region (&src2PR, &src1PR,
mask, NULL, layer->opacity,
layer->mode, visible, INITIAL_INTENSITY_ALPHA);
mask, NULL,
layer->opacity,
layer->mode,
visible_components,
INITIAL_INTENSITY_ALPHA);
else
combine_regions (&src1PR, &src2PR, &src1PR,
mask, NULL, layer->opacity,
layer->mode, visible, COMBINE_INTEN_A_INTEN_A);
mask, NULL,
layer->opacity,
layer->mode,
visible_components,
COMBINE_INTEN_A_INTEN_A);
}
else
{
if (! construct_flag)
initial_region (&src2PR, &src1PR,
mask, NULL, layer->opacity,
layer->mode, visible, INITIAL_INTENSITY);
mask, NULL,
layer->opacity,
layer->mode,
visible_components,
INITIAL_INTENSITY);
else
combine_regions (&src1PR, &src2PR, &src1PR,
mask, NULL, layer->opacity,
layer->mode, visible, COMBINE_INTEN_A_INTEN);
mask, NULL,
layer->opacity,
layer->mode,
visible_components,
COMBINE_INTEN_A_INTEN);
}
construct_flag = TRUE;
......@@ -1100,6 +1112,19 @@ gimp_image_get_height (const GimpImage *gimage)
return gimage->height;
}
gboolean
gimp_image_has_alpha (const GimpImage *gimage)
{
GimpLayer *layer;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), TRUE);
layer = (GimpLayer *) gimp_container_get_child_by_index (gimage->layers, 0);
return ((gimp_container_num_children (gimage->layers) > 1) ||
(layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer))));
}
gboolean
gimp_image_is_empty (const GimpImage *gimage)
{
......@@ -1238,8 +1263,7 @@ gimp_image_get_active_components (const GimpImage *gimage,
const GimpDrawable *drawable,
gint *active)
{
GimpLayer *layer;
gint i;
gint i;
/* first, blindly copy the gimage active channels */
for (i = 0; i < MAX_CHANNELS; i++)
......@@ -1259,8 +1283,11 @@ gimp_image_get_active_components (const GimpImage *gimage,
*/
if (GIMP_IS_LAYER (drawable))
{
GimpLayer *layer;
layer = GIMP_LAYER (drawable);
if (gimp_layer_has_alpha (layer) && layer->preserve_trans)
if (gimp_drawable_has_alpha (drawable) && layer->preserve_trans)
active[gimp_drawable_bytes (drawable) - 1] = 0;
}
}
......@@ -1713,12 +1740,12 @@ gimp_image_apply_image (GimpImage *gimage,
gint x,
gint y)
{
GimpChannel *mask;
gint x1, y1, x2, y2;
gint offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR;
gint operation;
gint active [MAX_CHANNELS];
GimpChannel *mask;
gint x1, y1, x2, y2;
gint offset_x, offset_y;
PixelRegion src1PR, destPR, maskPR;
CombinationMode operation;
gboolean active_components[MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
......@@ -1727,7 +1754,7 @@ gimp_image_apply_image (GimpImage *gimage,
NULL : gimp_image_get_mask (gimage));
/* configure the active channel array */
gimp_image_get_active_components (gimage, drawable, active);
gimp_image_get_active_components (gimage, drawable, active_components);
/* determine what sort of operation is being attempted and
* if it's actually legal...
......@@ -1797,12 +1824,12 @@ gimp_image_apply_image (GimpImage *gimage,
(x2 - x1), (y2 - y1),
FALSE);
combine_regions (&src1PR, src2PR, &destPR, &maskPR, NULL,
opacity, mode, active, operation);
opacity, mode, active_components, operation);
}
else
{
combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
opacity, mode, active, operation);
opacity, mode, active_components, operation);
}
}
......@@ -1822,14 +1849,14 @@ gimp_image_replace_image (GimpImage *gimage,
gint x,
gint y)
{
GimpChannel *mask;
gint x1, y1, x2, y2;
gint offset_x, offset_y;
PixelRegion src1PR, destPR;
PixelRegion mask2PR, tempPR;
guchar *temp_data;
gint operation;
gint active [MAX_CHANNELS];
GimpChannel *mask;
gint x1, y1, x2, y2;
gint offset_x, offset_y;
PixelRegion src1PR, destPR;
PixelRegion mask2PR, tempPR;
guchar *temp_data;
CombinationMode operation;
gboolean active_components[MAX_CHANNELS];
g_return_if_fail (GIMP_IS_IMAGE (gimage));
......@@ -1837,7 +1864,7 @@ gimp_image_replace_image (GimpImage *gimage,
mask = (gimp_image_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage);
/* configure the active channel array */
gimp_image_get_active_components (gimage, drawable, active);
gimp_image_get_active_components (gimage, drawable, active_components);
/* determine what sort of operation is being attempted and
* if it's actually legal...
......@@ -1930,14 +1957,14 @@ gimp_image_replace_image (GimpImage *gimage,
tempPR.data = temp_data;
combine_regions_replace (&src1PR, src2PR, &destPR, &tempPR, NULL,
opacity, active, operation);
opacity, active_components, operation);
g_free (temp_data);
}
else
{
combine_regions_replace (&src1PR, src2PR, &destPR, maskPR, NULL,
opacity, active, operation);
opacity, active_components, operation);
}
}
......@@ -2619,7 +2646,7 @@ gimp_image_raise_layer_to_top (GimpImage *gimage,
return FALSE;
}
if (! gimp_layer_has_alpha (layer))
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
g_message (_("Cannot raise a layer without alpha."));
return FALSE;
......@@ -2690,7 +2717,7 @@ gimp_image_position_layer (GimpImage *gimage,
num_layers - 1);
if (new_index == num_layers - 1 &&
! gimp_layer_has_alpha (tmp))
! gimp_drawable_has_alpha (GIMP_DRAWABLE (tmp)))
{
g_message (_("Layer \"%s\" has no alpha.\nLayer was placed above it."),
GIMP_OBJECT (tmp)->name);
......
......@@ -244,6 +244,7 @@ void gimp_image_unit_changed (GimpImage *gimage);
gint gimp_image_get_width (const GimpImage *gimage);
gint gimp_image_get_height (const GimpImage *gimage);
gboolean gimp_image_has_alpha (const GimpImage *gimage);
gboolean gimp_image_is_empty (const GimpImage *gimage);
GimpLayer * gimp_image_floating_sel (const GimpImage *gimage);
......
......@@ -562,7 +562,7 @@ gimp_layer_add_mask (GimpLayer *layer,
return NULL;
}
if (! gimp_layer_has_alpha (layer))
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
g_message (_("Cannot add layer mask to a layer\n"
"with no alpha channel."));
......@@ -648,7 +648,7 @@ gimp_layer_create_mask (const GimpLayer *layer,
case ADD_ALPHA_MASK:
/* Extract the layer's alpha channel */
if (gimp_layer_has_alpha (layer))
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
pixel_region_init (&layerPR, GIMP_DRAWABLE (layer)->tiles,
0, 0,
......@@ -706,7 +706,7 @@ gimp_layer_apply_mask (GimpLayer *layer,
return;
/* this operation can only be done to layers with an alpha channel */
if (! gimp_layer_has_alpha (layer))
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
return;
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (layer));
......@@ -1171,7 +1171,7 @@ gimp_layer_resize (GimpLayer *layer,
TRUE);
/* fill with the fill color */
if (gimp_layer_has_alpha (layer))
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
/* Set to transparent and black */
guchar bg[4] = {0, 0, 0, 0};
......@@ -1358,7 +1358,7 @@ gimp_layer_pick_correlate (GimpLayer *layer,
/* If the point is inside, and the layer has no
* alpha channel, success!
*/
if (! gimp_layer_has_alpha (layer))
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
return TRUE;
/* Otherwise, determine if the alpha value at
......@@ -1404,14 +1404,6 @@ gimp_layer_get_mask (const GimpLayer *layer)
return layer->mask;
}
gboolean
gimp_layer_has_alpha (const GimpLayer *layer)
{
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
return GIMP_IMAGE_TYPE_HAS_ALPHA (GIMP_DRAWABLE (layer)->type);
}
gboolean
gimp_layer_is_floating_sel (const GimpLayer *layer)
{
......
......@@ -146,7 +146,6 @@ gint gimp_layer_pick_correlate (GimpLayer *layer,
GimpLayerMask * gimp_layer_get_mask (const GimpLayer *layer);
gboolean gimp_layer_has_alpha (const GimpLayer *layer);
gboolean gimp_layer_is_floating_sel (const GimpLayer *layer);
void gimp_layer_set_opacity (GimpLayer *layer,
......
......@@ -543,7 +543,7 @@ gimp_image_initialize_projection (GimpImage *gimage,
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)) &&
! gimp_layer_has_alpha (layer) &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)) &&
(off_x <= x) &&
(off_y <= y) &&
(off_x + gimp_drawable_width (GIMP_DRAWABLE (layer)) >= x + w) &&
......@@ -588,7 +588,7 @@ gimp_image_construct (GimpImage *gimage,
if ((gimage->layers) && /* There's a layer. */
(! g_slist_next (gimage->layers)) && /* It's the only layer. */
(gimp_layer_has_alpha ((GimpLayer *) (gimage->layers->data))) &&
(gimp_drawable_has_alpha (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's !flat. */
(gimp_drawable_get_visible (GIMP_DRAWABLE (gimage->layers->data))) &&
/* It's visible. */
......
......@@ -925,7 +925,7 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell)
if (layer)
{
lm = gimp_layer_get_mask (layer) ? TRUE : FALSE;
alpha = gimp_layer_has_alpha (layer);
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lind = gimp_image_get_layer_index (gimage, layer);
}
......
......@@ -925,7 +925,7 @@ gimp_display_shell_set_menu_sensitivity (GimpDisplayShell *shell)
if (layer)
{
lm = gimp_layer_get_mask (layer) ? TRUE : FALSE;
alpha = gimp_layer_has_alpha (layer);
alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lind = gimp_image_get_layer_index (gimage, layer);
}
......
......@@ -1287,7 +1287,7 @@ layers_menu_update (GtkItemFactory *factory,
fs = (gimp_image_floating_sel (gimage) != NULL);
ac = (gimp_image_get_active_channel (gimage) != NULL);
alpha = layer && gimp_layer_has_alpha (layer);
alpha = layer && gimp_drawable_has_alpha (GIMP_DRAWABLE (layer));
lp = ! gimp_image_is_empty (gimage);
indexed = (gimp_image_base_type (gimage) == GIMP_INDEXED);
......@@ -1305,7 +1305,7 @@ layers_menu_update (GtkItemFactory *factory,
}
if (next)
next_alpha = gimp_layer_has_alpha (GIMP_LAYER (next->data));
next_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (next->data));
else
next_alpha = FALSE;
......
......@@ -406,7 +406,10 @@ gimp_channel_list_view_create_components (GimpChannelListView *view)
break;
}
components[n_components++] = GIMP_ALPHA_CHANNEL;
if (gimp_image_has_alpha (gimage))
{
components[n_components++] = GIMP_ALPHA_CHANNEL;
}
for (i = 0; i < n_components; i++)
{
......@@ -451,7 +454,8 @@ static void
gimp_channel_list_view_alpha_changed (GimpImage *gimage,
GimpChannelListView *view)
{
g_print ("gimp_channel_list_view_alpha_changed()\n");
gimp_channel_list_view_clear_components (view);
gimp_channel_list_view_create_components (view);
}
static void
......
......@@ -406,7 +406,10 @@ gimp_channel_list_view_create_components (GimpChannelListView *view)
break;
}
components[n_components++] = GIMP_ALPHA_CHANNEL;
if (gimp_image_has_alpha (gimage))
{
components[n_components++] = GIMP_ALPHA_CHANNEL;
}
for (i = 0; i < n_components; i++)
{
......@@ -451,7 +454,8 @@ static void
gimp_channel_list_view_alpha_changed (GimpImage *gimage,
GimpChannelListView *view)
{
g_print ("gimp_channel_list_view_alpha_changed()\n");
gimp_channel_list_view_clear_components (view);
gimp_channel_list_view_create_components (view);
}
static void
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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