Commit 2ce0e150 authored by Manish Singh's avatar Manish Singh

Misc changes for .18

        * app/indexed_palette.c: fix for wrong color selected in indexed
        palette dialog

        * app/xcf.c: don't crash on bad input (0 byte files)

        * app/plug_in.h
        * app/plug_in.c: fixes Gimp's most obscure bug. Failed plugin
        queries are handle correctly now

        * app/commands.c: added marching ants speed to preferences

        * plug-ins/tiff/tiff.c: correction for inversion for MINISWHITE
        images without alpha

        * plug-ins/pcx/pcx.c: updated to new version

        * app/paint_funcs.h: changed OPAQUE and TRANSPARENT to
        OPAQUE_OPACITY and TRANSPARENT_OPACITY to avoid possible
        conflicts. All affects .c files changed.

-Yosh
parent 3014db05
Sat Jan 24 17:23:13 PST 1998 Manish Singh <yosh@gimp.org>
* app/indexed_palette.c: fix for wrong color selected in indexed
palette dialog
* app/xcf.c: don't crash on bad input (0 byte files)
* app/plug_in.h
* app/plug_in.c: fixes Gimp's most obscure bug. Failed plugin
queries are handle correctly now
* app/commands.c: added marching ants speed to preferences
* plug-ins/tiff/tiff.c: correction for inversion for MINISWHITE
images without alpha
* plug-ins/pcx/pcx.c: updated to new version
* app/paint_funcs.h: changed OPAQUE and TRANSPARENT to
OPAQUE_OPACITY and TRANSPARENT_OPACITY to avoid possible
conflicts. All affects .c files changed.
Sat Jan 24 15:16:40 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* app/app_procs.c (make_initialization_status_window): Changed
......@@ -25,22 +47,6 @@ Tue Jan 13 21:36:07 PST 1998 Manish Singh <yosh@gimp.org>
* ltconfig
* ltmain.sh: downgraded to libtool 1.0f at Jay's suggestion
* app/gimage.c: Fix for the "merge to alpha" bug from Nathan
Summers
* app/text_tool.c: Fix for the font spec bug from Nathan
Summers
* plug-ins/maze/maze.c
* plug-ins/rotate/rotate.c: updated from registry
* plug-ins/blur/blur.c
* plug-ins/randomize/randomize.c
* plug-ins/vpropagate/vpropagate.c
* plug-ins/warp/warp.c: more portability fixes for DEC OSF1
Mon Jan 12 14:49:19 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* plug-ins/fractaltrace/fractaltrace.c (query): ymax argument was
listed twice. Fixed.
......
......@@ -111,6 +111,7 @@ static GtkWidget *prefs_dlg = NULL;
static int old_transparency_type;
static int old_transparency_size;
static int old_levels_of_undo;
static int old_marching_speed;
static int old_allow_resize_windows;
static int old_auto_save;
static int old_preview_size;
......@@ -206,7 +207,7 @@ file_new_ok_callback (GtkWidget *widget,
/* Make the background (or first) layer */
layer = layer_new (gimage->ID, gimage->width, gimage->height,
type, "Background", OPAQUE, NORMAL);
type, "Background", OPAQUE_OPACITY, NORMAL);
if (layer) {
/* add the new layer to the gimage */
......@@ -512,8 +513,8 @@ file_save_as_cmd_callback (GtkWidget *widget,
Still no settings for default-brush, default-gradient,
default-palette, default-pattern, gamma-correction, color-cube,
marching-ants-speed, show-rulers, ruler-units. No widget for
confirm-on-close although a lot of stuff is there.
show-rulers, ruler-units. No widget for confirm-on-close although
a lot of stuff is there.
No UI feedback for the fact that some settings won't take effect
until the next Gimp restart.
......@@ -567,6 +568,13 @@ file_prefs_ok_callback (GtkWidget *widget,
levels_of_undo = old_levels_of_undo;
return;
}
if (marching_speed <= 50)
{
message_box("Error: Marching speed must be 50 or greater.",
NULL, NULL);
marching_speed = old_marching_speed;
return;
}
if (default_width < 1)
{
message_box("Error: Default width must be one or greater.",
......@@ -626,6 +634,8 @@ file_prefs_save_callback (GtkWidget *widget,
if (levels_of_undo != old_levels_of_undo)
update = g_list_append (update, "undo-levels");
if (marching_speed != old_marching_speed)
update = g_list_append (update, "marching-ants-speed");
if (allow_resize_windows != old_allow_resize_windows)
update = g_list_append (update, "allow-resize-windows");
if (auto_save != old_auto_save)
......@@ -751,6 +761,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
prefs_dlg = NULL;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
allow_resize_windows = old_allow_resize_windows;
auto_save = old_auto_save;
no_cursor_updating = old_no_cursor_updating;
......@@ -960,6 +971,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_transparency_type = transparency_type;
old_transparency_size = transparency_size;
old_levels_of_undo = levels_of_undo;
old_marching_speed = marching_speed;
old_allow_resize_windows = allow_resize_windows;
old_auto_save = auto_save;
old_preview_size = preview_size;
......@@ -1287,6 +1299,9 @@ file_pref_cmd_callback (GtkWidget *widget,
sprintf (buffer, "%d", marching_speed);
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (entry), "changed",
(GtkSignalFunc) file_prefs_text_callback,
&marching_speed);
gtk_widget_show (entry);
label = gtk_label_new ("Interface");
......
......@@ -1967,9 +1967,8 @@ plug_in_query (char *filename,
}
plug_in_pop ();
plug_in_destroy (plug_in);
}
plug_in_destroy (plug_in);
}
}
......
......@@ -252,7 +252,7 @@ airbrush_motion (PaintCore *paint_core,
return;
/* color the pixels */
col[area->bytes - 1] = OPAQUE;
col[area->bytes - 1] = OPAQUE_OPACITY;
/* color the pixels */
color_pixels (temp_buf_data (area), col,
......
......@@ -190,7 +190,7 @@ app_init_update_status(char *label1val,
gtk_progress_bar_update(GTK_PROGRESS_BAR(pbar), pct_progress);
}
gtk_widget_draw(win_initstatus, &area);
idle_tag = gtk_idle_add(my_idle_proc, NULL);
idle_tag = gtk_idle_add((GtkFunction) my_idle_proc, NULL);
gtk_main_iteration();
gtk_idle_remove(idle_tag);
}
......
......@@ -1095,7 +1095,7 @@ gradient_precalc_shapeburst (GImage *gimage,
float *distp;
int size;
void * pr;
unsigned char white[1] = { OPAQUE };
unsigned char white[1] = { OPAQUE_OPACITY };
/* allocate the distance map */
if (distR.tiles)
......
......@@ -556,7 +556,7 @@ bucket_fill_line_color (buf, mask, col, has_alpha, bytes, width)
if (mask)
buf[alpha] = *mask++;
else
buf[alpha] = OPAQUE;
buf[alpha] = OPAQUE_OPACITY;
}
buf += bytes;
......@@ -594,7 +594,7 @@ bucket_fill_line_pattern (buf, mask, pattern, has_alpha, bytes, x, y, width)
if (mask)
buf[alpha] = *mask++;
else
buf[alpha] = OPAQUE;
buf[alpha] = OPAQUE_OPACITY;
}
buf += bytes;
......
......@@ -105,7 +105,7 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT, tile->ewidth * tile->eheight);
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
}
......
......@@ -373,7 +373,7 @@ offset (GImage *gimage,
{
palette_get_background (&fill[0], &fill[1], &fill[2]);
if (drawable_has_alpha (drawable))
fill[drawable_bytes (drawable) - 1] = OPAQUE;
fill[drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
}
if (offset_x >= 0 && offset_y >= 0)
......
......@@ -446,7 +446,7 @@ clone_motion (PaintCore *paint_core,
}
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE,
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (get_brush_opacity () * 255),
get_brush_paint_mode (), SOFT, CONSTANT);
}
......@@ -477,7 +477,7 @@ clone_line_image (GImage *dest,
if (has_alpha)
d[dest_alpha] = s[src_alpha];
else
d[dest_alpha] = OPAQUE;
d[dest_alpha] = OPAQUE_OPACITY;
s += src_bytes;
d += dest_bytes;
......@@ -517,7 +517,7 @@ clone_line_pattern (GImage *dest,
gimage_transform_color (dest, drawable, p, d, color);
d[alpha] = OPAQUE;
d[alpha] = OPAQUE_OPACITY;
d += bytes;
}
......
......@@ -111,6 +111,7 @@ static GtkWidget *prefs_dlg = NULL;
static int old_transparency_type;
static int old_transparency_size;
static int old_levels_of_undo;
static int old_marching_speed;
static int old_allow_resize_windows;
static int old_auto_save;
static int old_preview_size;
......@@ -206,7 +207,7 @@ file_new_ok_callback (GtkWidget *widget,
/* Make the background (or first) layer */
layer = layer_new (gimage->ID, gimage->width, gimage->height,
type, "Background", OPAQUE, NORMAL);
type, "Background", OPAQUE_OPACITY, NORMAL);
if (layer) {
/* add the new layer to the gimage */
......@@ -512,8 +513,8 @@ file_save_as_cmd_callback (GtkWidget *widget,
Still no settings for default-brush, default-gradient,
default-palette, default-pattern, gamma-correction, color-cube,
marching-ants-speed, show-rulers, ruler-units. No widget for
confirm-on-close although a lot of stuff is there.
show-rulers, ruler-units. No widget for confirm-on-close although
a lot of stuff is there.
No UI feedback for the fact that some settings won't take effect
until the next Gimp restart.
......@@ -567,6 +568,13 @@ file_prefs_ok_callback (GtkWidget *widget,
levels_of_undo = old_levels_of_undo;
return;
}
if (marching_speed <= 50)
{
message_box("Error: Marching speed must be 50 or greater.",
NULL, NULL);
marching_speed = old_marching_speed;
return;
}
if (default_width < 1)
{
message_box("Error: Default width must be one or greater.",
......@@ -626,6 +634,8 @@ file_prefs_save_callback (GtkWidget *widget,
if (levels_of_undo != old_levels_of_undo)
update = g_list_append (update, "undo-levels");
if (marching_speed != old_marching_speed)
update = g_list_append (update, "marching-ants-speed");
if (allow_resize_windows != old_allow_resize_windows)
update = g_list_append (update, "allow-resize-windows");
if (auto_save != old_auto_save)
......@@ -751,6 +761,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
prefs_dlg = NULL;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
allow_resize_windows = old_allow_resize_windows;
auto_save = old_auto_save;
no_cursor_updating = old_no_cursor_updating;
......@@ -960,6 +971,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_transparency_type = transparency_type;
old_transparency_size = transparency_size;
old_levels_of_undo = levels_of_undo;
old_marching_speed = marching_speed;
old_allow_resize_windows = allow_resize_windows;
old_auto_save = auto_save;
old_preview_size = preview_size;
......@@ -1287,6 +1299,9 @@ file_pref_cmd_callback (GtkWidget *widget,
sprintf (buffer, "%d", marching_speed);
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (entry), "changed",
(GtkSignalFunc) file_prefs_text_callback,
&marching_speed);
gtk_widget_show (entry);
label = gtk_label_new ("Interface");
......
......@@ -326,7 +326,7 @@ convolve_motion (PaintCore *paint_core,
}
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_replace_canvas (paint_core, drawable, OPAQUE,
paint_core_replace_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (get_brush_opacity () * 255),
SOFT, INCREMENTAL);
}
......
......@@ -271,7 +271,7 @@ edit_paste (GImage *gimage,
int cx, cy;
/* Make a new floating layer */
float_layer = layer_from_tiles (gimage, drawable, paste, "Pasted Layer", OPAQUE, NORMAL);
float_layer = layer_from_tiles (gimage, drawable, paste, "Pasted Layer", OPAQUE_OPACITY, NORMAL);
if (float_layer)
{
......@@ -320,7 +320,7 @@ edit_clear (GImage *gimage,
gimage_get_background (gimage, drawable, col);
if (drawable_has_alpha (drawable))
col [drawable_bytes (drawable) - 1] = OPAQUE;
col [drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
......@@ -332,7 +332,7 @@ edit_clear (GImage *gimage,
color_region (&bufPR, col);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE,
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
ERASE_MODE, NULL, x1, y1);
/* update the image */
......@@ -358,7 +358,7 @@ edit_fill (GImage *gimage,
gimage_get_background (gimage, drawable, col);
if (drawable_has_alpha (drawable))
col [drawable_bytes (drawable) - 1] = OPAQUE;
col [drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
......@@ -370,7 +370,7 @@ edit_fill (GImage *gimage,
color_region (&bufPR, col);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE,
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
NORMAL_MODE, NULL, x1, y1);
/* update the image */
......
......@@ -105,7 +105,7 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT, tile->ewidth * tile->eheight);
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
}
......
......@@ -105,7 +105,7 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT, tile->ewidth * tile->eheight);
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
}
......
......@@ -1095,7 +1095,7 @@ gradient_precalc_shapeburst (GImage *gimage,
float *distp;
int size;
void * pr;
unsigned char white[1] = { OPAQUE };
unsigned char white[1] = { OPAQUE_OPACITY };
/* allocate the distance map */
if (distR.tiles)
......
......@@ -373,7 +373,7 @@ offset (GImage *gimage,
{
palette_get_background (&fill[0], &fill[1], &fill[2]);
if (drawable_has_alpha (drawable))
fill[drawable_bytes (drawable) - 1] = OPAQUE;
fill[drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
}
if (offset_x >= 0 && offset_y >= 0)
......
......@@ -271,7 +271,7 @@ edit_paste (GImage *gimage,
int cx, cy;
/* Make a new floating layer */
float_layer = layer_from_tiles (gimage, drawable, paste, "Pasted Layer", OPAQUE, NORMAL);
float_layer = layer_from_tiles (gimage, drawable, paste, "Pasted Layer", OPAQUE_OPACITY, NORMAL);
if (float_layer)
{
......@@ -320,7 +320,7 @@ edit_clear (GImage *gimage,
gimage_get_background (gimage, drawable, col);
if (drawable_has_alpha (drawable))
col [drawable_bytes (drawable) - 1] = OPAQUE;
col [drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
......@@ -332,7 +332,7 @@ edit_clear (GImage *gimage,
color_region (&bufPR, col);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE,
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
ERASE_MODE, NULL, x1, y1);
/* update the image */
......@@ -358,7 +358,7 @@ edit_fill (GImage *gimage,
gimage_get_background (gimage, drawable, col);
if (drawable_has_alpha (drawable))
col [drawable_bytes (drawable) - 1] = OPAQUE;
col [drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
......@@ -370,7 +370,7 @@ edit_fill (GImage *gimage,
color_region (&bufPR, col);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE,
gimage_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
NORMAL_MODE, NULL, x1, y1);
/* update the image */
......
......@@ -373,7 +373,7 @@ offset (GImage *gimage,
{
palette_get_background (&fill[0], &fill[1], &fill[2]);
if (drawable_has_alpha (drawable))
fill[drawable_bytes (drawable) - 1] = OPAQUE;
fill[drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
}
if (offset_x >= 0 && offset_y >= 0)
......
......@@ -341,7 +341,7 @@ gimage_mask_float (gimage, drawable, off_x, off_y)
tiles = gimage_mask_extract (gimage, drawable, TRUE, FALSE);
/* Create a new layer from the buffer */
layer = layer_from_tiles (gimage, drawable, tiles, "Floated Layer", OPAQUE, NORMAL);
layer = layer_from_tiles (gimage, drawable, tiles, "Floated Layer", OPAQUE_OPACITY, NORMAL);
/* Set the offsets */
GIMP_DRAWABLE(layer)->offset_x = tiles->x + off_x;
......@@ -628,14 +628,14 @@ gimage_mask_stroke_paint_func (paint_core, drawable, state)
return NULL;
/* set the alpha channel */
col[area->bytes - 1] = OPAQUE;
col[area->bytes - 1] = OPAQUE_OPACITY;
/* color the pixels */
color_pixels (temp_buf_data (area), col,
area->width * area->height, area->bytes);
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE,
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (get_brush_opacity () * 255),
get_brush_paint_mode (), SOFT, CONSTANT);
......
......@@ -79,7 +79,7 @@ image_map_do (gpointer data)
/* apply the results */
pixel_region_init (&shadowPR, gimage->shadow, x, y, w, h, FALSE);
gimage_apply_image (gimage, _image_map->drawable, &shadowPR,
FALSE, OPAQUE, REPLACE_MODE, NULL, x, y);
FALSE, OPAQUE_OPACITY, REPLACE_MODE, NULL, x, y);
/* display the results */
if (_image_map->gdisp)
......
......@@ -430,15 +430,15 @@ layer_create_mask (layer, add_mask_type)
LayerMask *mask;
char * mask_name;
unsigned char black[3] = {0, 0, 0};
unsigned char white_mask = OPAQUE;
unsigned char black_mask = TRANSPARENT;
unsigned char white_mask = OPAQUE_OPACITY;
unsigned char black_mask = TRANSPARENT_OPACITY;
mask_name = (char *) g_malloc (strlen (GIMP_DRAWABLE(layer)->name) + strlen ("mask") + 2);
sprintf (mask_name, "%s mask", GIMP_DRAWABLE(layer)->name);
/* Create the layer mask */
mask = layer_mask_new (GIMP_DRAWABLE(layer)->gimage_ID, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height,
mask_name, OPAQUE, black);
mask_name, OPAQUE_OPACITY, black);
GIMP_DRAWABLE(mask)->offset_x = GIMP_DRAWABLE(layer)->offset_x;
GIMP_DRAWABLE(mask)->offset_y = GIMP_DRAWABLE(layer)->offset_y;
......@@ -540,7 +540,7 @@ layer_apply_mask (layer, mode)
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
pixel_region_init (&maskPR, GIMP_DRAWABLE(layer->mask)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
apply_mask_to_region (&srcPR, &maskPR, OPAQUE);
apply_mask_to_region (&srcPR, &maskPR, OPAQUE_OPACITY);
GIMP_DRAWABLE(layer)->preview_valid = FALSE;
layer->mask = NULL;
......
......@@ -165,7 +165,7 @@ drawable_merge_shadow (GimpDrawable *drawable, int undo)
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
pixel_region_init (&shadowPR, gimage->shadow, x1, y1,
(x2 - x1), (y2 - y1), FALSE);
gimage_apply_image (gimage, drawable, &shadowPR, undo, OPAQUE,
gimage_apply_image (gimage, drawable, &shadowPR, undo, OPAQUE_OPACITY,
REPLACE_MODE, NULL, x1, y1);
}
......
......@@ -105,14 +105,14 @@ eraser_motion (paint_core, drawable)
return;
/* set the alpha channel */
col[area->bytes - 1] = OPAQUE;
col[area->bytes - 1] = OPAQUE_OPACITY;
/* color the pixels */
color_pixels (temp_buf_data (area), col,
area->width * area->height, area->bytes);
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE,
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (get_brush_opacity () * 255),
ERASE_MODE, SOFT, CONSTANT);
}
......
......@@ -690,7 +690,7 @@ gimage_replace_image (GImage *gimage, GimpDrawable *drawable, PixelRegion *src2P
tempPR.h = y2 - y1;
tempPR.data = temp_data;
apply_mask_to_region (&tempPR, maskPR, OPAQUE);
apply_mask_to_region (&tempPR, maskPR, OPAQUE_OPACITY);
tempPR.x = 0;
tempPR.y = 0;
......@@ -1943,7 +1943,7 @@ gimage_merge_layers (GImage *gimage, link_ptr merge_list, MergeType merge_type)
case INDEXED: type = INDEXED_GIMAGE; break;
}
merge_layer = layer_new (gimage->ID, gimage->width, gimage->height,
type, drawable_name (GIMP_DRAWABLE(layer)), OPAQUE, NORMAL_MODE);
type, drawable_name (GIMP_DRAWABLE(layer)), OPAQUE_OPACITY, NORMAL_MODE);
if (!merge_layer) {
warning("gimage_merge_layers: could not allocate merge layer");
......@@ -2479,7 +2479,7 @@ gimage_is_flat (GImage *gimage)
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
......@@ -2488,7 +2488,7 @@ gimage_is_flat (GImage *gimage)
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
......@@ -2698,17 +2698,17 @@ gimage_projection_opacity (GImage *gimage)
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimage_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE;
return OPAQUE_OPACITY;
}
else
return OPAQUE;
return OPAQUE_OPACITY;
}
void
......
......@@ -341,7 +341,7 @@ gimage_mask_float (gimage, drawable, off_x, off_y)
tiles = gimage_mask_extract (gimage, drawable, TRUE, FALSE);
/* Create a new layer from the buffer */
layer = layer_from_tiles (gimage, drawable, tiles, "Floated Layer", OPAQUE, NORMAL);
layer = layer_from_tiles (gimage, drawable, tiles, "Floated Layer", OPAQUE_OPACITY, NORMAL);
/* Set the offsets */
GIMP_DRAWABLE(layer)->offset_x = tiles->x + off_x;
......@@ -628,14 +628,14 @@ gimage_mask_stroke_paint_func (paint_core, drawable, state)
return NULL;
/* set the alpha channel */
col[area->bytes - 1] = OPAQUE;
col[area->bytes - 1] = OPAQUE_OPACITY;
/* color the pixels */
color_pixels (temp_buf_data (area), col,
area->width * area->height, area->bytes);
/* paste the newly painted canvas to the gimage which is being worked on */
paint_core_paste_canvas (paint_core, drawable, OPAQUE,
paint_core_paste_canvas (paint_core, drawable, OPAQUE_OPACITY,
(int) (get_brush_opacity () * 255),
get_brush_paint_mode (), SOFT, CONSTANT);
......
......@@ -105,7 +105,7 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT, tile->ewidth * tile->eheight);
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
}
......
......@@ -373,7 +373,7 @@ offset (GImage *gimage,
{
palette_get_background (&fill[0], &fill[1], &fill[2]);
if (drawable_has_alpha (drawable))
fill[drawable_bytes (drawable) - 1] = OPAQUE;
fill[drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
}
if (offset_x >= 0 && offset_y >= 0)
......
......@@ -373,7 +373,7 @@ offset (GImage *gimage,
{
palette_get_background (&fill[0], &fill[1], &fill[2]);
if (drawable_has_alpha (drawable))
fill[drawable_bytes (drawable) - 1] = OPAQUE;
fill[drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
}
if (offset_x >= 0 && offset_y >= 0)
......
......@@ -430,15 +430,15 @@ layer_create_mask (layer, add_mask_type)
LayerMask *mask;
char * mask_name;
unsigned char black[3] = {0, 0, 0};
unsigned char white_mask = OPAQUE;
unsigned char black_mask = TRANSPARENT;
unsigned char white_mask = OPAQUE_OPACITY;
unsigned char black_mask = TRANSPARENT_OPACITY;
mask_name = (char *) g_malloc (strlen (GIMP_DRAWABLE(layer)->name) + strlen ("mask") + 2);
sprintf (mask_name, "%s mask", GIMP_DRAWABLE(layer)->name);
/* Create the layer mask */
mask = layer_mask_new (GIMP_DRAWABLE(layer)->gimage_ID, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height,
mask_name, OPAQUE, black);
mask_name, OPAQUE_OPACITY, black);
GIMP_DRAWABLE(mask)->offset_x = GIMP_DRAWABLE(layer)->offset_x;
GIMP_DRAWABLE(mask)->offset_y = GIMP_DRAWABLE(layer)->offset_y;
......@@ -540,7 +540,7 @@ layer_apply_mask (layer, mode)
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
pixel_region_init (&maskPR, GIMP_DRAWABLE(layer->mask)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
apply_mask_to_region (&srcPR, &maskPR, OPAQUE);
apply_mask_to_region (&srcPR, &maskPR, OPAQUE_OPACITY);
GIMP_DRAWABLE(layer)->preview_valid = FALSE;
layer->mask = NULL;
......
......@@ -271,7 +271,7 @@ edit_paste (GImage *gimage,
int cx, cy;
/* Make a new floating layer */
float_layer = layer_from_tiles (gimage, drawable, paste, "Pasted Layer", OPAQUE, NORMAL);
float_layer = layer_from_tiles (gimage, drawable, paste, "Pasted Layer", OPAQUE_OPACITY, NORMAL);
if (float_layer)
{
......@@ -320,7 +320,7 @@ edit_clear (GImage *gimage,
gimage_get_background (gimage, drawable, col);
if (drawable_has_alpha (drawable))
col [drawable_bytes (drawable) - 1] = OPAQUE;
col [drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;