1997-11-25 06:05:25 +08:00
/* 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
1998-04-13 13:44:11 +08:00
* Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
1997-11-25 06:05:25 +08:00
*/
# include <stdlib.h>
# include "appenv.h"
# include "brush_select.h"
# include "bucket_fill.h"
1999-01-11 07:36:29 +08:00
# include "cursorutil.h"
1997-11-25 06:05:25 +08:00
# include "drawable.h"
# include "fuzzy_select.h"
# include "gdisplay.h"
# include "gimage_mask.h"
# include "interface.h"
# include "paint_funcs.h"
# include "palette.h"
# include "patterns.h"
# include "selection.h"
1999-04-13 01:55:06 +08:00
# include "tool_options_ui.h"
1997-11-25 06:05:25 +08:00
# include "tools.h"
# include "undo.h"
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
# include "libgimp/gimpintl.h"
1999-04-09 06:25:54 +08:00
/* the bucket fill structures */
1997-11-25 06:05:25 +08:00
typedef struct _BucketTool BucketTool ;
struct _BucketTool
{
int target_x ; /* starting x coord */
int target_y ; /* starting y coord */
} ;
1999-04-09 06:25:54 +08:00
typedef struct _BucketOptions BucketOptions ;
struct _BucketOptions
{
1999-04-13 01:55:06 +08:00
ToolOptions tool_options ;
1999-04-09 06:25:54 +08:00
1999-04-13 01:55:06 +08:00
double opacity ;
double opacity_d ;
GtkObject * opacity_w ;
1999-04-09 06:25:54 +08:00
1999-04-13 01:55:06 +08:00
int paint_mode ;
int paint_mode_d ;
GtkWidget * paint_mode_w ;
1999-04-09 06:25:54 +08:00
1999-04-13 01:55:06 +08:00
double threshold ;
double threshold_d ;
GtkObject * threshold_w ;
1999-04-09 06:25:54 +08:00
1999-04-13 01:55:06 +08:00
FillMode fill_mode ;
FillMode fill_mode_d ;
GtkWidget * fill_mode_w ;
int sample_merged ;
int sample_merged_d ;
GtkWidget * sample_merged_w ;
1999-04-09 06:25:54 +08:00
} ;
1999-04-13 01:55:06 +08:00
/* the bucket fill tool options */
1999-04-09 06:25:54 +08:00
static BucketOptions * bucket_options = NULL ;
1997-11-25 06:05:25 +08:00
/* local function prototypes */
static void bucket_fill_button_press ( Tool * , GdkEventButton * , gpointer ) ;
static void bucket_fill_button_release ( Tool * , GdkEventButton * , gpointer ) ;
static void bucket_fill_motion ( Tool * , GdkEventMotion * , gpointer ) ;
static void bucket_fill_cursor_update ( Tool * , GdkEventMotion * , gpointer ) ;
static void bucket_fill_control ( Tool * , int , gpointer ) ;
1999-04-13 01:55:06 +08:00
static void bucket_fill ( GImage * , GimpDrawable * , FillMode ,
int , double , double ,
int , double , double ) ;
1997-11-25 06:05:25 +08:00
static void bucket_fill_region ( FillMode , PixelRegion * , PixelRegion * ,
1999-04-13 01:55:06 +08:00
unsigned char * , TempBuf * ,
int , int , int ) ;
1997-11-25 06:05:25 +08:00
static void bucket_fill_line_color ( unsigned char * , unsigned char * ,
unsigned char * , int , int , int ) ;
static void bucket_fill_line_pattern ( unsigned char * , unsigned char * ,
TempBuf * , int , int , int , int , int ) ;
static Argument * bucket_fill_invoker ( Argument * ) ;
1999-04-09 06:25:54 +08:00
/* functions */
1997-11-25 06:05:25 +08:00
static void
1999-04-13 01:55:06 +08:00
bucket_fill_mode_callback ( GtkWidget * widget ,
1997-11-25 06:05:25 +08:00
gpointer client_data )
{
bucket_options - > fill_mode = ( FillMode ) client_data ;
}
static void
1999-04-13 01:55:06 +08:00
bucket_fill_paint_mode_callback ( GtkWidget * widget ,
1997-11-25 06:05:25 +08:00
gpointer client_data )
{
bucket_options - > paint_mode = ( long ) client_data ;
}
1999-04-09 06:25:54 +08:00
static void
1999-04-13 01:55:06 +08:00
bucket_options_reset ( void )
1999-04-09 06:25:54 +08:00
{
BucketOptions * options = bucket_options ;
options - > paint_mode = options - > paint_mode_d ;
1999-04-13 01:55:06 +08:00
gtk_adjustment_set_value ( GTK_ADJUSTMENT ( options - > opacity_w ) ,
options - > opacity_d ) ;
1999-04-09 06:25:54 +08:00
gtk_option_menu_set_history ( GTK_OPTION_MENU ( options - > paint_mode_w ) , 0 ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( options - > sample_merged_w ) ,
options - > sample_merged_d ) ;
gtk_adjustment_set_value ( GTK_ADJUSTMENT ( options - > threshold_w ) ,
options - > threshold_d ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( options - > fill_mode_w ) , TRUE ) ;
}
1997-11-25 06:05:25 +08:00
static BucketOptions *
1999-04-13 01:55:06 +08:00
bucket_options_new ( void )
1997-11-25 06:05:25 +08:00
{
BucketOptions * options ;
1999-04-13 01:55:06 +08:00
1997-11-25 06:05:25 +08:00
GtkWidget * vbox ;
1999-04-09 06:25:54 +08:00
GtkWidget * table ;
1999-04-13 01:55:06 +08:00
GtkWidget * hbox ;
GtkWidget * abox ;
1997-11-25 06:05:25 +08:00
GtkWidget * label ;
1999-04-09 06:25:54 +08:00
GtkWidget * scale ;
1997-11-25 06:05:25 +08:00
GtkWidget * menu ;
1999-04-09 06:25:54 +08:00
GSList * group = NULL ;
1997-11-25 06:05:25 +08:00
GtkWidget * radio_frame ;
GtkWidget * radio_box ;
GtkWidget * radio_button ;
1999-04-13 01:55:06 +08:00
GtkWidget * separator ;
1997-11-25 06:05:25 +08:00
int i ;
char * button_names [ 2 ] =
{
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
N_ ( " Color Fill " ) ,
N_ ( " Pattern Fill " )
1997-11-25 06:05:25 +08:00
} ;
1999-04-13 01:55:06 +08:00
/* the new bucket fill tool options structure */
1997-11-25 06:05:25 +08:00
options = ( BucketOptions * ) g_malloc ( sizeof ( BucketOptions ) ) ;
1999-04-13 01:55:06 +08:00
tool_options_init ( ( ToolOptions * ) options ,
_ ( " Bucket Fill Options " ) ,
bucket_options_reset ) ;
1999-04-09 06:25:54 +08:00
options - > opacity = options - > opacity_d = 100.0 ;
1999-04-13 01:55:06 +08:00
options - > paint_mode = options - > paint_mode_d = NORMAL ;
options - > sample_merged = options - > sample_merged_d = FALSE ;
1999-04-09 06:25:54 +08:00
options - > threshold = options - > threshold_d = 15.0 ;
options - > fill_mode = options - > fill_mode_d = FgColorFill ;
1997-11-25 06:05:25 +08:00
/* the main vbox */
1999-04-13 01:55:06 +08:00
vbox = options - > tool_options . main_vbox ;
1997-11-25 06:05:25 +08:00
/* the opacity scale */
1999-04-13 01:55:06 +08:00
table = gtk_table_new ( 2 , 2 , FALSE ) ;
1999-04-09 06:25:54 +08:00
gtk_table_set_col_spacing ( GTK_TABLE ( table ) , 0 , 6 ) ;
1999-04-13 01:55:06 +08:00
gtk_table_set_row_spacing ( GTK_TABLE ( table ) , 0 , 2 ) ;
1999-04-09 06:25:54 +08:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , table , FALSE , FALSE , 0 ) ;
label = gtk_label_new ( _ ( " Opacity: " ) ) ;
gtk_misc_set_alignment ( GTK_MISC ( label ) , 1.0 , 1.0 ) ;
gtk_table_attach ( GTK_TABLE ( table ) , label , 0 , 1 , 0 , 1 ,
GTK_SHRINK | GTK_FILL , GTK_SHRINK | GTK_FILL , 0 , 0 ) ;
1997-11-25 06:05:25 +08:00
gtk_widget_show ( label ) ;
1999-04-09 06:25:54 +08:00
options - > opacity_w =
gtk_adjustment_new ( options - > opacity_d , 0.0 , 100.0 , 1.0 , 1.0 , 0.0 ) ;
scale = gtk_hscale_new ( GTK_ADJUSTMENT ( options - > opacity_w ) ) ;
gtk_table_attach_defaults ( GTK_TABLE ( table ) , scale , 1 , 2 , 0 , 1 ) ;
gtk_scale_set_value_pos ( GTK_SCALE ( scale ) , GTK_POS_TOP ) ;
gtk_range_set_update_policy ( GTK_RANGE ( scale ) , GTK_UPDATE_DELAYED ) ;
gtk_signal_connect ( GTK_OBJECT ( options - > opacity_w ) , " value_changed " ,
1999-04-13 01:55:06 +08:00
( GtkSignalFunc ) tool_options_double_adjustment_update ,
1997-11-25 06:05:25 +08:00
& options - > opacity ) ;
1999-04-09 06:25:54 +08:00
gtk_widget_show ( scale ) ;
1997-11-25 06:05:25 +08:00
1999-04-13 01:55:06 +08:00
/* the paint mode menu */
label = gtk_label_new ( _ ( " Mode: " ) ) ;
gtk_misc_set_alignment ( GTK_MISC ( label ) , 1.0 , 0.5 ) ;
gtk_table_attach ( GTK_TABLE ( table ) , label , 0 , 1 , 1 , 2 ,
GTK_SHRINK | GTK_FILL , GTK_SHRINK | GTK_FILL , 0 , 0 ) ;
gtk_widget_show ( label ) ;
abox = gtk_alignment_new ( 0.0 , 0.5 , 0.0 , 0.0 ) ;
gtk_table_attach_defaults ( GTK_TABLE ( table ) , abox , 1 , 2 , 1 , 2 ) ;
gtk_widget_show ( abox ) ;
options - > paint_mode_w = gtk_option_menu_new ( ) ;
gtk_container_add ( GTK_CONTAINER ( abox ) , options - > paint_mode_w ) ;
gtk_widget_show ( options - > paint_mode_w ) ;
menu = create_paint_mode_menu ( bucket_fill_paint_mode_callback , NULL ) ;
gtk_option_menu_set_menu ( GTK_OPTION_MENU ( options - > paint_mode_w ) , menu ) ;
/* show the table */
gtk_widget_show ( table ) ;
/* a separator after the paint mode options */
separator = gtk_hseparator_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , separator , FALSE , FALSE , 0 ) ;
gtk_widget_show ( separator ) ;
1997-11-25 06:05:25 +08:00
/* the threshold scale */
1999-04-13 01:55:06 +08:00
hbox = gtk_hbox_new ( FALSE , 6 ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
1999-04-09 06:25:54 +08:00
label = gtk_label_new ( _ ( " Threshold: " ) ) ;
gtk_misc_set_alignment ( GTK_MISC ( label ) , 1.0 , 1.0 ) ;
1999-04-13 01:55:06 +08:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , label , FALSE , FALSE , 0 ) ;
1997-11-25 06:05:25 +08:00
gtk_widget_show ( label ) ;
1999-04-09 06:25:54 +08:00
options - > threshold_w =
gtk_adjustment_new ( options - > threshold_d , 1.0 , 255.0 , 1.0 , 1.0 , 0.0 ) ;
scale = gtk_hscale_new ( GTK_ADJUSTMENT ( options - > threshold_w ) ) ;
1999-04-13 01:55:06 +08:00
gtk_box_pack_start ( GTK_BOX ( hbox ) , scale , TRUE , TRUE , 0 ) ;
1999-04-09 06:25:54 +08:00
gtk_scale_set_value_pos ( GTK_SCALE ( scale ) , GTK_POS_TOP ) ;
gtk_range_set_update_policy ( GTK_RANGE ( scale ) , GTK_UPDATE_DELAYED ) ;
gtk_signal_connect ( GTK_OBJECT ( options - > threshold_w ) , " value_changed " ,
1999-04-13 01:55:06 +08:00
( GtkSignalFunc ) tool_options_double_adjustment_update ,
1997-11-25 06:05:25 +08:00
& options - > threshold ) ;
1999-04-09 06:25:54 +08:00
gtk_widget_show ( scale ) ;
1997-11-25 06:05:25 +08:00
1999-04-13 01:55:06 +08:00
gtk_widget_show ( hbox ) ;
1999-04-09 06:25:54 +08:00
1999-04-13 01:55:06 +08:00
/* the sample merged toggle */
options - > sample_merged_w =
gtk_check_button_new_with_label ( _ ( " Sample Merged " ) ) ;
gtk_signal_connect ( GTK_OBJECT ( options - > sample_merged_w ) , " toggled " ,
( GtkSignalFunc ) tool_options_toggle_update ,
& options - > sample_merged ) ;
gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( options - > sample_merged_w ) ,
options - > sample_merged_d ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , options - > sample_merged_w , FALSE , FALSE , 0 ) ;
gtk_widget_show ( options - > sample_merged_w ) ;
1997-11-25 06:05:25 +08:00
/* the radio frame and box */
1999-04-09 06:25:54 +08:00
radio_frame = gtk_frame_new ( _ ( " Fill Type " ) ) ;
1997-11-25 06:05:25 +08:00
gtk_box_pack_start ( GTK_BOX ( vbox ) , radio_frame , FALSE , FALSE , 0 ) ;
radio_box = gtk_vbox_new ( FALSE , 1 ) ;
1999-04-09 06:25:54 +08:00
gtk_container_set_border_width ( GTK_CONTAINER ( radio_box ) , 2 ) ;
1997-11-25 06:05:25 +08:00
gtk_container_add ( GTK_CONTAINER ( radio_frame ) , radio_box ) ;
/* the radio buttons */
for ( i = 0 ; i < 2 ; i + + )
{
1999-04-09 06:25:54 +08:00
radio_button =
gtk_radio_button_new_with_label ( group , gettext ( button_names [ i ] ) ) ;
1997-11-25 06:05:25 +08:00
group = gtk_radio_button_group ( GTK_RADIO_BUTTON ( radio_button ) ) ;
gtk_signal_connect ( GTK_OBJECT ( radio_button ) , " toggled " ,
( GtkSignalFunc ) bucket_fill_mode_callback ,
( gpointer ) ( ( long ) ( i = = 1 ? PatternFill : FgColorFill ) ) ) ; /* kludgy */
gtk_box_pack_start ( GTK_BOX ( radio_box ) , radio_button , FALSE , FALSE , 0 ) ;
gtk_widget_show ( radio_button ) ;
1999-04-09 06:25:54 +08:00
if ( i = = 0 )
options - > fill_mode_w = radio_button ;
1997-11-25 06:05:25 +08:00
}
gtk_widget_show ( radio_box ) ;
gtk_widget_show ( radio_frame ) ;
return options ;
}
1998-03-19 06:35:31 +08:00
static void
1999-04-09 06:25:54 +08:00
bucket_fill_button_press ( Tool * tool ,
GdkEventButton * bevent ,
gpointer gdisp_ptr )
1997-11-25 06:05:25 +08:00
{
GDisplay * gdisp ;
BucketTool * bucket_tool ;
int use_offsets ;
gdisp = ( GDisplay * ) gdisp_ptr ;
bucket_tool = ( BucketTool * ) tool - > private ;
use_offsets = ( bucket_options - > sample_merged ) ? FALSE : TRUE ;
gdisplay_untransform_coords ( gdisp , bevent - > x , bevent - > y ,
& bucket_tool - > target_x ,
& bucket_tool - > target_y , FALSE , use_offsets ) ;
/* Make the tool active and set the gdisplay which owns it */
gdk_pointer_grab ( gdisp - > canvas - > window , FALSE ,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK ,
NULL , NULL , bevent - > time ) ;
/* Make the tool active and set the gdisplay which owns it */
tool - > gdisp_ptr = gdisp_ptr ;
tool - > state = ACTIVE ;
}
1998-03-19 06:35:31 +08:00
static void
1999-04-09 06:25:54 +08:00
bucket_fill_button_release ( Tool * tool ,
GdkEventButton * bevent ,
gpointer gdisp_ptr )
1997-11-25 06:05:25 +08:00
{
GDisplay * gdisp ;
BucketTool * bucket_tool ;
FillMode fill_mode ;
Argument * return_vals ;
int nreturn_vals ;
gdisp = ( GDisplay * ) gdisp_ptr ;
bucket_tool = ( BucketTool * ) tool - > private ;
gdk_pointer_ungrab ( bevent - > time ) ;
gdk_flush ( ) ;
/* if the 3rd button isn't pressed, fill the selected region */
if ( ! ( bevent - > state & GDK_BUTTON3_MASK ) )
{
fill_mode = bucket_options - > fill_mode ;
/* If the mode is color filling, and shift mask is down, fill with background */
if ( bevent - > state & GDK_SHIFT_MASK & & fill_mode = = FgColorFill )
fill_mode = BgColorFill ;
return_vals = procedural_db_run_proc ( " gimp_bucket_fill " ,
& nreturn_vals ,
1998-01-22 15:02:57 +08:00
PDB_DRAWABLE , drawable_ID ( gimage_active_drawable ( gdisp - > gimage ) ) ,
1997-11-25 06:05:25 +08:00
PDB_INT32 , ( gint32 ) fill_mode ,
PDB_INT32 , ( gint32 ) bucket_options - > paint_mode ,
PDB_FLOAT , ( gdouble ) bucket_options - > opacity ,
PDB_FLOAT , ( gdouble ) bucket_options - > threshold ,
PDB_INT32 , ( gint32 ) bucket_options - > sample_merged ,
PDB_FLOAT , ( gdouble ) bucket_tool - > target_x ,
PDB_FLOAT , ( gdouble ) bucket_tool - > target_y ,
PDB_END ) ;
if ( return_vals [ 0 ] . value . pdb_int = = PDB_SUCCESS )
gdisplays_flush ( ) ;
else
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
g_message ( _ ( " Bucket Fill operation failed. " ) ) ;
1997-11-25 06:05:25 +08:00
procedural_db_destroy_args ( return_vals , nreturn_vals ) ;
}
tool - > state = INACTIVE ;
}
static void
1999-04-09 06:25:54 +08:00
bucket_fill_motion ( Tool * tool ,
GdkEventMotion * mevent ,
gpointer gdisp_ptr )
1997-11-25 06:05:25 +08:00
{
}
static void
1999-04-09 06:25:54 +08:00
bucket_fill_cursor_update ( Tool * tool ,
GdkEventMotion * mevent ,
gpointer gdisp_ptr )
1997-11-25 06:05:25 +08:00
{
GDisplay * gdisp ;
Layer * layer ;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW ;
int x , y ;
1998-01-22 15:02:57 +08:00
int off_x , off_y ;
1997-11-25 06:05:25 +08:00
gdisp = ( GDisplay * ) gdisp_ptr ;
gdisplay_untransform_coords ( gdisp , mevent - > x , mevent - > y , & x , & y , FALSE , FALSE ) ;
1998-01-22 15:02:57 +08:00
if ( ( layer = gimage_get_active_layer ( gdisp - > gimage ) ) )
{
drawable_offsets ( GIMP_DRAWABLE ( layer ) , & off_x , & off_y ) ;
if ( x > = off_x & & y > = off_y & &
x < ( off_x + drawable_width ( GIMP_DRAWABLE ( layer ) ) ) & &
y < ( off_y + drawable_height ( GIMP_DRAWABLE ( layer ) ) ) )
{
/* One more test--is there a selected region?
* if so , is cursor inside ?
*/
if ( gimage_mask_is_empty ( gdisp - > gimage ) )
ctype = GDK_TCROSS ;
else if ( gimage_mask_value ( gdisp - > gimage , x , y ) )
ctype = GDK_TCROSS ;
}
}
1997-11-25 06:05:25 +08:00
gdisplay_install_tool_cursor ( gdisp , ctype ) ;
}
static void
1999-04-09 06:25:54 +08:00
bucket_fill_control ( Tool * tool ,
int action ,
gpointer gdisp_ptr )
1997-11-25 06:05:25 +08:00
{
}
static void
1999-04-09 06:25:54 +08:00
bucket_fill ( GImage * gimage ,
GimpDrawable * drawable ,
FillMode fill_mode ,
int paint_mode ,
double opacity ,
double threshold ,
int sample_merged ,
double x ,
double y )
1997-11-25 06:05:25 +08:00
{
TileManager * buf_tiles ;
PixelRegion bufPR , maskPR ;
Channel * mask = NULL ;
int bytes , has_alpha ;
int x1 , y1 , x2 , y2 ;
unsigned char col [ MAX_CHANNELS ] ;
unsigned char * d1 , * d2 ;
GPatternP pattern ;
TempBuf * pat_buf ;
int new_buf = 0 ;
pat_buf = NULL ;
if ( fill_mode = = FgColorFill )
1998-01-22 15:02:57 +08:00
gimage_get_foreground ( gimage , drawable , col ) ;
1997-11-25 06:05:25 +08:00
else if ( fill_mode = = BgColorFill )
1998-01-22 15:02:57 +08:00
gimage_get_background ( gimage , drawable , col ) ;
1997-11-25 06:05:25 +08:00
else if ( fill_mode = = PatternFill )
{
pattern = get_active_pattern ( ) ;
if ( ! pattern )
{
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
g_message ( _ ( " No available patterns for this operation. " ) ) ;
1997-11-25 06:05:25 +08:00
return ;
}
/* If the pattern doesn't match the image in terms of color type,
* transform it . ( ie pattern is RGB , image is indexed )
*/
1998-01-22 15:02:57 +08:00
if ( ( ( pattern - > mask - > bytes = = 3 ) & & ! drawable_color ( drawable ) ) | |
( ( pattern - > mask - > bytes = = 1 ) & & ! drawable_gray ( drawable ) ) )
1997-11-25 06:05:25 +08:00
{
int size ;
1998-01-22 15:02:57 +08:00
if ( ( pattern - > mask - > bytes = = 1 ) & & drawable_color ( drawable ) )
1997-11-25 06:05:25 +08:00
pat_buf = temp_buf_new ( pattern - > mask - > width , pattern - > mask - > height , 3 , 0 , 0 , NULL ) ;
else
pat_buf = temp_buf_new ( pattern - > mask - > width , pattern - > mask - > height , 1 , 0 , 0 , NULL ) ;
d1 = temp_buf_data ( pattern - > mask ) ;
d2 = temp_buf_data ( pat_buf ) ;
size = pattern - > mask - > width * pattern - > mask - > height ;
while ( size - - )
{
1998-01-22 15:02:57 +08:00
gimage_transform_color ( gimage , drawable , d1 , d2 ,
1997-11-25 06:05:25 +08:00
( pattern - > mask - > bytes = = 3 ) ? RGB : GRAY ) ;
d1 + = pattern - > mask - > bytes ;
d2 + = pat_buf - > bytes ;
}
new_buf = 1 ;
}
else
pat_buf = pattern - > mask ;
}
1999-01-11 07:36:29 +08:00
gimp_add_busy_cursors ( ) ;
1998-01-22 15:02:57 +08:00
bytes = drawable_bytes ( drawable ) ;
has_alpha = drawable_has_alpha ( drawable ) ;
1997-11-25 06:05:25 +08:00
/* If there is no selection mask, the do a seed bucket
* fill . . . To do this , calculate a new contiguous region
*/
1998-01-22 15:02:57 +08:00
if ( ! drawable_mask_bounds ( drawable , & x1 , & y1 , & x2 , & y2 ) )
1997-11-25 06:05:25 +08:00
{
1998-01-22 15:02:57 +08:00
mask = find_contiguous_region ( gimage , drawable , TRUE , ( int ) threshold ,
1997-11-25 06:05:25 +08:00
( int ) x , ( int ) y , sample_merged ) ;
channel_bounds ( mask , & x1 , & y1 , & x2 , & y2 ) ;
/* make sure we handle the mask correctly if it was sample-merged */
if ( sample_merged )
{
int off_x , off_y ;
/* Limit the channel bounds to the drawable's extents */
1998-01-22 15:02:57 +08:00
drawable_offsets ( drawable , & off_x , & off_y ) ;
x1 = BOUNDS ( x1 , off_x , ( off_x + drawable_width ( drawable ) ) ) ;
y1 = BOUNDS ( y1 , off_y , ( off_y + drawable_height ( drawable ) ) ) ;
x2 = BOUNDS ( x2 , off_x , ( off_x + drawable_width ( drawable ) ) ) ;
y2 = BOUNDS ( y2 , off_y , ( off_y + drawable_height ( drawable ) ) ) ;
1997-11-25 06:05:25 +08:00
1998-01-22 15:02:57 +08:00
pixel_region_init ( & maskPR , drawable_data ( GIMP_DRAWABLE ( mask ) ) ,
x1 , y1 , ( x2 - x1 ) , ( y2 - y1 ) , TRUE ) ;
1997-11-25 06:05:25 +08:00
/* translate mask bounds to drawable coords */
x1 - = off_x ;
y1 - = off_y ;
x2 - = off_x ;
y2 - = off_y ;
}
else
1998-01-22 15:02:57 +08:00
pixel_region_init ( & maskPR , drawable_data ( GIMP_DRAWABLE ( mask ) ) ,
x1 , y1 , ( x2 - x1 ) , ( y2 - y1 ) , TRUE ) ;
1997-11-25 06:05:25 +08:00
/* if the gimage doesn't have an alpha channel,
* make sure that the temp buf does . We need the
* alpha channel to fill with the region calculated above
*/
if ( ! has_alpha )
{
bytes + + ;
has_alpha = 1 ;
}
}
buf_tiles = tile_manager_new ( ( x2 - x1 ) , ( y2 - y1 ) , bytes ) ;
pixel_region_init ( & bufPR , buf_tiles , 0 , 0 , ( x2 - x1 ) , ( y2 - y1 ) , TRUE ) ;
if ( mask )
bucket_fill_region ( fill_mode , & bufPR , & maskPR , col , pat_buf , x1 , y1 , has_alpha ) ;
else
bucket_fill_region ( fill_mode , & bufPR , NULL , col , pat_buf , x1 , y1 , has_alpha ) ;
pixel_region_init ( & bufPR , buf_tiles , 0 , 0 , ( x2 - x1 ) , ( y2 - y1 ) , FALSE ) ;
1998-01-22 15:02:57 +08:00
gimage_apply_image ( gimage , drawable , & bufPR , TRUE ,
1997-11-25 06:05:25 +08:00
( opacity * 255 ) / 100 , paint_mode , NULL , x1 , y1 ) ;
/* update the image */
1998-01-22 15:02:57 +08:00
drawable_update ( drawable , x1 , y1 , ( x2 - x1 ) , ( y2 - y1 ) ) ;
1997-11-25 06:05:25 +08:00
/* free the temporary buffer */
tile_manager_destroy ( buf_tiles ) ;
/* free the mask */
if ( mask )
channel_delete ( mask ) ;
if ( new_buf )
temp_buf_free ( pat_buf ) ;
1999-01-11 07:36:29 +08:00
1999-01-18 01:03:54 +08:00
gimp_remove_busy_cursors ( NULL ) ;
1997-11-25 06:05:25 +08:00
}
static void
1999-04-09 06:25:54 +08:00
bucket_fill_line_color ( unsigned char * buf ,
unsigned char * mask ,
unsigned char * col ,
int has_alpha ,
int bytes ,
int width )
1997-11-25 06:05:25 +08:00
{
int alpha , b ;
alpha = ( has_alpha ) ? bytes - 1 : bytes ;
while ( width - - )
{
for ( b = 0 ; b < alpha ; b + + )
buf [ b ] = col [ b ] ;
if ( has_alpha )
{
if ( mask )
buf [ alpha ] = * mask + + ;
else
1998-01-25 09:24:46 +08:00
buf [ alpha ] = OPAQUE_OPACITY ;
1997-11-25 06:05:25 +08:00
}
buf + = bytes ;
}
}
static void
1999-04-09 06:25:54 +08:00
bucket_fill_line_pattern ( unsigned char * buf ,
unsigned char * mask ,
TempBuf * pattern ,
int has_alpha ,
int bytes ,
int x ,
int y ,
int width )
1997-11-25 06:05:25 +08:00
{
unsigned char * pat , * p ;
int alpha , b ;
int i ;
/* Get a pointer to the appropriate scanline of the pattern buffer */
pat = temp_buf_data ( pattern ) +
( y % pattern - > height ) * pattern - > width * pattern - > bytes ;
alpha = ( has_alpha ) ? bytes - 1 : bytes ;
for ( i = 0 ; i < width ; i + + )
{
p = pat + ( ( i + x ) % pattern - > width ) * pattern - > bytes ;
for ( b = 0 ; b < alpha ; b + + )
buf [ b ] = p [ b ] ;
if ( has_alpha )
{
if ( mask )
buf [ alpha ] = * mask + + ;
else
1998-01-25 09:24:46 +08:00
buf [ alpha ] = OPAQUE_OPACITY ;
1997-11-25 06:05:25 +08:00
}
buf + = bytes ;
}
}
static void
1999-04-09 06:25:54 +08:00
bucket_fill_region ( FillMode fill_mode ,
PixelRegion * bufPR ,
PixelRegion * maskPR ,
unsigned char * col ,
TempBuf * pattern ,
int off_x ,
int off_y ,
int has_alpha )
1997-11-25 06:05:25 +08:00
{
unsigned char * s , * m ;
int y ;
void * pr ;
for ( pr = pixel_regions_register ( 2 , bufPR , maskPR ) ; pr ! = NULL ; pr = pixel_regions_process ( pr ) )
{
s = bufPR - > data ;
if ( maskPR )
m = maskPR - > data ;
else
m = NULL ;
for ( y = 0 ; y < bufPR - > h ; y + + )
{
switch ( fill_mode )
{
case FgColorFill :
case BgColorFill :
bucket_fill_line_color ( s , m , col , has_alpha , bufPR - > bytes , bufPR - > w ) ;
break ;
case PatternFill :
bucket_fill_line_pattern ( s , m , pattern , has_alpha , bufPR - > bytes ,
off_x + bufPR - > x , off_y + y + bufPR - > y , bufPR - > w ) ;
break ;
}
s + = bufPR - > rowstride ;
if ( maskPR )
m + = maskPR - > rowstride ;
}
}
}
/*********************************/
/* Global bucket fill functions */
/*********************************/
Tool *
1999-01-22 07:17:19 +08:00
tools_new_bucket_fill ( void )
1997-11-25 06:05:25 +08:00
{
Tool * tool ;
BucketTool * private ;
1999-04-13 01:55:06 +08:00
/* The tool options */
1997-11-25 06:05:25 +08:00
if ( ! bucket_options )
1999-04-13 01:55:06 +08:00
{
bucket_options = bucket_options_new ( ) ;
tools_register ( BUCKET_FILL , ( ToolOptions * ) bucket_options ) ;
}
1997-11-25 06:05:25 +08:00
tool = ( Tool * ) g_malloc ( sizeof ( Tool ) ) ;
private = ( BucketTool * ) g_malloc ( sizeof ( BucketTool ) ) ;
tool - > type = BUCKET_FILL ;
tool - > state = INACTIVE ;
tool - > scroll_lock = 1 ; /* Disallow scrolling */
tool - > auto_snap_to = TRUE ;
tool - > private = private ;
1999-04-13 01:55:06 +08:00
1997-11-25 06:05:25 +08:00
tool - > button_press_func = bucket_fill_button_press ;
tool - > button_release_func = bucket_fill_button_release ;
tool - > motion_func = bucket_fill_motion ;
tool - > arrow_keys_func = standard_arrow_keys_func ;
tool - > cursor_update_func = bucket_fill_cursor_update ;
tool - > control_func = bucket_fill_control ;
1998-03-31 15:23:50 +08:00
tool - > preserve = TRUE ;
1997-11-25 06:05:25 +08:00
return tool ;
}
void
1999-04-09 06:25:54 +08:00
tools_free_bucket_fill ( Tool * tool )
1997-11-25 06:05:25 +08:00
{
BucketTool * bucket_tool ;
bucket_tool = ( BucketTool * ) tool - > private ;
g_free ( bucket_tool ) ;
}
/* The bucket fill procedure definition */
ProcArg bucket_fill_args [ ] =
{
{ PDB_DRAWABLE ,
" drawable " ,
1998-12-26 02:22:01 +08:00
" the affected drawable "
1997-11-25 06:05:25 +08:00
} ,
{ PDB_INT32 ,
" fill_mode " ,
1998-12-26 02:22:01 +08:00
" the type of fill: { FG-BUCKET-FILL (0), BG-BUCKET-FILL (1), PATTERN-BUCKET-FILL (2) } "
1997-11-25 06:05:25 +08:00
} ,
{ PDB_INT32 ,
" paint_mode " ,
1998-12-26 02:22:01 +08:00
" the paint application mode: { NORMAL (0), DISSOLVE (1), BEHIND (2), MULTIPLY/BURN (3), SCREEN (4), OVERLAY (5) DIFFERENCE (6), ADDITION (7), SUBTRACT (8), DARKEN-ONLY (9), LIGHTEN-ONLY (10), HUE (11), SATURATION (12), COLOR (13), VALUE (14), DIVIDE/DODGE (15) } "
1997-11-25 06:05:25 +08:00
} ,
{ PDB_FLOAT ,
" opacity " ,
1998-12-26 02:22:01 +08:00
" the opacity of the final bucket fill (0 <= opacity <= 100) "
1997-11-25 06:05:25 +08:00
} ,
{ PDB_FLOAT ,
" threshold " ,
1998-12-26 02:22:01 +08:00
" the threshold determines how extensive the seed fill will be. It's value is specified in terms of intensity levels (0 <= threshold <= 255). This parameter is only valid when there is no selection in the specified image. "
1997-11-25 06:05:25 +08:00
} ,
{ PDB_INT32 ,
" sample_merged " ,
1998-12-26 02:22:01 +08:00
" use the composite image, not the drawable "
1997-11-25 06:05:25 +08:00
} ,
{ PDB_FLOAT ,
" x " ,
1998-12-26 02:22:01 +08:00
" the x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image. "
1997-11-25 06:05:25 +08:00
} ,
{ PDB_FLOAT ,
" y " ,
1998-12-26 02:22:01 +08:00
" the y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image. "
1997-11-25 06:05:25 +08:00
} ,
} ;
ProcRecord bucket_fill_proc =
{
" gimp_bucket_fill " ,
1998-12-26 02:22:01 +08:00
" Fill the area specified either by the current selection if there is one, or by a seed fill starting at the specified coordinates. " ,
" This tool requires information on the paint application mode, and the fill mode, which can either be in the foreground color, or in the currently active pattern. If there is no selection, a seed fill is executed at the specified coordinates and extends outward in keeping with the threshold parameter. If there is a selection in the target image, the threshold, sample merged, x, and y arguments are unused. If the sample_merged parameter is non-zero, the data of the composite image will be used instead of that for the specified drawable. This is equivalent to sampling for colors after merging all visible layers. In the case of merged sampling, the x,y coordinates are relative to the image's origin; otherwise, they are relative to the drawable's origin. " ,
1997-11-25 06:05:25 +08:00
" Spencer Kimball & Peter Mattis " ,
" Spencer Kimball & Peter Mattis " ,
" 1995-1996 " ,
PDB_INTERNAL ,
/* Input arguments */
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
8 ,
1997-11-25 06:05:25 +08:00
bucket_fill_args ,
/* Output arguments */
0 ,
NULL ,
/* Exec method */
{ { bucket_fill_invoker } } ,
} ;
static Argument *
1999-04-09 06:25:54 +08:00
bucket_fill_invoker ( Argument * args )
1997-11-25 06:05:25 +08:00
{
int success = TRUE ;
GImage * gimage ;
1998-01-22 15:02:57 +08:00
GimpDrawable * drawable ;
1997-11-25 06:05:25 +08:00
FillMode fill_mode ;
int paint_mode ;
double opacity ;
double threshold ;
int sample_merged ;
double x , y ;
int int_value ;
double fp_value ;
1998-01-22 15:02:57 +08:00
drawable = NULL ;
1997-11-25 06:05:25 +08:00
fill_mode = BgColorFill ;
paint_mode = NORMAL_MODE ;
opacity = 100.0 ;
threshold = 0.0 ;
/* the drawable */
if ( success )
{
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
int_value = args [ 0 ] . value . pdb_int ;
1998-01-22 15:02:57 +08:00
drawable = drawable_get_ID ( int_value ) ;
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
if ( drawable = = NULL )
1997-11-25 06:05:25 +08:00
success = FALSE ;
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
else
gimage = drawable_gimage ( drawable ) ;
1997-11-25 06:05:25 +08:00
}
/* fill mode */
if ( success )
{
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
int_value = args [ 1 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
switch ( int_value )
{
case 0 : fill_mode = FgColorFill ; break ;
case 1 : fill_mode = BgColorFill ; break ;
case 2 : fill_mode = PatternFill ; break ;
default : success = FALSE ;
}
}
/* paint mode */
if ( success )
{
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
int_value = args [ 2 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
if ( int_value > = NORMAL_MODE & & int_value < = VALUE_MODE )
paint_mode = int_value ;
else
success = FALSE ;
}
/* opacity */
if ( success )
{
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
fp_value = args [ 3 ] . value . pdb_float ;
1997-11-25 06:05:25 +08:00
if ( fp_value > = 0.0 & & fp_value < = 100.0 )
opacity = fp_value ;
else
success = FALSE ;
}
/* threshold */
if ( success )
{
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
fp_value = args [ 4 ] . value . pdb_float ;
1997-11-25 06:05:25 +08:00
if ( fp_value > = 0.0 & & fp_value < = 255.0 )
threshold = fp_value ;
else
success = FALSE ;
}
/* sample_merged */
if ( success )
{
API-mega-break-it-all patch part one: removed the unnecessary PDB_IMAGE
* airbrush.c, blend.c, brightness_contrast.c, bucket_fill.c
by_color_select.c, channel_ops.c, clone.c, color_balance.c
color_picker.c, convolve.c, curves.c, desaturate.c, edit_cmds.c
equalize.c, eraser.c, flip_tool.c, fuzzy_select.c,
gimage_mask_cmds.c histogram_tool.c, hue_saturation.c, invert.c,
levels.c, pencil.c paintbrush.c, perspective_tool.c, posterize.c,
rotate_tool.c scale_tool.c, shear_tool.c, text_tool.c, threshold.c:
API-mega-break-it-all patch part one: removed the unnecessary
PDB_IMAGE argument from many functions.
Affected functions:
gimp_airbrush gimp_blend gimp_brightness_contrast gimp_bucket_fill
gimp_by_color_select gimp_channel_ops_offset gimp_clone gimp_color_balance
gimp_color_picker gimp_convolve gimp_curves_explicit gimp_curves_spline
gimp_desaturate gimp_edit_clear gimp_edit_copy gimp_edit_cut gimp_edit_fill
gimp_edit_paste gimp_edit_stroke gimp_equalize gimp_eraser
gimp_eraser_extended gimp_flip gimp_fuzzy_select gimp_histogram
gimp_hue_saturation gimp_invert gimp_levels gimp_paintbrush
gimp_paintbrush_extended gimp_pencil gimp_perspective gimp_posterize
gimp_rotate gimp_scale gimp_selection_float gimp_selection_layer_alpha
gimp_selection_load gimp_shear gimp_threshold
1998-11-14 04:40:00 +08:00
int_value = args [ 5 ] . value . pdb_int ;
1997-11-25 06:05:25 +08:00
sample_merged = ( int_value ) ? TRUE : FALSE ;
}
/* x, y */
if ( success )
{
1999-01-22 07:17:19 +08:00
x = args [ 6 ] . value . pdb_float ;
y = args [ 7 ] . value . pdb_float ;
1997-11-25 06:05:25 +08:00
}
/* call the blend procedure */
if ( success )
{
1998-01-22 15:02:57 +08:00
bucket_fill ( gimage , drawable , fill_mode , paint_mode ,
1997-11-25 06:05:25 +08:00
opacity , threshold , sample_merged , x , y ) ;
}
return procedural_db_return_args ( & bucket_fill_proc , success ) ;
}