Commit f16e01a2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

cleaned up a bit.

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

	* app/apptypes.h: cleaned up a bit.

	* app/asupsample.[ch]
	* app/blend.[ch]
	* app/channel.h
	* app/gimpprogress.[ch]
	* app/layer.h
	* app/perspective_tool.c
	* app/plug_in.h
	* app/rotate_tool.c
	* app/scale_tool.c
	* app/shear_tool.c
	* app/transform_core.[ch]: s/gimp_progress/GimpProgress/g and some
	changes related to the apptypes.h cleanup.
parent 2db88815
2000-12-31 Michael Natterer <mitch@gimp.org>
* app/apptypes.h: cleaned up a bit.
* app/asupsample.[ch]
* app/blend.[ch]
* app/channel.h
* app/gimpprogress.[ch]
* app/layer.h
* app/perspective_tool.c
* app/plug_in.h
* app/rotate_tool.c
* app/scale_tool.c
* app/shear_tool.c
* app/transform_core.[ch]: s/gimp_progress/GimpProgress/g and some
changes related to the apptypes.h cleanup.
2000-12-31 Michael Natterer <mitch@gimp.org>
* app/airbrush.[ch]
......
......@@ -337,125 +337,145 @@ typedef enum /*< skip >*/
} CursorModifier;
typedef struct _GimpContext GimpContext;
typedef struct _GimpContextPreview GimpContextPreview;
/* objects */
typedef struct _GimpChannel GimpChannel;
typedef struct _GimpChannelClass GimpChannelClass;
typedef struct _GimpObject GimpObject;
typedef GimpChannel Channel; /* convenience */
typedef struct _GimpSet GimpSet;
typedef struct _GimpList GimpList;
typedef struct _GDisplay GDisplay;
typedef struct _GimpContext GimpContext;
typedef struct _GPattern GPattern;
typedef struct _GimpDrawable GimpDrawable;
typedef struct _gradient_t gradient_t;
typedef struct _GimpChannel GimpChannel;
typedef GimpChannel Channel; /* convenience */
typedef struct _PaletteEntries PaletteEntries;
typedef struct _PaletteEntry PaletteEntry;
typedef struct _GimpLayer GimpLayer;
typedef struct _GimpLayerMask GimpLayerMask;
typedef struct _GimpDrawable GimpDrawable;
typedef GimpLayer Layer; /* convenience */
typedef GimpLayerMask LayerMask; /* convenience */
typedef struct _GimpLayer GimpLayer;
typedef struct _GimpLayerClass GimpLayerClass;
typedef struct _GimpLayerMask GimpLayerMask;
typedef struct _GimpLayerMaskClass GimpLayerMaskClass;
typedef struct _GimpImage GimpImage;
typedef GimpImage GImage;
typedef GimpLayer Layer; /* convenience */
typedef GimpLayerMask LayerMask; /* convenience */
typedef struct _GimpBrush GimpBrush;
typedef struct _GimpBrushList GimpBrushList;
typedef struct _GimpBrushGenerated GimpBrushGenerated;
typedef struct _GimpBrushPipe GimpBrushPipe;
typedef struct _GimpImage GimpImage;
typedef GimpImage GImage;
typedef struct _GimpSet GimpSet;
typedef struct _GimpList GimpList;
/* widgets */
typedef struct _Guide Guide;
typedef guint32 Tattoo;
typedef struct _HistogramWidget HistogramWidget;
typedef struct _PaintCore PaintCore;
typedef struct _DrawCore DrawCore;
typedef struct _GimpBrush GimpBrush;
typedef struct _GimpBrushList GimpBrushList;
typedef struct _GimpBrushGenerated GimpBrushGenerated;
typedef struct _GimpBrushPipe GimpBrushPipe;
/* other stuff */
typedef struct _GimpObject GimpObject;
typedef struct _Argument Argument;
typedef struct _GimpHistogram GimpHistogram;
typedef struct _GimpLut GimpLut;
typedef struct _BezierPoint BezierPoint;
typedef struct _BezierSelect BezierSelect;
typedef struct _BoundSeg BoundSeg;
typedef struct _BoundSeg BoundSeg;
typedef struct _layer_undo LayerUndo;
typedef struct _DrawCore DrawCore;
typedef struct _layer_mask_undo LayerMaskUndo;
typedef struct _GDisplay GDisplay;
typedef struct _fs_to_layer_undo FStoLayerUndo;
typedef struct _GimpContextPreview GimpContextPreview;
typedef struct _Argument Argument;
typedef struct _ProcArg ProcArg;
typedef struct _ProcRecord ProcRecord;
typedef struct _GimpHistogram GimpHistogram;
typedef struct _PlugIn PlugIn;
typedef struct _PlugInDef PlugInDef;
typedef struct _PlugInProcDef PlugInProcDef;
typedef struct _GimpImageNewValues GimpImageNewValues;
typedef struct _ParasiteList ParasiteList;
typedef struct _GimpLut GimpLut;
typedef struct _Tile Tile;
typedef struct _TileManager TileManager;
typedef struct _GimpParasite GimpParasite;
typedef void (* TileValidateProc) (TileManager *tm,
Tile *tile);
typedef struct _GimpProgress GimpProgress;
typedef struct _PixelRegionIterator PixelRegionIterator;
typedef struct _PixelRegion PixelRegion;
typedef struct _PixelRegionHolder PixelRegionHolder;
typedef struct _GPattern GPattern;
typedef struct _GimpParasite GimpParasite;
typedef struct _gradient_t gradient_t;
typedef struct _Guide Guide;
typedef gpointer ImageMap;
typedef struct _InfoDialog InfoDialog;
typedef struct _PaintCore PaintCore;
typedef struct _PaletteEntries PaletteEntries;
typedef struct _PaletteEntry PaletteEntry;
typedef struct _Path Path;
typedef struct _PathPoint PathPoint;
typedef struct _PathList PathList;
typedef GSList PathUndo;
typedef struct _PlugIn PlugIn;
typedef struct _PlugInDef PlugInDef;
typedef struct _PlugInProcDef PlugInProcDef;
typedef struct _ParasiteList ParasiteList;
typedef struct _PixelRegionIterator PixelRegionIterator;
typedef struct _PixelRegion PixelRegion;
typedef struct _PixelRegionHolder PixelRegionHolder;
typedef struct _ProcArg ProcArg;
typedef struct _ProcRecord ProcRecord;
typedef guint32 Tattoo;
typedef struct _TempBuf TempBuf;
typedef struct _TempBuf MaskBuf;
typedef struct _Tile Tile;
typedef struct _TileManager TileManager;
typedef struct _Tool Tool;
typedef struct _ToolInfo ToolInfo;
typedef struct _ToolOptions ToolOptions;
typedef struct _ScanConvertPoint ScanConvertPoint;
typedef struct _Selection Selection;
typedef struct _SelectionOptions SelectionOptions;
typedef void (* ToolOptionsResetFunc) (void);
typedef struct _TransformCore TransformCore;
typedef struct _BezierPoint BezierPoint;
typedef struct _BezierSelect BezierSelect;
typedef struct gimp_progress_pvt gimp_progress;
typedef void (* progress_func_t) (gint ymin,
gint ymax,
gint curr_y,
gpointer progress_data);
/* some undo stuff */
typedef gpointer ImageMap;
typedef void (* ImageMapApplyFunc) (PixelRegion *,
PixelRegion *,
gpointer);
typedef struct _layer_undo LayerUndo;
typedef struct _TransformCore TransformCore;
typedef struct _layer_mask_undo LayerMaskUndo;
typedef struct _ScanConvertPoint ScanConvertPoint;
typedef struct _fs_to_layer_undo FStoLayerUndo;
typedef struct _InfoDialog InfoDialog;
typedef GSList PathUndo;
typedef struct _Selection Selection;
typedef struct _HistogramWidget HistogramWidget;
/* functions */
typedef struct _GimpImageNewValues GimpImageNewValues;
typedef void (* TileValidateProc) (TileManager *tm,
Tile *tile);
typedef void (* ToolOptionsResetFunc) (void);
typedef void (* GimpProgressFunc) (gint ymin,
gint ymax,
gint curr_y,
gpointer progress_data);
typedef void (* ImageMapApplyFunc) (PixelRegion *,
PixelRegion *,
gpointer);
#endif /* __APPTYPES_H__ */
......@@ -84,7 +84,7 @@ adaptive_supersample_area (gint x1,
gpointer render_data,
put_pixel_func_t put_pixel_func,
gpointer put_pixel_data,
progress_func_t progress_func,
GimpProgressFunc progress_func,
gpointer progress_data)
{
int x, y, width; /* Counters, width of region */
......@@ -225,7 +225,7 @@ adaptive_supersample_area (gint x1,
/* Call progress display function */
if (progress_func && !(y & 0xf))
(*progress_func)(y1, y2, y, progress_data);
(* progress_func) (y1, y2, y, progress_data);
}
/* Free memory */
......
......@@ -49,7 +49,7 @@ gulong adaptive_supersample_area (gint x1,
gpointer render_data,
put_pixel_func_t put_pixel_func,
gpointer put_pixel_data,
progress_func_t progress_func,
GimpProgressFunc progress_func,
gpointer progress_data);
......
......@@ -162,66 +162,110 @@ static guint blend_n_targets = (sizeof (blend_target_table) /
/* local function prototypes */
static void gradient_type_callback (GtkWidget *widget,
gpointer data);
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);
static double gradient_calc_conical_sym_factor (double dist, double *axis, double offset,
double x, double y);
static double gradient_calc_conical_asym_factor (double dist, double *axis, double offset,
double x, double y);
static double gradient_calc_square_factor (double dist, double offset,
double x, double y);
static double gradient_calc_radial_factor (double dist, double offset,
double x, double y);
static double gradient_calc_linear_factor (double dist, double *vec, double offset,
double x, double y);
static double gradient_calc_bilinear_factor (double dist, double *vec, double offset,
double x, double y);
static double gradient_calc_spiral_factor (double dist, double *axis, double offset,
double x, double y, gint cwise);
static double gradient_calc_shapeburst_angular_factor (double x, double y);
static double gradient_calc_shapeburst_spherical_factor (double x, double y);
static double gradient_calc_shapeburst_dimpled_factor (double x, double y);
static double gradient_repeat_none (double val);
static double gradient_repeat_sawtooth (double val);
static double gradient_repeat_triangular (double val);
static void gradient_precalc_shapeburst (GImage *gimage, GimpDrawable *drawable,
PixelRegion *PR, double dist);
static void gradient_render_pixel (double x, double y,
color_t *color, void *render_data);
static void gradient_put_pixel (int x, int y,
color_t color, void *put_pixel_data);
static void gradient_fill_region (GImage *gimage, GimpDrawable *drawable, PixelRegion *PR,
int width, int height,
BlendMode blend_mode, GradientType gradient_type,
double offset, RepeatMode repeat,
int supersample, int max_depth, double threshold,
double sx, double sy, double ex, double ey,
progress_func_t progress_callback,
void *progress_data);
static void gradient_type_callback (GtkWidget *widget,
gpointer data);
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 );
static gdouble gradient_calc_conical_sym_factor (gdouble dist,
gdouble *axis,
gdouble offset,
gdouble x,
gdouble y);
static gdouble gradient_calc_conical_asym_factor (gdouble dist,
gdouble *axis,
gdouble offset,
gdouble x,
gdouble y);
static gdouble gradient_calc_square_factor (gdouble dist,
gdouble offset,
gdouble x,
gdouble y);
static gdouble gradient_calc_radial_factor (gdouble dist,
gdouble offset,
gdouble x,
gdouble y);
static gdouble gradient_calc_linear_factor (gdouble dist,
gdouble *vec,
gdouble offset,
gdouble x,
gdouble y);
static gdouble gradient_calc_bilinear_factor (gdouble dist,
gdouble *vec,
gdouble offset,
gdouble x,
gdouble y);
static gdouble gradient_calc_spiral_factor (gdouble dist,
gdouble *axis,
gdouble offset,
gdouble x,
gdouble y,
gint cwise);
static gdouble gradient_calc_shapeburst_angular_factor (gdouble x,
gdouble y);
static gdouble gradient_calc_shapeburst_spherical_factor (gdouble x,
gdouble y);
static gdouble gradient_calc_shapeburst_dimpled_factor (gdouble x,
gdouble y);
static gdouble gradient_repeat_none (gdouble val);
static gdouble gradient_repeat_sawtooth (gdouble val);
static gdouble gradient_repeat_triangular (gdouble val);
static void gradient_precalc_shapeburst (GImage *gimage,
GimpDrawable *drawable,
PixelRegion *PR,
gdouble dist);
static void gradient_render_pixel (gdouble x,
gdouble y,
color_t *color,
gpointer render_data);
static void gradient_put_pixel (gint x,
gint y,
color_t color,
gpointer put_pixel_data);
static void gradient_fill_region (GImage *gimage,
GimpDrawable *drawable,
PixelRegion *PR,
gint width,
gint height,
BlendMode blend_mode,
GradientType gradient_type,
gdouble offset,
RepeatMode repeat,
gint supersample,
gint max_depth,
gdouble threshold,
gdouble sx,
gdouble sy,
gdouble ex,
gdouble ey,
GimpProgressFunc progress_callback,
gpointer progress_data);
/* functions */
......@@ -462,22 +506,27 @@ blend_button_press (Tool *tool,
/* Keep the coordinates of the target */
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
&blend_tool->startx, &blend_tool->starty, FALSE, 1);
&blend_tool->startx, &blend_tool->starty,
FALSE, TRUE);
blend_tool->endx = blend_tool->startx;
blend_tool->endy = blend_tool->starty;
/* Make the tool active and set the gdisplay which owns it */
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
tool->gdisp = gdisp;
tool->state = ACTIVE;
/* initialize the statusbar display */
blend_tool->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "blend");
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, _("Blend: 0, 0"));
blend_tool->context_id =
gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "blend");
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar),
blend_tool->context_id, _("Blend: 0, 0"));
/* Start drawing the blend tool */
draw_core_start (blend_tool->core, gdisp->canvas->window, tool);
......@@ -494,7 +543,7 @@ blend_button_release (Tool *tool,
Argument *return_vals;
int nreturn_vals;
#else
gimp_progress *progress;
GimpProgress *progress;
#endif
gimage = gdisp->gimage;
......@@ -561,7 +610,7 @@ blend_button_release (Tool *tool,
blend_tool->starty,
blend_tool->endx,
blend_tool->endy,
progress ? progress_update_and_flush : (progress_func_t)NULL,
progress ? progress_update_and_flush : (GimpProgressFunc) NULL,
progress);
if (progress)
......@@ -756,30 +805,30 @@ blend_options_drop_tool (GtkWidget *widget,
/* The actual blending procedure */
void
blend (GImage *gimage,
GimpDrawable *drawable,
BlendMode blend_mode,
int paint_mode,
GradientType gradient_type,
double opacity,
double offset,
RepeatMode repeat,
int supersample,
int max_depth,
double threshold,
double startx,
double starty,
double endx,
double endy,
progress_func_t progress_callback,
void *progress_data)
blend (GImage *gimage,
GimpDrawable *drawable,
BlendMode blend_mode,
int paint_mode,
GradientType gradient_type,
double opacity,
double offset,
RepeatMode repeat,
int supersample,
int max_depth,
double threshold,
double startx,
double starty,
double endx,
double endy,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
TileManager *buf_tiles;
PixelRegion bufPR;
int has_alpha;
int has_selection;
int bytes;
int x1, y1, x2, y2;
PixelRegion bufPR;
gint has_alpha;
gint has_selection;
gint bytes;
gint x1, y1, x2, y2;
gimp_add_busy_cursors();
......@@ -1382,32 +1431,32 @@ gradient_put_pixel (int x,
}
static void
gradient_fill_region (GImage *gimage,
GimpDrawable *drawable,
PixelRegion *PR,
int width,
int height,
BlendMode blend_mode,
GradientType gradient_type,
double offset,
RepeatMode repeat,
int supersample,
int max_depth,
double threshold,
double sx,
double sy,
double ex,
double ey,
progress_func_t progress_callback,
void *progress_data)
gradient_fill_region (GImage *gimage,
GimpDrawable *drawable,
PixelRegion *PR,
int width,
int height,
BlendMode blend_mode,
GradientType gradient_type,
double offset,
RepeatMode repeat,
int supersample,
int max_depth,
double threshold,
double sx,
double sy,
double ex,
double ey,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
RenderBlendData rbd;
PutPixelData ppd;
unsigned char r, g, b;
int x, y;
int endx, endy;
void *pr;
unsigned char *data;
guchar r, g, b;
gint x, y;
gint endx, endy;
gpointer *pr;
guchar *data;
color_t color;
/* Get foreground and background colors, normalized */
......
......@@ -53,26 +53,26 @@ typedef enum
REPEAT_LAST /*< skip >*/
} RepeatMode;
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);
void blend (GimpImage *gimage,