export bucket_fill_region().

1999-08-23  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/bucket_fill.[ch]: export bucket_fill_region().

	* app/channels_dialog.c: enabled dropping a color to a channel.

	* app/color_area.c
	* app/color_panel.c
	* app/gimpdnd.[ch]: the whole color dnd is now done in a generic
	function in gimpdnd.c (dnd of other types is still hacked in at
	various places but will go to generic functions and callbacks as
	well).

	* app/disp_callbacks.[ch]
	* app/interface.c: drop a color to the display to bucket fill the
	selected region.
This commit is contained in:
Michael Natterer
1999-08-23 14:19:26 +00:00
committed by Michael Natterer
parent 5f2d497b40
commit ef4cb06bb7
28 changed files with 1225 additions and 1003 deletions

View File

@ -18,6 +18,7 @@
#include <stdlib.h>
#include "gdk/gdkkeysyms.h"
#include "appenv.h"
#include "bucket_fill.h"
#include "colormaps.h"
#include "cursorutil.h"
#include "devices.h"
@ -751,3 +752,61 @@ gdisplay_drag_drop (GtkWidget *widget,
return return_val;
}
void
gdisplay_set_color (gpointer data,
guchar r,
guchar g,
guchar b)
{
GimpImage *gimage;
GimpDrawable *drawable;
TileManager *buf_tiles;
PixelRegion bufPR;
GimpContext *context;
gint x1, x2, y1, y2;
gint bytes;
gboolean has_alpha;
guchar col[3];
gimage = ((GDisplay *) data)->gimage;
drawable = gimage_active_drawable (gimage);
gimp_add_busy_cursors ();
/* Get the fill parameters */
if (gimp_context_get_current () == gimp_context_get_user () &&
! global_paint_options)
context = tool_info[BUCKET_FILL].tool_context;
else
context = gimp_context_get_current ();
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
bytes = drawable_bytes (drawable);
has_alpha = drawable_has_alpha (drawable);
col[0] = r;
col[1] = g;
col[2] = b;
/* Fill the region */
buf_tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes);
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
bucket_fill_region (FG_BUCKET_FILL, &bufPR, NULL,
col, NULL, x1, y1, has_alpha);
/* Apply it to the image */
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
gimage_apply_image (gimage, drawable, &bufPR, TRUE,
gimp_context_get_opacity (context) * 255,
gimp_context_get_paint_mode (context),
NULL, x1, y1);
tile_manager_destroy (buf_tiles);
/* Update the displays */
drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
gdisplays_flush ();
gimp_remove_busy_cursors (NULL);
}