Commit f0372cad authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Treat changes to the selection like changes to any other drawable:

2003-10-06  Michael Natterer  <mitch@gimp.org>

	Treat changes to the selection like changes to any other drawable:

	* app/core/gimpchannel.c
	* app/core/gimpchannel-combine.c: call gimp_drawable_update() after
	changing the channel.

	* app/core/gimpimage.[ch]: added struct GimpImageFlushAccumulator
	with one member "gboolean mask_changed". Connect to "update" of
	the selection and set accum.mask_changed to TRUE in the callback.
	Added default implementation for GimpImage::flush() and emit
	"mask_changed" there.

	Unrelated:
	* app/core/gimpimage.h: removed GimpGuide struct...
	* app/core/gimpimage-guides.h: ...and added it here.

	* app/core/gimpimage-undo-push.c (undo_pop_mask)
	(undo_pop_channel_mod): don't distinguish between selection and
	non-selection channels and just call gimp_drawable_update().

	* app/core/gimpundo.h
	* app/core/gimpimage-undo.c: removed "gboolean mask_changed" from
	the GimpUndoAccumulator struct since we don't have to care about
	that signal explicitly any more.

	* app/display/gimpdisplay-foreach.[ch]: removed gimp_displays_flush().

	* tools/pdbgen/pdb/display.pdb (displays_flush_invoker): call
	gimp_image_flush() on all images so the flush accumulator is
	honored.

	This generalization enables the removal of more special purpose
	code which was needed to treat the selection different:

	* app/core/gimpimage-mask-select.[ch]: removed...

	* app/core/gimpchannel-select.[ch]: ...and added under a new name
	because it's not selection specific any more.

	* app/core/gimpimage-mask.[ch]: removed...

	* app/core/gimpselection.[ch]: ...added the two remaining
	functions here. Removed all calls to gimp_image_mask_changed().

	* app/core/Makefile.am
	* app/core/gimp-edit.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpimage-scale.c
	* app/core/gimpimage-snap.c
	* app/display/gimpdisplayshell.c
	* app/gui/channels-commands.c
	* app/gui/layers-commands.c
	* app/gui/select-commands.c
	* app/gui/vectors-commands.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpellipseselecttool.c
	* app/tools/gimpfreeselecttool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimprectselecttool.c
	* app/tools/gimptransformtool.c
	* app/widgets/gimpchanneltreeview.c
	* app/widgets/gimpselectioneditor.c
	* app/widgets/gimpvectorstreeview.c
	* app/xcf/xcf-save.c
	* tools/pdbgen/pdb/paths.pdb
	* tools/pdbgen/pdb/selection.pdb
	* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly.

	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpimage-colormap.c
	* app/core/gimplayer-floating-sel.c
	* app/core/gimplayer.c
	* app/gui/image-menu.c
	* app/paint/gimppaintcore.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpinkoptions.c
	* app/tools/gimpvectortool.c: removed useless and/or obsolete
	#includes.

	* app/pdb/display_cmds.c
	* app/pdb/paths_cmds.c
	* app/pdb/selection_cmds.c
	* app/pdb/selection_tools_cmds.c: regenerated.
parent 3ee37d40
2003-10-06 Michael Natterer <mitch@gimp.org>
Treat changes to the selection like changes to any other drawable:
* app/core/gimpchannel.c
* app/core/gimpchannel-combine.c: call gimp_drawable_update() after
changing the channel.
* app/core/gimpimage.[ch]: added struct GimpImageFlushAccumulator
with one member "gboolean mask_changed". Connect to "update" of
the selection and set accum.mask_changed to TRUE in the callback.
Added default implementation for GimpImage::flush() and emit
"mask_changed" there.
Unrelated:
* app/core/gimpimage.h: removed GimpGuide struct...
* app/core/gimpimage-guides.h: ...and added it here.
* app/core/gimpimage-undo-push.c (undo_pop_mask)
(undo_pop_channel_mod): don't distinguish between selection and
non-selection channels and just call gimp_drawable_update().
* app/core/gimpundo.h
* app/core/gimpimage-undo.c: removed "gboolean mask_changed" from
the GimpUndoAccumulator struct since we don't have to care about
that signal explicitly any more.
* app/display/gimpdisplay-foreach.[ch]: removed gimp_displays_flush().
* tools/pdbgen/pdb/display.pdb (displays_flush_invoker): call
gimp_image_flush() on all images so the flush accumulator is
honored.
This generalization enables the removal of more special purpose
code which was needed to treat the selection different:
* app/core/gimpimage-mask-select.[ch]: removed...
* app/core/gimpchannel-select.[ch]: ...and added under a new name
because it's not selection specific any more.
* app/core/gimpimage-mask.[ch]: removed...
* app/core/gimpselection.[ch]: ...added the two remaining
functions here. Removed all calls to gimp_image_mask_changed().
* app/core/Makefile.am
* app/core/gimp-edit.c
* app/core/gimpdrawable-transform.c
* app/core/gimpimage-scale.c
* app/core/gimpimage-snap.c
* app/display/gimpdisplayshell.c
* app/gui/channels-commands.c
* app/gui/layers-commands.c
* app/gui/select-commands.c
* app/gui/vectors-commands.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpellipseselecttool.c
* app/tools/gimpfreeselecttool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimprectselecttool.c
* app/tools/gimptransformtool.c
* app/widgets/gimpchanneltreeview.c
* app/widgets/gimpselectioneditor.c
* app/widgets/gimpvectorstreeview.c
* app/xcf/xcf-save.c
* tools/pdbgen/pdb/paths.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/selection_tools.pdb: changed accordingly.
* app/core/gimpdrawable-bucket-fill.c
* app/core/gimpimage-colormap.c
* app/core/gimplayer-floating-sel.c
* app/core/gimplayer.c
* app/gui/image-menu.c
* app/paint/gimppaintcore.c
* app/tools/gimpcroptool.c
* app/tools/gimpinkoptions.c
* app/tools/gimpvectortool.c: removed useless and/or obsolete
#includes.
* app/pdb/display_cmds.c
* app/pdb/paths_cmds.c
* app/pdb/selection_cmds.c
* app/pdb/selection_tools_cmds.c: regenerated.
2003-10-06 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c: guard callbacks
......@@ -29,11 +29,10 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-mask-select.h"
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpcomponenteditor.h"
......@@ -195,17 +194,18 @@ channels_to_selection_cmd_callback (GtkWidget *widget,
component = GIMP_COMPONENT_EDITOR (data)->clicked_component;
gimp_image_mask_select_component (gimage, component,
op, FALSE, 0.0, 0.0);
gimp_channel_select_component (gimp_image_get_mask (gimage), component,
op, FALSE, 0.0, 0.0);
}
else
{
GimpChannel *channel;
return_if_no_channel (gimage, channel, data);
gimp_image_mask_select_channel (gimage, _("Channel to Selection"),
channel, 0, 0,
op, FALSE, 0.0, 0.0);
gimp_channel_select_channel (gimp_image_get_mask (gimage),
_("Channel to Selection"),
channel, 0, 0,
op, FALSE, 0.0, 0.0);
}
gimp_image_flush (gimage);
......
......@@ -29,9 +29,9 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask-select.h"
#include "core/gimpimage-merge.h"
#include "core/gimpimage-undo.h"
#include "core/gimplayer.h"
......@@ -428,11 +428,11 @@ layers_mask_to_selection_cmd_callback (GtkWidget *widget,
gimp_item_offsets (GIMP_ITEM (mask), &off_x, &off_y);
gimp_image_mask_select_channel (gimage,
_("Layer Mask to Selection"),
GIMP_CHANNEL (mask),
off_x, off_y,
op, FALSE, 0.0, 0.0);
gimp_channel_select_channel (gimp_image_get_mask (gimage),
_("Layer Mask to Selection"),
GIMP_CHANNEL (mask),
off_x, off_y,
op, FALSE, 0.0, 0.0);
gimp_image_flush (gimage);
}
}
......@@ -466,8 +466,8 @@ layers_alpha_to_selection_cmd_callback (GtkWidget *widget,
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (active_layer)))
{
gimp_image_mask_select_alpha (gimage, active_layer,
op, FALSE, 0.0, 0.0);
gimp_channel_select_alpha (gimp_image_get_mask (gimage), active_layer,
op, FALSE, 0.0, 0.0);
gimp_image_flush (gimage);
}
}
......
......@@ -29,7 +29,6 @@
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-qmask.h"
#include "core/gimpselection.h"
......@@ -135,8 +134,9 @@ select_float_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
return_if_no_image (gimage, data);
gimp_image_mask_float (gimage, gimp_image_active_drawable (gimage),
TRUE, 0, 0);
gimp_selection_float (gimp_image_get_mask (gimage),
gimp_image_active_drawable (gimage),
TRUE, 0, 0);
gimp_image_flush (gimage);
}
......
......@@ -28,11 +28,10 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpimage-mask-select.h"
#include "core/gimptoolinfo.h"
#include "pdb/procedural_db.h"
......@@ -160,12 +159,10 @@ vectors_to_selection_cmd_callback (GtkWidget *widget,
op = (GimpChannelOps) action;
gimp_image_mask_select_vectors (gimage,
_("Path to Selection"),
active_vectors,
op,
TRUE,
FALSE, 0, 0);
gimp_channel_select_vectors (gimp_image_get_mask (gimage),
_("Path to Selection"),
active_vectors,
op, TRUE, FALSE, 0, 0);
gimp_image_flush (gimage);
}
......
......@@ -53,6 +53,8 @@ libappcore_a_sources = \
gimpchannel.h \
gimpchannel-combine.c \
gimpchannel-combine.h \
gimpchannel-select.c \
gimpchannel-select.h \
gimpcontainer.c \
gimpcontainer.h \
gimpcontainer-filter.c \
......@@ -117,10 +119,6 @@ libappcore_a_sources = \
gimpimage-grid.c \
gimpimage-guides.c \
gimpimage-guides.h \
gimpimage-mask.c \
gimpimage-mask.h \
gimpimage-mask-select.c \
gimpimage-mask-select.h \
gimpimage-merge.c \
gimpimage-merge.h \
gimpimage-new.c \
......
......@@ -36,11 +36,11 @@
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h"
#include "gimpselection.h"
#include "gimp-intl.h"
......@@ -63,7 +63,8 @@ gimp_edit_cut (GimpImage *gimage,
empty = gimp_channel_is_empty (gimp_image_get_mask (gimage));
/* Next, cut the mask portion from the gimage */
tiles = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, TRUE, FALSE, TRUE);
if (tiles)
gimage->gimp->have_current_cut_buffer = TRUE;
......@@ -120,7 +121,8 @@ gimp_edit_copy (GimpImage *gimage,
empty = gimp_channel_is_empty (gimp_image_get_mask (gimage));
/* First, copy the masked portion of the gimage */
tiles = gimp_image_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, FALSE, FALSE, TRUE);
if (tiles)
gimage->gimp->have_current_cut_buffer = TRUE;
......
......@@ -40,11 +40,11 @@
#include "gimpdrawable.h"
#include "gimpdrawable-transform.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimpselection.h"
#include "gimp-intl.h"
......@@ -74,22 +74,22 @@ static void sample_adapt (TileManager *tm,
gint level,
guchar *color,
guchar *bg_color,
gint bpp,
gint bpp,
gint alpha);
static void
sample_cubic (PixelSurround *surround,
gdouble u,
gdouble v,
static void
sample_cubic (PixelSurround *surround,
gdouble u,
gdouble v,
guchar *color,
gint bytes,
gint bytes,
gint alpha);
static void
sample_linear(PixelSurround *surround,
static void
sample_linear(PixelSurround *surround,
gdouble u,
gdouble v,
gdouble v,
guchar *color,
gint bytes,
gint alpha);
......@@ -117,10 +117,10 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
gint x1, y1, x2, y2; /* target bounding box */
gint x, y; /* target coordinates */
gint u1, v1, u2, v2; /* source bounding box */
gdouble uinc, vinc, winc; /* increments in source coordinates
gdouble uinc, vinc, winc; /* increments in source coordinates
pr horizontal target coordinate */
gdouble u[5],v[5]; /* source coordinates,
gdouble u[5],v[5]; /* source coordinates,
2
/ \ 0 is sample in the centre of pixel
1 0 3 1..4 is offset 1 pixel in each
......@@ -368,7 +368,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
for (b = 0; b < bytes; b++)
*d++ = bg_color[b];
}
else
else
{
guchar color[MAX_CHANNELS];
......@@ -415,7 +415,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
/* set the pixel region row */
pixel_region_set_row (&destPR, 0, (y - y1), width, dest);
}
if (interpolation_type != GIMP_INTERPOLATION_NONE)
pixel_surround_clear (&surround);
......@@ -529,7 +529,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
pixel_region_init (&destPR, new_tiles,
new_x + new_width - i - 1, new_y,
1, new_height, TRUE);
copy_region (&srcPR, &destPR);
copy_region (&srcPR, &destPR);
}
}
else
......@@ -650,7 +650,7 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
if (clip_result && (new_x != orig_x || new_y != orig_y ||
new_width != orig_width || new_height != orig_height))
{
guchar bg_color[MAX_CHANNELS];
gint clip_x, clip_y;
......@@ -758,19 +758,19 @@ gimp_drawable_transform_tiles_rotate (GimpDrawable *drawable,
break;
case GIMP_ROTATE_180:
g_assert (new_width == orig_width);
g_assert (new_width == orig_width);
buf = g_new (guchar, new_width * orig_bpp);
for (i = 0; i < orig_height; i++)
{
pixel_region_get_row (&srcPR, orig_x, orig_y + orig_height - 1 - i,
orig_width, buf, 1);
for (j = 0; j < orig_width / 2; j++)
{
guchar *left = buf + j * orig_bpp;
guchar *right = buf + (orig_width - 1 - j) * orig_bpp;
for (k = 0; k < orig_bpp; k++)
{
guchar tmp = left[k];
......@@ -840,7 +840,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
orig_tiles,
matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
interpolation_type,
FALSE,
NULL, NULL);
......@@ -1007,16 +1007,19 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
* gimp_layer_new_from_tiles() later which assumes that the tiles
* are either RGB or GRAY. Eeek!!! (Sven)
*/
tiles = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, TRUE, FALSE, TRUE);
*new_layer = TRUE;
}
else /* otherwise, just copy the layer */
{
if (GIMP_IS_LAYER (drawable))
tiles = gimp_image_mask_extract (gimage, drawable, FALSE, TRUE, TRUE);
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, FALSE, TRUE, TRUE);
else
tiles = gimp_image_mask_extract (gimage, drawable, FALSE, TRUE, FALSE);
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, FALSE, TRUE, FALSE);
*new_layer = FALSE;
}
......@@ -1056,7 +1059,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
return FALSE;
}
tile_manager_get_offsets (tiles,
tile_manager_get_offsets (tiles,
&GIMP_ITEM (layer)->offset_x,
&GIMP_ITEM (layer)->offset_y);
......@@ -1112,7 +1115,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
/* Fill in the new layer's attributes */
GIMP_ITEM (drawable)->width = tile_manager_width (tiles);
GIMP_ITEM (drawable)->height = tile_manager_height (tiles);
tile_manager_get_offsets (tiles,
tile_manager_get_offsets (tiles,
&GIMP_ITEM (drawable)->offset_x,
&GIMP_ITEM (drawable)->offset_y);
......@@ -1126,7 +1129,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
gimp_item_width (GIMP_ITEM (drawable)),
gimp_item_height (GIMP_ITEM (drawable)));
/* if we were operating on the floating selection, then it's boundary
/* if we were operating on the floating selection, then it's boundary
* and previews need invalidating
*/
if (drawable == (GimpDrawable *) floating_layer)
......@@ -1145,10 +1148,10 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
* We need the two pixel coords around them:
* iu to iu + 1, iv to iv + 1
*/
static void
sample_linear (PixelSurround *surround,
static void
sample_linear (PixelSurround *surround,
gdouble u,
gdouble v,
gdouble v,
guchar *color,
gint bytes,
gint alpha)
......@@ -1173,7 +1176,7 @@ sample_linear (PixelSurround *surround,
/* calculate alpha value of result pixel */
alphachan = &data[alpha];
a_val = BILINEAR (alphachan[0], alphachan[bytes],
a_val = BILINEAR (alphachan[0], alphachan[bytes],
alphachan[row], alphachan[row+bytes], du, dv);
if (a_val <= 0.0)
{
......@@ -1215,7 +1218,7 @@ sample_linear (PixelSurround *surround,
/*
bilinear interpolation of a 16.16 pixel
*/
static void
static void
sample_bi (TileManager *tm,
gint x,
gint y,
......@@ -1228,7 +1231,7 @@ sample_bi (TileManager *tm,
gint i;
gint xscale = (x & 65535);
gint yscale = (y & 65535);
gint x0 = x >> 16;
gint y0 = y >> 16;
gint x1 = x0 + 1;
......@@ -1238,14 +1241,14 @@ sample_bi (TileManager *tm,
/* fill the color with default values, since read_pixel_data_1
* does nothing, when accesses are out of bounds.
*/
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++)
*(guint*) (&C[i]) = *(guint*) (bg_color);
read_pixel_data_1 (tm, x0, y0, C[0]);
read_pixel_data_1 (tm, x1, y0, C[2]);
read_pixel_data_1 (tm, x0, y1, C[1]);
read_pixel_data_1 (tm, x1, y1, C[3]);
#define lerp(v1,v2,r) \
(((guint)(v1) * (65536 - (guint)(r)) + (guint)(v2)*(guint)(r)) / 65536)
......@@ -1268,17 +1271,17 @@ sample_bi (TileManager *tm,
}
else
{
for (i = 0; i < alpha; i++)
for (i = 0; i < alpha; i++)
color[i] = 0;
}
#undef lerp
}
/*
/*
* Returns TRUE if one of the deltas of the
* quad edge is > 1.0 (16.16 fixed values).
*/
static gboolean
static gboolean
supersample_test (gint x0, gint y0,
gint x1, gint y1,
gint x2, gint y2,
......@@ -1288,7 +1291,7 @@ supersample_test (gint x0, gint y0,
if (abs (x1 - x2) > 65535) return TRUE;
if (abs (x2 - x3) > 65535) return TRUE;
if (abs (x3 - x0) > 65535) return TRUE;
if (abs (y0 - y1) > 65535) return TRUE;
if (abs (y1 - y2) > 65535) return TRUE;
if (abs (y2 - y3) > 65535) return TRUE;
......@@ -1297,11 +1300,11 @@ supersample_test (gint x0, gint y0,
return FALSE;
}
/*
/*
* Returns TRUE if one of the deltas of the
* quad edge is > 1.0 (double values).
*/
static gboolean
static gboolean
supersample_dtest (gdouble x0, gdouble y0,
gdouble x1, gdouble y1,
gdouble x2, gdouble y2,
......@@ -1311,7 +1314,7 @@ supersample_dtest (gdouble x0, gdouble y0,
if (fabs (x1 - x2) > 1.0) return TRUE;
if (fabs (x2 - x3) > 1.0) return TRUE;
if (fabs (x3 - x0) > 1.0) return TRUE;
if (fabs (y0 - y1) > 1.0) return TRUE;
if (fabs (y1 - y2) > 1.0) return TRUE;
if (fabs (y2 - y3) > 1.0) return TRUE;
......@@ -1343,7 +1346,7 @@ get_sample (TileManager *tm,
{
gint i;
guchar C[4];
sample_bi (tm, xc, yc, C, bg_color, bpp, alpha);
for (i = 0; i < bpp; i++)
......@@ -1351,13 +1354,13 @@ get_sample (TileManager *tm,
(*cc)++; /* increase number of samples taken */
}
else
else
{
gint tx, lx, rx, bx, tlx, trx, blx, brx;
gint ty, ly, ry, by, tly, try, bly, bry;
/* calculate subdivided corner coordinates (including centercoords
thus using a bilinear interpolation,. almost as good as
thus using a bilinear interpolation,. almost as good as
doing the perspective transform for each subpixel coordinate*/
tx = (x0 + x1) / 2;
......@@ -1379,7 +1382,7 @@ get_sample (TileManager *tm,
by = (y3 + y2) / 2;
get_sample (tm,
tlx,tly,
tlx,tly,
x0,y0, tx,ty, xc,yc, lx,ly,
cc, level-1, color, bg_color, bpp, alpha);
......@@ -1400,7 +1403,7 @@ get_sample (TileManager *tm,
}
}
static void
static void
sample_adapt (TileManager *tm,
gdouble xc, gdouble yc,
gdouble x0, gdouble y0,
......@@ -1493,10 +1496,10 @@ gimp_drawable_transform_cubic (gdouble dx,
* We need the four integer pixel coords around them:
* iu to iu + 3, iv to iv + 3
*/
static void
sample_cubic (PixelSurround *surround,
static void
sample_cubic (PixelSurround *surround,
gdouble u,
gdouble v,
gdouble v,
guchar *color,
gint bytes,
gint alpha)
......
......@@ -144,11 +144,14 @@ gimp_channel_combine_rect (GimpChannel *mask,
x2 = CLAMP (x2, 0, GIMP_ITEM (mask)->width);
y2 = CLAMP (y2, 0, GIMP_ITEM (mask)->height);
if (x2 - x <= 0 || y2 - y <= 0)
w = x2 - x;
h = y2 - y;
if (w <= 0 || h <= 0)
return;
pixel_region_init (&maskPR, GIMP_DRAWABLE (mask)->tiles,
x, y, x2 - x, y2 - y, TRUE);
x, y, w, h, TRUE);
if (op == GIMP_CHANNEL_OP_ADD || op == GIMP_CHANNEL_OP_REPLACE)
color = OPAQUE_OPACITY;
......@@ -184,6 +187,8 @@ gimp_channel_combine_rect (GimpChannel *mask,
mask->y1 = CLAMP (mask->y1, 0, GIMP_ITEM (mask)->height);
mask->x2 = CLAMP (mask->x2, 0, GIMP_ITEM (mask)->width);
mask->y2 = CLAMP (mask->y2, 0, GIMP_ITEM (mask)->height);
gimp_drawable_update (GIMP_DRAWABLE (mask), x, y, w, h);
}
void
......@@ -355,6 +360,8 @@ gimp_channel_combine_ellipse (GimpChannel *mask,
mask->y1 = CLAMP (mask->y1, 0, GIMP_ITEM (mask)->height);
mask->x2 = CLAMP (mask->x2, 0, GIMP_ITEM (mask)->width);
mask->y2 = CLAMP (mask->y2, 0, GIMP_ITEM (mask)->height);
gimp_drawable_update (GIMP_DRAWABLE (mask), x, y, w, h);
}
static void
......@@ -487,4 +494,6 @@ gimp_channel_combine_mask (GimpChannel *mask,
}
mask->bounds_known = FALSE;
gimp_drawable_update (GIMP_DRAWABLE (mask), x1, y2, w, h);
}
This diff is collapsed.
......@@ -16,98 +16,98 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_IMAGE_MASK_SELECT_H__
#define __GIMP_IMAGE_MASK_SELECT_H__
#ifndef __GIMP_CHANNEL_SELECT_H__
#define __GIMP_CHANNEL_SELECT_H__
void gimp_image_mask_select_rectangle (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_channel_select_rectangle (GimpChannel *channel,
gint x,
gint y,
gint w,
gint h,
GimpChannelOps op,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_image_mask_select_ellipse (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_channel_select_ellipse (GimpChannel *channel,
gint x,
gint y,
gint w,
gint h,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_image_mask_select_polygon (GimpImage *gimage,
const gchar *undo_desc,
gint n_points,
GimpVector2 *points,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_channel_select_polygon (GimpChannel *channel,
const gchar *undo_desc,
gint n_points,
GimpVector2 *points,
GimpChannelOps op,
gboolean antialias,
gboolean feather,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimp_image_mask_select_vectors (GimpImage *gimage,
const gchar *undo_desc,
GimpVectors *vectors,