Commit 8ddebdf7 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/Makefile.am new files cut out of layer.[ch]. Renamed all functions to

2001-01-28  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/gimplayermask.[ch]: new files cut out of layer.[ch]. Renamed
	all functions to gimp_layes_mask_*(). removed artefacts like
	the ref/unref functions.

	* app/apptypes.h: removed the "LayerMask" typedef.

	* app/layer.[ch]: removed the layer mask stuff and renamed all
	functions to gimp_layer_*(). Added temporary typedefs for the old
	function names. The layer mask preview stuff is still there (should
	probably go to new layer_preview.{ch] files).

	* app/gimpimage.[ch]: added
	gimp_image_invalidate_[layer|channel]_previews() formerly known as
	[layer|channel]_invalidate_previews().

	* app/channel.[ch]: moved channel_layer_alpha() and
	channel_layer_mask() here because they are methods of the Channel.

	* app/channel_ops.c
	* app/convert.c
	* app/disp_callbacks.c
	* app/fileops.c
	* app/floating_sel.c
	* app/gimage.c
	* app/gimage_mask.c
	* app/gimpdnd.c
	* app/global_edit.c
	* app/layers_dialog.c
	* app/preferences_dialog.c
	* app/toolbox.c
	* app/undo.c
	* app/xcf.c
	* app/pdb/drawable_cmds.c
	* app/pdb/image_cmds.c
	* app/pdb/layer_cmds.c
	* app/tools/crop.c
	* app/tools/text_tool.c
	* app/tools/transform_core.c
	* tools/pdbgen/pdb.pl
	* tools/pdbgen/pdb/drawable.pdb: changed accordingly, cleanup.
parent 41746cb5
2001-01-28 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/gimplayermask.[ch]: new files cut out of layer.[ch]. Renamed
all functions to gimp_layes_mask_*(). removed artefacts like
the ref/unref functions.
* app/apptypes.h: removed the "LayerMask" typedef.
* app/layer.[ch]: removed the layer mask stuff and renamed all
functions to gimp_layer_*(). Added temporary typedefs for the old
function names. The layer mask preview stuff is still there (should
probably go to new layer_preview.{ch] files).
* app/gimpimage.[ch]: added
gimp_image_invalidate_[layer|channel]_previews() formerly known as
[layer|channel]_invalidate_previews().
* app/channel.[ch]: moved channel_layer_alpha() and
channel_layer_mask() here because they are methods of the Channel.
* app/channel_ops.c
* app/convert.c
* app/disp_callbacks.c
* app/fileops.c
* app/floating_sel.c
* app/gimage.c
* app/gimage_mask.c
* app/gimpdnd.c
* app/global_edit.c
* app/layers_dialog.c
* app/preferences_dialog.c
* app/toolbox.c
* app/undo.c
* app/xcf.c
* app/pdb/drawable_cmds.c
* app/pdb/image_cmds.c
* app/pdb/layer_cmds.c
* app/tools/crop.c
* app/tools/text_tool.c
* app/tools/transform_core.c
* tools/pdbgen/pdb.pl
* tools/pdbgen/pdb/drawable.pdb: changed accordingly, cleanup.
2001-01-26 Daniel Egger <egger@suse.de>
* plug-ins/common/iwarp.c: Cleaned up code and
......
......@@ -125,6 +125,8 @@ gimp_SOURCES = \
gimphistogram.h \
gimpimage.c \
gimpimage.h \
gimplayermask.c \
gimplayermask.h \
gimplist.c \
gimplist.h \
gimplut.c \
......
......@@ -50,7 +50,6 @@ typedef struct _GimpLayer GimpLayer;
typedef struct _GimpLayerMask GimpLayerMask;
typedef GimpLayer Layer; /* convenience */
typedef GimpLayerMask LayerMask; /* convenience */
typedef struct _GimpImage GimpImage;
typedef GimpImage GImage;
......@@ -148,11 +147,11 @@ typedef struct _TransformCore TransformCore;
/* some undo stuff */
typedef struct _layer_undo LayerUndo;
typedef struct _LayerUndo LayerUndo;
typedef struct _layer_mask_undo LayerMaskUndo;
typedef struct _LayerMaskUndo LayerMaskUndo;
typedef struct _fs_to_layer_undo FStoLayerUndo;
typedef struct _FStoLayerUndo FStoLayerUndo;
typedef GSList PathUndo;
......
......@@ -546,24 +546,6 @@ channel_preview_private (Channel *channel,
}
}
void
channel_invalidate_previews (GimpImage *gimage)
{
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
tmp = gimage->channels;
while (tmp)
{
channel = (Channel *) tmp->data;
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
tmp = g_slist_next (tmp);
}
}
Tattoo
channel_get_tattoo (const Channel *channel)
{
......@@ -1674,8 +1656,31 @@ channel_translate (Channel *mask,
}
void
channel_layer_alpha (Channel *mask,
Layer *layer)
channel_load (Channel *mask,
Channel *channel)
{
PixelRegion srcPR, destPR;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
/* copy the channel to the mask */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE (mask)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, TRUE);
copy_region (&srcPR, &destPR);
mask->bounds_known = FALSE;
}
void
channel_layer_alpha (Channel *mask,
GimpLayer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
......@@ -1710,23 +1715,39 @@ channel_layer_alpha (Channel *mask,
}
void
channel_load (Channel *mask,
Channel *channel)
channel_layer_mask (Channel *mask,
GimpLayer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
/* copy the channel to the mask */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE (mask)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, TRUE);
/* clear the mask */
pixel_region_init (&destPR, GIMP_DRAWABLE(mask)->tiles,
0, 0,
GIMP_DRAWABLE(mask)->width, GIMP_DRAWABLE(mask)->height,
TRUE);
color_region (&destPR, &empty);
x1 = CLAMP (GIMP_DRAWABLE(layer)->offset_x, 0, GIMP_DRAWABLE(mask)->width);
y1 = CLAMP (GIMP_DRAWABLE(layer)->offset_y, 0, GIMP_DRAWABLE(mask)->height);
x2 = CLAMP (GIMP_DRAWABLE(layer)->offset_x + GIMP_DRAWABLE(layer)->width,
0, GIMP_DRAWABLE(mask)->width);
y2 = CLAMP (GIMP_DRAWABLE(layer)->offset_y + GIMP_DRAWABLE(layer)->height,
0, GIMP_DRAWABLE(mask)->height);
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer->mask)->tiles,
(x1 - GIMP_DRAWABLE(layer)->offset_x),
(y1 - GIMP_DRAWABLE(layer)->offset_y),
(x2 - x1), (y2 - y1),
FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE(mask)->tiles,
x1, y1,
(x2 - x1), (y2 - y1),
TRUE);
copy_region (&srcPR, &destPR);
mask->bounds_known = FALSE;
......
......@@ -127,8 +127,6 @@ TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
void channel_invalidate_previews (GimpImage *gimage);
Tattoo channel_get_tattoo (const Channel *channel);
void channel_set_tattoo (Channel *channel,
Tattoo value);
......@@ -215,6 +213,11 @@ void channel_translate (Channel *mask,
void channel_load (Channel *mask,
Channel *channel);
void channel_layer_alpha (Channel *mask,
GimpLayer *layer);
void channel_layer_mask (Channel *mask,
GimpLayer *layer);
void channel_invalidate_bounds (Channel *channel);
......
......@@ -29,6 +29,7 @@
#include "apptypes.h"
#include "apptypes.h"
#include "channel.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
......
......@@ -1457,7 +1457,7 @@ convert_image (GImage *gimage,
undo_push_group_end (gimage);
/* shrink wrap and update all views */
layer_invalidate_previews (gimage);
gimp_image_invalidate_layer_previews (gimage);
gimp_image_invalidate_preview (gimage);
gdisplays_update_title (gimage);
gdisplays_update_full (gimage);
......
......@@ -34,6 +34,7 @@
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimplayermask.h"
#include "global_edit.h"
#include "layer.h"
#include "paint_funcs.h"
......
......@@ -546,24 +546,6 @@ channel_preview_private (Channel *channel,
}
}
void
channel_invalidate_previews (GimpImage *gimage)
{
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
tmp = gimage->channels;
while (tmp)
{
channel = (Channel *) tmp->data;
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
tmp = g_slist_next (tmp);
}
}
Tattoo
channel_get_tattoo (const Channel *channel)
{
......@@ -1674,8 +1656,31 @@ channel_translate (Channel *mask,
}
void
channel_layer_alpha (Channel *mask,
Layer *layer)
channel_load (Channel *mask,
Channel *channel)
{
PixelRegion srcPR, destPR;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
/* copy the channel to the mask */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE (mask)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, TRUE);
copy_region (&srcPR, &destPR);
mask->bounds_known = FALSE;
}
void
channel_layer_alpha (Channel *mask,
GimpLayer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
......@@ -1710,23 +1715,39 @@ channel_layer_alpha (Channel *mask,
}
void
channel_load (Channel *mask,
Channel *channel)
channel_layer_mask (Channel *mask,
GimpLayer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
/* copy the channel to the mask */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE (mask)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, TRUE);
/* clear the mask */
pixel_region_init (&destPR, GIMP_DRAWABLE(mask)->tiles,
0, 0,
GIMP_DRAWABLE(mask)->width, GIMP_DRAWABLE(mask)->height,
TRUE);
color_region (&destPR, &empty);
x1 = CLAMP (GIMP_DRAWABLE(layer)->offset_x, 0, GIMP_DRAWABLE(mask)->width);
y1 = CLAMP (GIMP_DRAWABLE(layer)->offset_y, 0, GIMP_DRAWABLE(mask)->height);
x2 = CLAMP (GIMP_DRAWABLE(layer)->offset_x + GIMP_DRAWABLE(layer)->width,
0, GIMP_DRAWABLE(mask)->width);
y2 = CLAMP (GIMP_DRAWABLE(layer)->offset_y + GIMP_DRAWABLE(layer)->height,
0, GIMP_DRAWABLE(mask)->height);
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer->mask)->tiles,
(x1 - GIMP_DRAWABLE(layer)->offset_x),
(y1 - GIMP_DRAWABLE(layer)->offset_y),
(x2 - x1), (y2 - y1),
FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE(mask)->tiles,
x1, y1,
(x2 - x1), (y2 - y1),
TRUE);
copy_region (&srcPR, &destPR);
mask->bounds_known = FALSE;
......
......@@ -127,8 +127,6 @@ TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
void channel_invalidate_previews (GimpImage *gimage);
Tattoo channel_get_tattoo (const Channel *channel);
void channel_set_tattoo (Channel *channel,
Tattoo value);
......@@ -215,6 +213,11 @@ void channel_translate (Channel *mask,
void channel_load (Channel *mask,
Channel *channel);
void channel_layer_alpha (Channel *mask,
GimpLayer *layer);
void channel_layer_mask (Channel *mask,
GimpLayer *layer);
void channel_invalidate_bounds (Channel *channel);
......
......@@ -546,24 +546,6 @@ channel_preview_private (Channel *channel,
}
}
void
channel_invalidate_previews (GimpImage *gimage)
{
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
tmp = gimage->channels;
while (tmp)
{
channel = (Channel *) tmp->data;
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
tmp = g_slist_next (tmp);
}
}
Tattoo
channel_get_tattoo (const Channel *channel)
{
......@@ -1674,8 +1656,31 @@ channel_translate (Channel *mask,
}
void
channel_layer_alpha (Channel *mask,
Layer *layer)
channel_load (Channel *mask,
Channel *channel)
{
PixelRegion srcPR, destPR;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
/* copy the channel to the mask */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE (mask)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, TRUE);
copy_region (&srcPR, &destPR);
mask->bounds_known = FALSE;
}
void
channel_layer_alpha (Channel *mask,
GimpLayer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
......@@ -1710,23 +1715,39 @@ channel_layer_alpha (Channel *mask,
}
void
channel_load (Channel *mask,
Channel *channel)
channel_layer_mask (Channel *mask,
GimpLayer *layer)
{
PixelRegion srcPR, destPR;
guchar empty = 0;
gint x1, y1, x2, y2;
/* push the current mask onto the undo stack */
channel_push_undo (mask);
/* copy the channel to the mask */
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE (mask)->tiles,
0, 0,
GIMP_DRAWABLE (channel)->width,
GIMP_DRAWABLE (channel)->height, TRUE);
/* clear the mask */
pixel_region_init (&destPR, GIMP_DRAWABLE(mask)->tiles,
0, 0,
GIMP_DRAWABLE(mask)->width, GIMP_DRAWABLE(mask)->height,
TRUE);
color_region (&destPR, &empty);
x1 = CLAMP (GIMP_DRAWABLE(layer)->offset_x, 0, GIMP_DRAWABLE(mask)->width);
y1 = CLAMP (GIMP_DRAWABLE(layer)->offset_y, 0, GIMP_DRAWABLE(mask)->height);
x2 = CLAMP (GIMP_DRAWABLE(layer)->offset_x + GIMP_DRAWABLE(layer)->width,
0, GIMP_DRAWABLE(mask)->width);
y2 = CLAMP (GIMP_DRAWABLE(layer)->offset_y + GIMP_DRAWABLE(layer)->height,
0, GIMP_DRAWABLE(mask)->height);
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer->mask)->tiles,
(x1 - GIMP_DRAWABLE(layer)->offset_x),
(y1 - GIMP_DRAWABLE(layer)->offset_y),
(x2 - x1), (y2 - y1),
FALSE);
pixel_region_init (&destPR, GIMP_DRAWABLE(mask)->tiles,
x1, y1,
(x2 - x1), (y2 - y1),
TRUE);
copy_region (&srcPR, &destPR);
mask->bounds_known = FALSE;
......
......@@ -127,8 +127,6 @@ TempBuf * channel_preview (Channel *channel,
gint width,
gint height);
void channel_invalidate_previews (GimpImage *gimage);
Tattoo channel_get_tattoo (const Channel *channel);
void channel_set_tattoo (Channel *channel,
Tattoo value);
......@@ -215,6 +213,11 @@ void channel_translate (Channel *mask,
void channel_load (Channel *mask,
Channel *channel);
void channel_layer_alpha (Channel *mask,
GimpLayer *layer);
void channel_layer_mask (Channel *mask,
GimpLayer *layer);
void channel_invalidate_bounds (Channel *channel);
......
......@@ -29,6 +29,7 @@
#include "apptypes.h"
#include "apptypes.h"
#include "channel.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
......
......@@ -34,6 +34,7 @@
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimplayermask.h"
#include "global_edit.h"
#include "layer.h"
#include "paint_funcs.h"
......
......@@ -1457,7 +1457,7 @@ convert_image (GImage *gimage,
undo_push_group_end (gimage);
/* shrink wrap and update all views */
layer_invalidate_previews (gimage);
gimp_image_invalidate_layer_previews (gimage);
gimp_image_invalidate_preview (gimage);
gdisplays_update_title (gimage);
gdisplays_update_full (gimage);
......
......@@ -29,6 +29,7 @@
#include "apptypes.h"
#include "apptypes.h"
#include "channel.h"
#include "channel_ops.h"
#include "cursorutil.h"
#include "drawable.h"
......
......@@ -35,6 +35,7 @@
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimplayermask.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "gimpparasite.h"
......@@ -2099,6 +2100,40 @@ gimp_image_validate (TileManager *tm,
gimp_image_construct (gimage, x, y, w, h);
}
void
gimp_image_invalidate_layer_previews (GimpImage *gimage)
{
GSList *tmp;
GimpLayer *layer;
g_return_if_fail (gimage != NULL);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (tmp = gimage->layers; tmp; tmp = g_slist_next (tmp))
{
layer = (Layer *) tmp->data;
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (layer), TRUE);
}
}
void
gimp_image_invalidate_channel_previews (GimpImage *gimage)
{
GSList *tmp;
Channel *channel;
g_return_if_fail (gimage != NULL);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (tmp = gimage->channels; tmp; tmp = g_slist_next (tmp))
{
channel = (Channel *) tmp->data;
gimp_drawable_invalidate_preview (GIMP_DRAWABLE (channel), TRUE);
}
}
gint
gimp_image_get_layer_index (const GimpImage *gimage,
const Layer *layer_arg)
......@@ -3222,10 +3257,10 @@ gimp_image_remove_layer (GimpImage *gimage,
return NULL;
}
LayerMask *
gimp_image_add_layer_mask (GimpImage *gimage,
Layer *layer,
LayerMask *mask)
GimpLayerMask *
gimp_image_add_layer_mask (GimpImage *gimage,
GimpLayer *layer,
GimpLayerMask *mask)
{
LayerMaskUndo *lmu;
......@@ -3258,7 +3293,7 @@ gimp_image_add_layer_mask (GimpImage *gimage,
return NULL;
}
layer_add_mask (layer, mask);
gimp_layer_add_mask (layer, mask);