app/airbrush.[ch] app/bezier_select.c app/bezier_selectP.h app/blend.[ch]

2000-12-31  Michael Natterer  <mitch@gimp.org>

	* app/airbrush.[ch]
	* app/bezier_select.c
	* app/bezier_selectP.h
	* app/blend.[ch]
	* app/boundary.h
	* app/brightness_contrast.[ch]
	* app/bucket_fill.c
	* app/by_color_select.c
	* app/clone.[ch]
	* app/color_balance.c
	* app/color_picker.c
	* app/commands.c
	* app/convolve.[ch]
	* app/crop.c
	* app/crop.h
	* app/curves.c
	* app/dodgeburn.[ch]
	* app/edit_selection.[ch]
	* app/ellipse_select.c
	* app/eraser.[ch]
	* app/flip_tool.[ch]
	* app/free_select.[ch]
	* app/fuzzy_select.[ch]
	* app/gdisplay.c
	* app/gimage.c
	* app/histogram_tool.[ch]
	* app/hue_saturation.[ch]
	* app/image_map.[ch]
	* app/ink.[ch]
	* app/iscissors.c
	* app/levels.c
	* app/magnify.[ch]
	* app/move.c
	* app/nav_window.[ch]
	* app/paint_core.[ch]
	* app/paintbrush.[ch]
	* app/path_bezier.[ch]
	* app/path_tool.c
	* app/pencil.[ch]
	* app/perspective_tool.[ch]
	* app/posterize.c
	* app/rect_select.[ch]
	* app/rotate_tool.[ch]
	* app/scale_tool.[ch]
	* app/selection.[ch]
	* app/shear_tool.[ch]
	* app/smudge.[ch]
	* app/text_tool.[ch]
	* app/threshold.c
	* app/tools.[ch]
	* app/transform_core.[ch]: removed the "gdisp_ptr" madness and
	useless casts all over the place. Introduced a "PaintState" enum
	instead of #define's. Various cleanups.
This commit is contained in:
Michael Natterer 2000-12-31 04:07:42 +00:00 committed by Michael Natterer
parent 5e18bba988
commit 2db8881557
253 changed files with 8070 additions and 7114 deletions

View File

@ -1,3 +1,59 @@
2000-12-31 Michael Natterer <mitch@gimp.org>
* app/airbrush.[ch]
* app/bezier_select.c
* app/bezier_selectP.h
* app/blend.[ch]
* app/boundary.h
* app/brightness_contrast.[ch]
* app/bucket_fill.c
* app/by_color_select.c
* app/clone.[ch]
* app/color_balance.c
* app/color_picker.c
* app/commands.c
* app/convolve.[ch]
* app/crop.c
* app/crop.h
* app/curves.c
* app/dodgeburn.[ch]
* app/edit_selection.[ch]
* app/ellipse_select.c
* app/eraser.[ch]
* app/flip_tool.[ch]
* app/free_select.[ch]
* app/fuzzy_select.[ch]
* app/gdisplay.c
* app/gimage.c
* app/histogram_tool.[ch]
* app/hue_saturation.[ch]
* app/image_map.[ch]
* app/ink.[ch]
* app/iscissors.c
* app/levels.c
* app/magnify.[ch]
* app/move.c
* app/nav_window.[ch]
* app/paint_core.[ch]
* app/paintbrush.[ch]
* app/path_bezier.[ch]
* app/path_tool.c
* app/pencil.[ch]
* app/perspective_tool.[ch]
* app/posterize.c
* app/rect_select.[ch]
* app/rotate_tool.[ch]
* app/scale_tool.[ch]
* app/selection.[ch]
* app/shear_tool.[ch]
* app/smudge.[ch]
* app/text_tool.[ch]
* app/threshold.c
* app/tools.[ch]
* app/transform_core.[ch]: removed the "gdisp_ptr" madness and
useless casts all over the place. Introduced a "PaintState" enum
instead of #define's. Various cleanups.
2000-12-30 Michael Natterer <mitch@gimp.org>
One more 17C3 commit ...

View File

@ -1080,11 +1080,12 @@ tools_select_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action)
{
ToolType tool_type;
GDisplay *gdisp;
gdisp = gdisplay_active ();
ToolType tool_type;
GDisplay *gdisp;
tool_type = (ToolType) callback_action;
gdisp = gdisplay_active ();
gimp_context_set_tool (gimp_context_get_user (), tool_type);
@ -1101,12 +1102,12 @@ tools_select_cmd_callback (GtkWidget *widget,
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
}
/* setting the gdisp_ptr here is a HACK to allow the tools'
/* setting the tool->gdisp here is a HACK to allow the tools'
* dialog windows being hidden if the tool was selected from
* a tear-off-menu and there was no mouse click in the display
* before deleting it
*/
active_tool->gdisp_ptr = gdisp;
active_tool->gdisp = gdisp;
}
/***** Filters *****/

View File

@ -77,6 +77,16 @@ struct _AirbrushOptions
};
/* local function prototypes */
static gpointer airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static gpointer airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
/* the airbrush tool options */
static AirbrushOptions *airbrush_options = NULL;
@ -189,13 +199,13 @@ tools_new_airbrush (void)
return tool;
}
void *
static gpointer
airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
GimpBrush *brush;
gdouble rate;
gdouble rate;
if (!drawable)
return NULL;
@ -357,10 +367,10 @@ airbrush_motion (PaintCore *paint_core,
SOFT, scale, mode);
}
static void *
static gpointer
airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
airbrush_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_pressure, non_gui_incremental);
@ -370,8 +380,8 @@ airbrush_non_gui_paint_func (PaintCore *paint_core,
gboolean
airbrush_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
AirbrushOptions *options = airbrush_options;
gdouble pressure = AIRBRUSH_PRESSURE_DEFAULT;
@ -384,11 +394,11 @@ airbrush_non_gui_default (GimpDrawable *drawable,
gboolean
airbrush_non_gui (GimpDrawable *drawable,
double pressure,
int num_strokes,
double *stroke_array)
gdouble pressure,
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
@ -419,8 +429,9 @@ airbrush_non_gui (GimpDrawable *drawable,
/* Cleanup */
paint_core_cleanup ();
return TRUE;
}
else
return FALSE;
return FALSE;
}

View File

@ -20,18 +20,16 @@
#define __AIRBRUSH_H__
void * airbrush_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean airbrush_non_gui (GimpDrawable *,
gdouble,
gint,
gdouble *);
gboolean airbrush_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean airbrush_non_gui (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
gdouble *stroke_array);
gboolean airbrush_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_airbrush (void);
void tools_free_airbrush (Tool *);
void tools_free_airbrush (Tool *tool);
#endif /* __AIRBRUSH_H__ */

View File

@ -20,9 +20,6 @@
#define __BOUNDARY_H__
#include "paint_funcs.h"
typedef enum
{
WithinBounds,

View File

@ -62,21 +62,33 @@ static ColorBalanceDialog *color_balance_dialog = NULL;
/* color balance action functions */
static void color_balance_control (Tool *, ToolAction, gpointer);
static void color_balance_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static ColorBalanceDialog * color_balance_dialog_new (void);
static void color_balance_update (ColorBalanceDialog *, int);
static void color_balance_preview (ColorBalanceDialog *);
static void color_balance_reset_callback (GtkWidget *, gpointer);
static void color_balance_ok_callback (GtkWidget *, gpointer);
static void color_balance_cancel_callback (GtkWidget *, gpointer);
static void color_balance_range_callback (GtkWidget *, gpointer);
static void color_balance_preserve_update (GtkWidget *, gpointer);
static void color_balance_preview_update (GtkWidget *, gpointer);
static void color_balance_cr_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_mg_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_yb_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_update (ColorBalanceDialog *cbd,
gint );
static void color_balance_preview (ColorBalanceDialog *cbd);
static void color_balance_reset_callback (GtkWidget *widget,
gpointer data);
static void color_balance_ok_callback (GtkWidget *widget,
gpointer data);
static void color_balance_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_balance_range_callback (GtkWidget *widget,
gpointer data);
static void color_balance_preserve_update (GtkWidget *widget,
gpointer data);
static void color_balance_preview_update (GtkWidget *widget,
gpointer data);
static void color_balance_cr_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void color_balance_mg_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void color_balance_yb_adjustment_update (GtkAdjustment *adj,
gpointer data);
/* color balance machinery */
@ -86,12 +98,12 @@ color_balance (PixelRegion *srcPR,
void *data)
{
ColorBalanceDialog *cbd;
guchar *src, *s;
guchar *dest, *d;
gint alpha;
gint r, g, b;
gint r_n, g_n, b_n;
gint w, h;
guchar *src, *s;
guchar *dest, *d;
gboolean alpha;
gint r, g, b;
gint r_n, g_n, b_n;
gint w, h;
cbd = (ColorBalanceDialog *) data;
@ -143,7 +155,7 @@ color_balance (PixelRegion *srcPR,
static void
color_balance_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ColorBalance * color_bal;
@ -599,7 +611,7 @@ color_balance_ok_callback (GtkWidget *widget,
cbd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -623,7 +635,7 @@ color_balance_cancel_callback (GtkWidget *widget,
cbd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -108,40 +108,72 @@ static CRMatrix CR_basis =
/* curves action functions */
static void curves_button_press (Tool *, GdkEventButton *, gpointer);
static void curves_button_release (Tool *, GdkEventButton *, gpointer);
static void curves_motion (Tool *, GdkEventMotion *, gpointer);
static void curves_control (Tool *, ToolAction, gpointer);
static void curves_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void curves_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void curves_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void curves_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static CurvesDialog * curves_dialog_new (void);
static CurvesDialog * curves_dialog_new (void);
static void curves_update (CurvesDialog *, int);
static void curves_plot_curve (CurvesDialog *, int, int, int, int);
static void curves_preview (CurvesDialog *);
static void curves_update (CurvesDialog *cd,
gint );
static void curves_plot_curve (CurvesDialog *cd,
gint ,
gint ,
gint ,
gint );
static void curves_preview (CurvesDialog *cd);
static void curves_channel_callback (GtkWidget *, gpointer);
static void curves_channel_callback (GtkWidget *widget,
gpointer data);
static void curves_smooth_callback (GtkWidget *, gpointer);
static void curves_free_callback (GtkWidget *, gpointer);
static void curves_smooth_callback (GtkWidget *widget,
gpointer data);
static void curves_free_callback (GtkWidget *widget,
gpointer data);
static void curves_channel_reset (int);
static void curves_reset_callback (GtkWidget *, gpointer);
static void curves_ok_callback (GtkWidget *, gpointer);
static void curves_cancel_callback (GtkWidget *, gpointer);
static void curves_load_callback (GtkWidget *, gpointer);
static void curves_save_callback (GtkWidget *, gpointer);
static void curves_preview_update (GtkWidget *, gpointer);
static gint curves_xrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_yrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_graph_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static void curves_CR_compose (CRMatrix, CRMatrix, CRMatrix);
static void curves_channel_reset (gint );
static void curves_reset_callback (GtkWidget *widget,
gpointer data);
static void curves_ok_callback (GtkWidget *widget,
gpointer data);
static void curves_cancel_callback (GtkWidget *widget,
gpointer data);
static void curves_load_callback (GtkWidget *widget,
gpointer data);
static void curves_save_callback (GtkWidget *widget,
gpointer data);
static void curves_preview_update (GtkWidget *widget,
gpointer data);
static gint curves_xrange_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static gint curves_yrange_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static gint curves_graph_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static void curves_CR_compose (CRMatrix ,
CRMatrix ,
CRMatrix );
static void file_dialog_create (GtkWidget *);
static void file_dialog_ok_callback (GtkWidget *, gpointer);
static void file_dialog_cancel_callback (GtkWidget *, gpointer);
static void file_dialog_create (GtkWidget *widget);
static void file_dialog_ok_callback (GtkWidget *widget,
gpointer data);
static void file_dialog_cancel_callback (GtkWidget *widget,
gpointer data);
static gboolean curves_read_from_file (FILE *f);
static void curves_write_to_file (FILE *f);
static gboolean curves_read_from_file (FILE *f);
static void curves_write_to_file (FILE *f);
/* curves machinery */
@ -152,10 +184,10 @@ curves_lut_func (CurvesDialog *cd,
gint channel,
gfloat value)
{
gfloat f;
gint index;
gfloat f;
gint index;
gdouble inten;
gint j;
gint j;
if (nchannels == 1)
j = 0;
@ -197,15 +229,15 @@ curves_colour_update (Tool *tool,
gint x,
gint y)
{
guchar *color;
gint offx;
gint offy;
gint maxval;
guchar *color;
gint offx;
gint offy;
gint maxval;
gboolean has_alpha;
gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE)
if (!tool || tool->state != ACTIVE)
return;
drawable_offsets (drawable, &offx, &offy);
@ -213,7 +245,7 @@ curves_colour_update (Tool *tool,
x -= offx;
y -= offy;
if (!(color = image_map_get_color_at(curves_dialog->image_map, x, y)))
if (!(color = image_map_get_color_at (curves_dialog->image_map, x, y)))
return;
sample_type = gimp_drawable_type (drawable);
@ -283,16 +315,14 @@ curves_add_point (GimpDrawable *drawable,
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
GDisplay *gdisp;
gint x, y;
GimpDrawable *drawable;
gdisp = gdisp_ptr;
drawable = gimp_image_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
tool->gdisp = gdisp;
if (drawable != tool->drawable)
{
@ -318,20 +348,18 @@ curves_button_press (Tool *tool,
static void
curves_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
gint x, y;
GimpDrawable *drawable;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if(!curves_dialog ||
!gdisp ||
!(drawable = gimp_image_active_drawable (gdisp->gimage)))
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
return;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, FALSE, FALSE);
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
if (bevent->state & GDK_SHIFT_MASK)
@ -355,14 +383,11 @@ curves_button_release (Tool *tool,
static void
curves_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
GDisplay *gdisp;
gint x, y;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr;
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
@ -376,7 +401,7 @@ curves_motion (Tool *tool,
static void
curves_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -1279,7 +1304,7 @@ curves_ok_callback (GtkWidget *widget,
cd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -1303,7 +1328,7 @@ curves_cancel_callback (GtkWidget *widget,
cd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -43,8 +43,8 @@
#define HUE_PARTITION_MASK GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK
#define SLIDER_WIDTH 200
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define HUE_PARTITION 0x0
#define HUE_SLIDER 0x1
@ -62,6 +62,38 @@ struct _HueSaturation
gint x, y; /* coords for last mouse click */
};
/* hue saturation action functions */
static void hue_saturation_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static HueSaturationDialog * hue_saturation_dialog_new (void);
static void hue_saturation_update (HueSaturationDialog *hsd,
gint);
static void hue_saturation_preview (HueSaturationDialog *hsd);
static void hue_saturation_reset_callback (GtkWidget *,
gpointer);
static void hue_saturation_ok_callback (GtkWidget *,
gpointer);
static void hue_saturation_cancel_callback (GtkWidget *,
gpointer);
static void hue_saturation_partition_callback (GtkWidget *,
gpointer);
static void hue_saturation_preview_update (GtkWidget *,
gpointer);
static void hue_saturation_hue_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_lightness_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_saturation_adjustment_update (GtkAdjustment *,
gpointer);
static gint hue_saturation_hue_partition_events (GtkWidget *,
GdkEvent *,
HueSaturationDialog *hsd);
/* the hue-saturation tool options */
static ToolOptions *hue_saturation_options = NULL;
@ -82,27 +114,6 @@ static gint default_colors[6][3] =
{ 255, 0, 255 }
};
/* hue saturation action functions */
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static HueSaturationDialog * hue_saturation_dialog_new (void);
static void hue_saturation_update (HueSaturationDialog *,
gint);
static void hue_saturation_preview (HueSaturationDialog *);
static void hue_saturation_reset_callback (GtkWidget *, gpointer);
static void hue_saturation_ok_callback (GtkWidget *, gpointer);
static void hue_saturation_cancel_callback (GtkWidget *, gpointer);
static void hue_saturation_partition_callback (GtkWidget *, gpointer);
static void hue_saturation_preview_update (GtkWidget *, gpointer);
static void hue_saturation_hue_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_lightness_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_saturation_adjustment_update (GtkAdjustment *,
gpointer);
static gint hue_saturation_hue_partition_events (GtkWidget *, GdkEvent *,
HueSaturationDialog *);
/* hue saturation machinery */
@ -223,7 +234,7 @@ hue_saturation (PixelRegion *srcPR,
static void
hue_saturation_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -691,7 +702,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
active_tool->preserve = TRUE;
if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
image_map_apply (hsd->image_map, hue_saturation, (gpointer) hsd);
if (hsd->image_map)
image_map_commit (hsd->image_map);
@ -700,7 +711,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
hsd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -724,7 +735,7 @@ hue_saturation_cancel_callback (GtkWidget *widget,
hsd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -54,6 +54,7 @@ struct _HueSaturationDialog
gboolean preview;
};
Tool * tools_new_hue_saturation (void);
void tools_free_hue_saturation (Tool *tool);

View File

@ -56,36 +56,50 @@ struct _Threshold
gint x, y; /* coords for last mouse click */
};
/* threshold action functions */
static void threshold_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static ThresholdDialog * threshold_dialog_new (void);
static void threshold_update (ThresholdDialog *td,
gint update);
static void threshold_preview (ThresholdDialog *td);
static void threshold_reset_callback (GtkWidget *widget,
gpointer data);
static void threshold_ok_callback (GtkWidget *widget,
gpointer data);
static void threshold_cancel_callback (GtkWidget *widget,
gpointer data);
static void threshold_preview_update (GtkWidget *widget,
gpointer data);
static void threshold_low_threshold_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void threshold_high_threshold_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void threshold (PixelRegion *,
PixelRegion *,
gpointer );
static void threshold_histogram_range (HistogramWidget *,
gint ,
gint ,
gpointer );
/* the threshold tool options */
static ToolOptions *threshold_options = NULL;
/* the threshold tool dialog */
static ThresholdDialog *threshold_dialog = NULL;
/* threshold action functions */
static void threshold_control (Tool *, ToolAction, gpointer);
static ThresholdDialog * threshold_dialog_new (void);
static void threshold_update (ThresholdDialog *,
gint);
static void threshold_preview (ThresholdDialog *);
static void threshold_reset_callback (GtkWidget *, gpointer);
static void threshold_ok_callback (GtkWidget *, gpointer);
static void threshold_cancel_callback (GtkWidget *, gpointer);
static void threshold_preview_update (GtkWidget *, gpointer);
static void threshold_low_threshold_adjustment_update (GtkAdjustment *,
gpointer);
static void threshold_high_threshold_adjustment_update (GtkAdjustment *,
gpointer);
static void threshold (PixelRegion *, PixelRegion *, void *);
static void threshold_histogram_range (HistogramWidget *, gint, gint,
gpointer);
/* threshold machinery */
void
threshold_2 (void *data,
threshold_2 (gpointer data,
PixelRegion *srcPR,
PixelRegion *destPR)
{
@ -152,7 +166,7 @@ threshold (PixelRegion *srcPR,
static void
threshold_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -453,7 +467,7 @@ threshold_ok_callback (GtkWidget *widget,
td->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -477,7 +491,7 @@ threshold_cancel_callback (GtkWidget *widget,
gdisplays_flush ();
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -119,19 +119,19 @@ typedef struct
static void bezier_select_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr);
GDisplay *gdisp);
static void bezier_select_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr);
GDisplay *gdisp);
static void bezier_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr);
GDisplay *gdisp);
static void bezier_select_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr);
GDisplay *gdisp);
static void bezier_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr);
GDisplay *gdisp);
static void bezier_select_draw (Tool *tool);
static void bezier_offset_point (BezierPoint *pt,
@ -308,22 +308,19 @@ tools_free_bezier_select (Tool *tool)
}
gint
bezier_select_load (void *gdisp_ptr,
bezier_select_load (GDisplay *gdisp,
BezierPoint *pts,
gint num_pts,
gint closed)
{
GDisplay *gdisp;
Tool *tool;
BezierSelect *bezier_sel;
gdisp = (GDisplay *) gdisp_ptr;
/* select the bezier tool */
gimp_context_set_tool (gimp_context_get_user (), BEZIER_SELECT);
tool = active_tool;
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
bezier_sel = (BezierSelect *) tool->private;
bezier_sel->points = pts;
@ -333,7 +330,7 @@ bezier_select_load (void *gdisp_ptr,
bezier_sel->state = BEZIER_EDIT;
bezier_sel->draw = BEZIER_DRAW_ALL;
bezier_convert (bezier_sel, tool->gdisp_ptr, SUBDIVIDE, FALSE);
bezier_convert (bezier_sel, tool->gdisp, SUBDIVIDE, FALSE);
draw_core_start (bezier_sel->core, gdisp->canvas->window, tool);
@ -966,9 +963,8 @@ bezier_start_new_segment (BezierSelect *bezier_sel,
static void
bezier_select_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
BezierSelect *bezier_sel;
BezierPoint *points;
BezierPoint *start_pt;
@ -978,8 +974,6 @@ bezier_select_button_press (Tool *tool,
gint x, y;
gint halfwidth, dummy;
gdisp = (GDisplay *) gdisp_ptr;
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
bezier_sel = tool->private;
@ -987,12 +981,12 @@ bezier_select_button_press (Tool *tool,
if (bezier_options->extend)
{
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
}
else
{
/* If the tool was being used in another image...reset it */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
if (tool->state == ACTIVE && gdisp != tool->gdisp)
{
draw_core_stop (bezier_sel->core, tool);
bezier_select_reset (bezier_sel);
@ -1008,8 +1002,8 @@ bezier_select_button_press (Tool *tool,
curTool = active_tool;
curSel = curTool->private;
curGdisp = (GDisplay *) gdisp_ptr;
active_tool->gdisp_ptr = gdisp_ptr;
curGdisp = (GDisplay *) gdisp;
active_tool->gdisp = gdisp;
curCore = bezier_sel->core;
switch (bezier_sel->state)
@ -1019,19 +1013,19 @@ bezier_select_button_press (Tool *tool,
break;
grab_pointer = TRUE;
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->state = ACTIVE;
tool->gdisp = gdisp;
/* if (bevent->state & GDK_MOD1_MASK) */
/* { */
/* init_edit_selection (tool, gdisp_ptr, bevent, EDIT_MASK_TRANSLATE); */
/* init_edit_selection (tool, gdisp, bevent, EDIT_MASK_TRANSLATE); */
/* break; */
/* } */
/* else if (!(bevent->state & GDK_SHIFT_MASK) && !(bevent->state & GDK_CONTROL_MASK)) */
/* if (! (layer_is_floating_sel (gimp_image_get_active_layer (gdisp->gimage))) && */
/* gdisplay_mask_value (gdisp, bevent->x, bevent->y) > HALF_WAY) */
/* { */
/* init_edit_selection (tool, gdisp_ptr, bevent, EDIT_MASK_TO_LAYER_TRANSLATE); */
/* init_edit_selection (tool, gdisp, bevent, EDIT_MASK_TO_LAYER_TRANSLATE); */
/* break; */
/* } */
@ -1079,7 +1073,7 @@ bezier_select_button_press (Tool *tool,
{
paths_dialog_set_default_op ();
/* recursive call */
bezier_select_button_press (tool, bevent, gdisp_ptr);
bezier_select_button_press (tool, bevent, gdisp);
}
return;
}
@ -1120,7 +1114,7 @@ bezier_select_button_press (Tool *tool,
{
paths_dialog_set_default_op ();
/* recursive call */
bezier_select_button_press (tool, bevent, gdisp_ptr);
bezier_select_button_press (tool, bevent, gdisp);
}
return;
}
@ -1150,7 +1144,7 @@ bezier_select_button_press (Tool *tool,
{
paths_dialog_set_default_op ();
/* recursive call */
bezier_select_button_press (tool, bevent, gdisp_ptr);
bezier_select_button_press (tool, bevent, gdisp);
}
return;
}
@ -1303,12 +1297,12 @@ bezier_select_button_press (Tool *tool,
static void
bezier_select_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
BezierSelect *bezier_sel;
gdisp = tool->gdisp_ptr;
gdisp = tool->gdisp;
bezier_sel = tool->private;
bezier_sel->state &= ~(BEZIER_DRAG);
@ -1316,7 +1310,7 @@ bezier_select_button_release (Tool *tool,
gdk_flush ();
if (bezier_sel->closed)
bezier_convert (bezier_sel, tool->gdisp_ptr, SUBDIVIDE, FALSE);
bezier_convert (bezier_sel, tool->gdisp, SUBDIVIDE, FALSE);
/* Here ?*/
paths_newpoint_current (bezier_sel,gdisp);
@ -1381,11 +1375,10 @@ bez_copy_points (BezierSelect *tobez,
static void
bezier_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
static gint lastx, lasty;
GDisplay *gdisp;
BezierSelect *bezier_sel;
BezierPoint *anchor;
BezierPoint *opposite_control;
@ -1396,7 +1389,6 @@ bezier_select_motion (Tool *tool,
if (tool->state != ACTIVE)
return;
gdisp = gdisp_ptr;
bezier_sel = tool->private;
if (!bezier_sel->cur_anchor || !bezier_sel->cur_control)
@ -1726,9 +1718,8 @@ bezier_point_on_curve (GDisplay *gdisp,
static void
bezier_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
BezierSelect *bezier_sel;
gboolean on_curve;
gboolean on_control_pnt;
@ -1736,11 +1727,9 @@ bezier_select_cursor_update (Tool *tool,
gint halfwidth, dummy;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
bezier_sel = tool->private;
if (gdisp != tool->gdisp_ptr || bezier_sel->core->draw_state == INVISIBLE)
if (gdisp != tool->gdisp || bezier_sel->core->draw_state == INVISIBLE)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
BEZIER_SELECT,
@ -1929,7 +1918,7 @@ bezier_select_cursor_update (Tool *tool,
static void
bezier_select_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
BezierSelect * bezier_sel;
@ -2016,10 +2005,10 @@ bezier_select_draw (Tool *tool)
GDisplay *gdisp;
BezierSelect *bezier_sel;
gdisp = tool->gdisp_ptr;
gdisp = tool->gdisp;
bezier_sel = tool->private;
bezier_draw(gdisp,bezier_sel);
bezier_draw (gdisp, bezier_sel);
}
@ -2447,17 +2436,17 @@ bezier_convert (BezierSelect *bezier_sel,
gint subdivisions,
gboolean antialias)
{
PixelRegion maskPR;
BezierPoint * points;
BezierPoint * start_pt;
BezierPoint * next_curve;
GSList * list;
unsigned char *buf, *b;
int draw_type;
int * vals, val;
int start, end;
int x, x2, w;
int i, j;
PixelRegion maskPR;
BezierPoint *points;
BezierPoint *start_pt;
BezierPoint *next_curve;
GSList *list;
guchar *buf, *b;
gint draw_type;
gint *vals, val;
gint start, end;
gint x, x2, w;
gint i, j;
if (!bezier_sel->closed)
gimp_fatal_error ("bezier_convert(): tried to convert an open bezier curve");
@ -2622,16 +2611,16 @@ bezier_convert_points (BezierSelect *bezier_sel,
}
static void
bezier_convert_line (GSList ** scanlines,
int x1,
int y1,
int x2,
int y2)
bezier_convert_line (GSList **scanlines,
gint x1,
gint y1,
gint x2,
gint y2)
{
int dx, dy;
int error, inc;
int tmp;
double slope;
gint dx, dy;
gint error, inc;
gint tmp;
gdouble slope;
if (y1 == y2)
return;
@ -2739,11 +2728,11 @@ bezier_convert_line (GSList ** scanlines,
}
static GSList *
bezier_insert_in_list (GSList * list,
int x)
bezier_insert_in_list (GSList *list,
gint x)
{
GSList * orig = list;
GSList * rest;
GSList *orig = list;
GSList *rest;
if (!list)
return g_slist_prepend (list, (void *) ((long) x));
@ -2770,21 +2759,22 @@ bezier_insert_in_list (GSList * list,
}
gboolean
bezier_tool_selected()
bezier_tool_selected (void)
{
return(active_tool &&
active_tool->type == BEZIER_SELECT &&
active_tool->state == ACTIVE);
return (active_tool &&
active_tool->type == BEZIER_SELECT &&
active_tool->state == ACTIVE);
}
void
bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
bezier_paste_bezierselect_to_current (GDisplay *gdisp,
BezierSelect *bsel)
{
BezierPoint *pts;
gint i;
Tool * tool;
BezierPoint *bpnt = NULL;
int need_move = 0;
gint i;
Tool *tool;
BezierPoint *bpnt = NULL;
gint need_move = 0;
/* g_print ("bezier_paste_bezierselect_to_current::\n"); */
/* printSel(bsel); */
@ -2794,22 +2784,22 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
active_tool->type == BEZIER_SELECT &&
active_tool->state == ACTIVE)
{
BezierSelect *bezier_sel = (BezierSelect*)active_tool->private;
BezierSelect *bezier_sel = (BezierSelect *) active_tool->private;
if(bezier_sel)
{
draw_core_stop ( curSel->core, active_tool );
draw_core_stop (curSel->core, active_tool);
bezier_select_reset (bezier_sel);
}
}
gimp_context_set_tool (gimp_context_get_user (), BEZIER_SELECT);
active_tool->paused_count = 0;
active_tool->gdisp_ptr = gdisp;
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
active_tool->gdisp = gdisp;
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
tool = active_tool;
bezier_select_reset( curSel );
bezier_select_reset (curSel);
draw_core_start (curSel->core, gdisp->canvas->window, tool);
@ -2817,20 +2807,22 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
pts = (BezierPoint *) bsel->points;
for (i=0; i< bsel->num_points; i++)
for (i = 0; i < bsel->num_points; i++)
{
if(need_move)
if (need_move)
{
bezier_add_point( curSel, BEZIER_MOVE, pts->x, pts->y);
bezier_add_point (curSel, BEZIER_MOVE, pts->x, pts->y);
need_move = 0;
}
else
bezier_add_point( curSel, pts->type, pts->x, pts->y);
{
bezier_add_point (curSel, pts->type, pts->x, pts->y);
}
if(bpnt == NULL)
if (bpnt == NULL)
bpnt = curSel->last_point;
if(pts->next_curve)
if (pts->next_curve)
{
/* g_print ("bezier_paste_bezierselect_to_current:: Close last curve off \n"); */
curSel->last_point->next = bpnt;
@ -2847,21 +2839,21 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
}
}
if ( bsel->closed )
if (bsel->closed)
{
curSel->last_point->next = bpnt;
bpnt->prev = curSel->last_point;
curSel->cur_anchor = curSel->points;
curSel->cur_control = curSel->points->next;
curSel->closed = 1;
if (curTool->gdisp_ptr)
bezier_convert(curSel, curTool->gdisp_ptr, SUBDIVIDE, FALSE);
if (curTool->gdisp)
bezier_convert (curSel, curTool->gdisp, SUBDIVIDE, FALSE);
}
/* g_print ("After pasting...\n"); */
/* printSel(curSel); */
if(bsel->num_points == 0)
if (bsel->num_points == 0)
{
curSel->state = BEZIER_START;
curSel->draw = 0;
@ -2876,17 +2868,17 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
}
static void
bezier_to_sel_internal(BezierSelect *bezier_sel,
Tool *tool,
GDisplay *gdisp,
gint op,
gint replace)
bezier_to_sel_internal (BezierSelect *bezier_sel,
Tool *tool,
GDisplay *gdisp,
gint op,
gint replace)
{
/* If we're antialiased, then recompute the
* mask...
*/
if (bezier_options->antialias)
bezier_convert (bezier_sel, tool->gdisp_ptr, SUBDIVIDE, TRUE);
bezier_convert (bezier_sel, tool->gdisp, SUBDIVIDE, TRUE);
/* if (!bezier_options->extend) */
/* { */
@ -3156,7 +3148,8 @@ test_add_point_on_segment (BezierSelect *bezier_sel,
return FALSE;
}
void bezier_select_mode(gint mode)
void
bezier_select_mode (gint mode)
{
ModeEdit = mode;
}

View File

@ -81,7 +81,7 @@ typedef void (* BezierPointsFunc) (BezierSelect *bezier_sel,
gpointer data);
/* Functions */
gint bezier_select_load (void *gdisp_ptr,
gint bezier_select_load (GDisplay *gdisp,
BezierPoint *points,
gint n_points,
gint closed);

View File

@ -162,13 +162,24 @@ static guint blend_n_targets = (sizeof (blend_target_table) /
/* local function prototypes */
static void gradient_type_callback (GtkWidget *, gpointer);
static void gradient_type_callback (GtkWidget *widget,
gpointer data);
static void blend_button_press (Tool *, GdkEventButton *, gpointer);
static void blend_button_release (Tool *, GdkEventButton *, gpointer);
static void blend_motion (Tool *, GdkEventMotion *, gpointer);
static void blend_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void blend_control (Tool *, ToolAction, gpointer);
static void blend_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void blend_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void blend_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void blend_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void blend_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static void blend_options_drop_gradient (GtkWidget *, gradient_t *, gpointer);
static void blend_options_drop_tool (GtkWidget *, ToolType, gpointer);
@ -432,12 +443,10 @@ blend_options_new (void)
static void
blend_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
BlendTool * blend_tool;
BlendTool *blend_tool;
gdisp = (GDisplay *) gdisp_ptr;
blend_tool = (BlendTool *) tool->private;
switch (drawable_type (gimp_image_active_drawable (gdisp->gimage)))
@ -463,7 +472,7 @@ blend_button_press (Tool *tool,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
tool->state = ACTIVE;
/* initialize the statusbar display */
@ -477,19 +486,17 @@ blend_button_press (Tool *tool,
static void
blend_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
GImage * gimage;
BlendTool * blend_tool;
GImage *gimage;
BlendTool *blend_tool;
#ifdef BLEND_UI_CALLS_VIA_PDB
Argument *return_vals;
Argument *return_vals;
int nreturn_vals;
#else
gimp_progress *progress;
#endif
gdisp = (GDisplay *) gdisp_ptr;
gimage = gdisp->gimage;
blend_tool = (BlendTool *) tool->private;
@ -568,13 +575,11 @@ blend_button_release (Tool *tool,
static void
blend_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
BlendTool * blend_tool;
gchar vector[STATUSBAR_SIZE];
BlendTool *blend_tool;
gchar vector[STATUSBAR_SIZE];
gdisp = (GDisplay *) gdisp_ptr;
blend_tool = (BlendTool *) tool->private;
/* undraw the current tool */
@ -642,12 +647,8 @@ blend_motion (Tool *tool,
static void
blend_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
gdisp = (GDisplay *) gdisp_ptr;
switch (drawable_type (gimp_image_active_drawable (gdisp->gimage)))
{
case INDEXED_GIMAGE:
@ -669,16 +670,16 @@ blend_cursor_update (Tool *tool,
static void
blend_draw (Tool *tool)
{
GDisplay * gdisp;
BlendTool * blend_tool;
int tx1, ty1, tx2, ty2;
BlendTool *blend_tool;
gint tx1, ty1, tx2, ty2;
gdisp = (GDisplay *) tool->gdisp_ptr;
blend_tool = (BlendTool *) tool->private;
gdisplay_transform_coords (gdisp, blend_tool->startx, blend_tool->starty,
gdisplay_transform_coords (tool->gdisp,
blend_tool->startx, blend_tool->starty,
&tx1, &ty1, 1);
gdisplay_transform_coords (gdisp, blend_tool->endx, blend_tool->endy,
gdisplay_transform_coords (tool->gdisp,
blend_tool->endx, blend_tool->endy,
&tx2, &ty2, 1);
/* Draw start target */
@ -705,7 +706,7 @@ blend_draw (Tool *tool)
static void
blend_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
BlendTool * blend_tool;

View File

@ -53,26 +53,26 @@ typedef enum
REPEAT_LAST /*< skip >*/
} RepeatMode;
void blend (GimpImage *,
GimpDrawable *,
BlendMode,
gint,
GradientType,
gdouble,
gdouble,
RepeatMode,
gint,
gint,
gdouble,
gdouble,
gdouble,
gdouble,
gdouble,
progress_func_t,
gpointer);
void blend (GimpImage *gimage,
GimpDrawable *drawable,
BlendMode blend_mode,
gint paint_mode,
GradientType gradient_type,
gdouble opacity,
gdouble offset,
RepeatMode repeat,
gint supersample,
gint max_depth,
gdouble threshold,
gdouble startx,
gdouble starty,
gdouble endx,
gdouble endy,
progress_func_t progress_callback,
gpointer progress_data);
Tool * tools_new_blend (void);
void tools_free_blend (Tool *tool);
void tools_free_blend (Tool *tool);
#endif /* __BLEND_H__ */

View File

@ -20,9 +20,6 @@
#define __BOUNDARY_H__
#include "paint_funcs.h"
typedef enum
{
WithinBounds,

View File

@ -83,7 +83,9 @@ static BrightnessContrastDialog *brightness_contrast_dialog = NULL;
/* brightness contrast action functions */
static void brightness_contrast_control (Tool *, ToolAction, gpointer);
static void brightness_contrast_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static BrightnessContrastDialog * brightness_contrast_dialog_new (void);
@ -104,7 +106,7 @@ static void brightness_contrast_contrast_adjustment_update (GtkAdjustment *,
static void
brightness_contrast_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -393,13 +395,13 @@ brightness_contrast_ok_callback (GtkWidget *widget,
active_tool->preserve = TRUE;
if (!bcd->preview)
{
brightness_contrast_lut_setup (bcd->lut, bcd->brightness / 255.0,
bcd->contrast / 127.0,
gimp_drawable_bytes (bcd->drawable));
image_map_apply (bcd->image_map, (ImageMapApplyFunc) gimp_lut_process_2,
(void *) bcd->lut);
}
{
brightness_contrast_lut_setup (bcd->lut, bcd->brightness / 255.0,
bcd->contrast / 127.0,
gimp_drawable_bytes (bcd->drawable));
image_map_apply (bcd->image_map, (ImageMapApplyFunc) gimp_lut_process_2,
(void *) bcd->lut);
}
if (bcd->image_map)
image_map_commit (bcd->image_map);
@ -408,7 +410,7 @@ brightness_contrast_ok_callback (GtkWidget *widget,
bcd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -432,7 +434,7 @@ brightness_contrast_cancel_callback (GtkWidget *widget,
gdisplays_flush ();
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -20,12 +20,12 @@
#define __BRIGHTNESS_CONTRAST_H__
Tool * tools_new_brightness_contrast (void);
void tools_free_brightness_contrast (Tool *tool);
Tool * tools_new_brightness_contrast (void);
void tools_free_brightness_contrast (Tool *tool);
void brightness_contrast_dialog_hide (void);
void brightness_contrast_initialize (GDisplay *gdisp);
void brightness_contrast_initialize (GDisplay *gdisp);
#endif /* __BRIGHTNESS_CONTRAST_H__ */

View File

@ -85,14 +85,30 @@ static BucketOptions *bucket_options = NULL;
/* 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_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void bucket_fill_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void bucket_fill_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void bucket_fill_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void bucket_fill_line_color (guchar *, guchar *, guchar *,
gboolean, gint, gint);
static void bucket_fill_line_pattern (guchar *, guchar *, TempBuf *,
gboolean, gint, gint, gint, gint);
static void bucket_fill_line_color (guchar *,
guchar *,
guchar *,
gboolean ,
gint ,
gint );
static void bucket_fill_line_pattern (guchar *,
guchar *,
TempBuf *,
gboolean ,
gint ,
gint ,
gint ,
gint );
/* functions */
@ -123,7 +139,7 @@ bucket_options_new (void)
GtkWidget *frame;
/* the new bucket fill tool options structure */
options = (BucketOptions *) g_malloc (sizeof (BucketOptions));
options = g_new (BucketOptions, 1);
paint_options_init ((PaintOptions *) options,
BUCKET_FILL,
bucket_options_reset);
@ -194,13 +210,11 @@ bucket_options_new (void)
static void
bucket_fill_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
BucketTool * bucket_tool;
gboolean use_offsets;
BucketTool *bucket_tool;
gboolean use_offsets;
gdisp = (GDisplay *) gdisp_ptr;
bucket_tool = (BucketTool *) tool->private;
use_offsets = (bucket_options->sample_merged) ? FALSE : TRUE;
@ -217,21 +231,19 @@ bucket_fill_button_press (Tool *tool,
NULL, NULL, bevent->time);
/* Make the tool active and set the gdisplay which owns it */
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
tool->state = ACTIVE;
}
static void
bucket_fill_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
BucketTool * bucket_tool;
Argument *return_vals;
gint nreturn_vals;
BucketTool *bucket_tool;
Argument *return_vals;
gint nreturn_vals;
gdisp = (GDisplay *) gdisp_ptr;
bucket_tool = (BucketTool *) tool->private;
gdk_pointer_ungrab (bevent->time);
@ -267,16 +279,13 @@ bucket_fill_button_release (Tool *tool,
static void
bucket_fill_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gint x, y;
gint off_x, off_y;
gdisp = (GDisplay *) gdisp_ptr;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gint x, y;
gint off_x, off_y;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
&x, &y, FALSE, FALSE);
@ -321,7 +330,7 @@ bucket_fill_cursor_update (Tool *tool,
static void
bucket_fill_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -359,14 +368,14 @@ bucket_fill (GimpImage *gimage,
TileManager *buf_tiles;
PixelRegion bufPR, maskPR;
Channel *mask = NULL;
gint bytes;
gboolean has_alpha;
gint x1, y1, x2, y2;
guchar col [MAX_CHANNELS];
guchar *d1, *d2;
GPattern *pattern;
TempBuf *pat_buf;
gboolean new_buf = FALSE;
gint bytes;
gboolean has_alpha;
gint x1, y1, x2, y2;
guchar col [MAX_CHANNELS];
guchar *d1, *d2;
GPattern *pattern;
TempBuf *pat_buf;
gboolean new_buf = FALSE;
pat_buf = NULL;
@ -433,7 +442,7 @@ bucket_fill (GimpImage *gimage,
/* make sure we handle the mask correctly if it was sample-merged */
if (sample_merged)
{
int off_x, off_y;
gint off_x, off_y;
/* Limit the channel bounds to the drawable's extents */
drawable_offsets (drawable, &off_x, &off_y);
@ -533,8 +542,8 @@ bucket_fill_line_pattern (guchar *buf,
gint width)
{
guchar *pat, *p;
gint alpha, b;
gint i;
gint alpha, b;
gint i;
/* Get a pointer to the appropriate scanline of the pattern buffer */
pat = temp_buf_data (pattern) +
@ -571,8 +580,8 @@ bucket_fill_region (BucketFillMode fill_mode,
gboolean has_alpha)
{
guchar *s, *m;
gint y;
void *pr;
gint y;
void *pr;
for (pr = pixel_regions_register (2, bufPR, maskPR);
pr != NULL;
@ -612,8 +621,8 @@ bucket_fill_region (BucketFillMode fill_mode,
Tool *
tools_new_bucket_fill (void)
{
Tool * tool;
BucketTool * private;
Tool *tool;
BucketTool *private;
/* The tool options */
if (! bucket_options)
@ -630,7 +639,7 @@ tools_new_bucket_fill (void)
tool->scroll_lock = TRUE; /* Disallow scrolling */
tool->private = (void *) private;
tool->private = (gpointer) private;
tool->button_press_func = bucket_fill_button_press;
tool->button_release_func = bucket_fill_button_release;
@ -643,7 +652,7 @@ tools_new_bucket_fill (void)
void
tools_free_bucket_fill (Tool *tool)
{
BucketTool * bucket_tool;
BucketTool *bucket_tool;
bucket_tool = (BucketTool *) tool->private;

View File

@ -82,6 +82,7 @@ struct _ByColorDialog
GImage *gimage; /* gimage which is currently under examination */
};
/* the by color selection tool options */
static SelectionOptions * by_color_options = NULL;
@ -93,43 +94,71 @@ static GtkTargetEntry by_color_select_targets[] =
{
GIMP_TARGET_COLOR
};
static guint n_by_color_select_targets = (sizeof (by_color_select_targets) /
sizeof (by_color_select_targets[0]));
static guint n_by_color_select_targets = (sizeof (by_color_select_targets) /
sizeof (by_color_select_targets[0]));
static void by_color_select_color_drop (GtkWidget *widget,
guchar r,
guchar g,
guchar b,
gpointer data);
static void by_color_select_color_drop (GtkWidget *widget,
guchar r,
guchar g,
guchar b,
gpointer data);
/* by_color select action functions */
static void by_color_select_button_press (Tool *, GdkEventButton *, gpointer);
static void by_color_select_button_release (Tool *, GdkEventButton *, gpointer);
static void by_color_select_modifier_update (Tool *, GdkEventKey * , gpointer);
static void by_color_select_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_oper_update (Tool *, GdkEventMotion *, gpointer);
static void by_color_select_control (Tool *, ToolAction, gpointer);
static void by_color_select_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void by_color_select_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void by_color_select_modifier_update (Tool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void by_color_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void by_color_select_oper_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void by_color_select_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static ByColorDialog * by_color_select_dialog_new (void);
static ByColorDialog * by_color_select_dialog_new (void);
static void by_color_select_render (ByColorDialog *, GImage *);
static void by_color_select_draw (ByColorDialog *, GImage *);
static gint by_color_select_preview_events (GtkWidget *,
static void by_color_select_render (ByColorDialog *,
GImage *);
static void by_color_select_draw (ByColorDialog *,
GImage *);
static gint by_color_select_preview_events (GtkWidget *,
GdkEventButton *,
ByColorDialog *);
static void by_color_select_invert_callback (GtkWidget *, gpointer);
static void by_color_select_select_all_callback (GtkWidget *, gpointer);
static void by_color_select_select_none_callback (GtkWidget *, gpointer);
static void by_color_select_reset_callback (GtkWidget *, gpointer);
static void by_color_select_close_callback (GtkWidget *, gpointer);
static void by_color_select_preview_button_press (ByColorDialog *,
ByColorDialog *);
static void by_color_select_invert_callback (GtkWidget *,
gpointer );
static void by_color_select_select_all_callback (GtkWidget *,
gpointer );
static void by_color_select_select_none_callback (GtkWidget *,
gpointer );
static void by_color_select_reset_callback (GtkWidget *,
gpointer );
static void by_color_select_close_callback (GtkWidget *,
gpointer );
static void by_color_select_preview_button_press (ByColorDialog *,
GdkEventButton *);
static gint is_pixel_sufficiently_different (guchar *, guchar *,
gint, gint, gint, gint);
static Channel * by_color_select_color (GImage *, GimpDrawable *,
guchar *, gint, gint, gint);
static gint is_pixel_sufficiently_different (guchar *,
guchar *,
gint ,
gint ,
gint ,
gint );
static Channel * by_color_select_color (GImage *,
GimpDrawable *,
guchar *,
gint ,
gint ,
gint );
/* by_color selection machinery */
@ -196,18 +225,18 @@ by_color_select_color (GImage *gimage,
* use the same antialiasing scheme as in fuzzy_select. Modify the gimage's
* mask to reflect the additional selection
*/
Channel *mask;
PixelRegion imagePR, maskPR;
guchar *image_data;
guchar *mask_data;
guchar *idata, *mdata;
guchar rgb[MAX_CHANNELS];
gint has_alpha, indexed;
gint width, height;
gint bytes, color_bytes, alpha;
gint i, j;
void * pr;
gint d_type;
Channel *mask;
PixelRegion imagePR, maskPR;
guchar *image_data;
guchar *mask_data;
guchar *idata, *mdata;
guchar rgb[MAX_CHANNELS];
gint has_alpha, indexed;
gint width, height;
gint bytes, color_bytes, alpha;
gint i, j;
gpointer pr;
gint d_type;
/* Get the image information */
if (sample_merged)
@ -342,12 +371,10 @@ by_color_select (GImage *gimage,
static void
by_color_select_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
ByColorSelect *by_color_sel;
gdisp = (GDisplay *) gdisp_ptr;
by_color_sel = (ByColorSelect *) tool->private;
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
@ -359,7 +386,7 @@ by_color_select_button_press (Tool *tool,
by_color_sel->y = bevent->y;
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
/* Make sure the "by color" select dialog is visible */
if (! GTK_WIDGET_VISIBLE (by_color_dialog->shell))
@ -393,16 +420,14 @@ by_color_select_button_press (Tool *tool,
static void
by_color_select_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ByColorSelect *by_color_sel;
GDisplay *gdisp;
gint x, y;
GimpDrawable *drawable;
guchar *color;
gint use_offsets;
gdisp = (GDisplay *) gdisp_ptr;
by_color_sel = (ByColorSelect *) tool->private;
drawable = gimp_image_active_drawable (gdisp->gimage);
@ -456,14 +481,12 @@ by_color_select_button_release (Tool *tool,
static void
by_color_select_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ByColorSelect *by_col_sel;
GDisplay *gdisp;
Layer *layer;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
by_col_sel = (ByColorSelect *) tool->private;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
@ -551,7 +574,7 @@ by_color_select_update_op_state (ByColorSelect *by_col_sel,
static void
by_color_select_modifier_update (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ByColorSelect *by_col_sel;
gint state;
@ -584,26 +607,25 @@ by_color_select_modifier_update (Tool *tool,
break;
}
by_color_select_update_op_state (by_col_sel, state, (GDisplay *) gdisp_ptr);
by_color_select_update_op_state (by_col_sel, state, gdisp);
}
static void
by_color_select_oper_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ByColorSelect *by_col_sel;
by_col_sel = (ByColorSelect *) tool->private;
by_color_select_update_op_state (by_col_sel, mevent->state,
(GDisplay *) gdisp_ptr);
by_color_select_update_op_state (by_col_sel, mevent->state, gdisp);
}
static void
by_color_select_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{

View File

@ -79,37 +79,59 @@ struct _CloneOptions
};
/* forward function declarations */
static gpointer clone_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void clone_draw (Tool *tool);
static void clone_motion (PaintCore *paint_core,
GimpDrawable *drawable,
GimpDrawable *src_drawable,
PaintPressureOptions *pressure_options,
CloneType type,
gint offset_x,
gint offset_y);
static void clone_line_image (GImage *dest,
GImage *src,
GimpDrawable *d_drawable,
GimpDrawable *s_drawable,
guchar *s,
guchar *d,
gint has_alpha,
gint src_bytes,
gint dest_bytes,
gint width);
static void clone_line_pattern (GImage *dest,
GimpDrawable *drawable,
GPattern *pattern,
guchar *d,
gint x,
gint y,
gint bytes,
gint width);
/* the clone tool options */
static CloneOptions *clone_options = NULL;
/* local variables */
static int src_x = 0; /* */
static int src_y = 0; /* position of clone src */
static int dest_x = 0; /* */
static int dest_y = 0; /* position of clone src */
static int offset_x = 0; /* */
static int offset_y = 0; /* offset for cloning */
static int first = TRUE;
static int trans_tx, trans_ty; /* transformed target */
static gint src_x = 0; /* */
static gint src_y = 0; /* position of clone src */
static gint dest_x = 0; /* */
static gint dest_y = 0; /* position of clone src */
static gint offset_x = 0; /* */
static gint offset_y = 0; /* offset for cloning */
static gint first = TRUE;
static gint trans_tx, trans_ty; /* transformed target */
static GDisplay *the_src_gdisp = NULL; /* ID of source gdisplay */
static GimpDrawable *src_drawable_ = NULL; /* source drawable */
static GimpDrawable *non_gui_src_drawable;
static int non_gui_offset_x;
static int non_gui_offset_y;
static gint non_gui_offset_x;
static gint non_gui_offset_y;
static CloneType non_gui_type;
/* forward function declarations */
static void clone_draw (Tool *);
static void clone_motion (PaintCore *, GimpDrawable *, GimpDrawable *,
PaintPressureOptions *, CloneType, int, int);
static void clone_line_image (GImage *, GImage *, GimpDrawable *,
GimpDrawable *, unsigned char *,
unsigned char *, int, int, int, int);
static void clone_line_pattern (GImage *, GimpDrawable *, GPattern *,
unsigned char *, int, int, int, int);
/* functions */
@ -128,8 +150,8 @@ static CloneOptions *
clone_options_new (void)
{
CloneOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *frame;
/* the new clone tool options structure */
options = g_new (CloneOptions, 1);
@ -202,23 +224,24 @@ clone_set_src_drawable (GimpDrawable *drawable)
}
}
void *
static gpointer
clone_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
gint state)
PaintState state)
{
GDisplay * gdisp;
GDisplay * src_gdisp;
int x1, y1, x2, y2;
static int orig_src_x, orig_src_y;
GDisplay *gdisp;
GDisplay *src_gdisp;
gint x1, y1, x2, y2;
static gint orig_src_x, orig_src_y;
gdisp = (GDisplay *) active_tool->gdisp_ptr;
gdisp = (GDisplay *) active_tool->gdisp;
switch (state)
{
case PRETRACE_PAINT:
draw_core_pause (paint_core->core, active_tool);
break;
case MOTION_PAINT:
x1 = paint_core->curx;
y1 = paint_core->cury;
@ -320,14 +343,11 @@ clone_paint_func (PaintCore *paint_core,
void
clone_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
int x, y;
gdisp = (GDisplay *) gdisp_ptr;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gint x, y;
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
&x, &y, TRUE, FALSE);
@ -661,10 +681,10 @@ clone_line_pattern (GImage *dest,
}
}
static void *
clone_non_gui_paint_func (PaintCore *paint_core,
static gpointer
clone_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
clone_motion (paint_core, drawable, non_gui_src_drawable,
&non_gui_pressure_options,
@ -675,16 +695,16 @@ clone_non_gui_paint_func (PaintCore *paint_core,
gboolean
clone_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
GimpDrawable *src_drawable = NULL;
CloneType clone_type = CLONE_DEFAULT_TYPE;
double local_src_x = 0.0;
double local_src_y = 0.0;
gdouble local_src_x = 0.0;
gdouble local_src_y = 0.0;
CloneOptions *options = clone_options;
if(options)
if (options)
{
clone_type = options->type;
src_drawable = src_drawable_;
@ -692,23 +712,23 @@ clone_non_gui_default (GimpDrawable *drawable,
local_src_y = src_y;
}
return clone_non_gui(drawable,
src_drawable,
clone_type,
local_src_x,local_src_y,
num_strokes,stroke_array);
return clone_non_gui (drawable,
src_drawable,
clone_type,
local_src_x,local_src_y,
num_strokes, stroke_array);
}
gboolean
clone_non_gui (GimpDrawable *drawable,
GimpDrawable *src_drawable,
CloneType clone_type,
double src_x,
double src_y,
int num_strokes,
double *stroke_array)
gdouble src_x,
gdouble src_y,
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))

View File

@ -26,21 +26,19 @@ typedef enum
PATTERN_CLONE
} CloneType;
void * clone_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean clone_non_gui (GimpDrawable *,
GimpDrawable *,
CloneType,
gdouble,
gdouble,
gint,
gdouble *);
gboolean clone_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean clone_non_gui (GimpDrawable *drawable,
GimpDrawable *src_drawable,
CloneType clone_type,
gdouble src_x,
gdouble src_y,
gint num_strokes,
gdouble *stroke_array);
gboolean clone_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);
void tools_free_clone (Tool *tool);
#endif /* __CLONE_H__ */

View File

@ -62,21 +62,33 @@ static ColorBalanceDialog *color_balance_dialog = NULL;
/* color balance action functions */
static void color_balance_control (Tool *, ToolAction, gpointer);
static void color_balance_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static ColorBalanceDialog * color_balance_dialog_new (void);
static void color_balance_update (ColorBalanceDialog *, int);
static void color_balance_preview (ColorBalanceDialog *);
static void color_balance_reset_callback (GtkWidget *, gpointer);
static void color_balance_ok_callback (GtkWidget *, gpointer);
static void color_balance_cancel_callback (GtkWidget *, gpointer);
static void color_balance_range_callback (GtkWidget *, gpointer);
static void color_balance_preserve_update (GtkWidget *, gpointer);
static void color_balance_preview_update (GtkWidget *, gpointer);
static void color_balance_cr_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_mg_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_yb_adjustment_update (GtkAdjustment *, gpointer);
static void color_balance_update (ColorBalanceDialog *cbd,
gint );
static void color_balance_preview (ColorBalanceDialog *cbd);
static void color_balance_reset_callback (GtkWidget *widget,
gpointer data);
static void color_balance_ok_callback (GtkWidget *widget,
gpointer data);
static void color_balance_cancel_callback (GtkWidget *widget,
gpointer data);
static void color_balance_range_callback (GtkWidget *widget,
gpointer data);
static void color_balance_preserve_update (GtkWidget *widget,
gpointer data);
static void color_balance_preview_update (GtkWidget *widget,
gpointer data);
static void color_balance_cr_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void color_balance_mg_adjustment_update (GtkAdjustment *adj,
gpointer data);
static void color_balance_yb_adjustment_update (GtkAdjustment *adj,
gpointer data);
/* color balance machinery */
@ -86,12 +98,12 @@ color_balance (PixelRegion *srcPR,
void *data)
{
ColorBalanceDialog *cbd;
guchar *src, *s;
guchar *dest, *d;
gint alpha;
gint r, g, b;
gint r_n, g_n, b_n;
gint w, h;
guchar *src, *s;
guchar *dest, *d;
gboolean alpha;
gint r, g, b;
gint r_n, g_n, b_n;
gint w, h;
cbd = (ColorBalanceDialog *) data;
@ -143,7 +155,7 @@ color_balance (PixelRegion *srcPR,
static void
color_balance_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ColorBalance * color_bal;
@ -599,7 +611,7 @@ color_balance_ok_callback (GtkWidget *widget,
cbd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -623,7 +635,7 @@ color_balance_cancel_callback (GtkWidget *widget,
cbd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -100,24 +100,36 @@ static gchar hex_buf [MAX_INFO_BUF];
/* local function prototypes */
static void color_picker_button_press (Tool *, GdkEventButton *, gpointer);
static void color_picker_button_release (Tool *, GdkEventButton *, gpointer);
static void color_picker_motion (Tool *, GdkEventMotion *, gpointer);
static void color_picker_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void color_picker_control (Tool *, ToolAction, gpointer);
static void color_picker_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void color_picker_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void color_picker_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void color_picker_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void color_picker_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static void color_picker_info_window_close_callback (GtkWidget *, gpointer);
static void color_picker_info_update (Tool *, gboolean);
static void color_picker_info_window_close_callback (GtkWidget *widget,
gpointer data);
static void color_picker_info_update (Tool *tool,
gboolean valid);
static gboolean pick_color_do (GimpImage *gimage,
GimpDrawable *drawable,
gint x,
gint y,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
gboolean update_active,
gint final);
static gboolean pick_color_do (GimpImage *gimage,
GimpDrawable *drawable,
gint x,
gint y,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
gboolean update_active,
gint final);
/* functions */
@ -235,19 +247,17 @@ color_picker_options_new (void)
static void
color_picker_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
ColorPickerTool *cp_tool;
gint x, y;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
cp_tool = (ColorPickerTool *) tool->private;
/* Make the tool active and set it's gdisplay & drawable */
tool->gdisp_ptr = gdisp;
tool->gdisp = gdisp;
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
tool->state = ACTIVE;
tool->state = ACTIVE;
/* create the info dialog if it doesn't exist */
if (! color_picker_info)
@ -356,15 +366,14 @@ color_picker_button_press (Tool *tool,
static void
color_picker_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
ColorPickerTool *cp_tool;
gint x, y;
gint x, y;
gdk_pointer_ungrab (bevent->time);
gdk_flush ();
gdisp = (GDisplay *) gdisp_ptr;
cp_tool = (ColorPickerTool *) tool->private;
/* First, transform the coordinates to gimp image space */
@ -386,13 +395,11 @@ color_picker_button_release (Tool *tool,
static void
color_picker_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
ColorPickerTool *cp_tool;
gint x, y;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
cp_tool = (ColorPickerTool *) tool->private;
/* undraw the current tool */
@ -421,13 +428,10 @@ color_picker_motion (Tool *tool,
static void
color_picker_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y,
FALSE, FALSE);
@ -446,9 +450,9 @@ color_picker_cursor_update (Tool *tool,
static void
color_picker_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
ColorPickerTool * cp_tool;
ColorPickerTool *cp_tool;
cp_tool = (ColorPickerTool *) tool->private;
@ -594,25 +598,23 @@ pick_color (GimpImage *gimage,
static void
colorpicker_draw (Tool *tool)
{
GDisplay * gdisp;
ColorPickerTool * cp_tool;
gint tx, ty;
gint radiusx, radiusy;
gint cx, cy;
ColorPickerTool *cp_tool;
gint tx, ty;
gint radiusx, radiusy;
gint cx, cy;
if (! color_picker_options->sample_average)
return;
gdisp = (GDisplay *) tool->gdisp_ptr;
cp_tool = (ColorPickerTool *) tool->private;
gdisplay_transform_coords (gdisp, cp_tool->centerx, cp_tool->centery,
gdisplay_transform_coords (tool->gdisp, cp_tool->centerx, cp_tool->centery,
&tx, &ty, TRUE);
radiusx = SCALEX (gdisp, color_picker_options->average_radius);
radiusy = SCALEY (gdisp, color_picker_options->average_radius);
cx = SCALEX (gdisp, 1);
cy = SCALEY (gdisp, 1);
radiusx = SCALEX (tool->gdisp, color_picker_options->average_radius);
radiusy = SCALEY (tool->gdisp, color_picker_options->average_radius);
cx = SCALEX (tool->gdisp, 1);
cy = SCALEY (tool->gdisp, 1);
/* Draw the circle around the collecting area */
gdk_draw_rectangle (cp_tool->core->win, cp_tool->core->gc, 0,

View File

@ -1080,11 +1080,12 @@ tools_select_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action)
{
ToolType tool_type;
GDisplay *gdisp;
gdisp = gdisplay_active ();
ToolType tool_type;
GDisplay *gdisp;
tool_type = (ToolType) callback_action;
gdisp = gdisplay_active ();
gimp_context_set_tool (gimp_context_get_user (), tool_type);
@ -1101,12 +1102,12 @@ tools_select_cmd_callback (GtkWidget *widget,
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
}
/* setting the gdisp_ptr here is a HACK to allow the tools'
/* setting the tool->gdisp here is a HACK to allow the tools'
* dialog windows being hidden if the tool was selected from
* a tear-off-menu and there was no mouse click in the display
* before deleting it
*/
active_tool->gdisp_ptr = gdisp;
active_tool->gdisp = gdisp;
}
/***** Filters *****/

View File

@ -82,6 +82,28 @@ struct _ConvolveOptions
};
/* forward function declarations */
static void calculate_matrix (ConvolveType type,
gdouble rate);
static void integer_matrix (gfloat *source,
gint *dest,
gint size);
static void copy_matrix (gfloat *src,
gfloat *dest,
gint size);
static gint sum_matrix (gint *matrix,
gint size);
static gpointer convolve_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void convolve_motion (PaintCore *paint_core,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
ConvolveType type,
gdouble rate);
/* the convolve tool options */
static ConvolveOptions * convolve_options = NULL;
@ -121,19 +143,8 @@ static gfloat sharpen_matrix [25] =
};
/* forward function declarations */
static void calculate_matrix (ConvolveType, double);
static void integer_matrix (float *, int *, int);
static void copy_matrix (float *, float *, int);
static int sum_matrix (int *, int);
static void convolve_motion (PaintCore *, GimpDrawable *,
PaintPressureOptions *,
ConvolveType, double);
/* functions */
static void
convolve_options_reset (void)
{
@ -205,10 +216,10 @@ convolve_options_new (void)
return options;
}
void *
static gpointer
convolve_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
switch (state)
{
@ -217,6 +228,9 @@ convolve_paint_func (PaintCore *paint_core,
convolve_options->paint_options.pressure_options,
convolve_options->type, convolve_options->rate);
break;
default:
break;
}
return NULL;
@ -225,7 +239,7 @@ convolve_paint_func (PaintCore *paint_core,
static void
convolve_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -282,18 +296,18 @@ convolve_modifier_key_func (Tool *tool,
static void
convolve_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
paint_core_cursor_update (tool, mevent, gdisp);
}
Tool *
tools_new_convolve (void)
{
Tool * tool;
PaintCore * private;
Tool *tool;
PaintCore *private;
/* The tool options */
if (! convolve_options)
@ -570,34 +584,34 @@ calculate_matrix (ConvolveType type,
}
static void
integer_matrix (float *source,
int *dest,
int size)
integer_matrix (gfloat *source,
gint *dest,
gint size)
{
int i;
gint i;
#define PRECISION 10000
for (i = 0; i < size*size; i++)
*dest++ = (int) (*source ++ * PRECISION);
*dest++ = (gint) (*source ++ * PRECISION);
}
static void
copy_matrix (float *src,
float *dest,
int size)
copy_matrix (gfloat *src,
gfloat *dest,
gint size)
{
int i;
gint i;
for (i = 0; i < size*size; i++)
*dest++ = *src++;
}
static int
sum_matrix (int *matrix,
int size)
sum_matrix (gint *matrix,
gint size)
{
int sum = 0;
gint sum = 0;
size *= size;
@ -608,10 +622,10 @@ sum_matrix (int *matrix,
}
static void *
convolve_non_gui_paint_func (PaintCore *paint_core,
static gpointer
convolve_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
convolve_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_type, non_gui_rate);
@ -621,11 +635,11 @@ convolve_non_gui_paint_func (PaintCore *paint_core,
gboolean
convolve_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
double rate = DEFAULT_CONVOLVE_RATE;
ConvolveType type = DEFAULT_CONVOLVE_TYPE;
gdouble rate = DEFAULT_CONVOLVE_RATE;
ConvolveType type = DEFAULT_CONVOLVE_TYPE;
ConvolveOptions *options = convolve_options;
if (options)
@ -641,17 +655,17 @@ gboolean
convolve_non_gui (GimpDrawable *drawable,
double rate,
ConvolveType type,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
{
/* Set the paint core's paint func */
non_gui_paint_core.paint_func = convolve_non_gui_paint_func;
non_gui_type = type;
non_gui_rate = rate;
@ -678,6 +692,6 @@ convolve_non_gui (GimpDrawable *drawable,
paint_core_cleanup ();
return TRUE;
}
else
return FALSE;
return FALSE;
}

View File

@ -28,19 +28,17 @@ typedef enum
} ConvolveType;
void * convolve_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean convolve_non_gui (GimpDrawable *,
gdouble ,
ConvolveType ,
gint ,
gdouble *);
gboolean convolve_non_gui_default (GimpDrawable *,
gint ,
gdouble *);
Tool * tools_new_convolve (void );
void tools_free_convolve (Tool *);
gboolean convolve_non_gui (GimpDrawable *drawable,
gdouble rate,
ConvolveType type,
gint num_strokes,
gdouble *stroke_array);
gboolean convolve_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_convolve (void);
void tools_free_convolve (Tool *tool);
#endif /* __CONVOLVE_H__ */

View File

@ -162,13 +162,24 @@ static guint blend_n_targets = (sizeof (blend_target_table) /
/* local function prototypes */
static void gradient_type_callback (GtkWidget *, gpointer);
static void gradient_type_callback (GtkWidget *widget,
gpointer data);
static void blend_button_press (Tool *, GdkEventButton *, gpointer);
static void blend_button_release (Tool *, GdkEventButton *, gpointer);
static void blend_motion (Tool *, GdkEventMotion *, gpointer);
static void blend_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void blend_control (Tool *, ToolAction, gpointer);
static void blend_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void blend_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void blend_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void blend_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void blend_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static void blend_options_drop_gradient (GtkWidget *, gradient_t *, gpointer);
static void blend_options_drop_tool (GtkWidget *, ToolType, gpointer);
@ -432,12 +443,10 @@ blend_options_new (void)
static void
blend_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
BlendTool * blend_tool;
BlendTool *blend_tool;
gdisp = (GDisplay *) gdisp_ptr;
blend_tool = (BlendTool *) tool->private;
switch (drawable_type (gimp_image_active_drawable (gdisp->gimage)))
@ -463,7 +472,7 @@ blend_button_press (Tool *tool,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
tool->state = ACTIVE;
/* initialize the statusbar display */
@ -477,19 +486,17 @@ blend_button_press (Tool *tool,
static void
blend_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
GImage * gimage;
BlendTool * blend_tool;
GImage *gimage;
BlendTool *blend_tool;
#ifdef BLEND_UI_CALLS_VIA_PDB
Argument *return_vals;
Argument *return_vals;
int nreturn_vals;
#else
gimp_progress *progress;
#endif
gdisp = (GDisplay *) gdisp_ptr;
gimage = gdisp->gimage;
blend_tool = (BlendTool *) tool->private;
@ -568,13 +575,11 @@ blend_button_release (Tool *tool,
static void
blend_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
BlendTool * blend_tool;
gchar vector[STATUSBAR_SIZE];
BlendTool *blend_tool;
gchar vector[STATUSBAR_SIZE];
gdisp = (GDisplay *) gdisp_ptr;
blend_tool = (BlendTool *) tool->private;
/* undraw the current tool */
@ -642,12 +647,8 @@ blend_motion (Tool *tool,
static void
blend_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
gdisp = (GDisplay *) gdisp_ptr;
switch (drawable_type (gimp_image_active_drawable (gdisp->gimage)))
{
case INDEXED_GIMAGE:
@ -669,16 +670,16 @@ blend_cursor_update (Tool *tool,
static void
blend_draw (Tool *tool)
{
GDisplay * gdisp;
BlendTool * blend_tool;
int tx1, ty1, tx2, ty2;
BlendTool *blend_tool;
gint tx1, ty1, tx2, ty2;
gdisp = (GDisplay *) tool->gdisp_ptr;
blend_tool = (BlendTool *) tool->private;
gdisplay_transform_coords (gdisp, blend_tool->startx, blend_tool->starty,
gdisplay_transform_coords (tool->gdisp,
blend_tool->startx, blend_tool->starty,
&tx1, &ty1, 1);
gdisplay_transform_coords (gdisp, blend_tool->endx, blend_tool->endy,
gdisplay_transform_coords (tool->gdisp,
blend_tool->endx, blend_tool->endy,
&tx2, &ty2, 1);
/* Draw start target */
@ -705,7 +706,7 @@ blend_draw (Tool *tool)
static void
blend_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
BlendTool * blend_tool;

View File

@ -107,16 +107,16 @@ image_map_do (gpointer data)
}
ImageMap
image_map_create (void *gdisp_ptr,
image_map_create (GDisplay *gdisp,
GimpDrawable *drawable)
{
_ImageMap *_image_map;
_image_map = g_new (_ImageMap, 1);
_image_map->gdisp = (GDisplay *) gdisp_ptr;
_image_map->drawable = drawable;
_image_map->gdisp = gdisp;
_image_map->drawable = drawable;
_image_map->undo_tiles = NULL;
_image_map->state = WAITING;
_image_map->state = WAITING;
/* Interactive tools based on image_map disable the undo stack */
/* to avert any unintented undo interaction through the UI */

View File

@ -26,8 +26,8 @@
* MUST be followed with an image_map_commit or an image_map_abort call
* The image map is no longer valid after a call to commit or abort.
*/
ImageMap image_map_create (void *,
GimpDrawable *);
ImageMap image_map_create (GDisplay *gdisp,
GimpDrawable *drawable);
void image_map_apply (ImageMap,
ImageMapApplyFunc,
void *);

View File

@ -375,10 +375,10 @@ gdisplay_delete (GDisplay *gdisp)
/* clear out the pointer to this gdisp from the active tool */
if (active_tool &&
active_tool->gdisp_ptr == gdisp)
active_tool->gdisp == gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
}
/* free the selection structure */

View File

@ -121,25 +121,49 @@ static GtkWidget *size_sizeentry;
/* Crop type functions */
static void crop_button_press (Tool *, GdkEventButton *, gpointer);
static void crop_button_release (Tool *, GdkEventButton *, gpointer);
static void crop_motion (Tool *, GdkEventMotion *, gpointer);
static void crop_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void crop_control (Tool *, ToolAction, gpointer);
static void crop_arrow_keys_func (Tool *, GdkEventKey *, gpointer);
static void crop_modifier_key_func (Tool *, GdkEventKey *, gpointer);
static void crop_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void crop_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void crop_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void crop_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void crop_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static void crop_arrow_keys_func (Tool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void crop_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
/* Crop helper functions */
static void crop_recalc (Tool *, Crop *);
static void crop_start (Tool *, Crop *);
static void crop_adjust_guides (GImage *, int, int, int, int);
static void crop_recalc (Tool *tool,
Crop *crop);
static void crop_start (Tool *tool,
Crop *crop);
static void crop_adjust_guides (GImage *gimage,
gint x1,
gint y1,
gint x2,
gint y2);
/* Crop dialog functions */
static void crop_info_update (Tool *);
static void crop_info_create (Tool *);
static void crop_crop_callback (GtkWidget *, gpointer);
static void crop_resize_callback (GtkWidget *, gpointer);
static void crop_close_callback (GtkWidget *, gpointer);
static void crop_info_update (Tool *tool);
static void crop_info_create (Tool *tool);
static void crop_crop_callback (GtkWidget *widget,
gpointer data);
static void crop_resize_callback (GtkWidget *widget,
gpointer data);
static void crop_close_callback (GtkWidget *widget,
gpointer data);
/* Crop area-select functions */
typedef enum
@ -149,19 +173,40 @@ typedef enum
AUTO_CROP_COLOR = 2
} AutoCropType;
typedef guchar * (*GetColorFunc) (GtkObject *, int, int);
typedef AutoCropType (*ColorsEqualFunc) (guchar *, guchar *, int);
static void crop_selection_callback (GtkWidget *, gpointer);
static void crop_automatic_callback (GtkWidget *, gpointer);
static AutoCropType crop_guess_bgcolor (GtkObject *, GetColorFunc,
int, int, guchar *, int, int, int, int);
static int crop_colors_equal (guchar *, guchar *, int);
static int crop_colors_alpha (guchar *, guchar *, int);
typedef guchar * (* GetColorFunc) (GtkObject *,
gint ,
gint );
typedef AutoCropType (* ColorsEqualFunc) (guchar *,
guchar *,
gint );
static void crop_selection_callback (GtkWidget *widget,
gpointer data);
static void crop_automatic_callback (GtkWidget *widget,
gpointer data);
static AutoCropType crop_guess_bgcolor (GtkObject *,
GetColorFunc,
gint ,
gint ,
guchar *,
gint ,
gint ,
gint ,
gint );
static gint crop_colors_equal (guchar *,
guchar *,
gint );
static gint crop_colors_alpha (guchar *,
guchar *,
gint );
/* Crop dialog callback funtions */
static void crop_orig_changed (GtkWidget *, gpointer);
static void crop_size_changed (GtkWidget *, gpointer);
static void crop_orig_changed (GtkWidget *widget,
gpointer data);
static void crop_size_changed (GtkWidget *widget,
gpointer data);
/* Functions */
@ -182,8 +227,8 @@ static CropOptions *
crop_options_new (void)
{
CropOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *frame;
/* the new crop tool options structure */
options = g_new (CropOptions, 1);
@ -241,16 +286,14 @@ crop_options_new (void)
static void
crop_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Crop * crop;
GDisplay * gdisp;
Crop *crop;
gdisp = (GDisplay *) gdisp_ptr;
crop = (Crop *) tool->private;
if (tool->state == INACTIVE ||
gdisp_ptr != tool->gdisp_ptr)
gdisp != tool->gdisp)
{
crop->function = CREATING;
}
@ -291,7 +334,7 @@ crop_button_press (Tool *tool,
if (tool->state == ACTIVE)
draw_core_stop (crop->core, tool);
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
tool->drawable = gimp_image_active_drawable (gdisp->gimage);
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
@ -318,13 +361,11 @@ crop_button_press (Tool *tool,
static void
crop_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Crop * crop;
GDisplay *gdisp;
Crop *crop;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
gdk_pointer_ungrab (bevent->time);
gdk_flush ();
@ -352,13 +393,15 @@ crop_button_release (Tool *tool,
static void
crop_adjust_guides (GImage *gimage,
int x1, int y1,
int x2, int y2)
gint x1,
gint y1,
gint x2,
gint y2)
{
GList * glist;
Guide * guide;
gboolean remove_guide;
GList *glist;
Guide *guide;
gboolean remove_guide;
for (glist = gimage->guides; glist; glist = g_list_next (glist))
{
@ -407,19 +450,17 @@ crop_adjust_guides (GImage *gimage,
static void
crop_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Crop *crop;
GDisplay *gdisp;
Layer *layer;
gint x1, y1, x2, y2;
gint curx, cury;
gint inc_x, inc_y;
gchar size[STATUSBAR_SIZE];
gint min_x, min_y, max_x, max_y;
Crop *crop;
Layer *layer;
gint x1, y1, x2, y2;
gint curx, cury;
gint inc_x, inc_y;
gchar size[STATUSBAR_SIZE];
gint min_x, min_y, max_x, max_y;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
/* This is the only case when the motion events should be ignored--
we're just waiting for the button release event to crop the image */
@ -554,19 +595,17 @@ crop_motion (Tool *tool,
static void
crop_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Crop *crop;
Crop *crop;
GdkCursorType ctype = GIMP_MOUSE_CURSOR;
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gdisp = (GDisplay *) gdisp_ptr;
crop = (Crop *) tool->private;
if (tool->state == INACTIVE ||
(tool->state == ACTIVE && tool->gdisp_ptr != gdisp_ptr))
(tool->state == ACTIVE && tool->gdisp != gdisp))
{
ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
}
@ -605,16 +644,13 @@ crop_cursor_update (Tool *tool,
static void
crop_arrow_keys_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
Crop *crop;
gint inc_x, inc_y;
gint min_x, min_y;
gint max_x, max_y;
gdisp = (GDisplay *) gdisp_ptr;
Layer *layer;
Crop *crop;
gint inc_x, inc_y;
gint min_x, min_y;
gint max_x, max_y;
if (tool->state == ACTIVE)
{
@ -687,7 +723,7 @@ crop_arrow_keys_func (Tool *tool,
static void
crop_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -712,7 +748,7 @@ crop_modifier_key_func (Tool *tool,
static void
crop_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Crop *crop;
@ -741,19 +777,17 @@ crop_control (Tool *tool,
void
crop_draw (Tool *tool)
{
Crop *crop;
GDisplay *gdisp;
Crop *crop;
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
crop = (Crop *) tool->private;
#define SRW 10
#define SRH 10
gdk_draw_line (crop->core->win, crop->core->gc,
crop->x1, crop->y1, gdisp->disp_width, crop->y1);
crop->x1, crop->y1, tool->gdisp->disp_width, crop->y1);
gdk_draw_line (crop->core->win, crop->core->gc,
crop->x1, crop->y1, crop->x1, gdisp->disp_height);
crop->x1, crop->y1, crop->x1, tool->gdisp->disp_height);
gdk_draw_line (crop->core->win, crop->core->gc,
crop->x2, crop->y2, 0, crop->y2);
gdk_draw_line (crop->core->win, crop->core->gc,
@ -843,10 +877,10 @@ crop_image (GImage *gimage,
Channel *channel;
GList *guide_list_ptr;
GSList *list;
gint width, height;
gint lx1, ly1, lx2, ly2;
gint off_x, off_y;
gint doff_x, doff_y;
gint width, height;
gint lx1, ly1, lx2, ly2;
gint off_x, off_y;
gint doff_x, doff_y;
width = x2 - x1;
height = y2 - y1;
@ -978,13 +1012,9 @@ static void
crop_recalc (Tool *tool,
Crop *crop)
{
GDisplay *gdisp;
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisplay_transform_coords (gdisp, crop->tx1, crop->ty1,
gdisplay_transform_coords (tool->gdisp, crop->tx1, crop->ty1,
&crop->x1, &crop->y1, FALSE);
gdisplay_transform_coords (gdisp, crop->tx2, crop->ty2,
gdisplay_transform_coords (tool->gdisp, crop->tx2, crop->ty2,
&crop->x2, &crop->y2, FALSE);
}
@ -993,9 +1023,6 @@ crop_start (Tool *tool,
Crop *crop)
{
static GDisplay *old_gdisp = NULL;
GDisplay *gdisp;
gdisp = (GDisplay *) tool->gdisp_ptr;
crop_recalc (tool, crop);
@ -1006,33 +1033,33 @@ crop_start (Tool *tool,
gtk_signal_handler_block_by_data (GTK_OBJECT (size_sizeentry), crop_info);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
gdisp->gimage->xresolution, FALSE);
tool->gdisp->gimage->xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
gdisp->gimage->yresolution, FALSE);
tool->gdisp->gimage->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
0, gdisp->gimage->width);
0, tool->gdisp->gimage->width);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
0, gdisp->gimage->height);
0, tool->gdisp->gimage->height);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
gdisp->gimage->xresolution, FALSE);
tool->gdisp->gimage->xresolution, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
gdisp->gimage->yresolution, FALSE);
tool->gdisp->gimage->yresolution, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
0, gdisp->gimage->width);
0, tool->gdisp->gimage->width);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
0, gdisp->gimage->height);
0, tool->gdisp->gimage->height);
if (old_gdisp != gdisp)
if (old_gdisp != tool->gdisp)
{
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
gdisp->gimage->unit) ;
tool->gdisp->gimage->unit) ;
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
gdisp->gimage->unit);
tool->gdisp->gimage->unit);
if (gdisp->dot_for_dot)
if (tool->gdisp->dot_for_dot)
{
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
GIMP_UNIT_PIXEL);
@ -1044,15 +1071,16 @@ crop_start (Tool *tool,
gtk_signal_handler_unblock_by_data (GTK_OBJECT (size_sizeentry), crop_info);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (origin_sizeentry), crop_info);
old_gdisp = gdisp;
old_gdisp = tool->gdisp;
/* initialize the statusbar display */
crop->context_id =
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "crop");
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar),
gtk_statusbar_get_context_id (GTK_STATUSBAR (tool->gdisp->statusbar),
"crop");
gtk_statusbar_push (GTK_STATUSBAR (tool->gdisp->statusbar),
crop->context_id, _("Crop: 0 x 0"));
draw_core_start (crop->core, gdisp->canvas->window, tool);
draw_core_start (crop->core, tool->gdisp->canvas->window, tool);
}
@ -1068,7 +1096,7 @@ crop_info_create (Tool *tool)
GtkWidget *bbox;
GtkWidget *button;
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisp = (GDisplay *) tool->gdisp;
/* create the info dialog */
crop_info = info_dialog_new (_("Crop & Resize Information"),
@ -1147,11 +1175,9 @@ crop_info_create (Tool *tool)
static void
crop_info_update (Tool *tool)
{
Crop *crop;
GDisplay *gdisp;
Crop *crop;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
orig_vals[0] = crop->tx1;
orig_vals[1] = crop->ty1;
@ -1166,15 +1192,13 @@ static void
crop_crop_callback (GtkWidget *widget,
gpointer data)
{
Tool *tool;
Crop *crop;
GDisplay *gdisp;
Tool *tool;
Crop *crop;
tool = active_tool;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
crop_image (gdisp->gimage,
crop_image (tool->gdisp->gimage,
crop->tx1, crop->ty1,
crop->tx2, crop->ty2,
crop_options->layer_only,
@ -1188,15 +1212,13 @@ static void
crop_resize_callback (GtkWidget *widget,
gpointer data)
{
Tool *tool;
Crop *crop;
GDisplay *gdisp;
Tool *tool;
Crop *crop;
tool = active_tool;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
crop_image (gdisp->gimage,
crop_image (tool->gdisp->gimage,
crop->tx1, crop->ty1,
crop->tx2, crop->ty2,
crop_options->layer_only,
@ -1221,9 +1243,9 @@ crop_close_callback (GtkWidget *widget,
info_dialog_popdown (crop_info);
tool->gdisp_ptr = NULL;
tool->gdisp = NULL;
tool->drawable = NULL;
tool->state = INACTIVE;
tool->state = INACTIVE;
}
static void
@ -1235,9 +1257,9 @@ crop_selection_callback (GtkWidget *widget,
Layer *layer;
GDisplay *gdisp;
tool = active_tool;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
tool = active_tool;
crop = (Crop *) tool->private;
gdisp = tool->gdisp;
draw_core_pause (crop->core, tool);
if (! gimage_mask_bounds (gdisp->gimage,
@ -1266,24 +1288,24 @@ static void
crop_automatic_callback (GtkWidget *widget,
gpointer data)
{
Tool *tool;
Crop *crop;
GDisplay *gdisp;
GimpDrawable *active_drawable = NULL;
GetColorFunc get_color_func;
ColorsEqualFunc colors_equal_func;
GtkObject *get_color_obj;
guchar bgcolor[4] = {0, 0, 0, 0};
gboolean has_alpha = FALSE;
PixelRegion PR;
guchar *buffer = NULL;
gint offset_x, offset_y, width, height, bytes;
gint x, y, abort;
gint x1, y1, x2, y2;
Tool *tool;
Crop *crop;
GDisplay *gdisp;
GimpDrawable *active_drawable = NULL;
GetColorFunc get_color_func;
ColorsEqualFunc colors_equal_func;
GtkObject *get_color_obj;
guchar bgcolor[4] = {0, 0, 0, 0};
gboolean has_alpha = FALSE;
PixelRegion PR;
guchar *buffer = NULL;
gint offset_x, offset_y, width, height, bytes;
gint x, y, abort;
gint x1, y1, x2, y2;
tool = active_tool;
crop = (Crop *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisp = tool->gdisp;
draw_core_pause (crop->core, tool);
gimp_add_busy_cursors ();
@ -1516,18 +1538,17 @@ static void
crop_orig_changed (GtkWidget *widget,
gpointer data)
{
Tool *tool;
Crop *crop;
GDisplay *gdisp;
gint ox;
gint oy;
Tool *tool;
Crop *crop;
gint ox;
gint oy;
tool = active_tool;
if (tool && active_tool->type == CROP)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
crop = (Crop *) tool->private;
ox = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0));
oy = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1));
@ -1549,18 +1570,17 @@ static void
crop_size_changed (GtkWidget *widget,
gpointer data)
{
Tool *tool;
Crop *crop;
GDisplay *gdisp;
gint sx;
gint sy;
Tool *tool;
Crop *crop;
gint sx;
gint sy;
tool = active_tool;
if (tool && active_tool->type == CROP)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
crop = (Crop *) tool->private;
crop = (Crop *) tool->private;
sx = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
sy = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);

View File

@ -29,17 +29,15 @@ typedef enum
void crop_draw (Tool *tool);
void crop_image (GimpImage *gimage,
gint,
gint,
gint,
gint,
gint,
gint);
gint x1,
gint y1,
gint x2,
gint y2,
gboolean layer_only,
gboolean crop_layers);
Tool * tools_new_crop (void);
void tools_free_crop (Tool *tool);
#endif /* __CROP_H__ */

View File

@ -108,40 +108,72 @@ static CRMatrix CR_basis =
/* curves action functions */
static void curves_button_press (Tool *, GdkEventButton *, gpointer);
static void curves_button_release (Tool *, GdkEventButton *, gpointer);
static void curves_motion (Tool *, GdkEventMotion *, gpointer);
static void curves_control (Tool *, ToolAction, gpointer);
static void curves_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void curves_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void curves_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void curves_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static CurvesDialog * curves_dialog_new (void);
static CurvesDialog * curves_dialog_new (void);
static void curves_update (CurvesDialog *, int);
static void curves_plot_curve (CurvesDialog *, int, int, int, int);
static void curves_preview (CurvesDialog *);
static void curves_update (CurvesDialog *cd,
gint );
static void curves_plot_curve (CurvesDialog *cd,
gint ,
gint ,
gint ,
gint );
static void curves_preview (CurvesDialog *cd);
static void curves_channel_callback (GtkWidget *, gpointer);
static void curves_channel_callback (GtkWidget *widget,
gpointer data);
static void curves_smooth_callback (GtkWidget *, gpointer);
static void curves_free_callback (GtkWidget *, gpointer);
static void curves_smooth_callback (GtkWidget *widget,
gpointer data);
static void curves_free_callback (GtkWidget *widget,
gpointer data);
static void curves_channel_reset (int);
static void curves_reset_callback (GtkWidget *, gpointer);
static void curves_ok_callback (GtkWidget *, gpointer);
static void curves_cancel_callback (GtkWidget *, gpointer);
static void curves_load_callback (GtkWidget *, gpointer);
static void curves_save_callback (GtkWidget *, gpointer);
static void curves_preview_update (GtkWidget *, gpointer);
static gint curves_xrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_yrange_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static gint curves_graph_events (GtkWidget *, GdkEvent *, CurvesDialog *);
static void curves_CR_compose (CRMatrix, CRMatrix, CRMatrix);
static void curves_channel_reset (gint );
static void curves_reset_callback (GtkWidget *widget,
gpointer data);
static void curves_ok_callback (GtkWidget *widget,
gpointer data);
static void curves_cancel_callback (GtkWidget *widget,
gpointer data);
static void curves_load_callback (GtkWidget *widget,
gpointer data);
static void curves_save_callback (GtkWidget *widget,
gpointer data);
static void curves_preview_update (GtkWidget *widget,
gpointer data);
static gint curves_xrange_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static gint curves_yrange_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static gint curves_graph_events (GtkWidget *widget,
GdkEvent *event,
CurvesDialog *cd);
static void curves_CR_compose (CRMatrix ,
CRMatrix ,
CRMatrix );
static void file_dialog_create (GtkWidget *);
static void file_dialog_ok_callback (GtkWidget *, gpointer);
static void file_dialog_cancel_callback (GtkWidget *, gpointer);
static void file_dialog_create (GtkWidget *widget);
static void file_dialog_ok_callback (GtkWidget *widget,
gpointer data);
static void file_dialog_cancel_callback (GtkWidget *widget,
gpointer data);
static gboolean curves_read_from_file (FILE *f);
static void curves_write_to_file (FILE *f);
static gboolean curves_read_from_file (FILE *f);
static void curves_write_to_file (FILE *f);
/* curves machinery */
@ -152,10 +184,10 @@ curves_lut_func (CurvesDialog *cd,
gint channel,
gfloat value)
{
gfloat f;
gint index;
gfloat f;
gint index;
gdouble inten;
gint j;
gint j;
if (nchannels == 1)
j = 0;
@ -197,15 +229,15 @@ curves_colour_update (Tool *tool,
gint x,
gint y)
{
guchar *color;
gint offx;
gint offy;
gint maxval;
guchar *color;
gint offx;
gint offy;
gint maxval;
gboolean has_alpha;
gboolean is_indexed;
GimpImageType sample_type;
if(!tool || tool->state != ACTIVE)
if (!tool || tool->state != ACTIVE)
return;
drawable_offsets (drawable, &offx, &offy);
@ -213,7 +245,7 @@ curves_colour_update (Tool *tool,
x -= offx;
y -= offy;
if (!(color = image_map_get_color_at(curves_dialog->image_map, x, y)))
if (!(color = image_map_get_color_at (curves_dialog->image_map, x, y)))
return;
sample_type = gimp_drawable_type (drawable);
@ -283,16 +315,14 @@ curves_add_point (GimpDrawable *drawable,
static void
curves_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
GDisplay *gdisp;
gint x, y;
GimpDrawable *drawable;
gdisp = gdisp_ptr;
drawable = gimp_image_active_drawable (gdisp->gimage);
tool->gdisp_ptr = gdisp;
tool->gdisp = gdisp;
if (drawable != tool->drawable)
{
@ -318,20 +348,18 @@ curves_button_press (Tool *tool,
static void
curves_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
gint x, y;
GimpDrawable *drawable;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if(!curves_dialog ||
!gdisp ||
!(drawable = gimp_image_active_drawable (gdisp->gimage)))
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
return;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, FALSE, FALSE);
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
curves_colour_update (tool, gdisp, drawable, x, y);
if (bevent->state & GDK_SHIFT_MASK)
@ -355,14 +383,11 @@ curves_button_release (Tool *tool,
static void
curves_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x, y;
GDisplay *gdisp;
gint x, y;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr;
if (! curves_dialog ||
! gdisp ||
! (drawable = gimp_image_active_drawable (gdisp->gimage)))
@ -376,7 +401,7 @@ curves_motion (Tool *tool,
static void
curves_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -1279,7 +1304,7 @@ curves_ok_callback (GtkWidget *widget,
cd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -1303,7 +1328,7 @@ curves_cancel_callback (GtkWidget *widget,
cd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -499,20 +499,17 @@ selection_march_ants (gpointer data)
Selection *
selection_create (GdkWindow *win,
gpointer gdisp_ptr,
int size,
int width,
int speed)
GDisplay *gdisp,
gint size,
gint width,
gint speed)
{
GdkColor fg, bg;
GDisplay *gdisp;
Selection * new;
int base_type;
int i;
GdkColor fg, bg;
Selection *new;
gint base_type;
gint i;
gdisp = (GDisplay *) gdisp_ptr;
new = (Selection *) g_malloc (sizeof (Selection));
new = g_new (Selection, 1);
base_type = gimp_image_base_type (gdisp->gimage);
if (cycled_marching_ants)
@ -532,7 +529,7 @@ selection_create (GdkWindow *win,
}
new->win = win;
new->gdisp = gdisp_ptr;
new->gdisp = gdisp;
new->segs_in = NULL;
new->segs_out = NULL;
new->segs_layer = NULL;
@ -563,8 +560,8 @@ selection_create (GdkWindow *win,
else
{
/* get black and white pixels for this gdisplay */
fg.pixel = gdisplay_black_pixel ((GDisplay *) gdisp_ptr);
bg.pixel = gdisplay_white_pixel ((GDisplay *) gdisp_ptr);
fg.pixel = gdisplay_black_pixel (gdisp);
bg.pixel = gdisplay_white_pixel (gdisp);
gdk_gc_set_foreground (new->gc_in, &fg);
gdk_gc_set_background (new->gc_in, &bg);
@ -581,8 +578,8 @@ selection_create (GdkWindow *win,
#endif
/* Setup 2nd & 3rd GCs */
fg.pixel = gdisplay_white_pixel ((GDisplay *) gdisp_ptr);
bg.pixel = gdisplay_gray_pixel ((GDisplay *) gdisp_ptr);
fg.pixel = gdisplay_white_pixel (gdisp);
bg.pixel = gdisplay_gray_pixel (gdisp);
/* create a new graphics context */
new->gc_out = gdk_gc_new (new->win);
@ -592,8 +589,8 @@ selection_create (GdkWindow *win,
gdk_gc_set_line_attributes (new->gc_out, 1, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
/* get black and color pixels for this gdisplay */
fg.pixel = gdisplay_black_pixel ((GDisplay *) gdisp_ptr);
bg.pixel = gdisplay_color_pixel ((GDisplay *) gdisp_ptr);
fg.pixel = gdisplay_black_pixel (gdisp);
bg.pixel = gdisplay_color_pixel (gdisp);
/* create a new graphics context */
new->gc_layer = gdk_gc_new (new->win);
@ -719,7 +716,7 @@ selection_layer_invis (Selection *select)
void
selection_hide (Selection *select,
void *gdisp_ptr)
GDisplay *gdisp)
{
selection_invis (select);
selection_layer_invis (select);

View File

@ -19,57 +19,60 @@
#ifndef __SELECTION_H__
#define __SELECTION_H__
struct _Selection
{
/* This information is for maintaining the selection's appearance */
GdkWindow * win; /* Window to draw to */
void * gdisp; /* GDisplay that owns the selection */
GdkGC * gc_in; /* GC for drawing selection outline */
GdkGC * gc_out; /* GC for selected regions outside current layer */
GdkGC * gc_layer; /* GC for current layer outline */
GdkWindow *win; /* Window to draw to */
GDisplay *gdisp; /* GDisplay that owns the selection */
GdkGC *gc_in; /* GC for drawing selection outline */
GdkGC *gc_out; /* GC for selected regions outside
* current layer */
GdkGC *gc_layer; /* GC for current layer outline */
/* This information is for drawing the marching ants around the border */
GdkSegment * segs_in; /* gdk segments of area boundary */
GdkSegment * segs_out; /* gdk segments of area boundary */
GdkSegment * segs_layer; /* gdk segments of area boundary */
gint num_segs_in; /* number of segments in segs1 */
gint num_segs_out; /* number of segments in segs2 */
gint num_segs_layer; /* number of segments in segs3 */
gint index_in; /* index of current stipple pattern */
gint index_out; /* index of current stipple pattern */
gint index_layer; /* index of current stipple pattern */
gint state; /* internal drawing state */
gint paused; /* count of pause requests */
gint recalc; /* flag to recalculate the selection */
gint speed; /* speed of marching ants */
gint hidden; /* is the selection hidden? */
gint timer; /* timer for successive draws */
gint cycle; /* color cycling turned on */
GdkPixmap * cycle_pix; /* cycling pixmap */
GdkSegment *segs_in; /* gdk segments of area boundary */
GdkSegment *segs_out; /* gdk segments of area boundary */
GdkSegment *segs_layer; /* gdk segments of area boundary */
gint num_segs_in; /* number of segments in segs1 */
gint num_segs_out; /* number of segments in segs2 */
gint num_segs_layer; /* number of segments in segs3 */
gint index_in; /* index of current stipple pattern */
gint index_out; /* index of current stipple pattern */
gint index_layer; /* index of current stipple pattern */
gint state; /* internal drawing state */
gint paused; /* count of pause requests */
gint recalc; /* flag to recalculate the selection */
gint speed; /* speed of marching ants */
gint hidden; /* is the selection hidden? */
gint timer; /* timer for successive draws */
gint cycle; /* color cycling turned on */
GdkPixmap *cycle_pix; /* cycling pixmap */
/* These are used only if USE_XDRAWPOINTS is defined. */
GdkPoint * points_in[8]; /* points of segs_in for fast ants */
gint num_points_in[8]; /* number of points in points_in */
GdkGC * gc_white; /* gc for drawing white points */
GdkGC * gc_black; /* gc for drawing black points */
GdkPoint *points_in[8]; /* points of segs_in for fast ants */
gint num_points_in[8]; /* number of points in points_in */
GdkGC *gc_white; /* gc for drawing white points */
GdkGC *gc_black; /* gc for drawing black points */
};
/* Function declarations */
Selection * selection_create (GdkWindow *,
gpointer ,
gint ,
gint ,
gint );
void selection_pause (Selection *);
void selection_resume (Selection *);
void selection_start (Selection *,
gint );
void selection_invis (Selection *);
void selection_layer_invis (Selection *);
void selection_hide (Selection *,
gpointer );
void selection_free (Selection *);
Selection * selection_create (GdkWindow *win,
GDisplay *disp,
gint size,
gint width,
gint speed);
void selection_pause (Selection *select);
void selection_resume (Selection *select);
void selection_start (Selection *select,
gint recalc);
void selection_invis (Selection *select);
void selection_layer_invis (Selection *select);
void selection_hide (Selection *select,
GDisplay *gdisp);
void selection_free (Selection *select);
#endif /* __SELECTION_H__ */

View File

@ -375,10 +375,10 @@ gdisplay_delete (GDisplay *gdisp)
/* clear out the pointer to this gdisp from the active tool */
if (active_tool &&
active_tool->gdisp_ptr == gdisp)
active_tool->gdisp == gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
}
/* free the selection structure */

View File

@ -499,20 +499,17 @@ selection_march_ants (gpointer data)
Selection *
selection_create (GdkWindow *win,
gpointer gdisp_ptr,
int size,
int width,
int speed)
GDisplay *gdisp,
gint size,
gint width,
gint speed)
{
GdkColor fg, bg;
GDisplay *gdisp;
Selection * new;
int base_type;
int i;
GdkColor fg, bg;
Selection *new;
gint base_type;
gint i;
gdisp = (GDisplay *) gdisp_ptr;
new = (Selection *) g_malloc (sizeof (Selection));
new = g_new (Selection, 1);
base_type = gimp_image_base_type (gdisp->gimage);
if (cycled_marching_ants)
@ -532,7 +529,7 @@ selection_create (GdkWindow *win,
}
new->win = win;
new->gdisp = gdisp_ptr;
new->gdisp = gdisp;
new->segs_in = NULL;
new->segs_out = NULL;
new->segs_layer = NULL;
@ -563,8 +560,8 @@ selection_create (GdkWindow *win,
else
{
/* get black and white pixels for this gdisplay */
fg.pixel = gdisplay_black_pixel ((GDisplay *) gdisp_ptr);
bg.pixel = gdisplay_white_pixel ((GDisplay *) gdisp_ptr);
fg.pixel = gdisplay_black_pixel (gdisp);
bg.pixel = gdisplay_white_pixel (gdisp);
gdk_gc_set_foreground (new->gc_in, &fg);
gdk_gc_set_background (new->gc_in, &bg);
@ -581,8 +578,8 @@ selection_create (GdkWindow *win,
#endif
/* Setup 2nd & 3rd GCs */
fg.pixel = gdisplay_white_pixel ((GDisplay *) gdisp_ptr);
bg.pixel = gdisplay_gray_pixel ((GDisplay *) gdisp_ptr);
fg.pixel = gdisplay_white_pixel (gdisp);
bg.pixel = gdisplay_gray_pixel (gdisp);
/* create a new graphics context */
new->gc_out = gdk_gc_new (new->win);
@ -592,8 +589,8 @@ selection_create (GdkWindow *win,
gdk_gc_set_line_attributes (new->gc_out, 1, GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_MITER);
/* get black and color pixels for this gdisplay */
fg.pixel = gdisplay_black_pixel ((GDisplay *) gdisp_ptr);
bg.pixel = gdisplay_color_pixel ((GDisplay *) gdisp_ptr);
fg.pixel = gdisplay_black_pixel (gdisp);
bg.pixel = gdisplay_color_pixel (gdisp);
/* create a new graphics context */
new->gc_layer = gdk_gc_new (new->win);
@ -719,7 +716,7 @@ selection_layer_invis (Selection *select)
void
selection_hide (Selection *select,
void *gdisp_ptr)
GDisplay *gdisp)
{
selection_invis (select);
selection_layer_invis (select);

View File

@ -19,57 +19,60 @@
#ifndef __SELECTION_H__
#define __SELECTION_H__
struct _Selection
{
/* This information is for maintaining the selection's appearance */
GdkWindow * win; /* Window to draw to */
void * gdisp; /* GDisplay that owns the selection */
GdkGC * gc_in; /* GC for drawing selection outline */
GdkGC * gc_out; /* GC for selected regions outside current layer */
GdkGC * gc_layer; /* GC for current layer outline */
GdkWindow *win; /* Window to draw to */
GDisplay *gdisp; /* GDisplay that owns the selection */
GdkGC *gc_in; /* GC for drawing selection outline */
GdkGC *gc_out; /* GC for selected regions outside
* current layer */
GdkGC *gc_layer; /* GC for current layer outline */
/* This information is for drawing the marching ants around the border */
GdkSegment * segs_in; /* gdk segments of area boundary */
GdkSegment * segs_out; /* gdk segments of area boundary */
GdkSegment * segs_layer; /* gdk segments of area boundary */
gint num_segs_in; /* number of segments in segs1 */
gint num_segs_out; /* number of segments in segs2 */
gint num_segs_layer; /* number of segments in segs3 */
gint index_in; /* index of current stipple pattern */
gint index_out; /* index of current stipple pattern */
gint index_layer; /* index of current stipple pattern */
gint state; /* internal drawing state */
gint paused; /* count of pause requests */
gint recalc; /* flag to recalculate the selection */
gint speed; /* speed of marching ants */
gint hidden; /* is the selection hidden? */
gint timer; /* timer for successive draws */
gint cycle; /* color cycling turned on */
GdkPixmap * cycle_pix; /* cycling pixmap */
GdkSegment *segs_in; /* gdk segments of area boundary */
GdkSegment *segs_out; /* gdk segments of area boundary */
GdkSegment *segs_layer; /* gdk segments of area boundary */
gint num_segs_in; /* number of segments in segs1 */
gint num_segs_out; /* number of segments in segs2 */
gint num_segs_layer; /* number of segments in segs3 */
gint index_in; /* index of current stipple pattern */
gint index_out; /* index of current stipple pattern */
gint index_layer; /* index of current stipple pattern */
gint state; /* internal drawing state */
gint paused; /* count of pause requests */
gint recalc; /* flag to recalculate the selection */
gint speed; /* speed of marching ants */
gint hidden; /* is the selection hidden? */
gint timer; /* timer for successive draws */
gint cycle; /* color cycling turned on */
GdkPixmap *cycle_pix; /* cycling pixmap */
/* These are used only if USE_XDRAWPOINTS is defined. */
GdkPoint * points_in[8]; /* points of segs_in for fast ants */
gint num_points_in[8]; /* number of points in points_in */
GdkGC * gc_white; /* gc for drawing white points */
GdkGC * gc_black; /* gc for drawing black points */
GdkPoint *points_in[8]; /* points of segs_in for fast ants */
gint num_points_in[8]; /* number of points in points_in */
GdkGC *gc_white; /* gc for drawing white points */
GdkGC *gc_black; /* gc for drawing black points */
};
/* Function declarations */
Selection * selection_create (GdkWindow *,
gpointer ,
gint ,
gint ,
gint );
void selection_pause (Selection *);
void selection_resume (Selection *);
void selection_start (Selection *,
gint );
void selection_invis (Selection *);
void selection_layer_invis (Selection *);
void selection_hide (Selection *,
gpointer );
void selection_free (Selection *);
Selection * selection_create (GdkWindow *win,
GDisplay *disp,
gint size,
gint width,
gint speed);
void selection_pause (Selection *select);
void selection_resume (Selection *select);
void selection_start (Selection *select,
gint recalc);
void selection_invis (Selection *select);
void selection_layer_invis (Selection *select);
void selection_hide (Selection *select,
GDisplay *gdisp);
void selection_free (Selection *select);
#endif /* __SELECTION_H__ */

View File

@ -77,6 +77,7 @@ typedef enum
#define PREVIEW_UPDATE_TIMEOUT 1100
typedef struct _NavWinData NavWinData;
struct _NavWinData
{
NavWinType ptype;
@ -88,7 +89,7 @@ struct _NavWinData
GtkWidget *zoom_label;
GtkObject *zoom_adjustment;
GtkWidget *preview;
void *gdisp_ptr; /* I'm not happy 'bout this one */
GDisplay *gdisp; /* I'm not happy 'bout this one */
GdkGC *gc;
gint dispx; /* x pos of top left corner of display area */
gint dispy; /* y pos of top left corner of display area */
@ -251,10 +252,6 @@ nav_window_draw_sqr (NavWinData *iwd,
gint w,
gint h)
{
GDisplay *gdisp;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdk_gc_set_function (iwd->gc, GDK_INVERT);
if (undraw)
@ -307,7 +304,7 @@ set_size_data (NavWinData *iwd)
GDisplay *gdisp;
GimpImage *gimage;
gdisp = (GDisplay *)(iwd->gdisp_ptr);
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
sel_width = gimage->width;
@ -345,9 +342,6 @@ create_preview_widget (NavWinData *iwd)
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *frame;
GDisplay *gdisp;
gdisp = (GDisplay *)(iwd->gdisp_ptr);
hbox = gtk_hbox_new (FALSE,0);
iwd->previewBox = hbox;
@ -406,7 +400,7 @@ update_real_view (NavWinData *iwd,
gint xpnt;
gint ypnt;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
xratio = SCALEFACTOR_X (gdisp);
yratio = SCALEFACTOR_Y (gdisp);
@ -433,7 +427,7 @@ update_real_view (NavWinData *iwd,
yoffset = ypnt - gdisp->offset_y;
iwd->block_window_marker = TRUE;
scroll_display (iwd->gdisp_ptr, xoffset, yoffset);
scroll_display (iwd->gdisp, xoffset, yoffset);
iwd->block_window_marker = FALSE;
}
@ -454,10 +448,8 @@ nav_window_update_preview (NavWinData *iwd)
gimp_add_busy_cursors ();
gdisp = (GDisplay *) iwd->gdisp_ptr;
/* Calculate preview size */
gimage = ((GDisplay *) (iwd->gdisp_ptr))->gimage;
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
/* Min size is 2 */
pwidth = iwd->pwidth;
@ -615,10 +607,8 @@ nav_window_update_preview_blank (NavWinData *iwd)
GimpImage *gimage;
GDisplay *gdisp;
gdisp = (GDisplay *) iwd->gdisp_ptr;
/* Calculate preview size */
gimage = ((GDisplay *) (iwd->gdisp_ptr))->gimage;
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
#endif /* 0 */
@ -670,9 +660,9 @@ update_zoom_label (NavWinData *iwd)
/* Update the zoom scale string */
g_snprintf (scale_str, MAX_SCALE_BUF, "%d:%d",
SCALEDEST (((GDisplay *)iwd->gdisp_ptr)),
SCALESRC (((GDisplay *)iwd->gdisp_ptr)));
SCALEDEST (iwd->gdisp),
SCALESRC (iwd->gdisp));
gtk_label_set_text (GTK_LABEL (iwd->zoom_label), scale_str);
}
@ -689,8 +679,8 @@ update_zoom_adjustment (NavWinData *iwd)
adj = GTK_ADJUSTMENT (iwd->zoom_adjustment);
f =
((gdouble) SCALEDEST (((GDisplay *) iwd->gdisp_ptr))) /
((gdouble) SCALESRC (((GDisplay *) iwd->gdisp_ptr)));
((gdouble) SCALEDEST (iwd->gdisp)) /
((gdouble) SCALESRC (iwd->gdisp));
if (f < 1.0)
{
@ -782,7 +772,7 @@ nav_window_preview_events (GtkWidget *widget,
if(!iwd || iwd->frozen == TRUE)
return FALSE;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
switch (event->type)
{
@ -998,7 +988,7 @@ nav_window_expose_events (GtkWidget *widget,
if(!iwd || iwd->frozen == TRUE)
return FALSE;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
switch (event->type)
{
@ -1025,12 +1015,12 @@ nav_window_expose_events (GtkWidget *widget,
static gint
nav_preview_update_do (NavWinData *iwd)
{
/* If the gdisp_ptr has gone then don't do anything in this timer */
if (!iwd->gdisp_ptr)
/* If the gdisp has gone then don't do anything in this timer */
if (!iwd->gdisp)
return FALSE;
nav_window_update_preview (iwd);
nav_window_disp_area (iwd, iwd->gdisp_ptr);
nav_window_disp_area (iwd, iwd->gdisp);
gtk_widget_queue_draw (iwd->preview);
iwd->installedDirtyTimer = FALSE;
@ -1076,16 +1066,13 @@ navwindow_zoomin (GtkWidget *widget,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
iwd = (NavWinData *)data;
iwd = (NavWinData *) data;
if(!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
change_scale (gdisp, ZOOMIN);
change_scale (iwd->gdisp, ZOOMIN);
}
static void
@ -1093,16 +1080,13 @@ navwindow_zoomout (GtkWidget *widget,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
iwd = (NavWinData *)data;
if (!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
change_scale (gdisp, ZOOMOUT);
change_scale (iwd->gdisp, ZOOMOUT);
}
static void
@ -1110,7 +1094,6 @@ zoom_adj_changed (GtkAdjustment *adj,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
gint scalesrc;
gint scaledest;
@ -1119,8 +1102,6 @@ zoom_adj_changed (GtkAdjustment *adj,
if (!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
if (adj->value < 0.0)
{
scalesrc = abs ((gint) adj->value - 1);
@ -1133,7 +1114,7 @@ zoom_adj_changed (GtkAdjustment *adj,
}
iwd->block_adj_sig = TRUE;
change_scale (gdisp, (scaledest * 100) + scalesrc);
change_scale (iwd->gdisp, (scaledest * 100) + scalesrc);
iwd->block_adj_sig = FALSE;
}
@ -1168,8 +1149,8 @@ nav_create_button_area (InfoDialog *info_win)
/* user zoom ratio */
g_snprintf (scale_str, MAX_SCALE_BUF, "%d:%d",
SCALEDEST (((GDisplay *)iwd->gdisp_ptr)),
SCALESRC (((GDisplay *)iwd->gdisp_ptr)));
SCALEDEST (iwd->gdisp),
SCALESRC (iwd->gdisp));
label1 = gtk_label_new (scale_str);
gtk_widget_show (label1);
@ -1256,12 +1237,12 @@ info_window_image_preview_new (InfoDialog *info_win)
}
NavWinData *
create_dummy_iwd (void *gdisp_ptr,
create_dummy_iwd (GDisplay *gdisp,
NavWinType ptype)
{
NavWinData *iwd;
iwd = (NavWinData *) g_malloc (sizeof (NavWinData));
iwd = g_new (NavWinData, 1);
iwd->ptype = ptype;
iwd->info_win = NULL;
iwd->showingPreview = TRUE;
@ -1269,7 +1250,7 @@ create_dummy_iwd (void *gdisp_ptr,
iwd->preview = NULL;
iwd->zoom_label = NULL;
iwd->zoom_adjustment = NULL;
iwd->gdisp_ptr = gdisp_ptr;
iwd->gdisp = gdisp;
iwd->dispx = -1;
iwd->dispy = -1;
iwd->dispwidth = -1;
@ -1299,7 +1280,7 @@ create_dummy_iwd (void *gdisp_ptr,
static InfoDialog *nav_window_auto = NULL;
static gchar *
nav_window_title(GDisplay *gdisp)
nav_window_title (GDisplay *gdisp)
{
gchar *title;
gchar *title_buf;
@ -1326,8 +1307,8 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
NavWinData *iwd;
gchar *title_buf;
iwd = (NavWinData *)nav_window_auto->user_data;
old_gdisp = (GDisplay *) iwd->gdisp_ptr;
iwd = (NavWinData *) nav_window_auto->user_data;
old_gdisp = iwd->gdisp;
if (!nav_window_auto || gdisp == old_gdisp || !gdisp)
{
@ -1347,7 +1328,7 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
if (gimage && gimp_set_have (image_context, gimage))
{
iwd->gdisp_ptr = gdisp;
iwd->gdisp = gdisp;
/* Update preview to new display */
nav_window_preview_resized (nav_window_auto);
@ -1382,9 +1363,10 @@ nav_window_follow_auto (void)
if (!gdisp)
return;
if(!nav_window_auto)
if (!nav_window_auto)
{
nav_window_auto = nav_window_create ((void *) gdisp);
nav_window_auto = nav_window_create (gdisp);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
"display_changed",
GTK_SIGNAL_FUNC (nav_window_change_display),
@ -1400,20 +1382,17 @@ nav_window_follow_auto (void)
InfoDialog *
nav_window_create (void *gdisp_ptr)
nav_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
GDisplay *gdisp;
NavWinData *iwd;
GtkWidget *container;
gchar *title_buf;
GimpImageBaseType type;
gdisp = (GDisplay *) gdisp_ptr;
type = gimp_image_base_type (gdisp->gimage);
title_buf = nav_window_title(gdisp);
title_buf = nav_window_title (gdisp);
info_win = info_dialog_new (title_buf,
gimp_standard_help_func,
@ -1434,7 +1413,7 @@ nav_window_create (void *gdisp_ptr)
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
iwd = create_dummy_iwd (gdisp_ptr, NAV_WINDOW);
iwd = create_dummy_iwd (gdisp, NAV_WINDOW);
info_win->user_data = iwd;
iwd->info_win = info_win;
@ -1501,7 +1480,7 @@ nav_window_update_window_marker (InfoDialog *info_win)
iwd->dispwidth, iwd->dispheight);
/* Update to new size */
nav_window_disp_area (iwd, iwd->gdisp_ptr);
nav_window_disp_area (iwd, iwd->gdisp);
/* and redraw */
nav_window_draw_sqr (iwd,
@ -1563,14 +1542,14 @@ nav_window_get_gdisp (void)
for (listPtr = list; listPtr; listPtr = g_slist_next (listPtr))
{
gimage = GIMP_IMAGE (listPtr->data);
gdisp = gdisplays_check_valid (NULL,gimage);
gdisp = gdisplays_check_valid (NULL, gimage);
if (gdisp)
break;
}
g_slist_free (list);
return (gdisp);
return gdisp;
}
@ -1589,12 +1568,12 @@ nav_window_free (GDisplay *del_gdisp,
{
if (nav_window_auto != NULL)
{
GDisplay * gdisp;
GDisplay *gdisp;
iwd = (NavWinData *) nav_window_auto->user_data;
/* Only freeze if we are displaying the image we have deleted */
if ((GDisplay *) iwd->gdisp_ptr != del_gdisp)
if (iwd->gdisp != del_gdisp)
return;
if (iwd->timer_id)
@ -1605,7 +1584,9 @@ nav_window_free (GDisplay *del_gdisp,
gdisp = nav_window_get_gdisp ();
if (gdisp)
nav_window_change_display (NULL, gdisp, NULL);
{
nav_window_change_display (NULL, gdisp, NULL);
}
else
{
/* Clear window and freeze */
@ -1615,7 +1596,7 @@ nav_window_free (GDisplay *del_gdisp,
_("Navigation: No Image"));
gtk_widget_set_sensitive (nav_window_auto->vbox, FALSE);
iwd->gdisp_ptr = NULL;
iwd->gdisp = NULL;
gtk_widget_hide (GTK_WIDGET (nav_window_auto->shell));
}
}
@ -1651,7 +1632,7 @@ nav_popup_click_handler (GtkWidget *widget,
bevent = (GdkEventButton *)event;
if(!gdisp->nav_popup)
if (! gdisp->nav_popup)
{
/* popup a simplfied window with the nav box in it */
GtkWidget *frame;
@ -1674,14 +1655,14 @@ nav_popup_click_handler (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_object_set_data (GTK_OBJECT (gdisp->nav_popup),"navpop_prt",
(gpointer) iwp);
nav_window_disp_area (iwp, iwp->gdisp_ptr);
nav_window_disp_area (iwp, iwp->gdisp);
}
else
{
gtk_widget_hide (gdisp->nav_popup);
iwp = (NavWinData *) gtk_object_get_data (GTK_OBJECT (gdisp->nav_popup),
"navpop_prt");
nav_window_disp_area (iwp, iwp->gdisp_ptr);
nav_window_disp_area (iwp, iwp->gdisp);
nav_window_update_preview (iwp);
}

View File

@ -77,6 +77,7 @@ typedef enum
#define PREVIEW_UPDATE_TIMEOUT 1100
typedef struct _NavWinData NavWinData;
struct _NavWinData
{
NavWinType ptype;
@ -88,7 +89,7 @@ struct _NavWinData
GtkWidget *zoom_label;
GtkObject *zoom_adjustment;
GtkWidget *preview;
void *gdisp_ptr; /* I'm not happy 'bout this one */
GDisplay *gdisp; /* I'm not happy 'bout this one */
GdkGC *gc;
gint dispx; /* x pos of top left corner of display area */
gint dispy; /* y pos of top left corner of display area */
@ -251,10 +252,6 @@ nav_window_draw_sqr (NavWinData *iwd,
gint w,
gint h)
{
GDisplay *gdisp;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdk_gc_set_function (iwd->gc, GDK_INVERT);
if (undraw)
@ -307,7 +304,7 @@ set_size_data (NavWinData *iwd)
GDisplay *gdisp;
GimpImage *gimage;
gdisp = (GDisplay *)(iwd->gdisp_ptr);
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
sel_width = gimage->width;
@ -345,9 +342,6 @@ create_preview_widget (NavWinData *iwd)
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *frame;
GDisplay *gdisp;
gdisp = (GDisplay *)(iwd->gdisp_ptr);
hbox = gtk_hbox_new (FALSE,0);
iwd->previewBox = hbox;
@ -406,7 +400,7 @@ update_real_view (NavWinData *iwd,
gint xpnt;
gint ypnt;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
xratio = SCALEFACTOR_X (gdisp);
yratio = SCALEFACTOR_Y (gdisp);
@ -433,7 +427,7 @@ update_real_view (NavWinData *iwd,
yoffset = ypnt - gdisp->offset_y;
iwd->block_window_marker = TRUE;
scroll_display (iwd->gdisp_ptr, xoffset, yoffset);
scroll_display (iwd->gdisp, xoffset, yoffset);
iwd->block_window_marker = FALSE;
}
@ -454,10 +448,8 @@ nav_window_update_preview (NavWinData *iwd)
gimp_add_busy_cursors ();
gdisp = (GDisplay *) iwd->gdisp_ptr;
/* Calculate preview size */
gimage = ((GDisplay *) (iwd->gdisp_ptr))->gimage;
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
/* Min size is 2 */
pwidth = iwd->pwidth;
@ -615,10 +607,8 @@ nav_window_update_preview_blank (NavWinData *iwd)
GimpImage *gimage;
GDisplay *gdisp;
gdisp = (GDisplay *) iwd->gdisp_ptr;
/* Calculate preview size */
gimage = ((GDisplay *) (iwd->gdisp_ptr))->gimage;
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
#endif /* 0 */
@ -670,9 +660,9 @@ update_zoom_label (NavWinData *iwd)
/* Update the zoom scale string */
g_snprintf (scale_str, MAX_SCALE_BUF, "%d:%d",
SCALEDEST (((GDisplay *)iwd->gdisp_ptr)),
SCALESRC (((GDisplay *)iwd->gdisp_ptr)));
SCALEDEST (iwd->gdisp),
SCALESRC (iwd->gdisp));
gtk_label_set_text (GTK_LABEL (iwd->zoom_label), scale_str);
}
@ -689,8 +679,8 @@ update_zoom_adjustment (NavWinData *iwd)
adj = GTK_ADJUSTMENT (iwd->zoom_adjustment);
f =
((gdouble) SCALEDEST (((GDisplay *) iwd->gdisp_ptr))) /
((gdouble) SCALESRC (((GDisplay *) iwd->gdisp_ptr)));
((gdouble) SCALEDEST (iwd->gdisp)) /
((gdouble) SCALESRC (iwd->gdisp));
if (f < 1.0)
{
@ -782,7 +772,7 @@ nav_window_preview_events (GtkWidget *widget,
if(!iwd || iwd->frozen == TRUE)
return FALSE;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
switch (event->type)
{
@ -998,7 +988,7 @@ nav_window_expose_events (GtkWidget *widget,
if(!iwd || iwd->frozen == TRUE)
return FALSE;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
switch (event->type)
{
@ -1025,12 +1015,12 @@ nav_window_expose_events (GtkWidget *widget,
static gint
nav_preview_update_do (NavWinData *iwd)
{
/* If the gdisp_ptr has gone then don't do anything in this timer */
if (!iwd->gdisp_ptr)
/* If the gdisp has gone then don't do anything in this timer */
if (!iwd->gdisp)
return FALSE;
nav_window_update_preview (iwd);
nav_window_disp_area (iwd, iwd->gdisp_ptr);
nav_window_disp_area (iwd, iwd->gdisp);
gtk_widget_queue_draw (iwd->preview);
iwd->installedDirtyTimer = FALSE;
@ -1076,16 +1066,13 @@ navwindow_zoomin (GtkWidget *widget,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
iwd = (NavWinData *)data;
iwd = (NavWinData *) data;
if(!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
change_scale (gdisp, ZOOMIN);
change_scale (iwd->gdisp, ZOOMIN);
}
static void
@ -1093,16 +1080,13 @@ navwindow_zoomout (GtkWidget *widget,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
iwd = (NavWinData *)data;
if (!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
change_scale (gdisp, ZOOMOUT);
change_scale (iwd->gdisp, ZOOMOUT);
}
static void
@ -1110,7 +1094,6 @@ zoom_adj_changed (GtkAdjustment *adj,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
gint scalesrc;
gint scaledest;
@ -1119,8 +1102,6 @@ zoom_adj_changed (GtkAdjustment *adj,
if (!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
if (adj->value < 0.0)
{
scalesrc = abs ((gint) adj->value - 1);
@ -1133,7 +1114,7 @@ zoom_adj_changed (GtkAdjustment *adj,
}
iwd->block_adj_sig = TRUE;
change_scale (gdisp, (scaledest * 100) + scalesrc);
change_scale (iwd->gdisp, (scaledest * 100) + scalesrc);
iwd->block_adj_sig = FALSE;
}
@ -1168,8 +1149,8 @@ nav_create_button_area (InfoDialog *info_win)
/* user zoom ratio */
g_snprintf (scale_str, MAX_SCALE_BUF, "%d:%d",
SCALEDEST (((GDisplay *)iwd->gdisp_ptr)),
SCALESRC (((GDisplay *)iwd->gdisp_ptr)));
SCALEDEST (iwd->gdisp),
SCALESRC (iwd->gdisp));
label1 = gtk_label_new (scale_str);
gtk_widget_show (label1);
@ -1256,12 +1237,12 @@ info_window_image_preview_new (InfoDialog *info_win)
}
NavWinData *
create_dummy_iwd (void *gdisp_ptr,
create_dummy_iwd (GDisplay *gdisp,
NavWinType ptype)
{
NavWinData *iwd;
iwd = (NavWinData *) g_malloc (sizeof (NavWinData));
iwd = g_new (NavWinData, 1);
iwd->ptype = ptype;
iwd->info_win = NULL;
iwd->showingPreview = TRUE;
@ -1269,7 +1250,7 @@ create_dummy_iwd (void *gdisp_ptr,
iwd->preview = NULL;
iwd->zoom_label = NULL;
iwd->zoom_adjustment = NULL;
iwd->gdisp_ptr = gdisp_ptr;
iwd->gdisp = gdisp;
iwd->dispx = -1;
iwd->dispy = -1;
iwd->dispwidth = -1;
@ -1299,7 +1280,7 @@ create_dummy_iwd (void *gdisp_ptr,
static InfoDialog *nav_window_auto = NULL;
static gchar *
nav_window_title(GDisplay *gdisp)
nav_window_title (GDisplay *gdisp)
{
gchar *title;
gchar *title_buf;
@ -1326,8 +1307,8 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
NavWinData *iwd;
gchar *title_buf;
iwd = (NavWinData *)nav_window_auto->user_data;
old_gdisp = (GDisplay *) iwd->gdisp_ptr;
iwd = (NavWinData *) nav_window_auto->user_data;
old_gdisp = iwd->gdisp;
if (!nav_window_auto || gdisp == old_gdisp || !gdisp)
{
@ -1347,7 +1328,7 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
if (gimage && gimp_set_have (image_context, gimage))
{
iwd->gdisp_ptr = gdisp;
iwd->gdisp = gdisp;
/* Update preview to new display */
nav_window_preview_resized (nav_window_auto);
@ -1382,9 +1363,10 @@ nav_window_follow_auto (void)
if (!gdisp)
return;
if(!nav_window_auto)
if (!nav_window_auto)
{
nav_window_auto = nav_window_create ((void *) gdisp);
nav_window_auto = nav_window_create (gdisp);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
"display_changed",
GTK_SIGNAL_FUNC (nav_window_change_display),
@ -1400,20 +1382,17 @@ nav_window_follow_auto (void)
InfoDialog *
nav_window_create (void *gdisp_ptr)
nav_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
GDisplay *gdisp;
NavWinData *iwd;
GtkWidget *container;
gchar *title_buf;
GimpImageBaseType type;
gdisp = (GDisplay *) gdisp_ptr;
type = gimp_image_base_type (gdisp->gimage);
title_buf = nav_window_title(gdisp);
title_buf = nav_window_title (gdisp);
info_win = info_dialog_new (title_buf,
gimp_standard_help_func,
@ -1434,7 +1413,7 @@ nav_window_create (void *gdisp_ptr)
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
iwd = create_dummy_iwd (gdisp_ptr, NAV_WINDOW);
iwd = create_dummy_iwd (gdisp, NAV_WINDOW);
info_win->user_data = iwd;
iwd->info_win = info_win;
@ -1501,7 +1480,7 @@ nav_window_update_window_marker (InfoDialog *info_win)
iwd->dispwidth, iwd->dispheight);
/* Update to new size */
nav_window_disp_area (iwd, iwd->gdisp_ptr);
nav_window_disp_area (iwd, iwd->gdisp);
/* and redraw */
nav_window_draw_sqr (iwd,
@ -1563,14 +1542,14 @@ nav_window_get_gdisp (void)
for (listPtr = list; listPtr; listPtr = g_slist_next (listPtr))
{
gimage = GIMP_IMAGE (listPtr->data);
gdisp = gdisplays_check_valid (NULL,gimage);
gdisp = gdisplays_check_valid (NULL, gimage);
if (gdisp)
break;
}
g_slist_free (list);
return (gdisp);
return gdisp;
}
@ -1589,12 +1568,12 @@ nav_window_free (GDisplay *del_gdisp,
{
if (nav_window_auto != NULL)
{
GDisplay * gdisp;
GDisplay *gdisp;
iwd = (NavWinData *) nav_window_auto->user_data;
/* Only freeze if we are displaying the image we have deleted */
if ((GDisplay *) iwd->gdisp_ptr != del_gdisp)
if (iwd->gdisp != del_gdisp)
return;
if (iwd->timer_id)
@ -1605,7 +1584,9 @@ nav_window_free (GDisplay *del_gdisp,
gdisp = nav_window_get_gdisp ();
if (gdisp)
nav_window_change_display (NULL, gdisp, NULL);
{
nav_window_change_display (NULL, gdisp, NULL);
}
else
{
/* Clear window and freeze */
@ -1615,7 +1596,7 @@ nav_window_free (GDisplay *del_gdisp,
_("Navigation: No Image"));
gtk_widget_set_sensitive (nav_window_auto->vbox, FALSE);
iwd->gdisp_ptr = NULL;
iwd->gdisp = NULL;
gtk_widget_hide (GTK_WIDGET (nav_window_auto->shell));
}
}
@ -1651,7 +1632,7 @@ nav_popup_click_handler (GtkWidget *widget,
bevent = (GdkEventButton *)event;
if(!gdisp->nav_popup)
if (! gdisp->nav_popup)
{
/* popup a simplfied window with the nav box in it */
GtkWidget *frame;
@ -1674,14 +1655,14 @@ nav_popup_click_handler (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_object_set_data (GTK_OBJECT (gdisp->nav_popup),"navpop_prt",
(gpointer) iwp);
nav_window_disp_area (iwp, iwp->gdisp_ptr);
nav_window_disp_area (iwp, iwp->gdisp);
}
else
{
gtk_widget_hide (gdisp->nav_popup);
iwp = (NavWinData *) gtk_object_get_data (GTK_OBJECT (gdisp->nav_popup),
"navpop_prt");
nav_window_disp_area (iwp, iwp->gdisp_ptr);
nav_window_disp_area (iwp, iwp->gdisp);
nav_window_update_preview (iwp);
}

View File

@ -44,6 +44,12 @@
#include "libgimp/gimpintl.h"
/* Default values */
#define DODGEBURN_DEFAULT_TYPE DODGE
#define DODGEBURN_DEFAULT_EXPOSURE 50.0
#define DODGEBURN_DEFAULT_MODE DODGEBURN_HIGHLIGHTS
/* the dodgeburn structures */
typedef struct _DodgeBurnOptions DodgeBurnOptions;
@ -67,36 +73,49 @@ struct _DodgeBurnOptions
GimpLut *lut;
};
static void
dodgeburn_make_luts (PaintCore *, double, DodgeBurnType, DodgeBurnMode,
GimpLut *, GimpDrawable *);
static gfloat dodgeburn_highlights_lut_func (void *, int, int, gfloat);
static gfloat dodgeburn_midtones_lut_func (void *, int, int, gfloat);
static gfloat dodgeburn_shadows_lut_func (void *, int, int, gfloat);
static gpointer dodgeburn_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void dodgeburn_make_luts (PaintCore *paint_cure,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable);
static gfloat dodgeburn_highlights_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value);
static gfloat dodgeburn_midtones_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value);
static gfloat dodgeburn_shadows_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value);
static void dodgeburn_motion (PaintCore *paint_core,
PaintPressureOptions *pressure_options,
gdouble dodgeburn_exposure,
GimpLut *lut,
GimpDrawable *drawable);
static void dodgeburn_init (PaintCore *paint_cure,
GimpDrawable *drawable);
static void dodgeburn_finish (PaintCore *paint_core,
GimpDrawable *drawable);
/* The dodge burn lookup tables */
gfloat dodgeburn_highlights (void *, int, int, gfloat);
gfloat dodgeburn_midtones (void *, int, int, gfloat);
gfloat dodgeburn_shadows (void *, int, int, gfloat);
/* the dodgeburn tool options */
static DodgeBurnOptions * dodgeburn_options = NULL;
/* Non gui function */
static double non_gui_exposure;
static gdouble non_gui_exposure;
static GimpLut *non_gui_lut;
/* Default values */
#define DODGEBURN_DEFAULT_TYPE DODGE
#define DODGEBURN_DEFAULT_EXPOSURE 50.0
#define DODGEBURN_DEFAULT_MODE DODGEBURN_HIGHLIGHTS
static void dodgeburn_motion (PaintCore *,
PaintPressureOptions *,
double, GimpLut *, GimpDrawable *);
static void dodgeburn_init (PaintCore *, GimpDrawable *);
static void dodgeburn_finish (PaintCore *, GimpDrawable *);
/* functions */
@ -198,24 +217,29 @@ dodgeburn_options_new (void)
return options;
}
void *
static gpointer
dodgeburn_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
GimpDrawable *drawable,
PaintState state)
{
switch (state)
{
case INIT_PAINT:
dodgeburn_init (paint_core, drawable);
break;
case MOTION_PAINT:
dodgeburn_motion (paint_core,
dodgeburn_options->paint_options.pressure_options,
dodgeburn_options->exposure, dodgeburn_options->lut, drawable);
break;
case FINISH_PAINT:
dodgeburn_finish (paint_core, drawable);
break;
default:
break;
}
return NULL;
@ -238,7 +262,8 @@ dodgeburn_init (PaintCore *paint_core,
GimpDrawable *drawable)
{
/* Here we create the luts to do the painting with.*/
dodgeburn_options->lut = gimp_lut_new();
dodgeburn_options->lut = gimp_lut_new ();
dodgeburn_make_luts (paint_core,
dodgeburn_options->exposure,
dodgeburn_options->type,
@ -249,17 +274,17 @@ dodgeburn_init (PaintCore *paint_core,
static void
dodgeburn_make_luts (PaintCore *paint_core,
double db_exposure,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable)
{
GimpLutFunc lut_func;
int nchannels = gimp_drawable_bytes (drawable);
GimpLutFunc lut_func;
gint nchannels = gimp_drawable_bytes (drawable);
static gfloat exposure;
exposure = (db_exposure) / 100.0;
exposure = db_exposure / 100.0;
/* make the exposure negative if burn for luts*/
if (type == BURN)
@ -281,15 +306,15 @@ dodgeburn_make_luts (PaintCore *paint_core,
break;
}
gimp_lut_setup_exact (lut,
lut_func, (void *)&exposure,
nchannels);
gimp_lut_setup_exact (lut,
lut_func, (gpointer) &exposure,
nchannels);
}
static void
dodgeburn_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -317,7 +342,7 @@ dodgeburn_modifier_key_func (Tool *tool,
break;
case GDK_Control_L:
case GDK_Control_R:
if ( !(kevent->state & GDK_SHIFT_MASK) ) /* shift enables line draw mode */
if (! (kevent->state & GDK_SHIFT_MASK)) /* shift enables line draw mode */
{
switch (dodgeburn_options->type)
{
@ -342,18 +367,18 @@ dodgeburn_modifier_key_func (Tool *tool,
static void
dodgeburn_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
tool->toggled = (dodgeburn_options->type == BURN);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
paint_core_cursor_update (tool, mevent, gdisp);
}
Tool *
tools_new_dodgeburn (void)
{
Tool * tool;
PaintCore * private;
Tool *tool;
PaintCore *private;
/* The tool options */
if (! dodgeburn_options)
@ -420,25 +445,26 @@ dodgeburn_motion (PaintCore *paint_core,
no paint from this stroke yet) */
{
gint x1, y1, x2, y2;
x1 = CLAMP (area->x, 0, drawable_width (drawable));
y1 = CLAMP (area->y, 0, drawable_height (drawable));
x2 = CLAMP (area->x + area->width, 0, drawable_width (drawable));
y2 = CLAMP (area->y + area->height, 0, drawable_height (drawable));
gint x1, y1, x2, y2;
if (!(x2 - x1) || !(y2 - y1))
return;
x1 = CLAMP (area->x, 0, drawable_width (drawable));
y1 = CLAMP (area->y, 0, drawable_height (drawable));
x2 = CLAMP (area->x + area->width, 0, drawable_width (drawable));
y2 = CLAMP (area->y + area->height, 0, drawable_height (drawable));
/* get the original untouched image */
orig = paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2);
srcPR.bytes = orig->bytes;
srcPR.x = 0;
srcPR.y = 0;
srcPR.w = x2 - x1;
srcPR.h = y2 - y1;
srcPR.rowstride = srcPR.bytes * orig->width;
srcPR.data = temp_buf_data (orig);
}
if (!(x2 - x1) || !(y2 - y1))
return;
/* get the original untouched image */
orig = paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2);
srcPR.bytes = orig->bytes;
srcPR.x = 0;
srcPR.y = 0;
srcPR.w = x2 - x1;
srcPR.h = y2 - y1;
srcPR.rowstride = srcPR.bytes * orig->width;
srcPR.data = temp_buf_data (orig);
}
/* tempPR will hold the dodgeburned region*/
tempPR.bytes = srcPR.bytes;
@ -482,10 +508,10 @@ dodgeburn_motion (PaintCore *paint_core,
g_free (temp_data);
}
static void *
static gpointer
dodgeburn_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
dodgeburn_motion (paint_core, &non_gui_pressure_options,
non_gui_exposure, non_gui_lut, drawable);
@ -495,13 +521,13 @@ dodgeburn_non_gui_paint_func (PaintCore *paint_core,
gboolean
dodgeburn_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
double exposure = DODGEBURN_DEFAULT_TYPE;
DodgeBurnType type = DODGEBURN_DEFAULT_TYPE;
DodgeBurnMode mode = DODGEBURN_DEFAULT_MODE;
DodgeBurnOptions *options = dodgeburn_options;
gdouble exposure = DODGEBURN_DEFAULT_TYPE;
DodgeBurnType type = DODGEBURN_DEFAULT_TYPE;
DodgeBurnMode mode = DODGEBURN_DEFAULT_MODE;
DodgeBurnOptions *options = dodgeburn_options;
if (options)
{
@ -510,18 +536,19 @@ dodgeburn_non_gui_default (GimpDrawable *drawable,
mode = dodgeburn_options->mode;
}
return dodgeburn_non_gui (drawable, exposure, type, mode, num_strokes, stroke_array);
return dodgeburn_non_gui (drawable, exposure, type, mode,
num_strokes, stroke_array);
}
gboolean
dodgeburn_non_gui (GimpDrawable *drawable,
double exposure,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
@ -569,15 +596,15 @@ dodgeburn_non_gui (GimpDrawable *drawable,
}
static gfloat
dodgeburn_highlights_lut_func (void *user_data,
int nchannels,
int channel,
gfloat value)
dodgeburn_highlights_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value)
{
gfloat * exposure_ptr = (gfloat *)user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
@ -586,14 +613,14 @@ dodgeburn_highlights_lut_func (void *user_data,
}
static gfloat
dodgeburn_midtones_lut_func (void *user_data,
int nchannels,
int channel,
gfloat value)
dodgeburn_midtones_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value)
{
gfloat * exposure_ptr = (gfloat *)user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
@ -603,19 +630,20 @@ dodgeburn_midtones_lut_func (void *user_data,
factor = 1.0 - exposure * (.333333);
else
factor = 1/(1.0 + exposure);
return pow (value, factor);
}
static gfloat
dodgeburn_shadows_lut_func (void *user_data,
int nchannels,
int channel,
gfloat value)
dodgeburn_shadows_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value)
{
gfloat * exposure_ptr = (gfloat *)user_data;
gfloat exposure = *exposure_ptr;
gfloat new_value;
gfloat factor;
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat new_value;
gfloat factor;
if ( (nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))

View File

@ -34,21 +34,18 @@ typedef enum
} DodgeBurnMode;
void * dodgeburn_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean dodgeburn_non_gui (GimpDrawable *,
gdouble,
DodgeBurnType,
DodgeBurnMode,
gint,
gdouble *);
gboolean dodgeburn_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_dodgeburn (void);
void tools_free_dodgeburn (Tool *);
void tools_free_dodgeburn (Tool *tool);
#endif /* __DODGEBURN_H__ */

View File

@ -127,15 +127,12 @@ edit_selection_snap (GDisplay *gdisp,
void
init_edit_selection (Tool *tool,
gpointer gdisp_ptr,
GDisplay *gdisp,
GdkEventButton *bevent,
EditType edit_type)
{
GDisplay *gdisp;
Layer *layer;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
gint x, y;
undo_push_group_start (gdisp->gimage, LAYER_DISPLACE_UNDO);
@ -218,15 +215,12 @@ init_edit_selection (Tool *tool,
void
edit_selection_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint x;
gint y;
GDisplay *gdisp;
Layer *layer;
gdisp = (GDisplay *) gdisp_ptr;
/* resume the current selection and ungrab the pointer */
selection_resume (gdisp->select);
@ -312,11 +306,10 @@ edit_selection_button_release (Tool *tool,
void
edit_selection_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
gchar offset[STATUSBAR_SIZE];
gdouble lastmotion_x, lastmotion_y;
gchar offset[STATUSBAR_SIZE];
gdouble lastmotion_x, lastmotion_y;
if (tool->state != ACTIVE)
{
@ -324,8 +317,6 @@ edit_selection_motion (Tool *tool,
return;
}
gdisp = (GDisplay *) gdisp_ptr;
gdk_flush ();
draw_core_pause (edit_select.core, tool);
@ -521,7 +512,7 @@ edit_selection_draw (Tool *tool)
gint off_x, off_y;
GdkSegment *segs_copy;
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisp = tool->gdisp;
select = gdisp->select;
switch (edit_select.edit_type)
@ -637,7 +628,7 @@ edit_selection_draw (Tool *tool)
void
edit_selection_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -663,11 +654,8 @@ edit_selection_control (Tool *tool,
void
edit_selection_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR,
TOOL_TYPE_NONE,
CURSOR_MODIFIER_MOVE,
@ -770,10 +758,9 @@ process_event_queue_keys (GdkEventKey *kevent,
void
edit_sel_arrow_keys_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gint inc_x, inc_y, mask_inc_x, mask_inc_y;
GDisplay *gdisp;
Layer *layer;
Layer *floating_layer;
GSList *layer_list;
@ -781,8 +768,6 @@ edit_sel_arrow_keys_func (Tool *tool,
layer = NULL;
gdisp = (GDisplay *) gdisp_ptr;
inc_x =
process_event_queue_keys (kevent,
GDK_Left, 0, -1,

View File

@ -30,26 +30,26 @@ typedef enum
void init_edit_selection (Tool *tool,
gpointer gdisp_ptr,
GDisplay *gdisp,
GdkEventButton *bevent,
EditType edit_type);
void edit_selection_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr);
void edit_selection_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr);
void edit_selection_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr);
void edit_selection_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr);
void edit_selection_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
void edit_selection_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void edit_selection_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
void edit_selection_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void edit_selection_draw (Tool *tool);
void edit_sel_arrow_keys_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr);
GDisplay *gdisp);
#endif /* __EDIT_SELECTION_H__ */

View File

@ -93,12 +93,10 @@ ellipse_select (GimpImage *gimage,
void
ellipse_select_draw (Tool *tool)
{
GDisplay *gdisp;
EllipseSelect *ellipse_sel;
gint x1, y1;
gint x2, y2;
gdisp = (GDisplay *) tool->gdisp_ptr;
ellipse_sel = (EllipseSelect *) tool->private;
x1 = MIN (ellipse_sel->x, ellipse_sel->x + ellipse_sel->w);
@ -106,8 +104,8 @@ ellipse_select_draw (Tool *tool)
x2 = MAX (ellipse_sel->x, ellipse_sel->x + ellipse_sel->w);
y2 = MAX (ellipse_sel->y, ellipse_sel->y + ellipse_sel->h);
gdisplay_transform_coords (gdisp, x1, y1, &x1, &y1, 0);
gdisplay_transform_coords (gdisp, x2, y2, &x2, &y2, 0);
gdisplay_transform_coords (tool->gdisp, x1, y1, &x1, &y1, 0);
gdisplay_transform_coords (tool->gdisp, x2, y2, &x2, &y2, 0);
gdk_draw_arc (ellipse_sel->core->win,
ellipse_sel->core->gc, 0,

View File

@ -42,7 +42,7 @@
#include "libgimp/gimpintl.h"
/* Defaults */
/* Defaults */
#define ERASER_DEFAULT_HARD FALSE
#define ERASER_DEFAULT_INCREMENTAL FALSE
#define ERASER_DEFAULT_ANTI_ERASE FALSE
@ -50,6 +50,7 @@
/* the eraser structures */
typedef struct _EraserOptions EraserOptions;
struct _EraserOptions
{
PaintOptions paint_options;
@ -64,6 +65,18 @@ struct _EraserOptions
};
/* forward function declarations */
static gpointer eraser_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void eraser_motion (PaintCore *paint_core,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
gboolean hard,
gboolean incremental,
gboolean anti_erase);
/* the eraser tool options */
static EraserOptions *eraser_options = NULL;
@ -72,11 +85,6 @@ static gboolean non_gui_hard;
static gboolean non_gui_incremental;
static gboolean non_gui_anti_erase;
/* forward function declarations */
static void eraser_motion (PaintCore *, GimpDrawable *,
PaintPressureOptions *,
gboolean, gboolean, gboolean);
/* functions */
@ -137,7 +145,7 @@ eraser_options_new (void)
static void
eraser_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -164,10 +172,10 @@ eraser_modifier_key_func (Tool *tool,
}
void *
static gpointer
eraser_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
switch (state)
{
@ -196,8 +204,8 @@ eraser_paint_func (PaintCore *paint_core,
Tool *
tools_new_eraser (void)
{
Tool * tool;
PaintCore * private;
Tool *tool;
PaintCore *private;
/* The tool options */
if (! eraser_options)
@ -274,10 +282,10 @@ eraser_motion (PaintCore *paint_core,
}
static void *
static gpointer
eraser_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
eraser_motion (paint_core, drawable,
&non_gui_pressure_options,
@ -288,8 +296,8 @@ eraser_non_gui_paint_func (PaintCore *paint_core,
gboolean
eraser_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
gboolean hardness = ERASER_DEFAULT_HARD;
gboolean method = ERASER_DEFAULT_INCREMENTAL;
@ -310,13 +318,13 @@ eraser_non_gui_default (GimpDrawable *drawable,
gboolean
eraser_non_gui (GimpDrawable *drawable,
int num_strokes,
double *stroke_array,
int hardness,
int method,
int anti_erase)
gint num_strokes,
gdouble *stroke_array,
gint hardness,
gint method,
gboolean anti_erase)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
@ -351,6 +359,6 @@ eraser_non_gui (GimpDrawable *drawable,
paint_core_cleanup ();
return TRUE;
}
else
return FALSE;
return FALSE;
}

View File

@ -20,21 +20,18 @@
#define __ERASER_H__
void * eraser_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean eraser_non_gui (GimpDrawable *,
gint ,
gdouble *,
gint ,
gint ,
gint );
gboolean eraser_non_gui_default (GimpDrawable *,
gint ,
gdouble *);
gboolean eraser_non_gui (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array,
gint hardness,
gint method,
gboolean anti_erase);
gboolean eraser_non_gui_default (GimpDrawable *paint_core,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_eraser (void );
void tools_free_eraser (Tool *);
Tool * tools_new_eraser (void);
void tools_free_eraser (Tool *tool);
#endif /* __ERASER_H__ */

View File

@ -61,6 +61,16 @@ struct _FlipOptions
GtkWidget *type_w[2];
};
/* local function prototypes */
static TileManager * flip_tool_transform (Tool *tool,
GDisplay *gdisp,
TransformState state);
/* private variables */
static FlipOptions *flip_options = NULL;
/* functions */
@ -117,7 +127,7 @@ flip_options_new (void)
static void
flip_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -139,17 +149,15 @@ flip_modifier_key_func (Tool *tool,
break;
}
}
TileManager *
static TileManager *
flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
GDisplay *gdisp,
TransformState state)
{
TransformCore *transform_core;
GDisplay *gdisp;
transform_core = (TransformCore *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
switch (state)
{
@ -179,14 +187,11 @@ flip_tool_transform (Tool *tool,
static void
flip_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
GimpDrawable *drawable;
GdkCursorType ctype = GIMP_BAD_CURSOR;
gdisp = (GDisplay *) gdisp_ptr;
if ((drawable = gimp_image_active_drawable (gdisp->gimage)))
{
gint x, y;
@ -231,10 +236,10 @@ tools_new_flip (void)
tools_register (FLIP, (ToolOptions *) flip_options);
}
tool = transform_core_new (FLIP, FALSE);
tool = transform_core_new (FLIP, FALSE);
private = tool->private;
private->trans_func = flip_tool_transform;
private->trans_func = flip_tool_transform;
private->trans_info[FLIP_INFO] = -1.0;
tool->modifier_key_func = flip_modifier_key_func;

View File

@ -20,10 +20,6 @@
#define __FLIP_TOOL_H__
TileManager * flip_tool_transform (Tool *tool,
gpointer gdisp_ptr,
TransformState state);
TileManager * flip_tool_flip (GimpImage *gimage,
GimpDrawable *drawable,
TileManager *orig,

View File

@ -51,6 +51,7 @@
/* the free selection structures */
typedef struct _FreeSelect FreeSelect;
struct _FreeSelect
{
DrawCore *core; /* Core select object */
@ -65,6 +66,18 @@ struct _FreeSelect
};
/* local function prototypes */
static void free_select_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void free_select_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void free_select_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
/* the free selection tool options */
static SelectionOptions * free_options = NULL;
@ -157,15 +170,13 @@ free_select (GImage *gimage,
}
}
void
static void
free_select_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
FreeSelect *free_sel;
gdisp = (GDisplay *) gdisp_ptr;
free_sel = (FreeSelect *) tool->private;
gdk_pointer_grab (gdisp->canvas->window, FALSE,
@ -175,15 +186,15 @@ free_select_button_press (Tool *tool,
NULL, NULL, bevent->time);
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
switch (free_sel->op)
{
case SELECTION_MOVE_MASK:
init_edit_selection (tool, gdisp_ptr, bevent, EDIT_MASK_TRANSLATE);
init_edit_selection (tool, gdisp, bevent, EDIT_MASK_TRANSLATE);
return;
case SELECTION_MOVE:
init_edit_selection (tool, gdisp_ptr, bevent, EDIT_MASK_TO_LAYER_TRANSLATE);
init_edit_selection (tool, gdisp, bevent, EDIT_MASK_TO_LAYER_TRANSLATE);
return;
default:
break;
@ -197,17 +208,15 @@ free_select_button_press (Tool *tool,
tool);
}
void
static void
free_select_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
FreeSelect *free_sel;
ScanConvertPoint *pts;
GDisplay *gdisp;
gint i;
gdisp = (GDisplay *) gdisp_ptr;
free_sel = (FreeSelect *) tool->private;
gdk_pointer_ungrab (bevent->time);
@ -251,15 +260,13 @@ free_select_button_release (Tool *tool,
}
}
void
static void
free_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
FreeSelect *free_sel;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
free_sel = (FreeSelect *) tool->private;
/* needed for immediate cursor update on modifier event */
@ -273,7 +280,7 @@ free_select_motion (Tool *tool,
{
free_sel->op = SELECTION_REPLACE;
rect_select_cursor_update (tool, mevent, gdisp_ptr);
rect_select_cursor_update (tool, mevent, gdisp);
}
if (add_point (free_sel->num_pts, mevent->x, mevent->y))
@ -291,7 +298,7 @@ free_select_motion (Tool *tool,
static void
free_select_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
FreeSelect *free_sel;

View File

@ -20,19 +20,6 @@
#define __FREE_SELECT_H__
/* free select action functions */
void free_select_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr);
void free_select_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr);
void free_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr);
/* free select functions */
void free_select (GimpImage *gimage,

View File

@ -71,6 +71,27 @@ struct _FuzzySelect
};
/* fuzzy select action functions */
static void fuzzy_select_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void fuzzy_select_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void fuzzy_select_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void fuzzy_select_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static void fuzzy_select_draw (Tool *tool);
static GdkSegment * fuzzy_select_calculate (Tool *tool,
GDisplay *gdisp,
gint *nsegs);
/* the fuzzy selection tool options */
static SelectionOptions *fuzzy_options = NULL;
@ -81,18 +102,6 @@ static gint num_segs = 0;
Channel * fuzzy_mask = NULL;
/* fuzzy select action functions */
static void fuzzy_select_button_press (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_button_release (Tool *, GdkEventButton *, gpointer);
static void fuzzy_select_motion (Tool *, GdkEventMotion *, gpointer);
static void fuzzy_select_control (Tool *, ToolAction, gpointer);
static void fuzzy_select_draw (Tool *);
/* fuzzy select action functions */
static GdkSegment * fuzzy_select_calculate (Tool *, void *, int *);
/*************************************/
/* Fuzzy selection apparatus */
@ -390,12 +399,10 @@ fuzzy_select (GImage *gimage,
static void
fuzzy_select_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
FuzzySelect *fuzzy_sel;
gdisp = (GDisplay *) gdisp_ptr;
fuzzy_sel = (FuzzySelect *) tool->private;
fuzzy_sel->x = bevent->x;
@ -411,21 +418,21 @@ fuzzy_select_button_press (Tool *tool,
NULL, NULL, bevent->time);
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp;
tool->gdisp = gdisp;
if (fuzzy_sel->op == SELECTION_MOVE_MASK)
{
init_edit_selection (tool, gdisp_ptr, bevent, EDIT_MASK_TRANSLATE);
init_edit_selection (tool, gdisp, bevent, EDIT_MASK_TRANSLATE);
return;
}
else if (fuzzy_sel->op == SELECTION_MOVE)
{
init_edit_selection (tool, gdisp_ptr, bevent, EDIT_MASK_TO_LAYER_TRANSLATE);
init_edit_selection (tool, gdisp, bevent, EDIT_MASK_TO_LAYER_TRANSLATE);
return;
}
/* calculate the region boundary */
segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_segs);
segs = fuzzy_select_calculate (tool, gdisp, &num_segs);
draw_core_start (fuzzy_sel->core,
gdisp->canvas->window,
@ -435,13 +442,11 @@ fuzzy_select_button_press (Tool *tool,
static void
fuzzy_select_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
FuzzySelect *fuzzy_sel;
GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr;
fuzzy_sel = (FuzzySelect *) tool->private;
gdk_pointer_ungrab (bevent->time);
@ -471,13 +476,13 @@ fuzzy_select_button_release (Tool *tool,
static void
fuzzy_select_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
FuzzySelect *fuzzy_sel;
GdkSegment *new_segs;
gint num_new_segs;
gint diff_x, diff_y;
gdouble diff;
gint num_new_segs;
gint diff_x, diff_y;
gdouble diff;
static guint last_time = 0;
@ -505,7 +510,7 @@ fuzzy_select_motion (Tool *tool,
fuzzy_sel->first_threshold + diff);
/* calculate the new fuzzy boundary */
new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs);
new_segs = fuzzy_select_calculate (tool, gdisp, &num_new_segs);
/* stop the current boundary */
draw_core_pause (fuzzy_sel->core, tool);
@ -522,24 +527,22 @@ fuzzy_select_motion (Tool *tool,
static GdkSegment *
fuzzy_select_calculate (Tool *tool,
void *gdisp_ptr,
gint *nsegs)
fuzzy_select_calculate (Tool *tool,
GDisplay *gdisp,
gint *nsegs)
{
PixelRegion maskPR;
FuzzySelect *fuzzy_sel;
GDisplay *gdisp;
Channel *new;
GdkSegment *segs;
BoundSeg *bsegs;
GimpDrawable *drawable;
gint i;
gint x, y;
gboolean use_offsets;
gint i;
gint x, y;
gboolean use_offsets;
fuzzy_sel = (FuzzySelect *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
drawable = gimp_image_active_drawable (gdisp->gimage);
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_add_busy_cursors ();
@ -605,7 +608,7 @@ fuzzy_select_draw (Tool *tool)
static void
fuzzy_select_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
FuzzySelect *fuzzy_sel;

View File

@ -20,14 +20,6 @@
#define __FUZZY_SELECT_H__
extern Channel *fuzzy_mask;
/* fuzzy select functions */
Tool * tools_new_fuzzy_select (void);
void tools_free_fuzzy_select (Tool *tool);
/* functions */
Channel * find_contiguous_region (GimpImage *gimage,
GimpDrawable *drawable,
gboolean antialias,
@ -41,5 +33,11 @@ void fuzzy_select (GimpImage *gimage,
gboolean feather,
gdouble feather_radius);
Tool * tools_new_fuzzy_select (void);
void tools_free_fuzzy_select (Tool *tool);
extern Channel *fuzzy_mask;
#endif /* __FUZZY_SELECT_H__ */

View File

@ -375,10 +375,10 @@ gdisplay_delete (GDisplay *gdisp)
/* clear out the pointer to this gdisp from the active tool */
if (active_tool &&
active_tool->gdisp_ptr == gdisp)
active_tool->gdisp == gdisp)
{
active_tool->drawable = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
}
/* free the selection structure */

View File

@ -123,9 +123,9 @@ gimage_invalidate_previews (void)
static void
gimage_dirty_handler (GimpImage *gimage)
{
if (active_tool && !active_tool->preserve)
if (active_tool && ! active_tool->preserve)
{
GDisplay* gdisp = active_tool->gdisp_ptr;
GDisplay* gdisp = active_tool->gdisp;
if (gdisp)
{
@ -149,8 +149,8 @@ gimlist_cb (gpointer image,
gint
gimage_image_count (void)
{
GSList *list=NULL;
gint num_images = 0;
GSList *list = NULL;
gint num_images = 0;
gimage_foreach (gimlist_cb, &list);
num_images = g_slist_length (list);

View File

@ -1080,11 +1080,12 @@ tools_select_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action)
{
ToolType tool_type;
GDisplay *gdisp;
gdisp = gdisplay_active ();
ToolType tool_type;
GDisplay *gdisp;
tool_type = (ToolType) callback_action;
gdisp = gdisplay_active ();
gimp_context_set_tool (gimp_context_get_user (), tool_type);
@ -1101,12 +1102,12 @@ tools_select_cmd_callback (GtkWidget *widget,
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
}
/* setting the gdisp_ptr here is a HACK to allow the tools'
/* setting the tool->gdisp here is a HACK to allow the tools'
* dialog windows being hidden if the tool was selected from
* a tear-off-menu and there was no mouse click in the display
* before deleting it
*/
active_tool->gdisp_ptr = gdisp;
active_tool->gdisp = gdisp;
}
/***** Filters *****/

View File

@ -1080,11 +1080,12 @@ tools_select_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint callback_action)
{
ToolType tool_type;
GDisplay *gdisp;
gdisp = gdisplay_active ();
ToolType tool_type;
GDisplay *gdisp;
tool_type = (ToolType) callback_action;
gdisp = gdisplay_active ();
gimp_context_set_tool (gimp_context_get_user (), tool_type);
@ -1101,12 +1102,12 @@ tools_select_cmd_callback (GtkWidget *widget,
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
}
/* setting the gdisp_ptr here is a HACK to allow the tools'
/* setting the tool->gdisp here is a HACK to allow the tools'
* dialog windows being hidden if the tool was selected from
* a tear-off-menu and there was no mouse click in the display
* before deleting it
*/
active_tool->gdisp_ptr = gdisp;
active_tool->gdisp = gdisp;
}
/***** Filters *****/

View File

@ -51,23 +51,32 @@ struct _HistogramTool
gint x, y; /* coords for last mouse click */
};
/* histogram_tool action functions */
static void histogram_tool_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static HistogramToolDialog * histogram_tool_dialog_new (void);
static void histogram_tool_close_callback (GtkWidget *widget,
gpointer data);
static void histogram_tool_channel_callback (GtkWidget *widget,
gpointer data);
static void histogram_tool_gradient_draw (GtkWidget *gdisp,
gint channel);
static void histogram_tool_dialog_update (HistogramToolDialog *htd,
gint start,
gint end);
/* the histogram tool options */
static ToolOptions * histogram_tool_options = NULL;
/* the histogram tool dialog */
static HistogramToolDialog * histogram_tool_dialog = NULL;
/* histogram_tool action functions */
static void histogram_tool_control (Tool *, ToolAction, gpointer);
static HistogramToolDialog * histogram_tool_dialog_new (void);
static void histogram_tool_close_callback (GtkWidget *, gpointer);
static void histogram_tool_channel_callback (GtkWidget *, gpointer);
static void histogram_tool_gradient_draw (GtkWidget *, gint);
static void histogram_tool_dialog_update (HistogramToolDialog *,
gint, gint);
/* histogram_tool machinery */
@ -78,13 +87,13 @@ histogram_tool_histogram_range (HistogramWidget *widget,
gpointer data)
{
HistogramToolDialog *htd;
gdouble pixels;
gdouble count;
gdouble pixels;
gdouble count;
htd = (HistogramToolDialog *) data;
if (htd == NULL || htd->hist == NULL ||
gimp_histogram_nchannels(htd->hist) <= 0)
gimp_histogram_nchannels (htd->hist) <= 0)
return;
pixels = gimp_histogram_get_count (htd->hist, 0, 255);
@ -148,7 +157,7 @@ histogram_tool_dialog_update (HistogramToolDialog *htd,
static void
histogram_tool_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -171,8 +180,8 @@ histogram_tool_control (Tool *tool,
Tool *
tools_new_histogram_tool (void)
{
Tool * tool;
HistogramTool * private;
Tool *tool;
HistogramTool *private;
/* The tool options */
if (! histogram_tool_options)
@ -181,7 +190,7 @@ tools_new_histogram_tool (void)
tools_register (HISTOGRAM, histogram_tool_options);
}
tool = tools_new_tool (HISTOGRAM);
tool = tools_new_tool (HISTOGRAM);
private = g_new0 (HistogramTool, 1);
tool->scroll_lock = TRUE; /* Disallow scrolling */
@ -402,7 +411,7 @@ histogram_tool_close_callback (GtkWidget *widget,
gimp_dialog_hide (htd->shell);
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -426,7 +435,7 @@ histogram_tool_gradient_draw (GtkWidget *gradient,
{
guchar buf[HISTOGRAM_WIDTH * 3];
guchar r, g, b;
gint i;
gint i;
r = g = b = 0;
switch (channel)
@ -458,5 +467,3 @@ histogram_tool_gradient_draw (GtkWidget *gradient,
gtk_widget_queue_draw (gradient);
}

View File

@ -48,6 +48,7 @@ struct _HistogramToolDialog
gint color;
};
/* histogram_tool functions */
Tool * tools_new_histogram_tool (void);
void tools_free_histogram_tool (Tool *tool);

View File

@ -43,8 +43,8 @@
#define HUE_PARTITION_MASK GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK
#define SLIDER_WIDTH 200
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define DA_WIDTH 40
#define DA_HEIGHT 20
#define HUE_PARTITION 0x0
#define HUE_SLIDER 0x1
@ -62,6 +62,38 @@ struct _HueSaturation
gint x, y; /* coords for last mouse click */
};
/* hue saturation action functions */
static void hue_saturation_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static HueSaturationDialog * hue_saturation_dialog_new (void);
static void hue_saturation_update (HueSaturationDialog *hsd,
gint);
static void hue_saturation_preview (HueSaturationDialog *hsd);
static void hue_saturation_reset_callback (GtkWidget *,
gpointer);
static void hue_saturation_ok_callback (GtkWidget *,
gpointer);
static void hue_saturation_cancel_callback (GtkWidget *,
gpointer);
static void hue_saturation_partition_callback (GtkWidget *,
gpointer);
static void hue_saturation_preview_update (GtkWidget *,
gpointer);
static void hue_saturation_hue_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_lightness_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_saturation_adjustment_update (GtkAdjustment *,
gpointer);
static gint hue_saturation_hue_partition_events (GtkWidget *,
GdkEvent *,
HueSaturationDialog *hsd);
/* the hue-saturation tool options */
static ToolOptions *hue_saturation_options = NULL;
@ -82,27 +114,6 @@ static gint default_colors[6][3] =
{ 255, 0, 255 }
};
/* hue saturation action functions */
static void hue_saturation_control (Tool *, ToolAction, gpointer);
static HueSaturationDialog * hue_saturation_dialog_new (void);
static void hue_saturation_update (HueSaturationDialog *,
gint);
static void hue_saturation_preview (HueSaturationDialog *);
static void hue_saturation_reset_callback (GtkWidget *, gpointer);
static void hue_saturation_ok_callback (GtkWidget *, gpointer);
static void hue_saturation_cancel_callback (GtkWidget *, gpointer);
static void hue_saturation_partition_callback (GtkWidget *, gpointer);
static void hue_saturation_preview_update (GtkWidget *, gpointer);
static void hue_saturation_hue_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_lightness_adjustment_update (GtkAdjustment *,
gpointer);
static void hue_saturation_saturation_adjustment_update (GtkAdjustment *,
gpointer);
static gint hue_saturation_hue_partition_events (GtkWidget *, GdkEvent *,
HueSaturationDialog *);
/* hue saturation machinery */
@ -223,7 +234,7 @@ hue_saturation (PixelRegion *srcPR,
static void
hue_saturation_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -691,7 +702,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
active_tool->preserve = TRUE;
if (!hsd->preview)
image_map_apply (hsd->image_map, hue_saturation, (void *) hsd);
image_map_apply (hsd->image_map, hue_saturation, (gpointer) hsd);
if (hsd->image_map)
image_map_commit (hsd->image_map);
@ -700,7 +711,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
hsd->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -724,7 +735,7 @@ hue_saturation_cancel_callback (GtkWidget *widget,
hsd->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -54,6 +54,7 @@ struct _HueSaturationDialog
gboolean preview;
};
Tool * tools_new_hue_saturation (void);
void tools_free_hue_saturation (Tool *tool);

View File

@ -107,16 +107,16 @@ image_map_do (gpointer data)
}
ImageMap
image_map_create (void *gdisp_ptr,
image_map_create (GDisplay *gdisp,
GimpDrawable *drawable)
{
_ImageMap *_image_map;
_image_map = g_new (_ImageMap, 1);
_image_map->gdisp = (GDisplay *) gdisp_ptr;
_image_map->drawable = drawable;
_image_map->gdisp = gdisp;
_image_map->drawable = drawable;
_image_map->undo_tiles = NULL;
_image_map->state = WAITING;
_image_map->state = WAITING;
/* Interactive tools based on image_map disable the undo stack */
/* to avert any unintented undo interaction through the UI */

View File

@ -26,8 +26,8 @@
* MUST be followed with an image_map_commit or an image_map_abort call
* The image map is no longer valid after a call to commit or abort.
*/
ImageMap image_map_create (void *,
GimpDrawable *);
ImageMap image_map_create (GDisplay *gdisp,
GimpDrawable *drawable);
void image_map_apply (ImageMap,
ImageMapApplyFunc,
void *);

325
app/ink.c
View File

@ -57,7 +57,13 @@
/* the Ink structures */
typedef Blob *(*BlobFunc) (gdouble, gdouble, gdouble, gdouble, gdouble, gdouble);
typedef Blob * (* BlobFunc) (gdouble,
gdouble,
gdouble,
gdouble,
gdouble,
gdouble);
typedef struct _InkTool InkTool;
@ -88,8 +94,8 @@ typedef struct _BrushWidget BrushWidget;
struct _BrushWidget
{
GtkWidget *widget;
gboolean state;
GtkWidget *widget;
gboolean state;
};
typedef struct _InkOptions InkOptions;
@ -130,95 +136,109 @@ struct _InkOptions
};
/* the ink tool options */
static InkOptions * ink_options = NULL;
/* local function prototypes */
static void ink_button_press (Tool *tool,
GdkEventButton *mevent,
GDisplay *gdisp);
static void ink_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void ink_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void ink_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void ink_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static void time_smoother_add (InkTool *ink_tool,
guint32 value);
static gdouble time_smoother_result (InkTool *ink_tool);
static void time_smoother_init (InkTool *ink_tool,
guint32 initval);
static void dist_smoother_add (InkTool *ink_tool,
gdouble value);
static gdouble dist_smoother_result (InkTool *ink_tool);
static void dist_smoother_init (InkTool *ink_tool,
gdouble initval);
static void ink_init (InkTool *ink_tool,
GimpDrawable *drawable,
gdouble x,
gdouble y);
static void ink_finish (InkTool *ink_tool,
GimpDrawable *drawable,
gint tool_id);
static void ink_cleanup (void);
static void ink_type_update (GtkWidget *radio_button,
BlobFunc function);
static GdkPixmap * blob_pixmap (GdkColormap *colormap,
GdkVisual *visual,
BlobFunc function);
static void paint_blob (GdkDrawable *drawable,
GdkGC *gc,
Blob *blob);
/* Rendering functions */
static void ink_set_paint_area (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_paste (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_to_canvas_tiles (InkTool *ink_tool,
Blob *blob,
guchar *color);
static void ink_set_undo_tiles (GimpDrawable *drawable,
gint x,
gint y,
gint w,
gint h);
static void ink_set_canvas_tiles (gint x,
gint y,
gint w,
gint h);
/* Brush pseudo-widget callbacks */
static void brush_widget_active_rect (BrushWidget *brush_widget,
GtkWidget *widget,
GdkRectangle *rect);
static void brush_widget_realize (GtkWidget *widget);
static void brush_widget_expose (GtkWidget *widget,
GdkEventExpose *event,
BrushWidget *brush_widget);
static void brush_widget_button_press (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_button_release (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_motion_notify (GtkWidget *widget,
GdkEventMotion *event,
BrushWidget *brush_widget);
/* local variables */
/* the ink tool options */
static InkOptions *ink_options = NULL;
/* undo blocks variables */
static TileManager * undo_tiles = NULL;
static TileManager *undo_tiles = NULL;
/* Tiles used to render the stroke at 1 byte/pp */
static TileManager * canvas_tiles = NULL;
static TileManager *canvas_tiles = NULL;
/* Flat buffer that is used to used to render the dirty region
* for composition onto the destination drawable
*/
static TempBuf * canvas_buf = NULL;
/* local function prototypes */
static void ink_button_press (Tool *, GdkEventButton *, gpointer);
static void ink_button_release (Tool *, GdkEventButton *, gpointer);
static void ink_motion (Tool *, GdkEventMotion *, gpointer);
static void ink_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void ink_control (Tool *, ToolAction, gpointer);
static void time_smoother_add (InkTool* ink_tool, guint32 value);
static gdouble time_smoother_result (InkTool* ink_tool);
static void time_smoother_init (InkTool* ink_tool, guint32 initval);
static void dist_smoother_add (InkTool* ink_tool, gdouble value);
static gdouble dist_smoother_result (InkTool* ink_tool);
static void dist_smoother_init (InkTool* ink_tool, gdouble initval);
static void ink_init (InkTool *ink_tool,
GimpDrawable *drawable,
double x,
double y);
static void ink_finish (InkTool *ink_tool,
GimpDrawable *drawable,
int tool_id);
static void ink_cleanup (void);
static void ink_type_update (GtkWidget *radio_button,
BlobFunc function);
static GdkPixmap *blob_pixmap (GdkColormap *colormap,
GdkVisual *visual,
BlobFunc function);
static void paint_blob (GdkDrawable *drawable,
GdkGC *gc,
Blob *blob);
/* Rendering functions */
static void ink_set_paint_area (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_paste (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_to_canvas_tiles (InkTool *ink_tool,
Blob *blob,
guchar *color);
static void ink_set_undo_tiles (GimpDrawable *drawable,
int x,
int y,
int w,
int h);
static void ink_set_canvas_tiles(int x,
int y,
int w,
int h);
/* Brush pseudo-widget callbacks */
static void brush_widget_active_rect (BrushWidget *brush_widget,
GtkWidget *w,
GdkRectangle *rect);
static void brush_widget_realize (GtkWidget *w);
static void brush_widget_expose (GtkWidget *w,
GdkEventExpose *event,
BrushWidget *brush_widget);
static void brush_widget_button_press (GtkWidget *w,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_button_release (GtkWidget *w,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_motion_notify (GtkWidget *w,
GdkEventMotion *event,
BrushWidget *brush_widget);
static TempBuf *canvas_buf = NULL;
/* functions */
@ -798,15 +818,13 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
static void
ink_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gdouble x, y;
GDisplay *gdisp;
InkTool *ink_tool;
GimpDrawable *drawable;
Blob *b;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
/* Keep the coordinates of the target */
@ -816,8 +834,8 @@ ink_button_press (Tool *tool,
ink_init (ink_tool, drawable, x, y);
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->state = ACTIVE;
tool->gdisp = gdisp;
tool->paused_count = 0;
/* pause the current selection and grab the pointer */
@ -834,7 +852,7 @@ ink_button_press (Tool *tool,
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
tool->state = ACTIVE;
b = ink_pen_ellipse (x, y,
@ -856,14 +874,12 @@ ink_button_press (Tool *tool,
static void
ink_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
GImage * gimage;
InkTool * ink_tool;
GImage *gimage;
InkTool *ink_tool;
gdisp = (GDisplay *) gdisp_ptr;
gimage = gdisp->gimage;
gimage = gdisp->gimage;
ink_tool = (InkTool *) tool->private;
/* resume the current selection and ungrab the pointer */
@ -965,21 +981,18 @@ time_smoother_add (InkTool* ink_tool, guint32 value)
static void
ink_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
InkTool *ink_tool;
InkTool *ink_tool;
GimpDrawable *drawable;
Blob *b, *blob_union;
Blob *b, *blob_union;
double x, y;
double pressure;
double velocity;
double dist;
gdouble x, y;
gdouble pressure;
gdouble velocity;
gdouble dist;
gdouble lasttime, thistime;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
gdisplay_untransform_coords_f (gdisp, mevent->x, mevent->y, &x, &y, TRUE);
@ -1034,14 +1047,11 @@ ink_motion (Tool *tool,
static void
ink_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
int x, y;
gdisp = (GDisplay *) gdisp_ptr;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gint x, y;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
&x, &y, FALSE, FALSE);
@ -1073,7 +1083,7 @@ ink_cursor_update (Tool *tool,
static void
ink_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
InkTool *ink_tool;
@ -1099,8 +1109,10 @@ ink_control (Tool *tool,
}
static void
ink_init (InkTool *ink_tool, GimpDrawable *drawable,
double x, double y)
ink_init (InkTool *ink_tool,
GimpDrawable *drawable,
gdouble x,
gdouble y)
{
/* free the block structures */
if (undo_tiles)
@ -1123,7 +1135,9 @@ ink_init (InkTool *ink_tool, GimpDrawable *drawable,
}
static void
ink_finish (InkTool *ink_tool, GimpDrawable *drawable, int tool_id)
ink_finish (InkTool *ink_tool,
GimpDrawable *drawable,
gint tool_id)
{
/* push an undo */
drawable_apply_image (drawable, ink_tool->x1, ink_tool->y1,
@ -1178,9 +1192,9 @@ ink_set_paint_area (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob)
{
int x, y, width, height;
int x1, y1, x2, y2;
int bytes;
gint x, y, width, height;
gint x1, y1, x2, y2;
gint bytes;
blob_bounds (blob, &x, &y, &width, &height);
@ -1203,10 +1217,12 @@ enum { ROW_START, ROW_STOP };
/* The insertion sort here, for SUBSAMPLE = 8, tends to beat out
* qsort() by 4x with CFLAGS=-O2, 2x with CFLAGS=-g
*/
static void insert_sort (int *data, int n)
static void
insert_sort (gint *data,
gint n)
{
int i, j, k;
int tmp1, tmp2;
gint i, j, k;
gint tmp1, tmp2;
for (i=2; i<2*n; i+=2)
{
@ -1230,7 +1246,7 @@ static void insert_sort (int *data, int n)
static void
fill_run (guchar *dest,
guchar alpha,
int w)
gint w)
{
if (alpha == 255)
{
@ -1247,17 +1263,20 @@ fill_run (guchar *dest,
}
static void
render_blob_line (Blob *blob, guchar *dest,
int x, int y, int width)
render_blob_line (Blob *blob,
guchar *dest,
gint x,
gint y,
gint width)
{
int buf[4*SUBSAMPLE];
int *data = buf;
int n = 0;
int i, j;
int current = 0; /* number of filled rows at this point
* in the scan line */
int last_x;
gint buf[4*SUBSAMPLE];
gint *data = buf;
gint n = 0;
gint i, j;
gint current = 0; /* number of filled rows at this point
* in the scan line
*/
gint last_x;
/* Sort start and ends for all lines */
@ -1309,8 +1328,8 @@ render_blob_line (Blob *blob, guchar *dest,
last_x = 0;
for (i=0; i<n;)
{
int cur_x = data[2*i] / SUBSAMPLE - x;
int pixel;
gint cur_x = data[2*i] / SUBSAMPLE - x;
gint pixel;
/* Fill in portion leading up to this pixel */
if (current && cur_x != last_x)
@ -1339,7 +1358,7 @@ render_blob_line (Blob *blob, guchar *dest,
i++;
}
dest[cur_x] = MAX(dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
dest[cur_x] = MAX (dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
last_x = cur_x + 1;
}
@ -1349,12 +1368,13 @@ render_blob_line (Blob *blob, guchar *dest,
}
static void
render_blob (PixelRegion *dest, Blob *blob)
render_blob (PixelRegion *dest,
Blob *blob)
{
int i;
int h;
unsigned char * s;
void * pr;
gint i;
gint h;
guchar *s;
gpointer pr;
for (pr = pixel_regions_register (1, dest);
pr != NULL;
@ -1377,10 +1397,10 @@ ink_paste (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob)
{
GImage *gimage;
PixelRegion srcPR;
int offx, offy;
unsigned char col[MAX_CHANNELS];
GImage *gimage;
PixelRegion srcPR;
gint offx, offy;
gchar col[MAX_CHANNELS];
if (! (gimage = drawable_gimage (drawable)))
return;
@ -1502,9 +1522,12 @@ ink_set_undo_tiles (GimpDrawable *drawable,
static void
ink_set_canvas_tiles (int x, int y, int w, int h)
ink_set_canvas_tiles (gint x,
gint y,
gint w,
gint h)
{
int i, j;
gint i, j;
Tile *tile;
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
@ -1537,8 +1560,8 @@ ink_no_draw (Tool *tool)
Tool *
tools_new_ink (void)
{
Tool * tool;
InkTool * private;
Tool *tool;
InkTool *private;
/* The tool options */
if (! ink_options)
@ -1550,10 +1573,10 @@ tools_new_ink (void)
ink_options_reset ();
}
tool = tools_new_tool (INK);
tool = tools_new_tool (INK);
private = g_new0 (InkTool, 1);
private->core = draw_core_new (ink_no_draw);
private->core = draw_core_new (ink_no_draw);
private->last_blob = NULL;
tool->private = private;
@ -1570,7 +1593,7 @@ tools_new_ink (void)
void
tools_free_ink (Tool *tool)
{
InkTool * ink_tool;
InkTool *ink_tool;
ink_tool = (InkTool *) tool->private;

View File

@ -23,6 +23,7 @@
Tool * tools_new_ink (void);
void tools_free_ink (Tool *tool);
/* Procedure definition and marshalling function */
extern ProcRecord ink_proc;

View File

@ -133,6 +133,7 @@ struct _iscissors
};
typedef struct _IScissorsOptions IScissorsOptions;
struct _IScissorsOptions
{
SelectionOptions selection_options;
@ -187,7 +188,7 @@ struct _IScissorsOptions
/* static variables */
/* where to move on a given link direction */
static int move [8][2] =
static gint move [8][2] =
{
{ 1, 0 },
{ 0, 1 },
@ -271,57 +272,72 @@ static IScissorsOptions *iscissors_options = NULL;
/***********************************************************************/
/* Local function prototypes */
static void iscissors_button_press (Tool *, GdkEventButton *, gpointer);
static void iscissors_button_release (Tool *, GdkEventButton *, gpointer);
static void iscissors_motion (Tool *, GdkEventMotion *, gpointer);
static void iscissors_oper_update (Tool *, GdkEventMotion *, gpointer);
static void iscissors_modifier_update (Tool *, GdkEventKey *, gpointer);
static void iscissors_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void iscissors_control (Tool *, ToolAction, gpointer);
static void iscissors_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void iscissors_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void iscissors_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void iscissors_oper_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void iscissors_modifier_update (Tool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void iscissors_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void iscissors_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static void iscissors_reset (Iscissors *iscissors);
static void iscissors_draw (Tool *tool);
static void iscissors_reset (Iscissors *iscissors);
static void iscissors_draw (Tool *tool);
static TileManager * gradient_map_new (GImage *gimage);
static TileManager * gradient_map_new (GImage *gimage);
static void find_optimal_path (TileManager *gradient_map,
TempBuf *dp_buf,
gint x1,
gint y1,
gint x2,
gint y2,
gint xs,
gint ys);
static void find_max_gradient (Iscissors *iscissors,
GImage *gimage,
gint *x,
gint *y);
static void calculate_curve (Tool *tool,
ICurve *curve);
static void iscissors_draw_curve (GDisplay *gdisp,
Iscissors *iscissors,
ICurve *curve);
static void iscissors_free_icurves (GSList *list);
static void iscissors_free_buffers (Iscissors *iscissors);
static void find_optimal_path (TileManager *gradient_map,
TempBuf *dp_buf,
gint x1,
gint y1,
gint x2,
gint y2,
gint xs,
gint ys);
static void find_max_gradient (Iscissors *iscissors,
GImage *gimage,
gint *x,
gint *y);
static void calculate_curve (Tool *tool,
ICurve *curve);
static void iscissors_draw_curve (GDisplay *gdisp,
Iscissors *iscissors,
ICurve *curve);
static void iscissors_free_icurves (GSList *list);
static void iscissors_free_buffers (Iscissors *iscissors);
static gint mouse_over_vertex (Iscissors *iscissors,
gint x,
gint y);
static gboolean clicked_on_vertex (Tool *tool);
static GSList * mouse_over_curve (Iscissors *iscissors,
gint x,
gint y);
static gboolean clicked_on_curve (Tool *tool);
static gint mouse_over_vertex (Iscissors *iscissors,
gint x,
gint y);
static gboolean clicked_on_vertex (Tool *tool);
static GSList * mouse_over_curve (Iscissors *iscissors,
gint x,
gint y);
static gboolean clicked_on_curve (Tool *tool);
static void precalculate_arrays (void);
static GPtrArray * plot_pixels (Iscissors *iscissors,
TempBuf *dp_buf,
gint x1,
gint y1,
gint xs,
gint ys,
gint xe,
gint ye);
static GPtrArray * plot_pixels (Iscissors *iscissors,
TempBuf *dp_buf,
gint x1,
gint y1,
gint xs,
gint ys,
gint xe,
gint ye);
static void
iscissors_options_reset (void)
@ -412,23 +428,21 @@ tools_free_iscissors (Tool *tool)
static void
iscissors_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
GimpDrawable *drawable;
Iscissors *iscissors;
gboolean grab_pointer = FALSE;
gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private;
drawable = gimp_image_active_drawable (gdisp->gimage);
drawable = gimp_image_active_drawable (gdisp->gimage);
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
&iscissors->x, &iscissors->y, FALSE, FALSE);
/* If the tool was being used in another image...reset it */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
if (tool->state == ACTIVE && gdisp != tool->gdisp)
{
/*iscissors->draw = DRAW_CURVE; XXX? */
draw_core_stop (iscissors->core, tool);
@ -436,19 +450,19 @@ iscissors_button_press (Tool *tool,
}
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
switch (iscissors->state)
{
case NO_ACTION:
#if 0
/* XXX what's this supposed to do? */
if (!(bevent->state & GDK_SHIFT_MASK) &&
!(bevent->state & GDK_CONTROL_MASK))
if (selection_point_inside (gdisp->select, gdisp_ptr,
if (! (bevent->state & GDK_SHIFT_MASK) &&
! (bevent->state & GDK_CONTROL_MASK))
if (selection_point_inside (gdisp->select, gdisp,
bevent->x, bevent->y))
{
init_edit_selection (tool, gdisp->select, gdisp_ptr,
init_edit_selection (tool, gdisp->select, gdisp,
bevent->x, bevent->y);
return;
}
@ -534,17 +548,16 @@ iscissors_button_press (Tool *tool,
static void
iscissors_convert (Iscissors *iscissors,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp = (GDisplay *) gdisp_ptr;
ScanConverter *sc;
ScanConvertPoint *pts;
guint npts;
GSList *list;
ICurve *icurve;
guint packed;
gint i;
gint index;
guint npts;
GSList *list;
ICurve *icurve;
guint packed;
gint i;
gint index;
sc = scan_converter_new (gdisp->gimage->width, gdisp->gimage->height, 1);
@ -583,13 +596,11 @@ iscissors_convert (Iscissors *iscissors,
static void
iscissors_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Iscissors *iscissors;
GDisplay *gdisp;
ICurve *curve;
gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private;
TRC (("iscissors_button_release\n"));
@ -694,18 +705,16 @@ iscissors_button_release (Tool *tool,
/* convert the curves into a region */
if (iscissors->connected)
iscissors_convert (iscissors, gdisp_ptr);
iscissors_convert (iscissors, gdisp);
}
static void
iscissors_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Iscissors *iscissors;
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
iscissors = (Iscissors *) tool->private;
if (tool->state != ACTIVE || iscissors->state == NO_ACTION)
@ -763,16 +772,16 @@ iscissors_motion (Tool *tool,
static void
iscissors_draw (Tool *tool)
{
GDisplay *gdisp;
GDisplay *gdisp;
Iscissors *iscissors;
ICurve *curve;
GSList *list;
int tx1, ty1, tx2, ty2;
int txn, tyn;
ICurve *curve;
GSList *list;
gint tx1, ty1, tx2, ty2;
gint txn, tyn;
TRC (("iscissors_draw\n"));
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisp = tool->gdisp;
iscissors = (Iscissors *) tool->private;
gdisplay_transform_coords (gdisp, iscissors->ix, iscissors->iy, &tx1, &ty1,
@ -900,14 +909,12 @@ iscissors_draw_curve (GDisplay *gdisp,
static void
iscissors_oper_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Iscissors *iscissors;
GDisplay *gdisp;
gint x, y;
iscissors = (Iscissors *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
&x, &y, FALSE, FALSE);
@ -954,7 +961,7 @@ iscissors_oper_update (Tool *tool,
static void
iscissors_modifier_update (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Iscissors *iscissors;
SelectOps op;
@ -997,13 +1004,11 @@ iscissors_modifier_update (Tool *tool,
static void
iscissors_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Iscissors *iscissors;
GDisplay *gdisp;
iscissors = (Iscissors *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
switch (iscissors->op)
{
@ -1073,7 +1078,7 @@ iscissors_cursor_update (Tool *tool,
static void
iscissors_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Iscissors * iscissors;
Iscissors_draw draw;
@ -1409,11 +1414,11 @@ calculate_curve (Tool *tool,
{
GDisplay *gdisp;
Iscissors *iscissors;
gint x, y, dir;
gint xs, ys, xe, ye;
gint x1, y1, x2, y2;
gint width, height;
gint ewidth, eheight;
gint x, y, dir;
gint xs, ys, xe, ye;
gint x1, y1, x2, y2;
gint width, height;
gint ewidth, eheight;
TRC (("calculate_curve(%p, %p)\n", tool, curve));
@ -1427,7 +1432,7 @@ calculate_curve (Tool *tool,
* structure.
*/
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisp = tool->gdisp;
iscissors = (Iscissors *) tool->private;
/* Get the bounding box */

View File

@ -46,6 +46,7 @@
#include "libgimp/gimpintl.h"
#define LOW_INPUT 0x1
#define GAMMA 0x2
#define HIGH_INPUT 0x4
@ -72,6 +73,7 @@
GDK_BUTTON1_MOTION_MASK | \
GDK_POINTER_MOTION_HINT_MASK
/* the levels structures */
typedef struct _Levels Levels;
@ -121,6 +123,61 @@ struct _LevelsDialog
GimpLut *lut;
};
/* levels action functions */
static void levels_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static LevelsDialog * levels_dialog_new (void);
static void levels_calculate_transfers (LevelsDialog *ld);
static void levels_update (LevelsDialog *ld,
gint channel);
static void levels_preview (LevelsDialog *ld);
static void levels_channel_callback (GtkWidget *widget,
gpointer data);
static void levels_reset_callback (GtkWidget *widget,
gpointer data);
static void levels_ok_callback (GtkWidget *widget,
gpointer data);
static void levels_cancel_callback (GtkWidget *widget,
gpointer data);
static void levels_auto_callback (GtkWidget *widget,
gpointer data);
static void levels_load_callback (GtkWidget *widget,
gpointer data);
static void levels_save_callback (GtkWidget *widget,
gpointer data);
static void levels_preview_update (GtkWidget *widget,
gpointer data);
static void levels_low_input_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
static void levels_gamma_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
static void levels_high_input_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
static void levels_low_output_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
static void levels_high_output_adjustment_update (GtkAdjustment *adjustment,
gpointer data);
static gint levels_input_da_events (GtkWidget *widget,
GdkEvent *event,
LevelsDialog *ld);
static gint levels_output_da_events (GtkWidget *widget,
GdkEvent *event,
LevelsDialog *ld);
static void file_dialog_create (GtkWidget *widget);
static void file_dialog_ok_callback (GtkWidget *widget,
gpointer data);
static void file_dialog_cancel_callback (GtkWidget *widget,
gpointer data);
static gboolean levels_read_from_file (FILE *f);
static void levels_write_to_file (FILE *f);
/* the levels tool options */
static ToolOptions *levels_options = NULL;
@ -133,46 +190,13 @@ static gboolean load_save;
static GtkWidget *color_option_items[5];
/* levels action functions */
static void levels_control (Tool *, ToolAction, gpointer);
static LevelsDialog * levels_dialog_new (void);
static void levels_calculate_transfers (LevelsDialog *);
static void levels_update (LevelsDialog *, gint);
static void levels_preview (LevelsDialog *);
static void levels_channel_callback (GtkWidget *, gpointer);
static void levels_reset_callback (GtkWidget *, gpointer);
static void levels_ok_callback (GtkWidget *, gpointer);
static void levels_cancel_callback (GtkWidget *, gpointer);
static void levels_auto_callback (GtkWidget *, gpointer);
static void levels_load_callback (GtkWidget *, gpointer);
static void levels_save_callback (GtkWidget *, gpointer);
static void levels_preview_update (GtkWidget *, gpointer);
static void levels_low_input_adjustment_update (GtkAdjustment *, gpointer);
static void levels_gamma_adjustment_update (GtkAdjustment *, gpointer);
static void levels_high_input_adjustment_update (GtkAdjustment *, gpointer);
static void levels_low_output_adjustment_update (GtkAdjustment *, gpointer);
static void levels_high_output_adjustment_update (GtkAdjustment *, gpointer);
static gint levels_input_da_events (GtkWidget *, GdkEvent *,
LevelsDialog *);
static gint levels_output_da_events (GtkWidget *, GdkEvent *,
LevelsDialog *);
static void file_dialog_create (GtkWidget *);
static void file_dialog_ok_callback (GtkWidget *, gpointer);
static void file_dialog_cancel_callback (GtkWidget *, gpointer);
static gboolean levels_read_from_file (FILE *f);
static void levels_write_to_file (FILE *f);
/* levels action functions */
static void
levels_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (action)
{
@ -1028,7 +1052,7 @@ levels_ok_callback (GtkWidget *widget,
ld->image_map = NULL;
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}
@ -1052,7 +1076,7 @@ levels_cancel_callback (GtkWidget *widget,
ld->image_map = NULL;
}
active_tool->gdisp_ptr = NULL;
active_tool->gdisp = NULL;
active_tool->drawable = NULL;
}

View File

@ -70,25 +70,37 @@ struct _MagnifyOptions
};
/* the magnify tool options */
static MagnifyOptions *magnify_options = NULL;
/* magnify action functions */
static void magnify_button_press (Tool *, GdkEventButton *, gpointer);
static void magnify_button_release (Tool *, GdkEventButton *, gpointer);
static void magnify_motion (Tool *, GdkEventMotion *, gpointer);
static void magnify_modifier_update (Tool *, GdkEventKey *, gpointer);
static void magnify_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void magnify_control (Tool *, ToolAction, gpointer);
static void magnify_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void magnify_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void magnify_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void magnify_modifier_update (Tool *tool,
GdkEventKey *kevent,
GDisplay *gdisp);
static void magnify_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void magnify_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
/* magnify utility functions */
static void zoom_in (gint *src,
gint *dest,
gint scale);
static void zoom_out (gint *src,
gint *dest,
gint scale);
static void zoom_in (gint *src,
gint *dest,
gint scale);
static void zoom_out (gint *src,
gint *dest,
gint scale);
/* the magnify tool options */
static MagnifyOptions *magnify_options = NULL;
/* magnify tool options functions */
@ -193,13 +205,11 @@ zoom_out (gint *src,
static void
magnify_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Magnify *magnify;
gint x, y;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
magnify = (Magnify *) tool->private;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, TRUE, 0);
@ -216,7 +226,7 @@ magnify_button_press (Tool *tool,
NULL, NULL, bevent->time);
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
draw_core_start (magnify->core,
gdisp->canvas->window,
@ -227,17 +237,15 @@ magnify_button_press (Tool *tool,
static void
magnify_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Magnify *magnify;
GDisplay *gdisp;
gint win_width, win_height;
gint width, height;
gint scalesrc, scaledest;
gint scale;
gint x1, y1, x2, y2, w, h;
gint win_width, win_height;
gint width, height;
gint scalesrc, scaledest;
gint scale;
gint x1, y1, x2, y2, w, h;
gdisp = (GDisplay *) gdisp_ptr;
magnify = (Magnify *) tool->private;
gdk_pointer_ungrab (bevent->time);
@ -297,16 +305,14 @@ magnify_button_release (Tool *tool,
static void
magnify_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Magnify *magnify;
GDisplay *gdisp;
gint x, y;
gint x, y;
if (tool->state != ACTIVE)
return;
gdisp = (GDisplay *) gdisp_ptr;
magnify = (Magnify *) tool->private;
draw_core_pause (magnify->core, tool);
@ -322,7 +328,7 @@ magnify_motion (Tool *tool,
static void
magnify_modifier_update (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -344,12 +350,8 @@ magnify_modifier_update (Tool *tool,
static void
magnify_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
gdisp = (GDisplay *) gdisp_ptr;
if (magnify_options->type == ZOOMIN)
{
gdisplay_install_tool_cursor (gdisp, GIMP_ZOOM_CURSOR,
@ -370,11 +372,9 @@ magnify_cursor_update (Tool *tool,
void
magnify_draw (Tool *tool)
{
GDisplay *gdisp;
Magnify *magnify;
gint x1, y1, x2, y2;
gint x1, y1, x2, y2;
gdisp = (GDisplay *) tool->gdisp_ptr;
magnify = (Magnify *) tool->private;
x1 = MIN (magnify->x, magnify->x + magnify->w);
@ -382,8 +382,8 @@ magnify_draw (Tool *tool)
x2 = MAX (magnify->x, magnify->x + magnify->w);
y2 = MAX (magnify->y, magnify->y + magnify->h);
gdisplay_transform_coords (gdisp, x1, y1, &x1, &y1, 0);
gdisplay_transform_coords (gdisp, x2, y2, &x2, &y2, 0);
gdisplay_transform_coords (tool->gdisp, x1, y1, &x1, &y1, 0);
gdisplay_transform_coords (tool->gdisp, x2, y2, &x2, &y2, 0);
gdk_draw_rectangle (magnify->core->win, magnify->core->gc, 0,
x1, y1, (x2 - x1), (y2 - y1));
@ -393,7 +393,7 @@ magnify_draw (Tool *tool)
static void
magnify_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
Magnify *magnify;
@ -422,7 +422,7 @@ magnify_control (Tool *tool,
Tool *
tools_new_magnify (void)
{
Tool *tool;
Tool *tool;
Magnify *private;
/* The tool options */
@ -432,7 +432,7 @@ tools_new_magnify (void)
tools_register (MAGNIFY, (ToolOptions *) magnify_options);
}
tool = tools_new_tool (MAGNIFY);
tool = tools_new_tool (MAGNIFY);
private = g_new0 (Magnify, 1);
private->core = draw_core_new (magnify_draw);

View File

@ -47,6 +47,9 @@
#define ARC_RADIUS_2 1100
#define STATUSBAR_SIZE 128
/* maximum information buffer size */
#define MAX_INFO_BUF 16
/* possible measure functions */
typedef enum
{
@ -89,8 +92,27 @@ struct _MeasureOptions
};
/* maximum information buffer size */
#define MAX_INFO_BUF 16
/* local function prototypes */
static void measure_tool_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void measure_tool_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void measure_tool_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void measure_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void measure_tool_control (Tool *tool,
ToolAction action,
GDisplay *gdisp);
static void measure_tool_info_window_close_callback (GtkWidget *widget,
gpointer data);
static void measure_tool_info_update (void);
static MeasureOptions *measure_tool_options = NULL;
@ -100,28 +122,6 @@ static gchar distance_buf[MAX_INFO_BUF];
static gchar angle_buf[MAX_INFO_BUF];
/* local function prototypes */
static void measure_tool_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr);
static void measure_tool_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr);
static void measure_tool_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr);
static void measure_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr);
static void measure_tool_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr);
static void measure_tool_info_window_close_callback (GtkWidget *widget,
gpointer data);
static void measure_tool_info_update (void);
static void
measure_tool_options_reset (void)
{
@ -195,21 +195,19 @@ measure_get_angle (gint dx,
static void
measure_tool_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
MeasureTool *measure_tool;
gint x[3];
gint y[3];
gint i;
gdisp = (GDisplay *) gdisp_ptr;
measure_tool = (MeasureTool *) tool->private;
/* if we are changing displays, pop the statusbar of the old one */
if (tool->state == ACTIVE && gdisp_ptr != tool->gdisp_ptr)
if (tool->state == ACTIVE && gdisp != tool->gdisp)
{
GDisplay *old_gdisp = tool->gdisp_ptr;
GDisplay *old_gdisp = tool->gdisp;
gtk_statusbar_pop (GTK_STATUSBAR (old_gdisp->statusbar),
measure_tool->context_id);
@ -219,7 +217,7 @@ measure_tool_button_press (Tool *tool,
measure_tool->function = CREATING;
if (tool->state == ACTIVE && gdisp_ptr == tool->gdisp_ptr)
if (tool->state == ACTIVE && gdisp == tool->gdisp)
{
/* if the cursor is in one of the handles,
* the new function will be moving or adding a new point or guide
@ -334,7 +332,7 @@ measure_tool_button_press (Tool *tool,
measure_tool->function = ADDING;
/* set the gdisplay */
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
/* start drawing the measure tool */
draw_core_start (measure_tool->core, gdisp->canvas->window, tool);
@ -378,12 +376,10 @@ measure_tool_button_press (Tool *tool,
static void
measure_tool_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
MeasureTool *measure_tool;
gdisp = (GDisplay *) gdisp_ptr;
measure_tool = (MeasureTool *) tool->private;
measure_tool->function = FINISHED;
@ -395,9 +391,8 @@ measure_tool_button_release (Tool *tool,
static void
measure_tool_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
MeasureTool *measure_tool;
gint x, y;
gint ax, ay;
@ -409,7 +404,6 @@ measure_tool_motion (Tool *tool,
gdouble distance;
gchar status_str[STATUSBAR_SIZE];
gdisp = (GDisplay *) gdisp_ptr;
measure_tool = (MeasureTool *) tool->private;
/* undraw the current tool */
@ -607,22 +601,20 @@ measure_tool_motion (Tool *tool,
static void
measure_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
MeasureTool *measure_tool;
GDisplay *gdisp;
gint x[3];
gint y[3];
gint i;
gboolean in_handle = FALSE;
MeasureTool *measure_tool;
gint x[3];
gint y[3];
gint i;
gboolean in_handle = FALSE;
GdkCursorType ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gdisp = (GDisplay *) gdisp_ptr;
measure_tool = (MeasureTool *) tool->private;
if (tool->state == ACTIVE && tool->gdisp_ptr == gdisp_ptr)
if (tool->state == ACTIVE && tool->gdisp == gdisp)
{
for (i = 0; i < measure_tool->num_points; i++)
{
@ -674,7 +666,6 @@ measure_tool_cursor_update (Tool *tool,
static void
measure_tool_draw (Tool *tool)
{
GDisplay *gdisp;
MeasureTool *measure_tool;
gint x[3];
gint y[3];
@ -682,12 +673,12 @@ measure_tool_draw (Tool *tool)
gint angle1, angle2;
gint draw_arc = 0;
gdisp = (GDisplay *) tool->gdisp_ptr;
measure_tool = (MeasureTool *) tool->private;
for (i = 0; i < measure_tool->num_points; i++)
{
gdisplay_transform_coords (gdisp, measure_tool->x[i], measure_tool->y[i],
gdisplay_transform_coords (tool->gdisp,
measure_tool->x[i], measure_tool->y[i],
&x[i], &y[i], FALSE);
if (i == 0 && measure_tool->num_points == 3)
{
@ -745,12 +736,10 @@ measure_tool_draw (Tool *tool)
static void
measure_tool_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
MeasureTool *measure_tool;
gdisp = (GDisplay *) tool->gdisp_ptr;
measure_tool = (MeasureTool *) tool->private;
switch (action)
@ -764,7 +753,8 @@ measure_tool_control (Tool *tool,
break;
case HALT:
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), measure_tool->context_id);
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar),
measure_tool->context_id);
draw_core_stop (measure_tool->core, tool);
tool->state = INACTIVE;
break;
@ -825,15 +815,13 @@ tools_new_measure_tool (void)
void
tools_free_measure_tool (Tool *tool)
{
GDisplay *gdisp;
MeasureTool *measure_tool;
measure_tool = (MeasureTool *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
if (tool->state == ACTIVE)
{
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar),
gtk_statusbar_pop (GTK_STATUSBAR (tool->gdisp->statusbar),
measure_tool->context_id);
draw_core_stop (measure_tool->core, tool);
}
@ -845,5 +833,6 @@ tools_free_measure_tool (Tool *tool)
info_dialog_free (measure_tool_info);
measure_tool_info = NULL;
}
g_free (measure_tool);
}

View File

@ -45,6 +45,7 @@
/* the move structures */
typedef struct _MoveTool MoveTool;
struct _MoveTool
{
Layer *layer;
@ -53,6 +54,26 @@ struct _MoveTool
};
/* move tool action functions */
static void move_tool_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void move_tool_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void move_tool_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void move_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void move_tool_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static void move_create_gc (GDisplay *gdisp);
/* the move tool options */
static ToolOptions *move_options = NULL;
@ -60,48 +81,37 @@ static ToolOptions *move_options = NULL;
static GdkGC *move_gc = NULL;
/* move tool action functions */
static void move_tool_button_press (Tool *, GdkEventButton *, gpointer);
static void move_tool_button_release (Tool *, GdkEventButton *, gpointer);
static void move_tool_motion (Tool *, GdkEventMotion *, gpointer);
static void move_tool_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void move_tool_control (Tool *, ToolAction, gpointer);
static void move_create_gc (GDisplay *gdisp);
/* move action functions */
static void
move_tool_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
MoveTool *move;
Layer *layer;
Guide *guide;
gint x, y;
gdisp = (GDisplay *) gdisp_ptr;
move = (MoveTool *) tool->private;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
move->layer = NULL;
move->guide = NULL;
move->disp = NULL;
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, FALSE, FALSE);
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y,
FALSE, FALSE);
if (bevent->state & GDK_MOD1_MASK &&
!gimage_mask_is_empty (gdisp->gimage))
{
init_edit_selection (tool, gdisp_ptr, bevent, EDIT_MASK_TRANSLATE);
init_edit_selection (tool, gdisp, bevent, EDIT_MASK_TRANSLATE);
tool->state = ACTIVE;
}
else if (bevent->state & GDK_SHIFT_MASK)
{
init_edit_selection (tool, gdisp_ptr, bevent, EDIT_LAYER_TRANSLATE);
init_edit_selection (tool, gdisp, bevent, EDIT_LAYER_TRANSLATE);
tool->state = ACTIVE;
}
else
@ -138,7 +148,7 @@ move_tool_button_press (Tool *tool,
else
{
gimp_image_set_active_layer (gdisp->gimage, layer);
init_edit_selection (tool, gdisp_ptr, bevent, EDIT_LAYER_TRANSLATE);
init_edit_selection (tool, gdisp, bevent, EDIT_LAYER_TRANSLATE);
}
tool->state = ACTIVE;
}
@ -202,15 +212,13 @@ move_draw_guide (GDisplay *gdisp,
static void
move_tool_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
MoveTool *move;
GDisplay *gdisp;
gboolean delete_guide;
gint x1, y1;
gint x2, y2;
gdisp = (GDisplay *) gdisp_ptr;
move = (MoveTool *) tool->private;
gdk_flush ();
@ -259,7 +267,7 @@ move_tool_button_release (Tool *tool,
}
else
{
move_tool_motion (tool, NULL, gdisp_ptr);
move_tool_motion (tool, NULL, gdisp);
}
selection_resume (gdisp->select);
@ -285,15 +293,13 @@ move_tool_button_release (Tool *tool,
static void
move_tool_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
MoveTool *move;
GDisplay *gdisp;
gint x, y;
move = (MoveTool *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
if (move->guide)
{
@ -323,16 +329,14 @@ move_tool_motion (Tool *tool,
static void
move_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
MoveTool *move;
GDisplay *gdisp;
Guide *guide;
Layer *layer;
gint x, y;
move = (MoveTool *) tool->private;
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y,
FALSE, FALSE);
@ -357,7 +361,7 @@ move_tool_cursor_update (Tool *tool,
if (gdisp->draw_guides &&
(guide = gdisplay_find_guide (gdisp, mevent->x, mevent->y)))
{
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
gdisplay_install_tool_cursor (gdisp, GDK_HAND2,
TOOL_TYPE_NONE,
CURSOR_MODIFIER_HAND,
@ -372,10 +376,10 @@ move_tool_cursor_update (Tool *tool,
gdisplay_draw_guide (gdisp, move->guide, FALSE);
}
gdisp = gdisp_ptr;
gdisp = gdisp;
gdisplay_draw_guide (gdisp, guide, TRUE);
move->guide = guide;
move->disp = gdisp;
move->disp = gdisp;
}
}
else if ((layer = gimp_image_pick_correlate_layer (gdisp->gimage, x, y)))
@ -412,7 +416,7 @@ move_tool_cursor_update (Tool *tool,
static void
move_tool_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
MoveTool *move;
@ -425,7 +429,7 @@ move_tool_control (Tool *tool,
case RESUME:
if (move->guide)
gdisplay_draw_guide (gdisp_ptr, move->guide, TRUE);
gdisplay_draw_guide (gdisp, move->guide, TRUE);
break;
case HALT:
@ -458,7 +462,7 @@ move_tool_start_hguide (Tool *tool,
selection_pause (gdisp->select);
tool->gdisp_ptr = gdisp;
tool->gdisp = gdisp;
tool->scroll_lock = TRUE;
private = tool->private;
@ -482,7 +486,7 @@ move_tool_start_vguide (Tool *tool,
selection_pause (gdisp->select);
tool->gdisp_ptr = gdisp;
tool->gdisp = gdisp;
tool->scroll_lock = TRUE;
private = tool->private;
@ -539,10 +543,10 @@ tools_free_move_tool (Tool *tool)
move = (MoveTool *) tool->private;
if (tool->gdisp_ptr)
if (tool->gdisp)
{
if (move->guide)
gdisplay_draw_guide (tool->gdisp_ptr, move->guide, FALSE);
gdisplay_draw_guide (tool->gdisp, move->guide, FALSE);
}
g_free (move);

View File

@ -77,6 +77,7 @@ typedef enum
#define PREVIEW_UPDATE_TIMEOUT 1100
typedef struct _NavWinData NavWinData;
struct _NavWinData
{
NavWinType ptype;
@ -88,7 +89,7 @@ struct _NavWinData
GtkWidget *zoom_label;
GtkObject *zoom_adjustment;
GtkWidget *preview;
void *gdisp_ptr; /* I'm not happy 'bout this one */
GDisplay *gdisp; /* I'm not happy 'bout this one */
GdkGC *gc;
gint dispx; /* x pos of top left corner of display area */
gint dispy; /* y pos of top left corner of display area */
@ -251,10 +252,6 @@ nav_window_draw_sqr (NavWinData *iwd,
gint w,
gint h)
{
GDisplay *gdisp;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdk_gc_set_function (iwd->gc, GDK_INVERT);
if (undraw)
@ -307,7 +304,7 @@ set_size_data (NavWinData *iwd)
GDisplay *gdisp;
GimpImage *gimage;
gdisp = (GDisplay *)(iwd->gdisp_ptr);
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
sel_width = gimage->width;
@ -345,9 +342,6 @@ create_preview_widget (NavWinData *iwd)
GtkWidget *hbox;
GtkWidget *image;
GtkWidget *frame;
GDisplay *gdisp;
gdisp = (GDisplay *)(iwd->gdisp_ptr);
hbox = gtk_hbox_new (FALSE,0);
iwd->previewBox = hbox;
@ -406,7 +400,7 @@ update_real_view (NavWinData *iwd,
gint xpnt;
gint ypnt;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
xratio = SCALEFACTOR_X (gdisp);
yratio = SCALEFACTOR_Y (gdisp);
@ -433,7 +427,7 @@ update_real_view (NavWinData *iwd,
yoffset = ypnt - gdisp->offset_y;
iwd->block_window_marker = TRUE;
scroll_display (iwd->gdisp_ptr, xoffset, yoffset);
scroll_display (iwd->gdisp, xoffset, yoffset);
iwd->block_window_marker = FALSE;
}
@ -454,10 +448,8 @@ nav_window_update_preview (NavWinData *iwd)
gimp_add_busy_cursors ();
gdisp = (GDisplay *) iwd->gdisp_ptr;
/* Calculate preview size */
gimage = ((GDisplay *) (iwd->gdisp_ptr))->gimage;
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
/* Min size is 2 */
pwidth = iwd->pwidth;
@ -615,10 +607,8 @@ nav_window_update_preview_blank (NavWinData *iwd)
GimpImage *gimage;
GDisplay *gdisp;
gdisp = (GDisplay *) iwd->gdisp_ptr;
/* Calculate preview size */
gimage = ((GDisplay *) (iwd->gdisp_ptr))->gimage;
gdisp = iwd->gdisp;
gimage = gdisp->gimage;
#endif /* 0 */
@ -670,9 +660,9 @@ update_zoom_label (NavWinData *iwd)
/* Update the zoom scale string */
g_snprintf (scale_str, MAX_SCALE_BUF, "%d:%d",
SCALEDEST (((GDisplay *)iwd->gdisp_ptr)),
SCALESRC (((GDisplay *)iwd->gdisp_ptr)));
SCALEDEST (iwd->gdisp),
SCALESRC (iwd->gdisp));
gtk_label_set_text (GTK_LABEL (iwd->zoom_label), scale_str);
}
@ -689,8 +679,8 @@ update_zoom_adjustment (NavWinData *iwd)
adj = GTK_ADJUSTMENT (iwd->zoom_adjustment);
f =
((gdouble) SCALEDEST (((GDisplay *) iwd->gdisp_ptr))) /
((gdouble) SCALESRC (((GDisplay *) iwd->gdisp_ptr)));
((gdouble) SCALEDEST (iwd->gdisp)) /
((gdouble) SCALESRC (iwd->gdisp));
if (f < 1.0)
{
@ -782,7 +772,7 @@ nav_window_preview_events (GtkWidget *widget,
if(!iwd || iwd->frozen == TRUE)
return FALSE;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
switch (event->type)
{
@ -998,7 +988,7 @@ nav_window_expose_events (GtkWidget *widget,
if(!iwd || iwd->frozen == TRUE)
return FALSE;
gdisp = (GDisplay *) iwd->gdisp_ptr;
gdisp = iwd->gdisp;
switch (event->type)
{
@ -1025,12 +1015,12 @@ nav_window_expose_events (GtkWidget *widget,
static gint
nav_preview_update_do (NavWinData *iwd)
{
/* If the gdisp_ptr has gone then don't do anything in this timer */
if (!iwd->gdisp_ptr)
/* If the gdisp has gone then don't do anything in this timer */
if (!iwd->gdisp)
return FALSE;
nav_window_update_preview (iwd);
nav_window_disp_area (iwd, iwd->gdisp_ptr);
nav_window_disp_area (iwd, iwd->gdisp);
gtk_widget_queue_draw (iwd->preview);
iwd->installedDirtyTimer = FALSE;
@ -1076,16 +1066,13 @@ navwindow_zoomin (GtkWidget *widget,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
iwd = (NavWinData *)data;
iwd = (NavWinData *) data;
if(!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
change_scale (gdisp, ZOOMIN);
change_scale (iwd->gdisp, ZOOMIN);
}
static void
@ -1093,16 +1080,13 @@ navwindow_zoomout (GtkWidget *widget,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
iwd = (NavWinData *)data;
if (!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
change_scale (gdisp, ZOOMOUT);
change_scale (iwd->gdisp, ZOOMOUT);
}
static void
@ -1110,7 +1094,6 @@ zoom_adj_changed (GtkAdjustment *adj,
gpointer data)
{
NavWinData *iwd;
GDisplay *gdisp;
gint scalesrc;
gint scaledest;
@ -1119,8 +1102,6 @@ zoom_adj_changed (GtkAdjustment *adj,
if (!iwd || iwd->frozen == TRUE)
return;
gdisp = (GDisplay *) iwd->gdisp_ptr;
if (adj->value < 0.0)
{
scalesrc = abs ((gint) adj->value - 1);
@ -1133,7 +1114,7 @@ zoom_adj_changed (GtkAdjustment *adj,
}
iwd->block_adj_sig = TRUE;
change_scale (gdisp, (scaledest * 100) + scalesrc);
change_scale (iwd->gdisp, (scaledest * 100) + scalesrc);
iwd->block_adj_sig = FALSE;
}
@ -1168,8 +1149,8 @@ nav_create_button_area (InfoDialog *info_win)
/* user zoom ratio */
g_snprintf (scale_str, MAX_SCALE_BUF, "%d:%d",
SCALEDEST (((GDisplay *)iwd->gdisp_ptr)),
SCALESRC (((GDisplay *)iwd->gdisp_ptr)));
SCALEDEST (iwd->gdisp),
SCALESRC (iwd->gdisp));
label1 = gtk_label_new (scale_str);
gtk_widget_show (label1);
@ -1256,12 +1237,12 @@ info_window_image_preview_new (InfoDialog *info_win)
}
NavWinData *
create_dummy_iwd (void *gdisp_ptr,
create_dummy_iwd (GDisplay *gdisp,
NavWinType ptype)
{
NavWinData *iwd;
iwd = (NavWinData *) g_malloc (sizeof (NavWinData));
iwd = g_new (NavWinData, 1);
iwd->ptype = ptype;
iwd->info_win = NULL;
iwd->showingPreview = TRUE;
@ -1269,7 +1250,7 @@ create_dummy_iwd (void *gdisp_ptr,
iwd->preview = NULL;
iwd->zoom_label = NULL;
iwd->zoom_adjustment = NULL;
iwd->gdisp_ptr = gdisp_ptr;
iwd->gdisp = gdisp;
iwd->dispx = -1;
iwd->dispy = -1;
iwd->dispwidth = -1;
@ -1299,7 +1280,7 @@ create_dummy_iwd (void *gdisp_ptr,
static InfoDialog *nav_window_auto = NULL;
static gchar *
nav_window_title(GDisplay *gdisp)
nav_window_title (GDisplay *gdisp)
{
gchar *title;
gchar *title_buf;
@ -1326,8 +1307,8 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
NavWinData *iwd;
gchar *title_buf;
iwd = (NavWinData *)nav_window_auto->user_data;
old_gdisp = (GDisplay *) iwd->gdisp_ptr;
iwd = (NavWinData *) nav_window_auto->user_data;
old_gdisp = iwd->gdisp;
if (!nav_window_auto || gdisp == old_gdisp || !gdisp)
{
@ -1347,7 +1328,7 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
if (gimage && gimp_set_have (image_context, gimage))
{
iwd->gdisp_ptr = gdisp;
iwd->gdisp = gdisp;
/* Update preview to new display */
nav_window_preview_resized (nav_window_auto);
@ -1382,9 +1363,10 @@ nav_window_follow_auto (void)
if (!gdisp)
return;
if(!nav_window_auto)
if (!nav_window_auto)
{
nav_window_auto = nav_window_create ((void *) gdisp);
nav_window_auto = nav_window_create (gdisp);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
"display_changed",
GTK_SIGNAL_FUNC (nav_window_change_display),
@ -1400,20 +1382,17 @@ nav_window_follow_auto (void)
InfoDialog *
nav_window_create (void *gdisp_ptr)
nav_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
GDisplay *gdisp;
NavWinData *iwd;
GtkWidget *container;
gchar *title_buf;
GimpImageBaseType type;
gdisp = (GDisplay *) gdisp_ptr;
type = gimp_image_base_type (gdisp->gimage);
title_buf = nav_window_title(gdisp);
title_buf = nav_window_title (gdisp);
info_win = info_dialog_new (title_buf,
gimp_standard_help_func,
@ -1434,7 +1413,7 @@ nav_window_create (void *gdisp_ptr)
(GtkSignalFunc) nav_window_destroy_callback,
info_win);
iwd = create_dummy_iwd (gdisp_ptr, NAV_WINDOW);
iwd = create_dummy_iwd (gdisp, NAV_WINDOW);
info_win->user_data = iwd;
iwd->info_win = info_win;
@ -1501,7 +1480,7 @@ nav_window_update_window_marker (InfoDialog *info_win)
iwd->dispwidth, iwd->dispheight);
/* Update to new size */
nav_window_disp_area (iwd, iwd->gdisp_ptr);
nav_window_disp_area (iwd, iwd->gdisp);
/* and redraw */
nav_window_draw_sqr (iwd,
@ -1563,14 +1542,14 @@ nav_window_get_gdisp (void)
for (listPtr = list; listPtr; listPtr = g_slist_next (listPtr))
{
gimage = GIMP_IMAGE (listPtr->data);
gdisp = gdisplays_check_valid (NULL,gimage);
gdisp = gdisplays_check_valid (NULL, gimage);
if (gdisp)
break;
}
g_slist_free (list);
return (gdisp);
return gdisp;
}
@ -1589,12 +1568,12 @@ nav_window_free (GDisplay *del_gdisp,
{
if (nav_window_auto != NULL)
{
GDisplay * gdisp;
GDisplay *gdisp;
iwd = (NavWinData *) nav_window_auto->user_data;
/* Only freeze if we are displaying the image we have deleted */
if ((GDisplay *) iwd->gdisp_ptr != del_gdisp)
if (iwd->gdisp != del_gdisp)
return;
if (iwd->timer_id)
@ -1605,7 +1584,9 @@ nav_window_free (GDisplay *del_gdisp,
gdisp = nav_window_get_gdisp ();
if (gdisp)
nav_window_change_display (NULL, gdisp, NULL);
{
nav_window_change_display (NULL, gdisp, NULL);
}
else
{
/* Clear window and freeze */
@ -1615,7 +1596,7 @@ nav_window_free (GDisplay *del_gdisp,
_("Navigation: No Image"));
gtk_widget_set_sensitive (nav_window_auto->vbox, FALSE);
iwd->gdisp_ptr = NULL;
iwd->gdisp = NULL;
gtk_widget_hide (GTK_WIDGET (nav_window_auto->shell));
}
}
@ -1651,7 +1632,7 @@ nav_popup_click_handler (GtkWidget *widget,
bevent = (GdkEventButton *)event;
if(!gdisp->nav_popup)
if (! gdisp->nav_popup)
{
/* popup a simplfied window with the nav box in it */
GtkWidget *frame;
@ -1674,14 +1655,14 @@ nav_popup_click_handler (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_object_set_data (GTK_OBJECT (gdisp->nav_popup),"navpop_prt",
(gpointer) iwp);
nav_window_disp_area (iwp, iwp->gdisp_ptr);
nav_window_disp_area (iwp, iwp->gdisp);
}
else
{
gtk_widget_hide (gdisp->nav_popup);
iwp = (NavWinData *) gtk_object_get_data (GTK_OBJECT (gdisp->nav_popup),
"navpop_prt");
nav_window_disp_area (iwp, iwp->gdisp_ptr);
nav_window_disp_area (iwp, iwp->gdisp);
nav_window_update_preview (iwp);
}

View File

@ -21,7 +21,7 @@
#define __NAV_WINDOW_H__
InfoDialog * nav_window_create (gpointer );
InfoDialog * nav_window_create (GDisplay *gdisp);
void nav_window_free (GDisplay *gdisp,
InfoDialog *idialog);
void nav_window_update_window_marker (InfoDialog *idialog);

View File

@ -77,6 +77,16 @@ struct _AirbrushOptions
};
/* local function prototypes */
static gpointer airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static gpointer airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
/* the airbrush tool options */
static AirbrushOptions *airbrush_options = NULL;
@ -189,13 +199,13 @@ tools_new_airbrush (void)
return tool;
}
void *
static gpointer
airbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
GimpBrush *brush;
gdouble rate;
gdouble rate;
if (!drawable)
return NULL;
@ -357,10 +367,10 @@ airbrush_motion (PaintCore *paint_core,
SOFT, scale, mode);
}
static void *
static gpointer
airbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
airbrush_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_pressure, non_gui_incremental);
@ -370,8 +380,8 @@ airbrush_non_gui_paint_func (PaintCore *paint_core,
gboolean
airbrush_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
AirbrushOptions *options = airbrush_options;
gdouble pressure = AIRBRUSH_PRESSURE_DEFAULT;
@ -384,11 +394,11 @@ airbrush_non_gui_default (GimpDrawable *drawable,
gboolean
airbrush_non_gui (GimpDrawable *drawable,
double pressure,
int num_strokes,
double *stroke_array)
gdouble pressure,
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
@ -419,8 +429,9 @@ airbrush_non_gui (GimpDrawable *drawable,
/* Cleanup */
paint_core_cleanup ();
return TRUE;
}
else
return FALSE;
return FALSE;
}

View File

@ -20,18 +20,16 @@
#define __AIRBRUSH_H__
void * airbrush_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean airbrush_non_gui (GimpDrawable *,
gdouble,
gint,
gdouble *);
gboolean airbrush_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean airbrush_non_gui (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
gdouble *stroke_array);
gboolean airbrush_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_airbrush (void);
void tools_free_airbrush (Tool *);
void tools_free_airbrush (Tool *tool);
#endif /* __AIRBRUSH_H__ */

View File

@ -79,37 +79,59 @@ struct _CloneOptions
};
/* forward function declarations */
static gpointer clone_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void clone_draw (Tool *tool);
static void clone_motion (PaintCore *paint_core,
GimpDrawable *drawable,
GimpDrawable *src_drawable,
PaintPressureOptions *pressure_options,
CloneType type,
gint offset_x,
gint offset_y);
static void clone_line_image (GImage *dest,
GImage *src,
GimpDrawable *d_drawable,
GimpDrawable *s_drawable,
guchar *s,
guchar *d,
gint has_alpha,
gint src_bytes,
gint dest_bytes,
gint width);
static void clone_line_pattern (GImage *dest,
GimpDrawable *drawable,
GPattern *pattern,
guchar *d,
gint x,
gint y,
gint bytes,
gint width);
/* the clone tool options */
static CloneOptions *clone_options = NULL;
/* local variables */
static int src_x = 0; /* */
static int src_y = 0; /* position of clone src */
static int dest_x = 0; /* */
static int dest_y = 0; /* position of clone src */
static int offset_x = 0; /* */
static int offset_y = 0; /* offset for cloning */
static int first = TRUE;
static int trans_tx, trans_ty; /* transformed target */
static gint src_x = 0; /* */
static gint src_y = 0; /* position of clone src */
static gint dest_x = 0; /* */
static gint dest_y = 0; /* position of clone src */
static gint offset_x = 0; /* */
static gint offset_y = 0; /* offset for cloning */
static gint first = TRUE;
static gint trans_tx, trans_ty; /* transformed target */
static GDisplay *the_src_gdisp = NULL; /* ID of source gdisplay */
static GimpDrawable *src_drawable_ = NULL; /* source drawable */
static GimpDrawable *non_gui_src_drawable;
static int non_gui_offset_x;
static int non_gui_offset_y;
static gint non_gui_offset_x;
static gint non_gui_offset_y;
static CloneType non_gui_type;
/* forward function declarations */
static void clone_draw (Tool *);
static void clone_motion (PaintCore *, GimpDrawable *, GimpDrawable *,
PaintPressureOptions *, CloneType, int, int);
static void clone_line_image (GImage *, GImage *, GimpDrawable *,
GimpDrawable *, unsigned char *,
unsigned char *, int, int, int, int);
static void clone_line_pattern (GImage *, GimpDrawable *, GPattern *,
unsigned char *, int, int, int, int);
/* functions */
@ -128,8 +150,8 @@ static CloneOptions *
clone_options_new (void)
{
CloneOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *frame;
/* the new clone tool options structure */
options = g_new (CloneOptions, 1);
@ -202,23 +224,24 @@ clone_set_src_drawable (GimpDrawable *drawable)
}
}
void *
static gpointer
clone_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
gint state)
PaintState state)
{
GDisplay * gdisp;
GDisplay * src_gdisp;
int x1, y1, x2, y2;
static int orig_src_x, orig_src_y;
GDisplay *gdisp;
GDisplay *src_gdisp;
gint x1, y1, x2, y2;
static gint orig_src_x, orig_src_y;
gdisp = (GDisplay *) active_tool->gdisp_ptr;
gdisp = (GDisplay *) active_tool->gdisp;
switch (state)
{
case PRETRACE_PAINT:
draw_core_pause (paint_core->core, active_tool);
break;
case MOTION_PAINT:
x1 = paint_core->curx;
y1 = paint_core->cury;
@ -320,14 +343,11 @@ clone_paint_func (PaintCore *paint_core,
void
clone_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
int x, y;
gdisp = (GDisplay *) gdisp_ptr;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gint x, y;
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
&x, &y, TRUE, FALSE);
@ -661,10 +681,10 @@ clone_line_pattern (GImage *dest,
}
}
static void *
clone_non_gui_paint_func (PaintCore *paint_core,
static gpointer
clone_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
clone_motion (paint_core, drawable, non_gui_src_drawable,
&non_gui_pressure_options,
@ -675,16 +695,16 @@ clone_non_gui_paint_func (PaintCore *paint_core,
gboolean
clone_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
GimpDrawable *src_drawable = NULL;
CloneType clone_type = CLONE_DEFAULT_TYPE;
double local_src_x = 0.0;
double local_src_y = 0.0;
gdouble local_src_x = 0.0;
gdouble local_src_y = 0.0;
CloneOptions *options = clone_options;
if(options)
if (options)
{
clone_type = options->type;
src_drawable = src_drawable_;
@ -692,23 +712,23 @@ clone_non_gui_default (GimpDrawable *drawable,
local_src_y = src_y;
}
return clone_non_gui(drawable,
src_drawable,
clone_type,
local_src_x,local_src_y,
num_strokes,stroke_array);
return clone_non_gui (drawable,
src_drawable,
clone_type,
local_src_x,local_src_y,
num_strokes, stroke_array);
}
gboolean
clone_non_gui (GimpDrawable *drawable,
GimpDrawable *src_drawable,
CloneType clone_type,
double src_x,
double src_y,
int num_strokes,
double *stroke_array)
gdouble src_x,
gdouble src_y,
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))

View File

@ -26,21 +26,19 @@ typedef enum
PATTERN_CLONE
} CloneType;
void * clone_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean clone_non_gui (GimpDrawable *,
GimpDrawable *,
CloneType,
gdouble,
gdouble,
gint,
gdouble *);
gboolean clone_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean clone_non_gui (GimpDrawable *drawable,
GimpDrawable *src_drawable,
CloneType clone_type,
gdouble src_x,
gdouble src_y,
gint num_strokes,
gdouble *stroke_array);
gboolean clone_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);
void tools_free_clone (Tool *tool);
#endif /* __CLONE_H__ */

View File

@ -82,6 +82,28 @@ struct _ConvolveOptions
};
/* forward function declarations */
static void calculate_matrix (ConvolveType type,
gdouble rate);
static void integer_matrix (gfloat *source,
gint *dest,
gint size);
static void copy_matrix (gfloat *src,
gfloat *dest,
gint size);
static gint sum_matrix (gint *matrix,
gint size);
static gpointer convolve_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void convolve_motion (PaintCore *paint_core,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
ConvolveType type,
gdouble rate);
/* the convolve tool options */
static ConvolveOptions * convolve_options = NULL;
@ -121,19 +143,8 @@ static gfloat sharpen_matrix [25] =
};
/* forward function declarations */
static void calculate_matrix (ConvolveType, double);
static void integer_matrix (float *, int *, int);
static void copy_matrix (float *, float *, int);
static int sum_matrix (int *, int);
static void convolve_motion (PaintCore *, GimpDrawable *,
PaintPressureOptions *,
ConvolveType, double);
/* functions */
static void
convolve_options_reset (void)
{
@ -205,10 +216,10 @@ convolve_options_new (void)
return options;
}
void *
static gpointer
convolve_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
switch (state)
{
@ -217,6 +228,9 @@ convolve_paint_func (PaintCore *paint_core,
convolve_options->paint_options.pressure_options,
convolve_options->type, convolve_options->rate);
break;
default:
break;
}
return NULL;
@ -225,7 +239,7 @@ convolve_paint_func (PaintCore *paint_core,
static void
convolve_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -282,18 +296,18 @@ convolve_modifier_key_func (Tool *tool,
static void
convolve_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
tool->toggled = (convolve_options->type == SHARPEN_CONVOLVE);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
paint_core_cursor_update (tool, mevent, gdisp);
}
Tool *
tools_new_convolve (void)
{
Tool * tool;
PaintCore * private;
Tool *tool;
PaintCore *private;
/* The tool options */
if (! convolve_options)
@ -570,34 +584,34 @@ calculate_matrix (ConvolveType type,
}
static void
integer_matrix (float *source,
int *dest,
int size)
integer_matrix (gfloat *source,
gint *dest,
gint size)
{
int i;
gint i;
#define PRECISION 10000
for (i = 0; i < size*size; i++)
*dest++ = (int) (*source ++ * PRECISION);
*dest++ = (gint) (*source ++ * PRECISION);
}
static void
copy_matrix (float *src,
float *dest,
int size)
copy_matrix (gfloat *src,
gfloat *dest,
gint size)
{
int i;
gint i;
for (i = 0; i < size*size; i++)
*dest++ = *src++;
}
static int
sum_matrix (int *matrix,
int size)
sum_matrix (gint *matrix,
gint size)
{
int sum = 0;
gint sum = 0;
size *= size;
@ -608,10 +622,10 @@ sum_matrix (int *matrix,
}
static void *
convolve_non_gui_paint_func (PaintCore *paint_core,
static gpointer
convolve_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
convolve_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_type, non_gui_rate);
@ -621,11 +635,11 @@ convolve_non_gui_paint_func (PaintCore *paint_core,
gboolean
convolve_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
double rate = DEFAULT_CONVOLVE_RATE;
ConvolveType type = DEFAULT_CONVOLVE_TYPE;
gdouble rate = DEFAULT_CONVOLVE_RATE;
ConvolveType type = DEFAULT_CONVOLVE_TYPE;
ConvolveOptions *options = convolve_options;
if (options)
@ -641,17 +655,17 @@ gboolean
convolve_non_gui (GimpDrawable *drawable,
double rate,
ConvolveType type,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
{
/* Set the paint core's paint func */
non_gui_paint_core.paint_func = convolve_non_gui_paint_func;
non_gui_type = type;
non_gui_rate = rate;
@ -678,6 +692,6 @@ convolve_non_gui (GimpDrawable *drawable,
paint_core_cleanup ();
return TRUE;
}
else
return FALSE;
return FALSE;
}

View File

@ -28,19 +28,17 @@ typedef enum
} ConvolveType;
void * convolve_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean convolve_non_gui (GimpDrawable *,
gdouble ,
ConvolveType ,
gint ,
gdouble *);
gboolean convolve_non_gui_default (GimpDrawable *,
gint ,
gdouble *);
Tool * tools_new_convolve (void );
void tools_free_convolve (Tool *);
gboolean convolve_non_gui (GimpDrawable *drawable,
gdouble rate,
ConvolveType type,
gint num_strokes,
gdouble *stroke_array);
gboolean convolve_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_convolve (void);
void tools_free_convolve (Tool *tool);
#endif /* __CONVOLVE_H__ */

View File

@ -44,6 +44,12 @@
#include "libgimp/gimpintl.h"
/* Default values */
#define DODGEBURN_DEFAULT_TYPE DODGE
#define DODGEBURN_DEFAULT_EXPOSURE 50.0
#define DODGEBURN_DEFAULT_MODE DODGEBURN_HIGHLIGHTS
/* the dodgeburn structures */
typedef struct _DodgeBurnOptions DodgeBurnOptions;
@ -67,36 +73,49 @@ struct _DodgeBurnOptions
GimpLut *lut;
};
static void
dodgeburn_make_luts (PaintCore *, double, DodgeBurnType, DodgeBurnMode,
GimpLut *, GimpDrawable *);
static gfloat dodgeburn_highlights_lut_func (void *, int, int, gfloat);
static gfloat dodgeburn_midtones_lut_func (void *, int, int, gfloat);
static gfloat dodgeburn_shadows_lut_func (void *, int, int, gfloat);
static gpointer dodgeburn_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void dodgeburn_make_luts (PaintCore *paint_cure,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable);
static gfloat dodgeburn_highlights_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value);
static gfloat dodgeburn_midtones_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value);
static gfloat dodgeburn_shadows_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value);
static void dodgeburn_motion (PaintCore *paint_core,
PaintPressureOptions *pressure_options,
gdouble dodgeburn_exposure,
GimpLut *lut,
GimpDrawable *drawable);
static void dodgeburn_init (PaintCore *paint_cure,
GimpDrawable *drawable);
static void dodgeburn_finish (PaintCore *paint_core,
GimpDrawable *drawable);
/* The dodge burn lookup tables */
gfloat dodgeburn_highlights (void *, int, int, gfloat);
gfloat dodgeburn_midtones (void *, int, int, gfloat);
gfloat dodgeburn_shadows (void *, int, int, gfloat);
/* the dodgeburn tool options */
static DodgeBurnOptions * dodgeburn_options = NULL;
/* Non gui function */
static double non_gui_exposure;
static gdouble non_gui_exposure;
static GimpLut *non_gui_lut;
/* Default values */
#define DODGEBURN_DEFAULT_TYPE DODGE
#define DODGEBURN_DEFAULT_EXPOSURE 50.0
#define DODGEBURN_DEFAULT_MODE DODGEBURN_HIGHLIGHTS
static void dodgeburn_motion (PaintCore *,
PaintPressureOptions *,
double, GimpLut *, GimpDrawable *);
static void dodgeburn_init (PaintCore *, GimpDrawable *);
static void dodgeburn_finish (PaintCore *, GimpDrawable *);
/* functions */
@ -198,24 +217,29 @@ dodgeburn_options_new (void)
return options;
}
void *
static gpointer
dodgeburn_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
GimpDrawable *drawable,
PaintState state)
{
switch (state)
{
case INIT_PAINT:
dodgeburn_init (paint_core, drawable);
break;
case MOTION_PAINT:
dodgeburn_motion (paint_core,
dodgeburn_options->paint_options.pressure_options,
dodgeburn_options->exposure, dodgeburn_options->lut, drawable);
break;
case FINISH_PAINT:
dodgeburn_finish (paint_core, drawable);
break;
default:
break;
}
return NULL;
@ -238,7 +262,8 @@ dodgeburn_init (PaintCore *paint_core,
GimpDrawable *drawable)
{
/* Here we create the luts to do the painting with.*/
dodgeburn_options->lut = gimp_lut_new();
dodgeburn_options->lut = gimp_lut_new ();
dodgeburn_make_luts (paint_core,
dodgeburn_options->exposure,
dodgeburn_options->type,
@ -249,17 +274,17 @@ dodgeburn_init (PaintCore *paint_core,
static void
dodgeburn_make_luts (PaintCore *paint_core,
double db_exposure,
gdouble db_exposure,
DodgeBurnType type,
DodgeBurnMode mode,
GimpLut *lut,
GimpDrawable *drawable)
{
GimpLutFunc lut_func;
int nchannels = gimp_drawable_bytes (drawable);
GimpLutFunc lut_func;
gint nchannels = gimp_drawable_bytes (drawable);
static gfloat exposure;
exposure = (db_exposure) / 100.0;
exposure = db_exposure / 100.0;
/* make the exposure negative if burn for luts*/
if (type == BURN)
@ -281,15 +306,15 @@ dodgeburn_make_luts (PaintCore *paint_core,
break;
}
gimp_lut_setup_exact (lut,
lut_func, (void *)&exposure,
nchannels);
gimp_lut_setup_exact (lut,
lut_func, (gpointer) &exposure,
nchannels);
}
static void
dodgeburn_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -317,7 +342,7 @@ dodgeburn_modifier_key_func (Tool *tool,
break;
case GDK_Control_L:
case GDK_Control_R:
if ( !(kevent->state & GDK_SHIFT_MASK) ) /* shift enables line draw mode */
if (! (kevent->state & GDK_SHIFT_MASK)) /* shift enables line draw mode */
{
switch (dodgeburn_options->type)
{
@ -342,18 +367,18 @@ dodgeburn_modifier_key_func (Tool *tool,
static void
dodgeburn_cursor_update_func (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
tool->toggled = (dodgeburn_options->type == BURN);
paint_core_cursor_update (tool, mevent, gdisp_ptr);
paint_core_cursor_update (tool, mevent, gdisp);
}
Tool *
tools_new_dodgeburn (void)
{
Tool * tool;
PaintCore * private;
Tool *tool;
PaintCore *private;
/* The tool options */
if (! dodgeburn_options)
@ -420,25 +445,26 @@ dodgeburn_motion (PaintCore *paint_core,
no paint from this stroke yet) */
{
gint x1, y1, x2, y2;
x1 = CLAMP (area->x, 0, drawable_width (drawable));
y1 = CLAMP (area->y, 0, drawable_height (drawable));
x2 = CLAMP (area->x + area->width, 0, drawable_width (drawable));
y2 = CLAMP (area->y + area->height, 0, drawable_height (drawable));
gint x1, y1, x2, y2;
if (!(x2 - x1) || !(y2 - y1))
return;
x1 = CLAMP (area->x, 0, drawable_width (drawable));
y1 = CLAMP (area->y, 0, drawable_height (drawable));
x2 = CLAMP (area->x + area->width, 0, drawable_width (drawable));
y2 = CLAMP (area->y + area->height, 0, drawable_height (drawable));
/* get the original untouched image */
orig = paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2);
srcPR.bytes = orig->bytes;
srcPR.x = 0;
srcPR.y = 0;
srcPR.w = x2 - x1;
srcPR.h = y2 - y1;
srcPR.rowstride = srcPR.bytes * orig->width;
srcPR.data = temp_buf_data (orig);
}
if (!(x2 - x1) || !(y2 - y1))
return;
/* get the original untouched image */
orig = paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2);
srcPR.bytes = orig->bytes;
srcPR.x = 0;
srcPR.y = 0;
srcPR.w = x2 - x1;
srcPR.h = y2 - y1;
srcPR.rowstride = srcPR.bytes * orig->width;
srcPR.data = temp_buf_data (orig);
}
/* tempPR will hold the dodgeburned region*/
tempPR.bytes = srcPR.bytes;
@ -482,10 +508,10 @@ dodgeburn_motion (PaintCore *paint_core,
g_free (temp_data);
}
static void *
static gpointer
dodgeburn_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
dodgeburn_motion (paint_core, &non_gui_pressure_options,
non_gui_exposure, non_gui_lut, drawable);
@ -495,13 +521,13 @@ dodgeburn_non_gui_paint_func (PaintCore *paint_core,
gboolean
dodgeburn_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
double exposure = DODGEBURN_DEFAULT_TYPE;
DodgeBurnType type = DODGEBURN_DEFAULT_TYPE;
DodgeBurnMode mode = DODGEBURN_DEFAULT_MODE;
DodgeBurnOptions *options = dodgeburn_options;
gdouble exposure = DODGEBURN_DEFAULT_TYPE;
DodgeBurnType type = DODGEBURN_DEFAULT_TYPE;
DodgeBurnMode mode = DODGEBURN_DEFAULT_MODE;
DodgeBurnOptions *options = dodgeburn_options;
if (options)
{
@ -510,18 +536,19 @@ dodgeburn_non_gui_default (GimpDrawable *drawable,
mode = dodgeburn_options->mode;
}
return dodgeburn_non_gui (drawable, exposure, type, mode, num_strokes, stroke_array);
return dodgeburn_non_gui (drawable, exposure, type, mode,
num_strokes, stroke_array);
}
gboolean
dodgeburn_non_gui (GimpDrawable *drawable,
double exposure,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
@ -569,15 +596,15 @@ dodgeburn_non_gui (GimpDrawable *drawable,
}
static gfloat
dodgeburn_highlights_lut_func (void *user_data,
int nchannels,
int channel,
gfloat value)
dodgeburn_highlights_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value)
{
gfloat * exposure_ptr = (gfloat *)user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor = 1.0 + exposure * (.333333);
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
return value;
@ -586,14 +613,14 @@ dodgeburn_highlights_lut_func (void *user_data,
}
static gfloat
dodgeburn_midtones_lut_func (void *user_data,
int nchannels,
int channel,
gfloat value)
dodgeburn_midtones_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value)
{
gfloat * exposure_ptr = (gfloat *)user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat factor;
if ((nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))
@ -603,19 +630,20 @@ dodgeburn_midtones_lut_func (void *user_data,
factor = 1.0 - exposure * (.333333);
else
factor = 1/(1.0 + exposure);
return pow (value, factor);
}
static gfloat
dodgeburn_shadows_lut_func (void *user_data,
int nchannels,
int channel,
gfloat value)
dodgeburn_shadows_lut_func (gpointer user_data,
gint nchannels,
gint channel,
gfloat value)
{
gfloat * exposure_ptr = (gfloat *)user_data;
gfloat exposure = *exposure_ptr;
gfloat new_value;
gfloat factor;
gfloat *exposure_ptr = (gfloat *) user_data;
gfloat exposure = *exposure_ptr;
gfloat new_value;
gfloat factor;
if ( (nchannels == 2 && channel == 1) ||
(nchannels == 4 && channel == 3))

View File

@ -34,21 +34,18 @@ typedef enum
} DodgeBurnMode;
void * dodgeburn_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean dodgeburn_non_gui (GimpDrawable *,
gdouble,
DodgeBurnType,
DodgeBurnMode,
gint,
gdouble *);
gboolean dodgeburn_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean dodgeburn_non_gui (GimpDrawable *drawable,
gdouble exposure,
DodgeBurnType type,
DodgeBurnMode mode,
gint num_strokes,
gdouble *stroke_array);
gboolean dodgeburn_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_dodgeburn (void);
void tools_free_dodgeburn (Tool *);
void tools_free_dodgeburn (Tool *tool);
#endif /* __DODGEBURN_H__ */

View File

@ -42,7 +42,7 @@
#include "libgimp/gimpintl.h"
/* Defaults */
/* Defaults */
#define ERASER_DEFAULT_HARD FALSE
#define ERASER_DEFAULT_INCREMENTAL FALSE
#define ERASER_DEFAULT_ANTI_ERASE FALSE
@ -50,6 +50,7 @@
/* the eraser structures */
typedef struct _EraserOptions EraserOptions;
struct _EraserOptions
{
PaintOptions paint_options;
@ -64,6 +65,18 @@ struct _EraserOptions
};
/* forward function declarations */
static gpointer eraser_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void eraser_motion (PaintCore *paint_core,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
gboolean hard,
gboolean incremental,
gboolean anti_erase);
/* the eraser tool options */
static EraserOptions *eraser_options = NULL;
@ -72,11 +85,6 @@ static gboolean non_gui_hard;
static gboolean non_gui_incremental;
static gboolean non_gui_anti_erase;
/* forward function declarations */
static void eraser_motion (PaintCore *, GimpDrawable *,
PaintPressureOptions *,
gboolean, gboolean, gboolean);
/* functions */
@ -137,7 +145,7 @@ eraser_options_new (void)
static void
eraser_modifier_key_func (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
switch (kevent->keyval)
{
@ -164,10 +172,10 @@ eraser_modifier_key_func (Tool *tool,
}
void *
static gpointer
eraser_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
switch (state)
{
@ -196,8 +204,8 @@ eraser_paint_func (PaintCore *paint_core,
Tool *
tools_new_eraser (void)
{
Tool * tool;
PaintCore * private;
Tool *tool;
PaintCore *private;
/* The tool options */
if (! eraser_options)
@ -274,10 +282,10 @@ eraser_motion (PaintCore *paint_core,
}
static void *
static gpointer
eraser_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
eraser_motion (paint_core, drawable,
&non_gui_pressure_options,
@ -288,8 +296,8 @@ eraser_non_gui_paint_func (PaintCore *paint_core,
gboolean
eraser_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
gboolean hardness = ERASER_DEFAULT_HARD;
gboolean method = ERASER_DEFAULT_INCREMENTAL;
@ -310,13 +318,13 @@ eraser_non_gui_default (GimpDrawable *drawable,
gboolean
eraser_non_gui (GimpDrawable *drawable,
int num_strokes,
double *stroke_array,
int hardness,
int method,
int anti_erase)
gint num_strokes,
gdouble *stroke_array,
gint hardness,
gint method,
gboolean anti_erase)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))
@ -351,6 +359,6 @@ eraser_non_gui (GimpDrawable *drawable,
paint_core_cleanup ();
return TRUE;
}
else
return FALSE;
return FALSE;
}

View File

@ -20,21 +20,18 @@
#define __ERASER_H__
void * eraser_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean eraser_non_gui (GimpDrawable *,
gint ,
gdouble *,
gint ,
gint ,
gint );
gboolean eraser_non_gui_default (GimpDrawable *,
gint ,
gdouble *);
gboolean eraser_non_gui (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array,
gint hardness,
gint method,
gboolean anti_erase);
gboolean eraser_non_gui_default (GimpDrawable *paint_core,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_eraser (void );
void tools_free_eraser (Tool *);
Tool * tools_new_eraser (void);
void tools_free_eraser (Tool *tool);
#endif /* __ERASER_H__ */

View File

@ -57,7 +57,13 @@
/* the Ink structures */
typedef Blob *(*BlobFunc) (gdouble, gdouble, gdouble, gdouble, gdouble, gdouble);
typedef Blob * (* BlobFunc) (gdouble,
gdouble,
gdouble,
gdouble,
gdouble,
gdouble);
typedef struct _InkTool InkTool;
@ -88,8 +94,8 @@ typedef struct _BrushWidget BrushWidget;
struct _BrushWidget
{
GtkWidget *widget;
gboolean state;
GtkWidget *widget;
gboolean state;
};
typedef struct _InkOptions InkOptions;
@ -130,95 +136,109 @@ struct _InkOptions
};
/* the ink tool options */
static InkOptions * ink_options = NULL;
/* local function prototypes */
static void ink_button_press (Tool *tool,
GdkEventButton *mevent,
GDisplay *gdisp);
static void ink_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
static void ink_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void ink_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
static void ink_control (Tool *tool,
ToolAction tool_action,
GDisplay *gdisp);
static void time_smoother_add (InkTool *ink_tool,
guint32 value);
static gdouble time_smoother_result (InkTool *ink_tool);
static void time_smoother_init (InkTool *ink_tool,
guint32 initval);
static void dist_smoother_add (InkTool *ink_tool,
gdouble value);
static gdouble dist_smoother_result (InkTool *ink_tool);
static void dist_smoother_init (InkTool *ink_tool,
gdouble initval);
static void ink_init (InkTool *ink_tool,
GimpDrawable *drawable,
gdouble x,
gdouble y);
static void ink_finish (InkTool *ink_tool,
GimpDrawable *drawable,
gint tool_id);
static void ink_cleanup (void);
static void ink_type_update (GtkWidget *radio_button,
BlobFunc function);
static GdkPixmap * blob_pixmap (GdkColormap *colormap,
GdkVisual *visual,
BlobFunc function);
static void paint_blob (GdkDrawable *drawable,
GdkGC *gc,
Blob *blob);
/* Rendering functions */
static void ink_set_paint_area (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_paste (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_to_canvas_tiles (InkTool *ink_tool,
Blob *blob,
guchar *color);
static void ink_set_undo_tiles (GimpDrawable *drawable,
gint x,
gint y,
gint w,
gint h);
static void ink_set_canvas_tiles (gint x,
gint y,
gint w,
gint h);
/* Brush pseudo-widget callbacks */
static void brush_widget_active_rect (BrushWidget *brush_widget,
GtkWidget *widget,
GdkRectangle *rect);
static void brush_widget_realize (GtkWidget *widget);
static void brush_widget_expose (GtkWidget *widget,
GdkEventExpose *event,
BrushWidget *brush_widget);
static void brush_widget_button_press (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_button_release (GtkWidget *widget,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_motion_notify (GtkWidget *widget,
GdkEventMotion *event,
BrushWidget *brush_widget);
/* local variables */
/* the ink tool options */
static InkOptions *ink_options = NULL;
/* undo blocks variables */
static TileManager * undo_tiles = NULL;
static TileManager *undo_tiles = NULL;
/* Tiles used to render the stroke at 1 byte/pp */
static TileManager * canvas_tiles = NULL;
static TileManager *canvas_tiles = NULL;
/* Flat buffer that is used to used to render the dirty region
* for composition onto the destination drawable
*/
static TempBuf * canvas_buf = NULL;
/* local function prototypes */
static void ink_button_press (Tool *, GdkEventButton *, gpointer);
static void ink_button_release (Tool *, GdkEventButton *, gpointer);
static void ink_motion (Tool *, GdkEventMotion *, gpointer);
static void ink_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void ink_control (Tool *, ToolAction, gpointer);
static void time_smoother_add (InkTool* ink_tool, guint32 value);
static gdouble time_smoother_result (InkTool* ink_tool);
static void time_smoother_init (InkTool* ink_tool, guint32 initval);
static void dist_smoother_add (InkTool* ink_tool, gdouble value);
static gdouble dist_smoother_result (InkTool* ink_tool);
static void dist_smoother_init (InkTool* ink_tool, gdouble initval);
static void ink_init (InkTool *ink_tool,
GimpDrawable *drawable,
double x,
double y);
static void ink_finish (InkTool *ink_tool,
GimpDrawable *drawable,
int tool_id);
static void ink_cleanup (void);
static void ink_type_update (GtkWidget *radio_button,
BlobFunc function);
static GdkPixmap *blob_pixmap (GdkColormap *colormap,
GdkVisual *visual,
BlobFunc function);
static void paint_blob (GdkDrawable *drawable,
GdkGC *gc,
Blob *blob);
/* Rendering functions */
static void ink_set_paint_area (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_paste (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob);
static void ink_to_canvas_tiles (InkTool *ink_tool,
Blob *blob,
guchar *color);
static void ink_set_undo_tiles (GimpDrawable *drawable,
int x,
int y,
int w,
int h);
static void ink_set_canvas_tiles(int x,
int y,
int w,
int h);
/* Brush pseudo-widget callbacks */
static void brush_widget_active_rect (BrushWidget *brush_widget,
GtkWidget *w,
GdkRectangle *rect);
static void brush_widget_realize (GtkWidget *w);
static void brush_widget_expose (GtkWidget *w,
GdkEventExpose *event,
BrushWidget *brush_widget);
static void brush_widget_button_press (GtkWidget *w,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_button_release (GtkWidget *w,
GdkEventButton *event,
BrushWidget *brush_widget);
static void brush_widget_motion_notify (GtkWidget *w,
GdkEventMotion *event,
BrushWidget *brush_widget);
static TempBuf *canvas_buf = NULL;
/* functions */
@ -798,15 +818,13 @@ ink_pen_ellipse (gdouble x_center, gdouble y_center,
static void
ink_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
gdouble x, y;
GDisplay *gdisp;
InkTool *ink_tool;
GimpDrawable *drawable;
Blob *b;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
/* Keep the coordinates of the target */
@ -816,8 +834,8 @@ ink_button_press (Tool *tool,
ink_init (ink_tool, drawable, x, y);
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->state = ACTIVE;
tool->gdisp = gdisp;
tool->paused_count = 0;
/* pause the current selection and grab the pointer */
@ -834,7 +852,7 @@ ink_button_press (Tool *tool,
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
tool->state = ACTIVE;
b = ink_pen_ellipse (x, y,
@ -856,14 +874,12 @@ ink_button_press (Tool *tool,
static void
ink_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
GImage * gimage;
InkTool * ink_tool;
GImage *gimage;
InkTool *ink_tool;
gdisp = (GDisplay *) gdisp_ptr;
gimage = gdisp->gimage;
gimage = gdisp->gimage;
ink_tool = (InkTool *) tool->private;
/* resume the current selection and ungrab the pointer */
@ -965,21 +981,18 @@ time_smoother_add (InkTool* ink_tool, guint32 value)
static void
ink_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
InkTool *ink_tool;
InkTool *ink_tool;
GimpDrawable *drawable;
Blob *b, *blob_union;
Blob *b, *blob_union;
double x, y;
double pressure;
double velocity;
double dist;
gdouble x, y;
gdouble pressure;
gdouble velocity;
gdouble dist;
gdouble lasttime, thistime;
gdisp = (GDisplay *) gdisp_ptr;
ink_tool = (InkTool *) tool->private;
gdisplay_untransform_coords_f (gdisp, mevent->x, mevent->y, &x, &y, TRUE);
@ -1034,14 +1047,11 @@ ink_motion (Tool *tool,
static void
ink_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
int x, y;
gdisp = (GDisplay *) gdisp_ptr;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gint x, y;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
&x, &y, FALSE, FALSE);
@ -1073,7 +1083,7 @@ ink_cursor_update (Tool *tool,
static void
ink_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
InkTool *ink_tool;
@ -1099,8 +1109,10 @@ ink_control (Tool *tool,
}
static void
ink_init (InkTool *ink_tool, GimpDrawable *drawable,
double x, double y)
ink_init (InkTool *ink_tool,
GimpDrawable *drawable,
gdouble x,
gdouble y)
{
/* free the block structures */
if (undo_tiles)
@ -1123,7 +1135,9 @@ ink_init (InkTool *ink_tool, GimpDrawable *drawable,
}
static void
ink_finish (InkTool *ink_tool, GimpDrawable *drawable, int tool_id)
ink_finish (InkTool *ink_tool,
GimpDrawable *drawable,
gint tool_id)
{
/* push an undo */
drawable_apply_image (drawable, ink_tool->x1, ink_tool->y1,
@ -1178,9 +1192,9 @@ ink_set_paint_area (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob)
{
int x, y, width, height;
int x1, y1, x2, y2;
int bytes;
gint x, y, width, height;
gint x1, y1, x2, y2;
gint bytes;
blob_bounds (blob, &x, &y, &width, &height);
@ -1203,10 +1217,12 @@ enum { ROW_START, ROW_STOP };
/* The insertion sort here, for SUBSAMPLE = 8, tends to beat out
* qsort() by 4x with CFLAGS=-O2, 2x with CFLAGS=-g
*/
static void insert_sort (int *data, int n)
static void
insert_sort (gint *data,
gint n)
{
int i, j, k;
int tmp1, tmp2;
gint i, j, k;
gint tmp1, tmp2;
for (i=2; i<2*n; i+=2)
{
@ -1230,7 +1246,7 @@ static void insert_sort (int *data, int n)
static void
fill_run (guchar *dest,
guchar alpha,
int w)
gint w)
{
if (alpha == 255)
{
@ -1247,17 +1263,20 @@ fill_run (guchar *dest,
}
static void
render_blob_line (Blob *blob, guchar *dest,
int x, int y, int width)
render_blob_line (Blob *blob,
guchar *dest,
gint x,
gint y,
gint width)
{
int buf[4*SUBSAMPLE];
int *data = buf;
int n = 0;
int i, j;
int current = 0; /* number of filled rows at this point
* in the scan line */
int last_x;
gint buf[4*SUBSAMPLE];
gint *data = buf;
gint n = 0;
gint i, j;
gint current = 0; /* number of filled rows at this point
* in the scan line
*/
gint last_x;
/* Sort start and ends for all lines */
@ -1309,8 +1328,8 @@ render_blob_line (Blob *blob, guchar *dest,
last_x = 0;
for (i=0; i<n;)
{
int cur_x = data[2*i] / SUBSAMPLE - x;
int pixel;
gint cur_x = data[2*i] / SUBSAMPLE - x;
gint pixel;
/* Fill in portion leading up to this pixel */
if (current && cur_x != last_x)
@ -1339,7 +1358,7 @@ render_blob_line (Blob *blob, guchar *dest,
i++;
}
dest[cur_x] = MAX(dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
dest[cur_x] = MAX (dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
last_x = cur_x + 1;
}
@ -1349,12 +1368,13 @@ render_blob_line (Blob *blob, guchar *dest,
}
static void
render_blob (PixelRegion *dest, Blob *blob)
render_blob (PixelRegion *dest,
Blob *blob)
{
int i;
int h;
unsigned char * s;
void * pr;
gint i;
gint h;
guchar *s;
gpointer pr;
for (pr = pixel_regions_register (1, dest);
pr != NULL;
@ -1377,10 +1397,10 @@ ink_paste (InkTool *ink_tool,
GimpDrawable *drawable,
Blob *blob)
{
GImage *gimage;
PixelRegion srcPR;
int offx, offy;
unsigned char col[MAX_CHANNELS];
GImage *gimage;
PixelRegion srcPR;
gint offx, offy;
gchar col[MAX_CHANNELS];
if (! (gimage = drawable_gimage (drawable)))
return;
@ -1502,9 +1522,12 @@ ink_set_undo_tiles (GimpDrawable *drawable,
static void
ink_set_canvas_tiles (int x, int y, int w, int h)
ink_set_canvas_tiles (gint x,
gint y,
gint w,
gint h)
{
int i, j;
gint i, j;
Tile *tile;
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
@ -1537,8 +1560,8 @@ ink_no_draw (Tool *tool)
Tool *
tools_new_ink (void)
{
Tool * tool;
InkTool * private;
Tool *tool;
InkTool *private;
/* The tool options */
if (! ink_options)
@ -1550,10 +1573,10 @@ tools_new_ink (void)
ink_options_reset ();
}
tool = tools_new_tool (INK);
tool = tools_new_tool (INK);
private = g_new0 (InkTool, 1);
private->core = draw_core_new (ink_no_draw);
private->core = draw_core_new (ink_no_draw);
private->last_blob = NULL;
tool->private = private;
@ -1570,7 +1593,7 @@ tools_new_ink (void)
void
tools_free_ink (Tool *tool)
{
InkTool * ink_tool;
InkTool *ink_tool;
ink_tool = (InkTool *) tool->private;

View File

@ -23,6 +23,7 @@
Tool * tools_new_ink (void);
void tools_free_ink (Tool *tool);
/* Procedure definition and marshalling function */
extern ProcRecord ink_proc;

View File

@ -40,6 +40,8 @@
#include "tool_options.h"
#define PENCIL_INCREMENTAL_DEFAULT FALSE
/* the pencil tool options */
typedef struct _PencilOptions PencilOptions;
@ -48,23 +50,29 @@ struct _PencilOptions
PaintOptions paint_options;
};
static PencilOptions *pencil_options = NULL;
/* forward function declarations */
static void pencil_motion (PaintCore *, GimpDrawable *,
PaintPressureOptions *, gboolean);
static void pencil_motion (PaintCore *paint_core,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
gboolean );
static gpointer pencil_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static PencilOptions *pencil_options = NULL;
static gboolean non_gui_incremental = FALSE;
static void pencil_options_reset (void);
#define PENCIL_INCREMENTAL_DEFAULT FALSE
/* functions */
void *
gpointer
pencil_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
switch (state)
{
@ -203,10 +211,10 @@ pencil_motion (PaintCore *paint_core,
HARD, scale, paint_appl_mode);
}
static void *
static gpointer
pencil_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
pencil_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_incremental);

View File

@ -20,12 +20,9 @@
#define __PENCIL_H__
void * pencil_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean pencil_non_gui (GimpDrawable *,
gint ,
gdouble *);
gboolean pencil_non_gui (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_pencil (void);
void tools_free_pencil (Tool *tool);

View File

@ -63,30 +63,40 @@ struct _SmudgeOptions
GtkObject *rate_w;
};
/* function prototypes */
static gpointer smudge_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void smudge_motion (PaintCore *paint_core,
PaintPressureOptions *pressure_options,
gdouble smudge_rate,
GimpDrawable *drawable);
static gboolean smudge_init (PaintCore *paint_core,
GimpDrawable *drawable);
static void smudge_finish (PaintCore *paint_core,
GimpDrawable *drawable);
static void smudge_nonclipped_painthit_coords (PaintCore *paint_core,
gint *x,
gint *y,
gint *w,
gint *h);
static void smudge_allocate_accum_buffer (gint w,
gint h,
gint bytes,
guchar *do_fill);
/* local variables */
static PixelRegion accumPR;
static guchar *accum_data;
/* the smudge tool options */
static SmudgeOptions * smudge_options = NULL;
/* local variables */
static gdouble non_gui_rate;
/* function prototypes */
static void smudge_motion (PaintCore *, PaintPressureOptions *,
gdouble, GimpDrawable *);
static gboolean smudge_init (PaintCore *, GimpDrawable *);
static void smudge_finish (PaintCore *, GimpDrawable *);
static void smudge_nonclipped_painthit_coords (PaintCore *paint_core,
gint *x,
gint *y,
gint *w,
gint *h);
static void smudge_allocate_accum_buffer (gint w,
gint h,
gint bytes,
guchar *do_fill);
static void
smudge_options_reset (void)
@ -143,10 +153,10 @@ smudge_options_new (void)
return options;
}
void *
static gpointer
smudge_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
/* initialization fails if the user starts outside the drawable */
static gboolean initialized = FALSE;
@ -157,13 +167,18 @@ smudge_paint_func (PaintCore *paint_core,
if (!initialized)
initialized = smudge_init (paint_core, drawable);
if (initialized)
smudge_motion (paint_core, smudge_options->paint_options.pressure_options,
smudge_motion (paint_core,
smudge_options->paint_options.pressure_options,
smudge_options->rate, drawable);
break;
case FINISH_PAINT:
smudge_finish (paint_core, drawable);
initialized = FALSE;
break;
default:
break;
}
return NULL;
@ -198,12 +213,12 @@ static gboolean
smudge_init (PaintCore *paint_core,
GimpDrawable *drawable)
{
GImage *gimage;
TempBuf *area;
GImage *gimage;
TempBuf *area;
PixelRegion srcPR;
gint x, y, w, h;
gint was_clipped;
guchar *do_fill = NULL;
gint x, y, w, h;
gint was_clipped;
guchar *do_fill = NULL;
if (! (gimage = drawable_gimage (drawable)))
return FALSE;
@ -239,7 +254,7 @@ smudge_init (PaintCore *paint_core,
do_fill = gimp_drawable_get_color_at (drawable,
CLAMP ((gint) paint_core->curx, 0, gimp_drawable_width (drawable) - 1),
CLAMP ((gint) paint_core->cury, 0, gimp_drawable_height (drawable) - 1));
smudge_allocate_accum_buffer (w, h, gimp_drawable_bytes (drawable), do_fill);
accumPR.x = area->x - x;
@ -277,7 +292,7 @@ smudge_allocate_accum_buffer (gint w,
gint h,
gint bytes,
guchar *do_fill)
{
{
/* Allocate the accumulation buffer */
accumPR.bytes = bytes;
accum_data = g_malloc (w * h * bytes);
@ -332,12 +347,12 @@ smudge_motion (PaintCore *paint_core,
gdouble smudge_rate,
GimpDrawable *drawable)
{
GImage *gimage;
TempBuf * area;
PixelRegion srcPR, destPR, tempPR;
gdouble rate;
gint opacity;
gint x,y,w,h;
GImage *gimage;
TempBuf *area;
PixelRegion srcPR, destPR, tempPR;
gdouble rate;
gint opacity;
gint x, y, w, h;
if (! (gimage = drawable_gimage (drawable)))
return;
@ -425,10 +440,10 @@ smudge_motion (PaintCore *paint_core,
1.0, INCREMENTAL);
}
static void *
static gpointer
smudge_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
smudge_motion (paint_core, &non_gui_pressure_options, non_gui_rate, drawable);
@ -437,8 +452,8 @@ smudge_non_gui_paint_func (PaintCore *paint_core,
gboolean
smudge_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
gdouble rate = SMUDGE_DEFAULT_RATE;
SmudgeOptions *options = smudge_options;
@ -452,8 +467,8 @@ smudge_non_gui_default (GimpDrawable *drawable,
gboolean
smudge_non_gui (GimpDrawable *drawable,
gdouble rate,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
gint i;
@ -493,6 +508,6 @@ smudge_non_gui (GimpDrawable *drawable,
smudge_finish (&non_gui_paint_core, drawable);
return TRUE;
}
else
return FALSE;
return FALSE;
}

View File

@ -33,16 +33,14 @@ typedef enum
SMUDGE_MODE_SHADOWS
} SmudgeMode;
void * smudge_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean smudge_non_gui (GimpDrawable *,
gdouble ,
gint ,
gdouble *);
gboolean smudge_non_gui_default (GimpDrawable *,
gint ,
gdouble *);
gboolean smudge_non_gui (GimpDrawable *drawable,
gdouble rate,
gint num_strokes,
gdouble *stroke_array);
gboolean smudge_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_smudge (void);
void tools_free_smudge (Tool *tool);

View File

@ -79,37 +79,59 @@ struct _CloneOptions
};
/* forward function declarations */
static gpointer clone_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static void clone_draw (Tool *tool);
static void clone_motion (PaintCore *paint_core,
GimpDrawable *drawable,
GimpDrawable *src_drawable,
PaintPressureOptions *pressure_options,
CloneType type,
gint offset_x,
gint offset_y);
static void clone_line_image (GImage *dest,
GImage *src,
GimpDrawable *d_drawable,
GimpDrawable *s_drawable,
guchar *s,
guchar *d,
gint has_alpha,
gint src_bytes,
gint dest_bytes,
gint width);
static void clone_line_pattern (GImage *dest,
GimpDrawable *drawable,
GPattern *pattern,
guchar *d,
gint x,
gint y,
gint bytes,
gint width);
/* the clone tool options */
static CloneOptions *clone_options = NULL;
/* local variables */
static int src_x = 0; /* */
static int src_y = 0; /* position of clone src */
static int dest_x = 0; /* */
static int dest_y = 0; /* position of clone src */
static int offset_x = 0; /* */
static int offset_y = 0; /* offset for cloning */
static int first = TRUE;
static int trans_tx, trans_ty; /* transformed target */
static gint src_x = 0; /* */
static gint src_y = 0; /* position of clone src */
static gint dest_x = 0; /* */
static gint dest_y = 0; /* position of clone src */
static gint offset_x = 0; /* */
static gint offset_y = 0; /* offset for cloning */
static gint first = TRUE;
static gint trans_tx, trans_ty; /* transformed target */
static GDisplay *the_src_gdisp = NULL; /* ID of source gdisplay */
static GimpDrawable *src_drawable_ = NULL; /* source drawable */
static GimpDrawable *non_gui_src_drawable;
static int non_gui_offset_x;
static int non_gui_offset_y;
static gint non_gui_offset_x;
static gint non_gui_offset_y;
static CloneType non_gui_type;
/* forward function declarations */
static void clone_draw (Tool *);
static void clone_motion (PaintCore *, GimpDrawable *, GimpDrawable *,
PaintPressureOptions *, CloneType, int, int);
static void clone_line_image (GImage *, GImage *, GimpDrawable *,
GimpDrawable *, unsigned char *,
unsigned char *, int, int, int, int);
static void clone_line_pattern (GImage *, GimpDrawable *, GPattern *,
unsigned char *, int, int, int, int);
/* functions */
@ -128,8 +150,8 @@ static CloneOptions *
clone_options_new (void)
{
CloneOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *frame;
/* the new clone tool options structure */
options = g_new (CloneOptions, 1);
@ -202,23 +224,24 @@ clone_set_src_drawable (GimpDrawable *drawable)
}
}
void *
static gpointer
clone_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
gint state)
PaintState state)
{
GDisplay * gdisp;
GDisplay * src_gdisp;
int x1, y1, x2, y2;
static int orig_src_x, orig_src_y;
GDisplay *gdisp;
GDisplay *src_gdisp;
gint x1, y1, x2, y2;
static gint orig_src_x, orig_src_y;
gdisp = (GDisplay *) active_tool->gdisp_ptr;
gdisp = (GDisplay *) active_tool->gdisp;
switch (state)
{
case PRETRACE_PAINT:
draw_core_pause (paint_core->core, active_tool);
break;
case MOTION_PAINT:
x1 = paint_core->curx;
y1 = paint_core->cury;
@ -320,14 +343,11 @@ clone_paint_func (PaintCore *paint_core,
void
clone_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
int x, y;
gdisp = (GDisplay *) gdisp_ptr;
Layer *layer;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gint x, y;
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
&x, &y, TRUE, FALSE);
@ -661,10 +681,10 @@ clone_line_pattern (GImage *dest,
}
}
static void *
clone_non_gui_paint_func (PaintCore *paint_core,
static gpointer
clone_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
clone_motion (paint_core, drawable, non_gui_src_drawable,
&non_gui_pressure_options,
@ -675,16 +695,16 @@ clone_non_gui_paint_func (PaintCore *paint_core,
gboolean
clone_non_gui_default (GimpDrawable *drawable,
int num_strokes,
double *stroke_array)
gint num_strokes,
gdouble *stroke_array)
{
GimpDrawable *src_drawable = NULL;
CloneType clone_type = CLONE_DEFAULT_TYPE;
double local_src_x = 0.0;
double local_src_y = 0.0;
gdouble local_src_x = 0.0;
gdouble local_src_y = 0.0;
CloneOptions *options = clone_options;
if(options)
if (options)
{
clone_type = options->type;
src_drawable = src_drawable_;
@ -692,23 +712,23 @@ clone_non_gui_default (GimpDrawable *drawable,
local_src_y = src_y;
}
return clone_non_gui(drawable,
src_drawable,
clone_type,
local_src_x,local_src_y,
num_strokes,stroke_array);
return clone_non_gui (drawable,
src_drawable,
clone_type,
local_src_x,local_src_y,
num_strokes, stroke_array);
}
gboolean
clone_non_gui (GimpDrawable *drawable,
GimpDrawable *src_drawable,
CloneType clone_type,
double src_x,
double src_y,
int num_strokes,
double *stroke_array)
gdouble src_x,
gdouble src_y,
gint num_strokes,
gdouble *stroke_array)
{
int i;
gint i;
if (paint_core_init (&non_gui_paint_core, drawable,
stroke_array[0], stroke_array[1]))

View File

@ -26,21 +26,19 @@ typedef enum
PATTERN_CLONE
} CloneType;
void * clone_paint_func (PaintCore *,
GimpDrawable *,
gint);
gboolean clone_non_gui (GimpDrawable *,
GimpDrawable *,
CloneType,
gdouble,
gdouble,
gint,
gdouble *);
gboolean clone_non_gui_default (GimpDrawable *,
gint,
gdouble *);
gboolean clone_non_gui (GimpDrawable *drawable,
GimpDrawable *src_drawable,
CloneType clone_type,
gdouble src_x,
gdouble src_y,
gint num_strokes,
gdouble *stroke_array);
gboolean clone_non_gui_default (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_clone (void);
void tools_free_clone (Tool *);
void tools_free_clone (Tool *tool);
#endif /* __CLONE_H__ */

View File

@ -196,18 +196,16 @@ paint_core_sample_color (GimpDrawable *drawable,
void
paint_core_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
paint_core_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp)
{
PaintCore *paint_core;
GDisplay *gdisp;
GimpBrush *current_brush;
gboolean draw_line;
gdouble x, y;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr;
paint_core = (PaintCore *) tool->private;
g_return_if_fail (gdisp != NULL);
@ -230,7 +228,7 @@ paint_core_button_press (Tool *tool,
#endif /* GTK_HAVE_SIX_VALUATORS */
paint_core->state = bevent->state;
if (gdisp_ptr != tool->gdisp_ptr ||
if (gdisp != tool->gdisp ||
paint_core->context_id < 1)
{
/* initialize the statusbar display */
@ -239,7 +237,7 @@ paint_core_button_press (Tool *tool,
}
/* if this is a new image, reinit the core vals */
if ((gdisp_ptr != tool->gdisp_ptr) || ! (bevent->state & GDK_SHIFT_MASK))
if ((gdisp != tool->gdisp) || ! (bevent->state & GDK_SHIFT_MASK))
{
/* initialize some values */
paint_core->startx = paint_core->lastx = paint_core->curx = x;
@ -295,7 +293,7 @@ paint_core_button_press (Tool *tool,
}
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
tool->paused_count = 0;
/* pause the current selection and grab the pointer */
@ -369,7 +367,7 @@ paint_core_button_press (Tool *tool,
if (paint_core->flags & TOOL_TRACES_ON_WINDOW)
(* paint_core->paint_func) (paint_core, drawable, PRETRACE_PAINT);
gdisplay_flush_now (gdisp);
if (paint_core->flags & TOOL_TRACES_ON_WINDOW)
@ -382,14 +380,12 @@ paint_core_button_press (Tool *tool,
void
paint_core_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay *gdisp;
GImage *gimage;
PaintCore *paint_core;
gdisp = (GDisplay *) gdisp_ptr;
gimage = gdisp->gimage;
gimage = gdisp->gimage;
paint_core = (PaintCore *) tool->private;
/* resume the current selection and ungrab the pointer */
@ -415,14 +411,12 @@ paint_core_button_release (Tool *tool,
}
void
paint_core_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
paint_core_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp)
{
GDisplay *gdisp;
PaintCore *paint_core;
gdisp = (GDisplay *) gdisp_ptr;
paint_core = (PaintCore *) tool->private;
gdisplay_untransform_coords_f (gdisp, (double) mevent->x, (double) mevent->y,
@ -470,11 +464,10 @@ paint_core_motion (Tool *tool,
}
void
paint_core_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
paint_core_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp)
{
GDisplay *gdisp;
Layer *layer;
PaintCore *paint_core;
gint x, y;
@ -484,14 +477,12 @@ paint_core_cursor_update (Tool *tool,
CursorModifier cmodifier = CURSOR_MODIFIER_NONE;
gboolean ctoggle = FALSE;
gdisp = (GDisplay *) gdisp_ptr;
paint_core = (PaintCore *) tool->private;
/* undraw the current tool */
draw_core_pause (paint_core->core, tool);
if (gdisp_ptr != tool->gdisp_ptr ||
paint_core->context_id < 1)
if (gdisp != tool->gdisp || paint_core->context_id < 1)
{
/* initialize the statusbar display */
paint_core->context_id =
@ -504,16 +495,16 @@ paint_core_cursor_update (Tool *tool,
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
{
/* If shift is down and this is not the first paint stroke, draw a line */
if (gdisp_ptr == tool->gdisp_ptr && (mevent->state & GDK_SHIFT_MASK))
if (gdisp == tool->gdisp && (mevent->state & GDK_SHIFT_MASK))
{
gdouble dx, dy, d;
ctype = GDK_PENCIL;
ctype = GDK_PENCIL;
/* Get the current coordinates */
gdisplay_untransform_coords_f (gdisp,
(double) mevent->x,
gdisplay_untransform_coords_f (gdisp,
(double) mevent->x,
(double) mevent->y,
&paint_core->curx,
&paint_core->curx,
&paint_core->cury, TRUE);
dx = paint_core->curx - paint_core->lastx;
@ -527,7 +518,7 @@ paint_core_cursor_update (Tool *tool,
gint tangens2[6] = { 34, 106, 196, 334, 618, 1944 };
gint cosinus[7] = { 256, 247, 222, 181, 128, 66, 0 };
gint i, radius, frac;
if (idy)
{
radius = sqrt (SQR (idx) + SQR (idy));
@ -640,17 +631,15 @@ paint_core_cursor_update (Tool *tool,
}
void
paint_core_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
paint_core_control (Tool *tool,
ToolAction action,
GDisplay *gdisp)
{
PaintCore *paint_core;
GDisplay *gdisp;
GimpDrawable *drawable;
gdisp = (GDisplay *) gdisp_ptr;
paint_core = (PaintCore *) tool->private;
drawable = gimp_image_active_drawable (gdisp->gimage);
drawable = gimp_image_active_drawable (gdisp->gimage);
switch (action)
{
@ -684,7 +673,7 @@ paint_core_draw (Tool *tool)
and we don't care about a redraw */
if (paint_core->core->gc != NULL)
{
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisp = tool->gdisp;
gdisplay_transform_coords (gdisp, paint_core->lastx, paint_core->lasty,
&tx1, &ty1, 1);
@ -853,10 +842,9 @@ paint_core_interpolate (PaintCore *paint_core,
{
GimpBrush *current_brush;
GimpVector2 delta;
#ifdef GTK_HAVE_SIX_VALUATORS
gdouble dpressure, dxtilt, dytilt, dwheel;
#else /* !GTK_HAVE_SIX_VALUATORS */
gdouble dpressure, dxtilt, dytilt;
#ifdef GTK_HAVE_SIX_VALUATORS
gdouble dwheel;
#endif /* GTK_HAVE_SIX_VALUATORS */
/* double spacing; */
/* double lastscale, curscale; */
@ -888,7 +876,7 @@ paint_core_interpolate (PaintCore *paint_core,
#endif /* GTK_HAVE_SIX_VALUATORS */
return;
/* calculate the distance traveled in the coordinate space of the brush */
/* calculate the distance traveled in the coordinate space of the brush */
mag = gimp_vector2_length (&(paint_core->brush->x_axis));
xd = gimp_vector2_inner_product (&delta,
&(paint_core->brush->x_axis)) / (mag*mag);
@ -897,11 +885,11 @@ paint_core_interpolate (PaintCore *paint_core,
yd = gimp_vector2_inner_product (&delta,
&(paint_core->brush->y_axis)) / (mag*mag);
dist = 0.5 * sqrt (xd*xd + yd*yd);
total = dist + paint_core->distance;
dist = 0.5 * sqrt (xd*xd + yd*yd);
total = dist + paint_core->distance;
initial = paint_core->distance;
pixel_dist = gimp_vector2_length (&delta);
pixel_dist = gimp_vector2_length (&delta);
pixel_initial = paint_core->pixel_dist;
/* FIXME: need to adapt the spacing to the size */
@ -911,9 +899,9 @@ paint_core_interpolate (PaintCore *paint_core,
while (paint_core->distance < total)
{
n = (int) (paint_core->distance / paint_core->spacing + 1.0 + EPSILON);
n = (gint) (paint_core->distance / paint_core->spacing + 1.0 + EPSILON);
left = n * paint_core->spacing - paint_core->distance;
paint_core->distance += left;
if (paint_core->distance <= (total+EPSILON))
@ -943,6 +931,7 @@ paint_core_interpolate (PaintCore *paint_core,
paint_core->brush = current_brush;
}
}
paint_core->distance = total;
paint_core->pixel_dist = pixel_initial + pixel_dist;
paint_core->curx = paint_core->lastx + delta.x;
@ -1190,7 +1179,8 @@ paint_core_paste_canvas (PaintCore *paint_core,
MaskBuf *brush_mask;
/* get the brush mask */
brush_mask = paint_core_get_brush_mask (paint_core, brush_hardness, brush_scale);
brush_mask = paint_core_get_brush_mask (paint_core,
brush_hardness, brush_scale);
/* paste the canvas buf */
paint_core_paste (paint_core, brush_mask, drawable,
@ -1255,9 +1245,9 @@ paint_core_calculate_brush_size (MaskBuf *mask,
ratio = 1 / 16;
else
ratio = sqrt (scale);
*width = MAX ((gint)(mask->width * ratio + 0.5), 1);
*height = MAX ((gint)(mask->height * ratio + 0.5), 1);
*width = MAX ((gint) (mask->width * ratio + 0.5), 1);
*height = MAX ((gint) (mask->height * ratio + 0.5), 1);
}
}
@ -1279,12 +1269,12 @@ paint_core_subsample_mask (MaskBuf *mask,
gint r, s;
x += (x < 0) ? mask->width : 0;
left = x - floor(x);
index1 = (int) (left * (gdouble)(SUBSAMPLE + 1));
left = x - floor (x);
index1 = (gint) (left * (gdouble) (SUBSAMPLE + 1));
y += (y < 0) ? mask->height : 0;
left = y - floor(y);
index2 = (int) (left * (gdouble)(SUBSAMPLE + 1));
left = y - floor (y);
index2 = (gint) (left * (gdouble) (SUBSAMPLE + 1));
kernel = subsample[index2][index1];
@ -1307,7 +1297,7 @@ paint_core_subsample_mask (MaskBuf *mask,
last_brush_mask = mask;
cache_invalid = FALSE;
}
dest = kernel_brushes[index2][index1] = mask_buf_new (mask->width + 2,
mask->height + 2);
@ -1416,9 +1406,10 @@ paint_core_pressurize_mask (MaskBuf *brush_mask,
}
#else /* ! FANCY_PRESSURE */
for (i=0;i<256;i++)
for (i = 0; i < 256; i++)
{
int tmp = (pressure/0.5)*i;
gint tmp = (pressure / 0.5) * i;
if (tmp > 255)
mapi[i] = 255;
else
@ -1430,7 +1421,7 @@ paint_core_pressurize_mask (MaskBuf *brush_mask,
/* Now convert the brush */
source = mask_buf_data (subsample_mask);
dest = mask_buf_data (pressure_brush);
dest = mask_buf_data (pressure_brush);
i = subsample_mask->width * subsample_mask->height;
while (i--)
@ -1527,13 +1518,13 @@ paint_core_scale_pixmap (MaskBuf *brush_mask,
scale = CLAMP (scale, 0.0, 1.0);
if (scale == 0.0)
if (scale == 0.0)
return NULL;
if (scale == 1.0)
return brush_mask;
paint_core_calculate_brush_size (brush_mask, scale,
paint_core_calculate_brush_size (brush_mask, scale,
&dest_width, &dest_height);
if (brush_mask == last_brush && !cache_invalid &&
@ -1568,13 +1559,15 @@ paint_core_get_brush_mask (PaintCore *paint_core,
switch (brush_hardness)
{
case SOFT:
mask = paint_core_subsample_mask (mask, paint_core->curx, paint_core->cury);
mask = paint_core_subsample_mask (mask,
paint_core->curx, paint_core->cury);
break;
case HARD:
mask = paint_core_solidify_mask (mask);
break;
case PRESSURE:
mask = paint_core_pressurize_mask (mask, paint_core->curx, paint_core->cury,
mask = paint_core_pressurize_mask (mask,
paint_core->curx, paint_core->cury,
paint_core->curpressure);
break;
default:
@ -1623,8 +1616,10 @@ paint_core_paste (PaintCore *paint_core,
/* Otherwise:
* combine the canvas buf and the brush mask to the canvas buf
*/
else /* mode != CONSTANT */
brush_to_canvas_buf (paint_core, brush_mask, brush_opacity);
else
{
brush_to_canvas_buf (paint_core, brush_mask, brush_opacity);
}
/* intialize canvas buf source pixel regions */
srcPR.bytes = canvas_buf->bytes;
@ -1678,7 +1673,7 @@ paint_core_replace (PaintCore *paint_core,
gint offx;
gint offy;
if (!drawable_has_alpha (drawable))
if (! drawable_has_alpha (drawable))
{
paint_core_paste (paint_core, brush_mask, drawable,
brush_opacity, image_opacity, NORMAL_MODE,
@ -1711,7 +1706,7 @@ paint_core_replace (PaintCore *paint_core,
canvas_buf->x, canvas_buf->y,
canvas_buf->width, canvas_buf->height, FALSE);
}
else
else
{
/* The mask is just the brush mask */
maskPR.bytes = 1;
@ -1722,7 +1717,7 @@ paint_core_replace (PaintCore *paint_core,
maskPR.rowstride = maskPR.bytes * brush_mask->width;
maskPR.data = mask_buf_data (brush_mask);
}
/* intialize canvas buf source pixel regions */
srcPR.bytes = canvas_buf->bytes;
srcPR.x = 0;

View File

@ -22,13 +22,16 @@
/* the different states that the painting function can be called with */
#define INIT_PAINT 0 /* Setup PaintFunc internals */
#define MOTION_PAINT 1 /* PaintFunc performs motion-related rendering */
#define PAUSE_PAINT 2 /* Unused. Reserved */
#define RESUME_PAINT 3 /* Unused. Reserved */
#define FINISH_PAINT 4 /* Cleanup and/or reset PaintFunc operation */
#define PRETRACE_PAINT 5 /* PaintFunc performs window tracing activity prior to rendering */
#define POSTTRACE_PAINT 6 /* PaintFunc performs window tracing activity following rendering */
typedef enum /*< skip >*/
{
INIT_PAINT, /* Setup PaintFunc internals */
MOTION_PAINT, /* PaintFunc performs motion-related rendering */
PAUSE_PAINT, /* Unused. Reserved */
RESUME_PAINT, /* Unused. Reserved */
FINISH_PAINT, /* Cleanup and/or reset PaintFunc operation */
PRETRACE_PAINT, /* PaintFunc performs window tracing activity prior to rendering */
POSTTRACE_PAINT /* PaintFunc performs window tracing activity following rendering */
} PaintState;
typedef enum /*< skip >*/
{
@ -44,54 +47,56 @@ typedef enum /*< skip >*/
*/
} ToolFlags;
typedef void * (* PaintFunc) (PaintCore *, GimpDrawable *, int);
typedef gpointer (* PaintFunc) (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState paint_state);
struct _PaintCore
{
DrawCore * core; /* Core select object */
DrawCore * core; /* Core select object */
double startx; /* starting x coord */
double starty; /* starting y coord */
double startpressure; /* starting pressure */
double startxtilt; /* starting xtilt */
double startytilt; /* starting ytilt */
gdouble startx; /* starting x coord */
gdouble starty; /* starting y coord */
gdouble startpressure; /* starting pressure */
gdouble startxtilt; /* starting xtilt */
gdouble startytilt; /* starting ytilt */
#ifdef GTK_HAVE_SIX_VALUATORS
double startwheel; /* starting wheel */
gdouble startwheel; /* starting wheel */
#endif /* GTK_HAVE_SIX_VALUATORS */
double curx; /* current x coord */
double cury; /* current y coord */
double curpressure; /* current pressure */
double curxtilt; /* current xtilt */
double curytilt; /* current ytilt */
gdouble curx; /* current x coord */
gdouble cury; /* current y coord */
gdouble curpressure; /* current pressure */
gdouble curxtilt; /* current xtilt */
gdouble curytilt; /* current ytilt */
#ifdef GTK_HAVE_SIX_VALUATORS
double curwheel; /* current wheel */
gdouble curwheel; /* current wheel */
#endif /* GTK_HAVE_SIX_VALUATORS */
double lastx; /* last x coord */
double lasty; /* last y coord */
double lastpressure; /* last pressure */
double lastxtilt; /* last xtilt */
double lastytilt; /* last ytilt */
gdouble lastx; /* last x coord */
gdouble lasty; /* last y coord */
gdouble lastpressure; /* last pressure */
gdouble lastxtilt; /* last xtilt */
gdouble lastytilt; /* last ytilt */
#ifdef GTK_HAVE_SIX_VALUATORS
double lastwheel; /* last wheel */
gdouble lastwheel; /* last wheel */
#endif /* GTK_HAVE_SIX_VALUATORS */
int state; /* state of buttons and keys */
gint state; /* state of buttons and keys */
double distance; /* distance traveled by brush */
double pixel_dist; /* distance in pixels */
double spacing; /* spacing */
gdouble distance; /* distance traveled by brush */
gdouble pixel_dist; /* distance in pixels */
gdouble spacing; /* spacing */
int x1, y1; /* image space coordinate */
int x2, y2; /* image space coords */
gint x1, y1; /* image space coordinate */
gint x2, y2; /* image space coords */
GimpBrush * brush; /* current brush */
GimpBrush * brush; /* current brush */
PaintFunc paint_func; /* painting function */
int pick_colors; /* pick color if ctrl or alt is pressed */
int pick_state; /* was ctrl or alt pressed when clicked? */
gboolean pick_colors; /* pick color if ctrl or alt is pressed */
gboolean pick_state; /* was ctrl or alt pressed when clicked? */
ToolFlags flags; /* tool flags, see ToolFlags above */
guint context_id; /* for the statusbar */
@ -100,30 +105,38 @@ struct _PaintCore
extern PaintCore non_gui_paint_core;
/* Special undo type */
typedef struct _paint_undo PaintUndo;
typedef struct _PaintUndo PaintUndo;
struct _paint_undo
struct _PaintUndo
{
int tool_ID;
double lastx;
double lasty;
double lastpressure;
double lastxtilt;
double lastytilt;
gint tool_ID;
gdouble lastx;
gdouble lasty;
gdouble lastpressure;
gdouble lastxtilt;
gdouble lastytilt;
#ifdef GTK_HAVE_SIX_VALUATORS
double lastwheel;
gdouble lastwheel;
#endif /* GTK_HAVE_SIX_VALUATORS */
};
/* paint tool action functions */
void paint_core_button_press (Tool *tool, GdkEventButton *bevent, gpointer gdisp_ptr);
void paint_core_button_release (Tool *tool, GdkEventButton *bevent, gpointer gdisp_ptr);
void paint_core_motion (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr);
void paint_core_cursor_update (Tool *tool, GdkEventMotion *mevent, gpointer gdisp_ptr);
void paint_core_button_press (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
void paint_core_button_release (Tool *tool,
GdkEventButton *bevent,
GDisplay *gdisp);
void paint_core_motion (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void paint_core_cursor_update (Tool *tool,
GdkEventMotion *mevent,
GDisplay *gdisp);
void paint_core_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr);
ToolAction action,
GDisplay *gdisp);
/* paint tool functions */
void paint_core_no_draw (Tool *tool);
@ -180,4 +193,5 @@ void paint_core_color_area_with_pixmap (PaintCore *paint_core,
gdouble scale,
BrushApplicationMode mode);
#endif /* __PAINT_CORE_H__ */

View File

@ -62,6 +62,7 @@
/* the paintbrush structures */
typedef struct _PaintbrushOptions PaintbrushOptions;
struct _PaintbrushOptions
{
PaintOptions paint_options;
@ -108,13 +109,16 @@ static GimpUnit non_gui_gradient_unit;
/* forward function declarations */
static void paintbrush_motion (PaintCore *,
GimpDrawable *,
PaintPressureOptions *,
gdouble,
gdouble,
PaintApplicationMode,
GradientPaintMode);
static void paintbrush_motion (PaintCore *,
GimpDrawable *,
PaintPressureOptions *,
gdouble ,
gdouble ,
PaintApplicationMode ,
GradientPaintMode );
static gpointer paintbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
/* functions */
@ -125,7 +129,7 @@ paintbrush_gradient_toggle_callback (GtkWidget *widget,
{
PaintbrushOptions *options = paintbrush_options;
static int incremental_save = FALSE;
static gboolean incremental_save = FALSE;
gimp_toggle_button_update (widget, data);
@ -147,8 +151,8 @@ static void
paintbrush_options_reset (void)
{
PaintbrushOptions *options = paintbrush_options;
GtkWidget *spinbutton;
gint digits;
GtkWidget *spinbutton;
gint digits;
paint_options_reset ((PaintOptions *) options);
@ -358,10 +362,10 @@ paintbrush_options_new (void)
#define TIMED_BRUSH 0
void *
static gpointer
paintbrush_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
GDisplay *gdisp = gdisplay_active ();
double fade_out;
@ -584,15 +588,15 @@ paintbrush_motion (PaintCore *paint_core,
}
static void *
static gpointer
paintbrush_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
GImage *gimage;
double fade_out;
double gradient_length;
double unit_factor;
GImage *gimage;
gdouble fade_out;
gdouble gradient_length;
gdouble unit_factor;
if (! (gimage = drawable_gimage (drawable)))
return NULL;

View File

@ -20,9 +20,6 @@
#define __PAINTBRUSH_H__
void * paintbrush_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean paintbrush_non_gui (GimpDrawable *,
gint ,
gdouble *,

View File

@ -77,7 +77,7 @@ path_bezier_draw_handles (Tool *tool,
{
PathTool *path_tool = (PathTool *) (tool->private);
PathBezierData *data = (PathBezierData *) segment->data;
GDisplay * gdisp = tool->gdisp_ptr;
GDisplay * gdisp = tool->gdisp;
gint sx, sy, hx, hy;

View File

@ -155,7 +155,7 @@ path_curve_draw_segment (Tool *tool,
numpts = path_curve_get_points (((PathTool *) tool->private), segment,
coordinates, 100, 0, 1);
for (index=0; index < numpts; index++) {
gdisplay_transform_coords (tool->gdisp_ptr,
gdisplay_transform_coords (tool->gdisp,
coordinates[index].x,
coordinates[index].y,
&x, &y, FALSE);

View File

@ -755,9 +755,8 @@ path_tool_cursor_position (Tool *tool,
void
path_tool_button_press (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
PathTool * path_tool;
gint grab_pointer=0;
gint x, y, halfwidth, dummy;
@ -766,9 +765,8 @@ path_tool_button_press (Tool *tool,
fprintf (stderr, "path_tool_button_press\n");
#endif PATH_TOOL_DEBUG
gdisp = (GDisplay *) gdisp_ptr;
path_tool = (PathTool *) tool->private;
tool->gdisp_ptr = gdisp_ptr;
tool->gdisp = gdisp;
/* Transform window-coordinates to canvas-coordinates */
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, TRUE, 0);
@ -1099,16 +1097,14 @@ path_tool_button_press_curve (Tool *tool,
void
path_tool_button_release (Tool *tool,
GdkEventButton *bevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
PathTool * path_tool;
#ifdef PATH_TOOL_DEBUG
fprintf (stderr, "path_tool_button_release\n");
#endif PATH_TOOL_DEBUG
gdisp = (GDisplay *) gdisp_ptr;
path_tool = (PathTool *) tool->private;
path_tool->state &= ~PATH_TOOL_DRAG;
@ -1125,14 +1121,12 @@ path_tool_button_release (Tool *tool,
void
path_tool_motion (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
PathTool * path_tool;
if (gtk_events_pending()) return;
gdisp = (GDisplay *) gdisp_ptr;
path_tool = (PathTool *) tool->private;
switch (path_tool->click_type) {
@ -1314,10 +1308,9 @@ path_tool_motion_curve (Tool *tool,
void
path_tool_cursor_update (Tool *tool,
GdkEventMotion *mevent,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
PathTool *path_tool;
GDisplay *gdisp;
gint x, y, halfwidth, dummy, cursor_location;
#ifdef PATH_TOOL_DEBUG
@ -1325,7 +1318,6 @@ path_tool_cursor_update (Tool *tool,
*/
#endif PATH_TOOL_DEBUG
gdisp = (GDisplay *) gdisp_ptr;
path_tool = (PathTool *) tool->private;
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
@ -1361,16 +1353,14 @@ path_tool_cursor_update (Tool *tool,
void
path_tool_control (Tool *tool,
ToolAction action,
gpointer gdisp_ptr)
GDisplay *gdisp)
{
GDisplay * gdisp;
PathTool * path_tool;
#ifdef PATH_TOOL_DEBUG
fprintf (stderr, "path_tool_control\n");
#endif PATH_TOOL_DEBUG
gdisp = (GDisplay *) tool->gdisp_ptr;
path_tool = (PathTool *) tool->private;
switch (action)
@ -1462,7 +1452,7 @@ tools_free_path_tool (Tool *tool)
fprintf (stderr, "tools_free_path_tool start\n");
#endif PATH_TOOL_DEBUG
path_tool = (PathTool *) tool->private;
gdisp = (GDisplay *) tool->gdisp_ptr;
gdisp = tool->gdisp;
if (tool->state == ACTIVE)
{
@ -1850,7 +1840,7 @@ path_tool_draw_helper (Path *path,
return;
}
gdisp = tool->gdisp_ptr;
gdisp = tool->gdisp;
path_tool = (PathTool *) tool->private;
core = path_tool->core;
@ -1894,7 +1884,7 @@ path_tool_draw (Tool *tool)
fprintf (stderr, "path_tool_draw\n");
#endif PATH_TOOL_DEBUG
gdisp = tool->gdisp_ptr;
gdisp = tool->gdisp;
path_tool = tool->private;
cur_path = path_tool->cur_path;

View File

@ -40,6 +40,8 @@
#include "tool_options.h"
#define PENCIL_INCREMENTAL_DEFAULT FALSE
/* the pencil tool options */
typedef struct _PencilOptions PencilOptions;
@ -48,23 +50,29 @@ struct _PencilOptions
PaintOptions paint_options;
};
static PencilOptions *pencil_options = NULL;
/* forward function declarations */
static void pencil_motion (PaintCore *, GimpDrawable *,
PaintPressureOptions *, gboolean);
static void pencil_motion (PaintCore *paint_core,
GimpDrawable *drawable,
PaintPressureOptions *pressure_options,
gboolean );
static gpointer pencil_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
PaintState state);
static PencilOptions *pencil_options = NULL;
static gboolean non_gui_incremental = FALSE;
static void pencil_options_reset (void);
#define PENCIL_INCREMENTAL_DEFAULT FALSE
/* functions */
void *
gpointer
pencil_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
switch (state)
{
@ -203,10 +211,10 @@ pencil_motion (PaintCore *paint_core,
HARD, scale, paint_appl_mode);
}
static void *
static gpointer
pencil_non_gui_paint_func (PaintCore *paint_core,
GimpDrawable *drawable,
int state)
PaintState state)
{
pencil_motion (paint_core, drawable, &non_gui_pressure_options,
non_gui_incremental);

View File

@ -20,12 +20,9 @@
#define __PENCIL_H__
void * pencil_paint_func (PaintCore *,
GimpDrawable *,
gint );
gboolean pencil_non_gui (GimpDrawable *,
gint ,
gdouble *);
gboolean pencil_non_gui (GimpDrawable *drawable,
gint num_strokes,
gdouble *stroke_array);
Tool * tools_new_pencil (void);
void tools_free_pencil (Tool *tool);

View File

@ -41,23 +41,28 @@
#include "libgimp/gimpintl.h"
/* forward function declarations */
static TileManager * perspective_tool_transform (Tool *tool,
GDisplay *gdisp,
TransformState state);
static void perspective_tool_recalc (Tool *tool,
GDisplay *gdisp);
static void perspective_tool_motion (Tool *tool,
GDisplay *gdisp);
static void perspective_info_update (Tool *tool);
/* storage for information dialog fields */
static gchar matrix_row_buf [3][MAX_INFO_BUF];
/* forward function declarations */
static void perspective_tool_recalc (Tool *, void *);
static void perspective_tool_motion (Tool *, void *);
static void perspective_info_update (Tool *);
TileManager *
static TileManager *
perspective_tool_transform (Tool *tool,
gpointer gdisp_ptr,
GDisplay *gdisp,
TransformState state)
{
GDisplay *gdisp;
TransformCore *transform_core;
gdisp = (GDisplay *) gdisp_ptr;
transform_core = (TransformCore *) tool->private;
switch (state)
@ -89,12 +94,12 @@ perspective_tool_transform (Tool *tool,
break;
case TRANSFORM_MOTION:
perspective_tool_motion (tool, gdisp_ptr);
perspective_tool_recalc (tool, gdisp_ptr);
perspective_tool_motion (tool, gdisp);
perspective_tool_recalc (tool, gdisp);
break;
case TRANSFORM_RECALC:
perspective_tool_recalc (tool, gdisp_ptr);
perspective_tool_recalc (tool, gdisp);
break;
case TRANSFORM_FINISH:
@ -173,14 +178,12 @@ perspective_info_update (Tool *tool)
}
static void
perspective_tool_motion (Tool *tool,
void *gdisp_ptr)
perspective_tool_motion (Tool *tool,
GDisplay *gdisp)
{
GDisplay *gdisp;
TransformCore *transform_core;
gint diff_x, diff_y;
gdisp = (GDisplay *) gdisp_ptr;
transform_core = (TransformCore *) tool->private;
diff_x = transform_core->curx - transform_core->lastx;
@ -210,16 +213,14 @@ perspective_tool_motion (Tool *tool,
}
static void
perspective_tool_recalc (Tool *tool,
void *gdisp_ptr)
perspective_tool_recalc (Tool *tool,
GDisplay *gdisp)
{
TransformCore *transform_core;
GDisplay *gdisp;
GimpMatrix3 m;
gdouble cx, cy;
gdouble scalex, scaley;
gdisp = (GDisplay *) tool->gdisp_ptr;
transform_core = (TransformCore *) tool->private;
/* determine the perspective transform that maps from

Some files were not shown because too many files have changed in this diff Show More