mirror of https://github.com/GNOME/gimp.git
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:
parent
5e18bba988
commit
2db8881557
56
ChangeLog
56
ChangeLog
|
@ -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 ...
|
||||
|
|
|
@ -1082,9 +1082,10 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
ToolType tool_type;
|
||||
GDisplay *gdisp;
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
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 *****/
|
||||
|
|
|
@ -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,10 +199,10 @@ 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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#define __BOUNDARY_H__
|
||||
|
||||
|
||||
#include "paint_funcs.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WithinBounds,
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
@ -88,7 +100,7 @@ color_balance (PixelRegion *srcPR,
|
|||
ColorBalanceDialog *cbd;
|
||||
guchar *src, *s;
|
||||
guchar *dest, *d;
|
||||
gint alpha;
|
||||
gboolean alpha;
|
||||
gint r, g, b;
|
||||
gint r_n, g_n, b_n;
|
||||
gint w, h;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,37 +108,69 @@ 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 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);
|
||||
|
@ -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;
|
||||
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;
|
||||
GimpDrawable *drawable;
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ struct _HueSaturationDialog
|
|||
gboolean preview;
|
||||
};
|
||||
|
||||
|
||||
Tool * tools_new_hue_saturation (void);
|
||||
void tools_free_hue_saturation (Tool *tool);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -1020,18 +1014,18 @@ bezier_select_button_press (Tool *tool,
|
|||
|
||||
grab_pointer = TRUE;
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp_ptr = gdisp_ptr;
|
||||
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,7 +2005,7 @@ 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);
|
||||
|
@ -2452,12 +2441,12 @@ bezier_convert (BezierSelect *bezier_sel,
|
|||
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;
|
||||
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");
|
||||
|
@ -2623,15 +2612,15 @@ bezier_convert_points (BezierSelect *bezier_sel,
|
|||
|
||||
static void
|
||||
bezier_convert_line (GSList **scanlines,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2)
|
||||
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;
|
||||
|
@ -2740,7 +2729,7 @@ bezier_convert_line (GSList ** scanlines,
|
|||
|
||||
static GSList *
|
||||
bezier_insert_in_list (GSList *list,
|
||||
int x)
|
||||
gint x)
|
||||
{
|
||||
GSList *orig = list;
|
||||
GSList *rest;
|
||||
|
@ -2770,7 +2759,7 @@ bezier_insert_in_list (GSList * list,
|
|||
}
|
||||
|
||||
gboolean
|
||||
bezier_tool_selected()
|
||||
bezier_tool_selected (void)
|
||||
{
|
||||
return (active_tool &&
|
||||
active_tool->type == BEZIER_SELECT &&
|
||||
|
@ -2778,13 +2767,14 @@ bezier_tool_selected()
|
|||
}
|
||||
|
||||
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 need_move = 0;
|
||||
|
||||
/* g_print ("bezier_paste_bezierselect_to_current::\n"); */
|
||||
/* printSel(bsel); */
|
||||
|
@ -2804,7 +2794,7 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
|
|||
|
||||
gimp_context_set_tool (gimp_context_get_user (), BEZIER_SELECT);
|
||||
active_tool->paused_count = 0;
|
||||
active_tool->gdisp_ptr = gdisp;
|
||||
active_tool->gdisp = gdisp;
|
||||
active_tool->drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
tool = active_tool;
|
||||
|
@ -2825,7 +2815,9 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
|
|||
need_move = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bezier_add_point (curSel, pts->type, pts->x, pts->y);
|
||||
}
|
||||
|
||||
if (bpnt == NULL)
|
||||
bpnt = curSel->last_point;
|
||||
|
@ -2854,8 +2846,8 @@ bezier_paste_bezierselect_to_current(GDisplay *gdisp,BezierSelect *bsel)
|
|||
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"); */
|
||||
|
@ -2886,7 +2878,7 @@ bezier_to_sel_internal(BezierSelect *bezier_sel,
|
|||
* 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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
55
app/blend.c
55
app/blend.c
|
@ -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;
|
||||
|
||||
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,9 +486,8 @@ 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;
|
||||
#ifdef BLEND_UI_CALLS_VIA_PDB
|
||||
|
@ -489,7 +497,6 @@ blend_button_release (Tool *tool,
|
|||
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];
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
|
|
34
app/blend.h
34
app/blend.h
|
@ -53,23 +53,23 @@ 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);
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#define __BOUNDARY_H__
|
||||
|
||||
|
||||
#include "paint_funcs.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WithinBounds,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
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;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
bucket_tool = (BucketTool *) tool->private;
|
||||
|
||||
gdk_pointer_ungrab (bevent->time);
|
||||
|
@ -267,17 +279,14 @@ 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;
|
||||
|
||||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
|
||||
&x, &y, FALSE, FALSE);
|
||||
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -96,6 +97,7 @@ static GtkTargetEntry by_color_select_targets[] =
|
|||
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,
|
||||
|
@ -104,32 +106,59 @@ static void by_color_select_color_drop (GtkWidget *widget,
|
|||
|
||||
/* 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 void by_color_select_render (ByColorDialog *, GImage *);
|
||||
static void by_color_select_draw (ByColorDialog *, GImage *);
|
||||
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_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 */
|
||||
|
@ -206,7 +235,7 @@ by_color_select_color (GImage *gimage,
|
|||
gint width, height;
|
||||
gint bytes, color_bytes, alpha;
|
||||
gint i, j;
|
||||
void * pr;
|
||||
gpointer pr;
|
||||
gint d_type;
|
||||
|
||||
/* Get the image information */
|
||||
|
@ -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)
|
||||
{
|
||||
|
|
104
app/clone.c
104
app/clone.c
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
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;
|
||||
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 *
|
||||
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,13 +695,13 @@ 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)
|
||||
|
@ -703,12 +723,12 @@ 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]))
|
||||
|
|
26
app/clone.h
26
app/clone.h
|
@ -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__ */
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
@ -88,7 +100,7 @@ color_balance (PixelRegion *srcPR,
|
|||
ColorBalanceDialog *cbd;
|
||||
guchar *src, *s;
|
||||
guchar *dest, *d;
|
||||
gint alpha;
|
||||
gboolean alpha;
|
||||
gint r, g, b;
|
||||
gint r_n, g_n, b_n;
|
||||
gint w, h;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,14 +100,26 @@ 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,
|
||||
|
@ -235,17 +247,15 @@ 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;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
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;
|
||||
|
||||
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,7 +450,7 @@ color_picker_cursor_update (Tool *tool,
|
|||
static void
|
||||
color_picker_control (Tool *tool,
|
||||
ToolAction action,
|
||||
gpointer gdisp_ptr)
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
ColorPickerTool *cp_tool;
|
||||
|
||||
|
@ -594,7 +598,6 @@ pick_color (GimpImage *gimage,
|
|||
static void
|
||||
colorpicker_draw (Tool *tool)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
ColorPickerTool *cp_tool;
|
||||
gint tx, ty;
|
||||
gint radiusx, radiusy;
|
||||
|
@ -603,16 +606,15 @@ colorpicker_draw (Tool *tool)
|
|||
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,
|
||||
|
|
|
@ -1082,9 +1082,10 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
ToolType tool_type;
|
||||
GDisplay *gdisp;
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
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 *****/
|
||||
|
|
|
@ -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,11 +296,11 @@ 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 *
|
||||
|
@ -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 *
|
||||
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,10 +635,10 @@ 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;
|
||||
gdouble rate = DEFAULT_CONVOLVE_RATE;
|
||||
ConvolveType type = DEFAULT_CONVOLVE_TYPE;
|
||||
ConvolveOptions *options = convolve_options;
|
||||
|
||||
|
@ -641,10 +655,10 @@ 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]))
|
||||
|
@ -678,6 +692,6 @@ convolve_non_gui (GimpDrawable *drawable,
|
|||
paint_core_cleanup ();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -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 *);
|
||||
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 *);
|
||||
void tools_free_convolve (Tool *tool);
|
||||
|
||||
|
||||
#endif /* __CONVOLVE_H__ */
|
||||
|
|
|
@ -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;
|
||||
|
||||
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,9 +486,8 @@ 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;
|
||||
#ifdef BLEND_UI_CALLS_VIA_PDB
|
||||
|
@ -489,7 +497,6 @@ blend_button_release (Tool *tool,
|
|||
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];
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
|
|
|
@ -107,13 +107,13 @@ 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->gdisp = gdisp;
|
||||
_image_map->drawable = drawable;
|
||||
_image_map->undo_tiles = NULL;
|
||||
_image_map->state = WAITING;
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -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 */
|
||||
|
|
206
app/crop.c
206
app/crop.c
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
||||
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 *) tool->private;
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
gdk_pointer_ungrab (bevent->time);
|
||||
gdk_flush ();
|
||||
|
@ -352,8 +393,10 @@ 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;
|
||||
|
@ -407,10 +450,9 @@ 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;
|
||||
|
@ -419,7 +461,6 @@ crop_motion (Tool *tool,
|
|||
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;
|
||||
|
||||
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,17 +644,14 @@ 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;
|
||||
|
||||
if (tool->state == ACTIVE)
|
||||
{
|
||||
crop = (Crop *) tool->private;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -742,18 +778,16 @@ void
|
|||
crop_draw (Tool *tool)
|
||||
{
|
||||
Crop *crop;
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
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,
|
||||
|
@ -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"),
|
||||
|
@ -1148,10 +1176,8 @@ static void
|
|||
crop_info_update (Tool *tool)
|
||||
{
|
||||
Crop *crop;
|
||||
GDisplay *gdisp;
|
||||
|
||||
crop = (Crop *) tool->private;
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
|
||||
orig_vals[0] = crop->tx1;
|
||||
orig_vals[1] = crop->ty1;
|
||||
|
@ -1168,13 +1194,11 @@ crop_crop_callback (GtkWidget *widget,
|
|||
{
|
||||
Tool *tool;
|
||||
Crop *crop;
|
||||
GDisplay *gdisp;
|
||||
|
||||
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,
|
||||
|
@ -1190,13 +1214,11 @@ crop_resize_callback (GtkWidget *widget,
|
|||
{
|
||||
Tool *tool;
|
||||
Crop *crop;
|
||||
GDisplay *gdisp;
|
||||
|
||||
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,7 +1243,7 @@ crop_close_callback (GtkWidget *widget,
|
|||
|
||||
info_dialog_popdown (crop_info);
|
||||
|
||||
tool->gdisp_ptr = NULL;
|
||||
tool->gdisp = NULL;
|
||||
tool->drawable = NULL;
|
||||
tool->state = INACTIVE;
|
||||
}
|
||||
|
@ -1237,7 +1259,7 @@ crop_selection_callback (GtkWidget *widget,
|
|||
|
||||
tool = active_tool;
|
||||
crop = (Crop *) tool->private;
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
gdisp = tool->gdisp;
|
||||
|
||||
draw_core_pause (crop->core, tool);
|
||||
if (! gimage_mask_bounds (gdisp->gimage,
|
||||
|
@ -1283,7 +1305,7 @@ crop_automatic_callback (GtkWidget *widget,
|
|||
|
||||
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 ();
|
||||
|
@ -1518,7 +1540,6 @@ crop_orig_changed (GtkWidget *widget,
|
|||
{
|
||||
Tool *tool;
|
||||
Crop *crop;
|
||||
GDisplay *gdisp;
|
||||
gint ox;
|
||||
gint oy;
|
||||
|
||||
|
@ -1526,8 +1547,8 @@ crop_orig_changed (GtkWidget *widget,
|
|||
|
||||
if (tool && active_tool->type == CROP)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
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));
|
||||
|
||||
|
@ -1551,7 +1572,6 @@ crop_size_changed (GtkWidget *widget,
|
|||
{
|
||||
Tool *tool;
|
||||
Crop *crop;
|
||||
GDisplay *gdisp;
|
||||
gint sx;
|
||||
gint sy;
|
||||
|
||||
|
@ -1559,8 +1579,8 @@ crop_size_changed (GtkWidget *widget,
|
|||
|
||||
if (tool && active_tool->type == CROP)
|
||||
{
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
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);
|
||||
|
||||
|
|
14
app/crop.h
14
app/crop.h
|
@ -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__ */
|
||||
|
||||
|
||||
|
|
105
app/curves.c
105
app/curves.c
|
@ -108,37 +108,69 @@ 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 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);
|
||||
|
@ -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;
|
||||
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;
|
||||
GimpDrawable *drawable;
|
||||
GDisplay *gdisp;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
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);
|
||||
|
|
|
@ -19,13 +19,15 @@
|
|||
#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 */
|
||||
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_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 */
|
||||
|
@ -54,22 +56,23 @@ struct _Selection
|
|||
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__ */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
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);
|
||||
|
|
|
@ -19,13 +19,15 @@
|
|||
#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 */
|
||||
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_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 */
|
||||
|
@ -54,22 +56,23 @@ struct _Selection
|
|||
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__ */
|
||||
|
|
|
@ -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,8 +660,8 @@ 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;
|
||||
|
||||
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;
|
||||
|
@ -1327,7 +1308,7 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
|
|||
gchar *title_buf;
|
||||
|
||||
iwd = (NavWinData *) nav_window_auto->user_data;
|
||||
old_gdisp = (GDisplay *) iwd->gdisp_ptr;
|
||||
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);
|
||||
|
@ -1384,7 +1365,8 @@ nav_window_follow_auto (void)
|
|||
|
||||
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,17 +1382,14 @@ 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);
|
||||
|
@ -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,
|
||||
|
@ -1570,7 +1549,7 @@ nav_window_get_gdisp (void)
|
|||
|
||||
g_slist_free (list);
|
||||
|
||||
return (gdisp);
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1594,7 +1573,7 @@ nav_window_free (GDisplay *del_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);
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,8 +660,8 @@ 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;
|
||||
|
||||
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;
|
||||
|
@ -1327,7 +1308,7 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
|
|||
gchar *title_buf;
|
||||
|
||||
iwd = (NavWinData *) nav_window_auto->user_data;
|
||||
old_gdisp = (GDisplay *) iwd->gdisp_ptr;
|
||||
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);
|
||||
|
@ -1384,7 +1365,8 @@ nav_window_follow_auto (void)
|
|||
|
||||
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,17 +1382,14 @@ 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);
|
||||
|
@ -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,
|
||||
|
@ -1570,7 +1549,7 @@ nav_window_get_gdisp (void)
|
|||
|
||||
g_slist_free (list);
|
||||
|
||||
return (gdisp);
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1594,7 +1573,7 @@ nav_window_free (GDisplay *del_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);
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
126
app/dodgeburn.c
126
app/dodgeburn.c
|
@ -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)
|
||||
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;
|
||||
|
@ -239,6 +263,7 @@ dodgeburn_init (PaintCore *paint_core,
|
|||
{
|
||||
/* Here we create the luts to do the painting with.*/
|
||||
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);
|
||||
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)
|
||||
|
@ -282,14 +307,14 @@ dodgeburn_make_luts (PaintCore *paint_core,
|
|||
}
|
||||
|
||||
gimp_lut_setup_exact (lut,
|
||||
lut_func, (void *)&exposure,
|
||||
lut_func, (gpointer) &exposure,
|
||||
nchannels);
|
||||
}
|
||||
|
||||
static void
|
||||
dodgeburn_modifier_key_func (Tool *tool,
|
||||
GdkEventKey *kevent,
|
||||
gpointer gdisp_ptr)
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
|
@ -342,11 +367,11 @@ 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 *
|
||||
|
@ -421,6 +446,7 @@ dodgeburn_motion (PaintCore *paint_core,
|
|||
|
||||
{
|
||||
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));
|
||||
|
@ -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,10 +521,10 @@ 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;
|
||||
gdouble exposure = DODGEBURN_DEFAULT_TYPE;
|
||||
DodgeBurnType type = DODGEBURN_DEFAULT_TYPE;
|
||||
DodgeBurnMode mode = DODGEBURN_DEFAULT_MODE;
|
||||
DodgeBurnOptions *options = dodgeburn_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,9 +596,9 @@ dodgeburn_non_gui (GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
static gfloat
|
||||
dodgeburn_highlights_lut_func (void *user_data,
|
||||
int nchannels,
|
||||
int channel,
|
||||
dodgeburn_highlights_lut_func (gpointer user_data,
|
||||
gint nchannels,
|
||||
gint channel,
|
||||
gfloat value)
|
||||
{
|
||||
gfloat *exposure_ptr = (gfloat *) user_data;
|
||||
|
@ -586,9 +613,9 @@ dodgeburn_highlights_lut_func (void *user_data,
|
|||
}
|
||||
|
||||
static gfloat
|
||||
dodgeburn_midtones_lut_func (void *user_data,
|
||||
int nchannels,
|
||||
int channel,
|
||||
dodgeburn_midtones_lut_func (gpointer user_data,
|
||||
gint nchannels,
|
||||
gint channel,
|
||||
gfloat value)
|
||||
{
|
||||
gfloat *exposure_ptr = (gfloat *) user_data;
|
||||
|
@ -603,13 +630,14 @@ 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,
|
||||
dodgeburn_shadows_lut_func (gpointer user_data,
|
||||
gint nchannels,
|
||||
gint channel,
|
||||
gfloat value)
|
||||
{
|
||||
gfloat *exposure_ptr = (gfloat *) user_data;
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -127,16 +127,13 @@ 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;
|
||||
|
||||
undo_push_group_start (gdisp->gimage, LAYER_DISPLACE_UNDO);
|
||||
|
||||
/* Move the (x, y) point from screen to image space */
|
||||
|
@ -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,9 +306,8 @@ 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;
|
||||
|
||||
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
GDisplay *gdisp);
|
||||
void edit_selection_motion (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
gpointer gdisp_ptr);
|
||||
GDisplay *gdisp);
|
||||
void edit_selection_control (Tool *tool,
|
||||
ToolAction action,
|
||||
gpointer gdisp_ptr);
|
||||
GDisplay *gdisp);
|
||||
void edit_selection_cursor_update (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
gpointer gdisp_ptr);
|
||||
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__ */
|
||||
|
|
|
@ -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,
|
||||
|
|
46
app/eraser.c
46
app/eraser.c
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
23
app/eraser.h
23
app/eraser.h
|
@ -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 *);
|
||||
void tools_free_eraser (Tool *tool);
|
||||
|
||||
|
||||
#endif /* __ERASER_H__ */
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
@ -140,16 +150,14 @@ flip_modifier_key_func (Tool *tool,
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,7 +476,7 @@ 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;
|
||||
|
@ -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);
|
||||
|
@ -523,12 +528,11 @@ fuzzy_select_motion (Tool *tool,
|
|||
|
||||
static GdkSegment *
|
||||
fuzzy_select_calculate (Tool *tool,
|
||||
void *gdisp_ptr,
|
||||
GDisplay *gdisp,
|
||||
gint *nsegs)
|
||||
{
|
||||
PixelRegion maskPR;
|
||||
FuzzySelect *fuzzy_sel;
|
||||
GDisplay *gdisp;
|
||||
Channel *new;
|
||||
GdkSegment *segs;
|
||||
BoundSeg *bsegs;
|
||||
|
@ -538,7 +542,6 @@ fuzzy_select_calculate (Tool *tool,
|
|||
gboolean use_offsets;
|
||||
|
||||
fuzzy_sel = (FuzzySelect *) tool->private;
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
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;
|
||||
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -125,7 +125,7 @@ gimage_dirty_handler (GimpImage *gimage)
|
|||
{
|
||||
if (active_tool && ! active_tool->preserve)
|
||||
{
|
||||
GDisplay* gdisp = active_tool->gdisp_ptr;
|
||||
GDisplay* gdisp = active_tool->gdisp;
|
||||
|
||||
if (gdisp)
|
||||
{
|
||||
|
|
|
@ -1082,9 +1082,10 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
ToolType tool_type;
|
||||
GDisplay *gdisp;
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
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 *****/
|
||||
|
|
|
@ -1082,9 +1082,10 @@ tools_select_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
ToolType tool_type;
|
||||
GDisplay *gdisp;
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
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 *****/
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -458,5 +467,3 @@ histogram_tool_gradient_draw (GtkWidget *gradient,
|
|||
|
||||
gtk_widget_queue_draw (gradient);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ struct _HistogramToolDialog
|
|||
gint color;
|
||||
};
|
||||
|
||||
|
||||
/* histogram_tool functions */
|
||||
Tool * tools_new_histogram_tool (void);
|
||||
void tools_free_histogram_tool (Tool *tool);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ struct _HueSaturationDialog
|
|||
gboolean preview;
|
||||
};
|
||||
|
||||
|
||||
Tool * tools_new_hue_saturation (void);
|
||||
void tools_free_hue_saturation (Tool *tool);
|
||||
|
||||
|
|
|
@ -107,13 +107,13 @@ 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->gdisp = gdisp;
|
||||
_image_map->drawable = drawable;
|
||||
_image_map->undo_tiles = NULL;
|
||||
_image_map->state = WAITING;
|
||||
|
|
|
@ -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 *);
|
||||
|
|
217
app/ink.c
217
app/ink.c
|
@ -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;
|
||||
|
||||
|
@ -130,45 +136,42 @@ struct _InkOptions
|
|||
};
|
||||
|
||||
|
||||
/* the ink tool options */
|
||||
static InkOptions * ink_options = NULL;
|
||||
|
||||
/* local variables */
|
||||
|
||||
/* undo blocks variables */
|
||||
static TileManager * undo_tiles = NULL;
|
||||
|
||||
/* Tiles used to render the stroke at 1 byte/pp */
|
||||
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 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 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 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 dist_smoother_init (InkTool *ink_tool,
|
||||
gdouble initval);
|
||||
|
||||
static void ink_init (InkTool *ink_tool,
|
||||
GimpDrawable *drawable,
|
||||
double x,
|
||||
double y);
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
static void ink_finish (InkTool *ink_tool,
|
||||
GimpDrawable *drawable,
|
||||
int tool_id);
|
||||
gint tool_id);
|
||||
static void ink_cleanup (void);
|
||||
|
||||
static void ink_type_update (GtkWidget *radio_button,
|
||||
|
@ -193,34 +196,51 @@ static void ink_to_canvas_tiles (InkTool *ink_tool,
|
|||
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);
|
||||
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 *w,
|
||||
GtkWidget *widget,
|
||||
GdkRectangle *rect);
|
||||
static void brush_widget_realize (GtkWidget *w);
|
||||
static void brush_widget_expose (GtkWidget *w,
|
||||
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 *w,
|
||||
static void brush_widget_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
BrushWidget *brush_widget);
|
||||
static void brush_widget_button_release (GtkWidget *w,
|
||||
static void brush_widget_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
BrushWidget *brush_widget);
|
||||
static void brush_widget_motion_notify (GtkWidget *w,
|
||||
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;
|
||||
|
||||
/* Tiles used to render the stroke at 1 byte/pp */
|
||||
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;
|
||||
|
||||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
|
@ -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 */
|
||||
|
@ -817,7 +835,7 @@ ink_button_press (Tool *tool,
|
|||
ink_init (ink_tool, drawable, x, y);
|
||||
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp_ptr = gdisp_ptr;
|
||||
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,13 +874,11 @@ 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;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
gimage = gdisp->gimage;
|
||||
ink_tool = (InkTool *) tool->private;
|
||||
|
||||
|
@ -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;
|
||||
GimpDrawable *drawable;
|
||||
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;
|
||||
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)
|
||||
|
@ -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;
|
||||
|
@ -1379,8 +1399,8 @@ ink_paste (InkTool *ink_tool,
|
|||
{
|
||||
GImage *gimage;
|
||||
PixelRegion srcPR;
|
||||
int offx, offy;
|
||||
unsigned char col[MAX_CHANNELS];
|
||||
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)))
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
Tool * tools_new_ink (void);
|
||||
void tools_free_ink (Tool *tool);
|
||||
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord ink_proc;
|
||||
|
||||
|
|
|
@ -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,13 +272,27 @@ 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);
|
||||
|
@ -323,6 +338,7 @@ static GPtrArray * plot_pixels (Iscissors *iscissors,
|
|||
gint xe,
|
||||
gint ye);
|
||||
|
||||
|
||||
static void
|
||||
iscissors_options_reset (void)
|
||||
{
|
||||
|
@ -412,14 +428,12 @@ 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);
|
||||
|
||||
|
@ -428,7 +442,7 @@ iscissors_button_press (Tool *tool,
|
|||
|
||||
/* 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,7 +450,7 @@ iscissors_button_press (Tool *tool,
|
|||
}
|
||||
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp_ptr = gdisp_ptr;
|
||||
tool->gdisp = gdisp;
|
||||
|
||||
switch (iscissors->state)
|
||||
{
|
||||
|
@ -445,10 +459,10 @@ iscissors_button_press (Tool *tool,
|
|||
/* 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 (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,9 +548,8 @@ 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;
|
||||
|
@ -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)
|
||||
|
@ -767,12 +776,12 @@ iscissors_draw (Tool *tool)
|
|||
Iscissors *iscissors;
|
||||
ICurve *curve;
|
||||
GSList *list;
|
||||
int tx1, ty1, tx2, ty2;
|
||||
int txn, tyn;
|
||||
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;
|
||||
|
@ -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 */
|
||||
|
|
96
app/levels.c
96
app/levels.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,17 +70,25 @@ 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,
|
||||
|
@ -91,6 +99,10 @@ static void zoom_out (gint *src,
|
|||
gint scale);
|
||||
|
||||
|
||||
/* the magnify tool options */
|
||||
static MagnifyOptions *magnify_options = NULL;
|
||||
|
||||
|
||||
/* magnify tool options functions */
|
||||
|
||||
static void
|
||||
|
@ -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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -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,10 +601,9 @@ 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;
|
||||
|
@ -619,10 +612,9 @@ measure_tool_cursor_update (Tool *tool,
|
|||
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);
|
||||
}
|
||||
|
|
76
app/move.c
76
app/move.c
|
@ -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,7 +376,7 @@ 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;
|
||||
|
@ -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);
|
||||
|
|
|
@ -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,8 +660,8 @@ 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;
|
||||
|
||||
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;
|
||||
|
@ -1327,7 +1308,7 @@ nav_window_change_display (GimpContext *context, /* NOT USED */
|
|||
gchar *title_buf;
|
||||
|
||||
iwd = (NavWinData *) nav_window_auto->user_data;
|
||||
old_gdisp = (GDisplay *) iwd->gdisp_ptr;
|
||||
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);
|
||||
|
@ -1384,7 +1365,8 @@ nav_window_follow_auto (void)
|
|||
|
||||
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,17 +1382,14 @@ 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);
|
||||
|
@ -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,
|
||||
|
@ -1570,7 +1549,7 @@ nav_window_get_gdisp (void)
|
|||
|
||||
g_slist_free (list);
|
||||
|
||||
return (gdisp);
|
||||
return gdisp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1594,7 +1573,7 @@ nav_window_free (GDisplay *del_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);
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,10 +199,10 @@ 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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
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;
|
||||
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 *
|
||||
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,13 +695,13 @@ 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)
|
||||
|
@ -703,12 +723,12 @@ 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]))
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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,11 +296,11 @@ 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 *
|
||||
|
@ -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 *
|
||||
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,10 +635,10 @@ 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;
|
||||
gdouble rate = DEFAULT_CONVOLVE_RATE;
|
||||
ConvolveType type = DEFAULT_CONVOLVE_TYPE;
|
||||
ConvolveOptions *options = convolve_options;
|
||||
|
||||
|
@ -641,10 +655,10 @@ 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]))
|
||||
|
@ -678,6 +692,6 @@ convolve_non_gui (GimpDrawable *drawable,
|
|||
paint_core_cleanup ();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -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 *);
|
||||
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 *);
|
||||
void tools_free_convolve (Tool *tool);
|
||||
|
||||
|
||||
#endif /* __CONVOLVE_H__ */
|
||||
|
|
|
@ -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)
|
||||
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;
|
||||
|
@ -239,6 +263,7 @@ dodgeburn_init (PaintCore *paint_core,
|
|||
{
|
||||
/* Here we create the luts to do the painting with.*/
|
||||
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);
|
||||
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)
|
||||
|
@ -282,14 +307,14 @@ dodgeburn_make_luts (PaintCore *paint_core,
|
|||
}
|
||||
|
||||
gimp_lut_setup_exact (lut,
|
||||
lut_func, (void *)&exposure,
|
||||
lut_func, (gpointer) &exposure,
|
||||
nchannels);
|
||||
}
|
||||
|
||||
static void
|
||||
dodgeburn_modifier_key_func (Tool *tool,
|
||||
GdkEventKey *kevent,
|
||||
gpointer gdisp_ptr)
|
||||
GDisplay *gdisp)
|
||||
{
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
|
@ -342,11 +367,11 @@ 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 *
|
||||
|
@ -421,6 +446,7 @@ dodgeburn_motion (PaintCore *paint_core,
|
|||
|
||||
{
|
||||
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));
|
||||
|
@ -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,10 +521,10 @@ 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;
|
||||
gdouble exposure = DODGEBURN_DEFAULT_TYPE;
|
||||
DodgeBurnType type = DODGEBURN_DEFAULT_TYPE;
|
||||
DodgeBurnMode mode = DODGEBURN_DEFAULT_MODE;
|
||||
DodgeBurnOptions *options = dodgeburn_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,9 +596,9 @@ dodgeburn_non_gui (GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
static gfloat
|
||||
dodgeburn_highlights_lut_func (void *user_data,
|
||||
int nchannels,
|
||||
int channel,
|
||||
dodgeburn_highlights_lut_func (gpointer user_data,
|
||||
gint nchannels,
|
||||
gint channel,
|
||||
gfloat value)
|
||||
{
|
||||
gfloat *exposure_ptr = (gfloat *) user_data;
|
||||
|
@ -586,9 +613,9 @@ dodgeburn_highlights_lut_func (void *user_data,
|
|||
}
|
||||
|
||||
static gfloat
|
||||
dodgeburn_midtones_lut_func (void *user_data,
|
||||
int nchannels,
|
||||
int channel,
|
||||
dodgeburn_midtones_lut_func (gpointer user_data,
|
||||
gint nchannels,
|
||||
gint channel,
|
||||
gfloat value)
|
||||
{
|
||||
gfloat *exposure_ptr = (gfloat *) user_data;
|
||||
|
@ -603,13 +630,14 @@ 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,
|
||||
dodgeburn_shadows_lut_func (gpointer user_data,
|
||||
gint nchannels,
|
||||
gint channel,
|
||||
gfloat value)
|
||||
{
|
||||
gfloat *exposure_ptr = (gfloat *) user_data;
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 *);
|
||||
void tools_free_eraser (Tool *tool);
|
||||
|
||||
|
||||
#endif /* __ERASER_H__ */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -130,45 +136,42 @@ struct _InkOptions
|
|||
};
|
||||
|
||||
|
||||
/* the ink tool options */
|
||||
static InkOptions * ink_options = NULL;
|
||||
|
||||
/* local variables */
|
||||
|
||||
/* undo blocks variables */
|
||||
static TileManager * undo_tiles = NULL;
|
||||
|
||||
/* Tiles used to render the stroke at 1 byte/pp */
|
||||
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 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 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 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 dist_smoother_init (InkTool *ink_tool,
|
||||
gdouble initval);
|
||||
|
||||
static void ink_init (InkTool *ink_tool,
|
||||
GimpDrawable *drawable,
|
||||
double x,
|
||||
double y);
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
static void ink_finish (InkTool *ink_tool,
|
||||
GimpDrawable *drawable,
|
||||
int tool_id);
|
||||
gint tool_id);
|
||||
static void ink_cleanup (void);
|
||||
|
||||
static void ink_type_update (GtkWidget *radio_button,
|
||||
|
@ -193,34 +196,51 @@ static void ink_to_canvas_tiles (InkTool *ink_tool,
|
|||
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);
|
||||
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 *w,
|
||||
GtkWidget *widget,
|
||||
GdkRectangle *rect);
|
||||
static void brush_widget_realize (GtkWidget *w);
|
||||
static void brush_widget_expose (GtkWidget *w,
|
||||
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 *w,
|
||||
static void brush_widget_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
BrushWidget *brush_widget);
|
||||
static void brush_widget_button_release (GtkWidget *w,
|
||||
static void brush_widget_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
BrushWidget *brush_widget);
|
||||
static void brush_widget_motion_notify (GtkWidget *w,
|
||||
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;
|
||||
|
||||
/* Tiles used to render the stroke at 1 byte/pp */
|
||||
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;
|
||||
|
||||
|
||||
/* functions */
|
||||
|
||||
static void
|
||||
|
@ -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 */
|
||||
|
@ -817,7 +835,7 @@ ink_button_press (Tool *tool,
|
|||
ink_init (ink_tool, drawable, x, y);
|
||||
|
||||
tool->state = ACTIVE;
|
||||
tool->gdisp_ptr = gdisp_ptr;
|
||||
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,13 +874,11 @@ 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;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
gimage = gdisp->gimage;
|
||||
ink_tool = (InkTool *) tool->private;
|
||||
|
||||
|
@ -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;
|
||||
GimpDrawable *drawable;
|
||||
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;
|
||||
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)
|
||||
|
@ -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;
|
||||
|
@ -1379,8 +1399,8 @@ ink_paste (InkTool *ink_tool,
|
|||
{
|
||||
GImage *gimage;
|
||||
PixelRegion srcPR;
|
||||
int offx, offy;
|
||||
unsigned char col[MAX_CHANNELS];
|
||||
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)))
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
Tool * tools_new_ink (void);
|
||||
void tools_free_ink (Tool *tool);
|
||||
|
||||
|
||||
/* Procedure definition and marshalling function */
|
||||
extern ProcRecord ink_proc;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -63,20 +63,19 @@ struct _SmudgeOptions
|
|||
GtkObject *rate_w;
|
||||
};
|
||||
|
||||
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 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,
|
||||
|
@ -88,6 +87,17 @@ static void smudge_allocate_accum_buffer (gint w,
|
|||
gint bytes,
|
||||
guchar *do_fill);
|
||||
|
||||
|
||||
/* local variables */
|
||||
static PixelRegion accumPR;
|
||||
static guchar *accum_data;
|
||||
|
||||
/* the smudge tool options */
|
||||
static SmudgeOptions * smudge_options = NULL;
|
||||
|
||||
static gdouble non_gui_rate;
|
||||
|
||||
|
||||
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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
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;
|
||||
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 *
|
||||
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,13 +695,13 @@ 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)
|
||||
|
@ -703,12 +723,12 @@ 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]))
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -198,16 +198,14 @@ paint_core_sample_color (GimpDrawable *drawable,
|
|||
void
|
||||
paint_core_button_press (Tool *tool,
|
||||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
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 */
|
||||
|
@ -382,13 +380,11 @@ 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;
|
||||
paint_core = (PaintCore *) tool->private;
|
||||
|
||||
|
@ -417,12 +413,10 @@ paint_core_button_release (Tool *tool,
|
|||
void
|
||||
paint_core_motion (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
gpointer gdisp_ptr)
|
||||
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,
|
||||
|
@ -472,9 +466,8 @@ paint_core_motion (Tool *tool,
|
|||
void
|
||||
paint_core_cursor_update (Tool *tool,
|
||||
GdkEventMotion *mevent,
|
||||
gpointer gdisp_ptr)
|
||||
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,7 +495,7 @@ 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;
|
||||
|
||||
|
@ -642,13 +633,11 @@ paint_core_cursor_update (Tool *tool,
|
|||
void
|
||||
paint_core_control (Tool *tool,
|
||||
ToolAction action,
|
||||
gpointer gdisp_ptr)
|
||||
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);
|
||||
|
||||
|
@ -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; */
|
||||
|
@ -911,7 +899,7 @@ 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;
|
||||
|
@ -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,
|
||||
|
@ -1280,11 +1270,11 @@ paint_core_subsample_mask (MaskBuf *mask,
|
|||
|
||||
x += (x < 0) ? mask->width : 0;
|
||||
left = x - floor (x);
|
||||
index1 = (int) (left * (gdouble)(SUBSAMPLE + 1));
|
||||
index1 = (gint) (left * (gdouble) (SUBSAMPLE + 1));
|
||||
|
||||
y += (y < 0) ? mask->height : 0;
|
||||
left = y - floor (y);
|
||||
index2 = (int) (left * (gdouble)(SUBSAMPLE + 1));
|
||||
index2 = (gint) (left * (gdouble) (SUBSAMPLE + 1));
|
||||
|
||||
kernel = subsample[index2][index1];
|
||||
|
||||
|
@ -1418,7 +1408,8 @@ paint_core_pressurize_mask (MaskBuf *brush_mask,
|
|||
|
||||
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
|
||||
|
@ -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 */
|
||||
else
|
||||
{
|
||||
brush_to_canvas_buf (paint_core, brush_mask, brush_opacity);
|
||||
}
|
||||
|
||||
/* intialize canvas buf source pixel regions */
|
||||
srcPR.bytes = canvas_buf->bytes;
|
||||
|
|
110
app/paint_core.h
110
app/paint_core.h
|
@ -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 */
|
||||
|
||||
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 */
|
||||
|
||||
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);
|
||||
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__ */
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
/* the paintbrush structures */
|
||||
|
||||
typedef struct _PaintbrushOptions PaintbrushOptions;
|
||||
|
||||
struct _PaintbrushOptions
|
||||
{
|
||||
PaintOptions paint_options;
|
||||
|
@ -115,6 +116,9 @@ static void paintbrush_motion (PaintCore *,
|
|||
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);
|
||||
|
||||
|
@ -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;
|
||||
gdouble fade_out;
|
||||
gdouble gradient_length;
|
||||
gdouble unit_factor;
|
||||
|
||||
if (! (gimage = drawable_gimage (drawable)))
|
||||
return NULL;
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#define __PAINTBRUSH_H__
|
||||
|
||||
|
||||
void * paintbrush_paint_func (PaintCore *,
|
||||
GimpDrawable *,
|
||||
gint );
|
||||
gboolean paintbrush_non_gui (GimpDrawable *,
|
||||
gint ,
|
||||
gdouble *,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
24
app/pencil.c
24
app/pencil.c
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
@ -174,13 +179,11 @@ perspective_info_update (Tool *tool)
|
|||
|
||||
static void
|
||||
perspective_tool_motion (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
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;
|
||||
|
@ -211,15 +214,13 @@ perspective_tool_motion (Tool *tool,
|
|||
|
||||
static void
|
||||
perspective_tool_recalc (Tool *tool,
|
||||
void *gdisp_ptr)
|
||||
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
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#define __PERSPECTIVE_TOOL_H__
|
||||
|
||||
|
||||
TileManager * perspective_tool_transform (Tool *tool,
|
||||
gpointer gdisp_ptr,
|
||||
TransformState state);
|
||||
TileManager * perspective_tool_perspective (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
GDisplay *gdisp,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue