gimp/app/core/gimplayermask.c

347 lines
9.3 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "apptypes.h"
#include "boundary.h"
removed the layer mask functions. 2001-03-06 Michael Natterer <mitch@gimp.org> * app/gimage.[ch]: removed the layer mask functions. * app/gimpchannel.[ch]: added a boolean "dummy" parameter to gimp_channel_copy() so it has the same signature as gimp_layer_copy() and can be used by the GimpDrawableListView to generically duplicate drawables. * app/gimpcontainerview.c: call "select_item" with a NULL item before changing the underlying GimpContainer so subclasses have a chance to update (e.g. set button sensitivity). * app/gimpdnd.c: folded all the GtkType comparing code into a utility function (much more readable now). * app/gimpdrawablelistview.[ch]: activated the "raise", "lower", "duplicate" and "delete". I'm not really happy with all those function pointers passed to the constructor (and the dummy parameters I've added to some GimpChannel functions) -- OTOH the generic view maybe worth the "gboolean dummy" cruft hanging around in the channel class. * app/gimplayer.[ch]: removed the "apply_mask", "edit_mask" and "show_mask" booleans ... * app/gimplayermask.[ch]: .. and added them here together with proper accessors and "*_changed" signals. This also makes the layer mask undo code much clearer as we don't have to store the booleans separately. * app/gimplayerlistitem.c: badly hacked to acheive the correct indicator being drawn around the active drawable. This needs a new GimpPreview function for setting the border color. * app/gimplistitem.c: smaller horizontal spacing. * app/gimppreview.[ch]: added the "border_width" parameter also to gimp_preview_set_size() so we can modify all previews the same way after creation. * app/layers_dialog.c: no need to push an undo group around the "duplicate layer" code. Was this an artefact or did I miss something here ??? * app/channel_ops.c * app/channels_dialog.c * app/gimage_mask.c * app/gimpcontainergridview.c * app/gimpcontainerlistview.c * app/gimpdrawablelistitem.c * app/gimpimage.[ch] * app/qmask.c * app/test_commands.c * app/undo.c * app/xcf.c * app/pdb/channel_cmds.c * tools/pdbgen/pdb/channel.pdb * app/pdb/selection_cmds.c * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch] * tools/pdbgen/pdb/layer.pdb: commented out the layer mask accessors from the perl code, so the functions temporarily disappeared all over the place. * plug-ins/Makefile.am: don't build XJT until the layer mask stuff is back. * pixmaps/eye.xpm: cropped it to it's minimal size.
2001-03-06 21:28:39 +08:00
#include "drawable.h"
#include "gimplayermask.h"
#include "paint_funcs.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimpparasite.h"
#include "libgimp/gimpintl.h"
removed the layer mask functions. 2001-03-06 Michael Natterer <mitch@gimp.org> * app/gimage.[ch]: removed the layer mask functions. * app/gimpchannel.[ch]: added a boolean "dummy" parameter to gimp_channel_copy() so it has the same signature as gimp_layer_copy() and can be used by the GimpDrawableListView to generically duplicate drawables. * app/gimpcontainerview.c: call "select_item" with a NULL item before changing the underlying GimpContainer so subclasses have a chance to update (e.g. set button sensitivity). * app/gimpdnd.c: folded all the GtkType comparing code into a utility function (much more readable now). * app/gimpdrawablelistview.[ch]: activated the "raise", "lower", "duplicate" and "delete". I'm not really happy with all those function pointers passed to the constructor (and the dummy parameters I've added to some GimpChannel functions) -- OTOH the generic view maybe worth the "gboolean dummy" cruft hanging around in the channel class. * app/gimplayer.[ch]: removed the "apply_mask", "edit_mask" and "show_mask" booleans ... * app/gimplayermask.[ch]: .. and added them here together with proper accessors and "*_changed" signals. This also makes the layer mask undo code much clearer as we don't have to store the booleans separately. * app/gimplayerlistitem.c: badly hacked to acheive the correct indicator being drawn around the active drawable. This needs a new GimpPreview function for setting the border color. * app/gimplistitem.c: smaller horizontal spacing. * app/gimppreview.[ch]: added the "border_width" parameter also to gimp_preview_set_size() so we can modify all previews the same way after creation. * app/layers_dialog.c: no need to push an undo group around the "duplicate layer" code. Was this an artefact or did I miss something here ??? * app/channel_ops.c * app/channels_dialog.c * app/gimage_mask.c * app/gimpcontainergridview.c * app/gimpcontainerlistview.c * app/gimpdrawablelistitem.c * app/gimpimage.[ch] * app/qmask.c * app/test_commands.c * app/undo.c * app/xcf.c * app/pdb/channel_cmds.c * tools/pdbgen/pdb/channel.pdb * app/pdb/selection_cmds.c * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch] * tools/pdbgen/pdb/layer.pdb: commented out the layer mask accessors from the perl code, so the functions temporarily disappeared all over the place. * plug-ins/Makefile.am: don't build XJT until the layer mask stuff is back. * pixmaps/eye.xpm: cropped it to it's minimal size.
2001-03-06 21:28:39 +08:00
enum
{
APPLY_CHANGED,
EDIT_CHANGED,
SHOW_CHANGED,
LAST_SIGNAL
};
static void gimp_layer_mask_class_init (GimpLayerMaskClass *klass);
static void gimp_layer_mask_init (GimpLayerMask *layermask);
static void gimp_layer_mask_destroy (GtkObject *object);
removed the layer mask functions. 2001-03-06 Michael Natterer <mitch@gimp.org> * app/gimage.[ch]: removed the layer mask functions. * app/gimpchannel.[ch]: added a boolean "dummy" parameter to gimp_channel_copy() so it has the same signature as gimp_layer_copy() and can be used by the GimpDrawableListView to generically duplicate drawables. * app/gimpcontainerview.c: call "select_item" with a NULL item before changing the underlying GimpContainer so subclasses have a chance to update (e.g. set button sensitivity). * app/gimpdnd.c: folded all the GtkType comparing code into a utility function (much more readable now). * app/gimpdrawablelistview.[ch]: activated the "raise", "lower", "duplicate" and "delete". I'm not really happy with all those function pointers passed to the constructor (and the dummy parameters I've added to some GimpChannel functions) -- OTOH the generic view maybe worth the "gboolean dummy" cruft hanging around in the channel class. * app/gimplayer.[ch]: removed the "apply_mask", "edit_mask" and "show_mask" booleans ... * app/gimplayermask.[ch]: .. and added them here together with proper accessors and "*_changed" signals. This also makes the layer mask undo code much clearer as we don't have to store the booleans separately. * app/gimplayerlistitem.c: badly hacked to acheive the correct indicator being drawn around the active drawable. This needs a new GimpPreview function for setting the border color. * app/gimplistitem.c: smaller horizontal spacing. * app/gimppreview.[ch]: added the "border_width" parameter also to gimp_preview_set_size() so we can modify all previews the same way after creation. * app/layers_dialog.c: no need to push an undo group around the "duplicate layer" code. Was this an artefact or did I miss something here ??? * app/channel_ops.c * app/channels_dialog.c * app/gimage_mask.c * app/gimpcontainergridview.c * app/gimpcontainerlistview.c * app/gimpdrawablelistitem.c * app/gimpimage.[ch] * app/qmask.c * app/test_commands.c * app/undo.c * app/xcf.c * app/pdb/channel_cmds.c * tools/pdbgen/pdb/channel.pdb * app/pdb/selection_cmds.c * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch] * tools/pdbgen/pdb/layer.pdb: commented out the layer mask accessors from the perl code, so the functions temporarily disappeared all over the place. * plug-ins/Makefile.am: don't build XJT until the layer mask stuff is back. * pixmaps/eye.xpm: cropped it to it's minimal size.
2001-03-06 21:28:39 +08:00
static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
static GimpChannelClass *parent_class = NULL;
GtkType
gimp_layer_mask_get_type (void)
{
static GtkType layer_mask_type = 0;
if (! layer_mask_type)
{
GtkTypeInfo layer_mask_info =
{
"GimpLayerMask",
sizeof (GimpLayerMask),
sizeof (GimpLayerMaskClass),
(GtkClassInitFunc) gimp_layer_mask_class_init,
(GtkObjectInitFunc) gimp_layer_mask_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
layer_mask_type = gtk_type_unique (GIMP_TYPE_CHANNEL, &layer_mask_info);
}
return layer_mask_type;
}
static void
gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_CHANNEL);
removed the layer mask functions. 2001-03-06 Michael Natterer <mitch@gimp.org> * app/gimage.[ch]: removed the layer mask functions. * app/gimpchannel.[ch]: added a boolean "dummy" parameter to gimp_channel_copy() so it has the same signature as gimp_layer_copy() and can be used by the GimpDrawableListView to generically duplicate drawables. * app/gimpcontainerview.c: call "select_item" with a NULL item before changing the underlying GimpContainer so subclasses have a chance to update (e.g. set button sensitivity). * app/gimpdnd.c: folded all the GtkType comparing code into a utility function (much more readable now). * app/gimpdrawablelistview.[ch]: activated the "raise", "lower", "duplicate" and "delete". I'm not really happy with all those function pointers passed to the constructor (and the dummy parameters I've added to some GimpChannel functions) -- OTOH the generic view maybe worth the "gboolean dummy" cruft hanging around in the channel class. * app/gimplayer.[ch]: removed the "apply_mask", "edit_mask" and "show_mask" booleans ... * app/gimplayermask.[ch]: .. and added them here together with proper accessors and "*_changed" signals. This also makes the layer mask undo code much clearer as we don't have to store the booleans separately. * app/gimplayerlistitem.c: badly hacked to acheive the correct indicator being drawn around the active drawable. This needs a new GimpPreview function for setting the border color. * app/gimplistitem.c: smaller horizontal spacing. * app/gimppreview.[ch]: added the "border_width" parameter also to gimp_preview_set_size() so we can modify all previews the same way after creation. * app/layers_dialog.c: no need to push an undo group around the "duplicate layer" code. Was this an artefact or did I miss something here ??? * app/channel_ops.c * app/channels_dialog.c * app/gimage_mask.c * app/gimpcontainergridview.c * app/gimpcontainerlistview.c * app/gimpdrawablelistitem.c * app/gimpimage.[ch] * app/qmask.c * app/test_commands.c * app/undo.c * app/xcf.c * app/pdb/channel_cmds.c * tools/pdbgen/pdb/channel.pdb * app/pdb/selection_cmds.c * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch] * tools/pdbgen/pdb/layer.pdb: commented out the layer mask accessors from the perl code, so the functions temporarily disappeared all over the place. * plug-ins/Makefile.am: don't build XJT until the layer mask stuff is back. * pixmaps/eye.xpm: cropped it to it's minimal size.
2001-03-06 21:28:39 +08:00
layer_mask_signals[APPLY_CHANGED] =
gtk_signal_new ("apply_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpLayerMaskClass,
apply_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
layer_mask_signals[EDIT_CHANGED] =
gtk_signal_new ("edit_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpLayerMaskClass,
edit_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
layer_mask_signals[SHOW_CHANGED] =
gtk_signal_new ("show_changed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpLayerMaskClass,
show_changed),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, layer_mask_signals, LAST_SIGNAL);
object_class->destroy = gimp_layer_mask_destroy;
}
static void
gimp_layer_mask_init (GimpLayerMask *layer_mask)
{
removed the layer mask functions. 2001-03-06 Michael Natterer <mitch@gimp.org> * app/gimage.[ch]: removed the layer mask functions. * app/gimpchannel.[ch]: added a boolean "dummy" parameter to gimp_channel_copy() so it has the same signature as gimp_layer_copy() and can be used by the GimpDrawableListView to generically duplicate drawables. * app/gimpcontainerview.c: call "select_item" with a NULL item before changing the underlying GimpContainer so subclasses have a chance to update (e.g. set button sensitivity). * app/gimpdnd.c: folded all the GtkType comparing code into a utility function (much more readable now). * app/gimpdrawablelistview.[ch]: activated the "raise", "lower", "duplicate" and "delete". I'm not really happy with all those function pointers passed to the constructor (and the dummy parameters I've added to some GimpChannel functions) -- OTOH the generic view maybe worth the "gboolean dummy" cruft hanging around in the channel class. * app/gimplayer.[ch]: removed the "apply_mask", "edit_mask" and "show_mask" booleans ... * app/gimplayermask.[ch]: .. and added them here together with proper accessors and "*_changed" signals. This also makes the layer mask undo code much clearer as we don't have to store the booleans separately. * app/gimplayerlistitem.c: badly hacked to acheive the correct indicator being drawn around the active drawable. This needs a new GimpPreview function for setting the border color. * app/gimplistitem.c: smaller horizontal spacing. * app/gimppreview.[ch]: added the "border_width" parameter also to gimp_preview_set_size() so we can modify all previews the same way after creation. * app/layers_dialog.c: no need to push an undo group around the "duplicate layer" code. Was this an artefact or did I miss something here ??? * app/channel_ops.c * app/channels_dialog.c * app/gimage_mask.c * app/gimpcontainergridview.c * app/gimpcontainerlistview.c * app/gimpdrawablelistitem.c * app/gimpimage.[ch] * app/qmask.c * app/test_commands.c * app/undo.c * app/xcf.c * app/pdb/channel_cmds.c * tools/pdbgen/pdb/channel.pdb * app/pdb/selection_cmds.c * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch] * tools/pdbgen/pdb/layer.pdb: commented out the layer mask accessors from the perl code, so the functions temporarily disappeared all over the place. * plug-ins/Makefile.am: don't build XJT until the layer mask stuff is back. * pixmaps/eye.xpm: cropped it to it's minimal size.
2001-03-06 21:28:39 +08:00
layer_mask->layer = NULL;
layer_mask->apply_mask = TRUE;
layer_mask->edit_mask = TRUE;
layer_mask->show_mask = FALSE;
}
static void
gimp_layer_mask_destroy (GtkObject *object)
{
GimpLayerMask *layer_mask;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_LAYER_MASK (object));
layer_mask = GIMP_LAYER_MASK (object);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GimpLayerMask *
gimp_layer_mask_new (GimpImage *gimage,
gint width,
gint height,
const gchar *name,
const GimpRGB *color)
{
GimpLayerMask *layer_mask;
layer_mask = gtk_type_new (GIMP_TYPE_LAYER_MASK);
gimp_drawable_configure (GIMP_DRAWABLE (layer_mask),
gimage, width, height, GRAY_GIMAGE, name);
/* set the layer_mask color and opacity */
GIMP_CHANNEL (layer_mask)->color = *color;
GIMP_CHANNEL (layer_mask)->show_masked = TRUE;
/* selection mask variables */
GIMP_CHANNEL (layer_mask)->empty = TRUE;
GIMP_CHANNEL (layer_mask)->segs_in = NULL;
GIMP_CHANNEL (layer_mask)->segs_out = NULL;
GIMP_CHANNEL (layer_mask)->num_segs_in = 0;
GIMP_CHANNEL (layer_mask)->num_segs_out = 0;
GIMP_CHANNEL (layer_mask)->bounds_known = TRUE;
GIMP_CHANNEL (layer_mask)->boundary_known = TRUE;
GIMP_CHANNEL (layer_mask)->x1 = 0;
GIMP_CHANNEL (layer_mask)->y1 = 0;
GIMP_CHANNEL (layer_mask)->x2 = width;
GIMP_CHANNEL (layer_mask)->y2 = height;
return layer_mask;
}
GimpLayerMask *
gimp_layer_mask_copy (GimpLayerMask *layer_mask)
{
gchar *layer_mask_name;
GimpLayerMask *new_layer_mask;
PixelRegion srcPR, destPR;
/* formulate the new layer_mask name */
layer_mask_name =
g_strdup_printf (_("%s copy"),
gimp_object_get_name (GIMP_OBJECT (layer_mask)));
/* allocate a new layer_mask object */
new_layer_mask = gimp_layer_mask_new (GIMP_DRAWABLE (layer_mask)->gimage,
GIMP_DRAWABLE (layer_mask)->width,
GIMP_DRAWABLE (layer_mask)->height,
layer_mask_name,
&GIMP_CHANNEL (layer_mask)->color);
removed the layer mask functions. 2001-03-06 Michael Natterer <mitch@gimp.org> * app/gimage.[ch]: removed the layer mask functions. * app/gimpchannel.[ch]: added a boolean "dummy" parameter to gimp_channel_copy() so it has the same signature as gimp_layer_copy() and can be used by the GimpDrawableListView to generically duplicate drawables. * app/gimpcontainerview.c: call "select_item" with a NULL item before changing the underlying GimpContainer so subclasses have a chance to update (e.g. set button sensitivity). * app/gimpdnd.c: folded all the GtkType comparing code into a utility function (much more readable now). * app/gimpdrawablelistview.[ch]: activated the "raise", "lower", "duplicate" and "delete". I'm not really happy with all those function pointers passed to the constructor (and the dummy parameters I've added to some GimpChannel functions) -- OTOH the generic view maybe worth the "gboolean dummy" cruft hanging around in the channel class. * app/gimplayer.[ch]: removed the "apply_mask", "edit_mask" and "show_mask" booleans ... * app/gimplayermask.[ch]: .. and added them here together with proper accessors and "*_changed" signals. This also makes the layer mask undo code much clearer as we don't have to store the booleans separately. * app/gimplayerlistitem.c: badly hacked to acheive the correct indicator being drawn around the active drawable. This needs a new GimpPreview function for setting the border color. * app/gimplistitem.c: smaller horizontal spacing. * app/gimppreview.[ch]: added the "border_width" parameter also to gimp_preview_set_size() so we can modify all previews the same way after creation. * app/layers_dialog.c: no need to push an undo group around the "duplicate layer" code. Was this an artefact or did I miss something here ??? * app/channel_ops.c * app/channels_dialog.c * app/gimage_mask.c * app/gimpcontainergridview.c * app/gimpcontainerlistview.c * app/gimpdrawablelistitem.c * app/gimpimage.[ch] * app/qmask.c * app/test_commands.c * app/undo.c * app/xcf.c * app/pdb/channel_cmds.c * tools/pdbgen/pdb/channel.pdb * app/pdb/selection_cmds.c * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch] * tools/pdbgen/pdb/layer.pdb: commented out the layer mask accessors from the perl code, so the functions temporarily disappeared all over the place. * plug-ins/Makefile.am: don't build XJT until the layer mask stuff is back. * pixmaps/eye.xpm: cropped it to it's minimal size.
2001-03-06 21:28:39 +08:00
GIMP_DRAWABLE (new_layer_mask)->visible = GIMP_DRAWABLE (layer_mask)->visible;
GIMP_DRAWABLE (new_layer_mask)->offset_x = GIMP_DRAWABLE (layer_mask)->offset_x;
GIMP_DRAWABLE (new_layer_mask)->offset_y = GIMP_DRAWABLE (layer_mask)->offset_y;
GIMP_CHANNEL (new_layer_mask)->show_masked = GIMP_CHANNEL (layer_mask)->show_masked;
new_layer_mask->apply_mask = layer_mask->apply_mask;
new_layer_mask->edit_mask = layer_mask->edit_mask;
new_layer_mask->show_mask = layer_mask->show_mask;
/* copy the contents across layer masks */
pixel_region_init (&srcPR, GIMP_DRAWABLE (layer_mask)->tiles,
0, 0,
GIMP_DRAWABLE (layer_mask)->width,
GIMP_DRAWABLE (layer_mask)->height,
FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE (new_layer_mask)->tiles,
0, 0,
GIMP_DRAWABLE (layer_mask)->width,
GIMP_DRAWABLE (layer_mask)->height,
TRUE);
copy_region (&srcPR, &destPR);
/* free up the layer_mask_name memory */
g_free (layer_mask_name);
return new_layer_mask;
}
void
gimp_layer_mask_set_layer (GimpLayerMask *mask,
GimpLayer *layer)
{
mask->layer = layer;
}
GimpLayer *
gimp_layer_mask_get_layer (GimpLayerMask *mask)
{
return mask->layer;
}
removed the layer mask functions. 2001-03-06 Michael Natterer <mitch@gimp.org> * app/gimage.[ch]: removed the layer mask functions. * app/gimpchannel.[ch]: added a boolean "dummy" parameter to gimp_channel_copy() so it has the same signature as gimp_layer_copy() and can be used by the GimpDrawableListView to generically duplicate drawables. * app/gimpcontainerview.c: call "select_item" with a NULL item before changing the underlying GimpContainer so subclasses have a chance to update (e.g. set button sensitivity). * app/gimpdnd.c: folded all the GtkType comparing code into a utility function (much more readable now). * app/gimpdrawablelistview.[ch]: activated the "raise", "lower", "duplicate" and "delete". I'm not really happy with all those function pointers passed to the constructor (and the dummy parameters I've added to some GimpChannel functions) -- OTOH the generic view maybe worth the "gboolean dummy" cruft hanging around in the channel class. * app/gimplayer.[ch]: removed the "apply_mask", "edit_mask" and "show_mask" booleans ... * app/gimplayermask.[ch]: .. and added them here together with proper accessors and "*_changed" signals. This also makes the layer mask undo code much clearer as we don't have to store the booleans separately. * app/gimplayerlistitem.c: badly hacked to acheive the correct indicator being drawn around the active drawable. This needs a new GimpPreview function for setting the border color. * app/gimplistitem.c: smaller horizontal spacing. * app/gimppreview.[ch]: added the "border_width" parameter also to gimp_preview_set_size() so we can modify all previews the same way after creation. * app/layers_dialog.c: no need to push an undo group around the "duplicate layer" code. Was this an artefact or did I miss something here ??? * app/channel_ops.c * app/channels_dialog.c * app/gimage_mask.c * app/gimpcontainergridview.c * app/gimpcontainerlistview.c * app/gimpdrawablelistitem.c * app/gimpimage.[ch] * app/qmask.c * app/test_commands.c * app/undo.c * app/xcf.c * app/pdb/channel_cmds.c * tools/pdbgen/pdb/channel.pdb * app/pdb/selection_cmds.c * tools/pdbgen/pdb/selection.pdb: changed accordingly. * app/pdb/internal_procs.c * app/pdb/layer_cmds.c * libgimp/gimplayer_pdb.[ch] * tools/pdbgen/pdb/layer.pdb: commented out the layer mask accessors from the perl code, so the functions temporarily disappeared all over the place. * plug-ins/Makefile.am: don't build XJT until the layer mask stuff is back. * pixmaps/eye.xpm: cropped it to it's minimal size.
2001-03-06 21:28:39 +08:00
void
gimp_layer_mask_set_apply (GimpLayerMask *layer_mask,
gboolean apply)
{
g_return_if_fail (layer_mask != NULL);
g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
if (layer_mask->apply_mask != apply)
{
layer_mask->apply_mask = apply;
if (layer_mask->layer)
{
GimpDrawable *drawable;
drawable = GIMP_DRAWABLE (layer_mask->layer);
drawable_update (drawable,
0, 0,
gimp_drawable_width (drawable),
gimp_drawable_height (drawable));
}
gtk_signal_emit (GTK_OBJECT (layer_mask),
layer_mask_signals[APPLY_CHANGED]);
}
}
gboolean
gimp_layer_mask_get_apply (GimpLayerMask *layer_mask)
{
g_return_val_if_fail (layer_mask != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_LAYER_MASK (layer_mask), FALSE);
return layer_mask->apply_mask;
}
void
gimp_layer_mask_set_edit (GimpLayerMask *layer_mask,
gboolean edit)
{
g_return_if_fail (layer_mask != NULL);
g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
if (layer_mask->edit_mask != edit)
{
layer_mask->edit_mask = edit;
gtk_signal_emit (GTK_OBJECT (layer_mask),
layer_mask_signals[EDIT_CHANGED]);
}
}
gboolean
gimp_layer_mask_get_edit (GimpLayerMask *layer_mask)
{
g_return_val_if_fail (layer_mask != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_LAYER_MASK (layer_mask), FALSE);
return layer_mask->edit_mask;
}
void
gimp_layer_mask_set_show (GimpLayerMask *layer_mask,
gboolean show)
{
g_return_if_fail (layer_mask != NULL);
g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
if (layer_mask->show_mask != show)
{
layer_mask->show_mask = show;
if (layer_mask->layer)
{
GimpDrawable *drawable;
drawable = GIMP_DRAWABLE (layer_mask->layer);
drawable_update (drawable,
0, 0,
gimp_drawable_width (drawable),
gimp_drawable_height (drawable));
}
gtk_signal_emit (GTK_OBJECT (layer_mask),
layer_mask_signals[SHOW_CHANGED]);
}
}
gboolean
gimp_layer_mask_get_show (GimpLayerMask *layer_mask)
{
g_return_val_if_fail (layer_mask != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_LAYER_MASK (layer_mask), FALSE);
return layer_mask->show_mask;
}