1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1999-09-02 09:41:18 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "asupsample.h"
|
|
|
|
#include "blend.h"
|
1999-01-11 07:36:29 +08:00
|
|
|
#include "cursorutil.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "draw_core.h"
|
|
|
|
#include "drawable.h"
|
|
|
|
#include "errors.h"
|
|
|
|
#include "fuzzy_select.h"
|
|
|
|
#include "gdisplay.h"
|
|
|
|
#include "gimage_mask.h"
|
1999-10-27 02:27:27 +08:00
|
|
|
#include "gimpui.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "gradient.h"
|
|
|
|
#include "interface.h"
|
1999-04-22 22:34:00 +08:00
|
|
|
#include "paint_options.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "selection.h"
|
|
|
|
#include "tools.h"
|
|
|
|
#include "undo.h"
|
|
|
|
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
#include "tile.h"
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#include "libgimp/gimpmath.h"
|
2000-01-03 06:30:20 +08:00
|
|
|
#include "libgimp/gimpcolorspace.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
|
1998-07-08 14:41:58 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* target size */
|
2000-01-14 20:41:00 +08:00
|
|
|
#define TARGET_HEIGHT 15
|
|
|
|
#define TARGET_WIDTH 15
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-06-22 06:12:07 +08:00
|
|
|
#define STATUSBAR_SIZE 128
|
1998-07-27 05:49:42 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* the blend structures */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
typedef gdouble (* RepeatFunc) (gdouble);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
typedef struct _BlendTool BlendTool;
|
2000-01-14 20:41:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _BlendTool
|
|
|
|
{
|
2000-01-14 20:41:00 +08:00
|
|
|
DrawCore *core; /* Core select object */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
gint startx; /* starting x coord */
|
|
|
|
gint starty; /* starting y coord */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
gint endx; /* ending x coord */
|
|
|
|
gint endy; /* ending y coord */
|
|
|
|
guint context_id; /* for the statusbar */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _BlendOptions BlendOptions;
|
2000-01-14 20:41:00 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _BlendOptions
|
|
|
|
{
|
1999-04-22 22:34:00 +08:00
|
|
|
PaintOptions paint_options;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
gdouble offset;
|
|
|
|
gdouble offset_d;
|
1999-04-09 06:25:54 +08:00
|
|
|
GtkObject *offset_w;
|
|
|
|
|
|
|
|
BlendMode blend_mode;
|
|
|
|
BlendMode blend_mode_d;
|
|
|
|
GtkWidget *blend_mode_w;
|
|
|
|
|
|
|
|
GradientType gradient_type;
|
|
|
|
GradientType gradient_type_d;
|
|
|
|
GtkWidget *gradient_type_w;
|
|
|
|
|
|
|
|
RepeatMode repeat;
|
|
|
|
RepeatMode repeat_d;
|
|
|
|
GtkWidget *repeat_w;
|
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
gint supersample;
|
|
|
|
gint supersample_d;
|
1999-04-09 06:25:54 +08:00
|
|
|
GtkWidget *supersample_w;
|
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
gint max_depth;
|
|
|
|
gint max_depth_d;
|
1999-04-09 06:25:54 +08:00
|
|
|
GtkObject *max_depth_w;
|
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
gdouble threshold;
|
|
|
|
gdouble threshold_d;
|
1999-04-09 06:25:54 +08:00
|
|
|
GtkObject *threshold_w;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
1999-06-22 06:12:07 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2000-01-14 20:41:00 +08:00
|
|
|
gdouble offset;
|
|
|
|
gdouble sx, sy;
|
1997-11-25 06:05:25 +08:00
|
|
|
BlendMode blend_mode;
|
|
|
|
GradientType gradient_type;
|
|
|
|
color_t fg, bg;
|
2000-01-14 20:41:00 +08:00
|
|
|
gdouble dist;
|
|
|
|
gdouble vec[2];
|
1997-11-25 06:05:25 +08:00
|
|
|
RepeatFunc repeat_func;
|
|
|
|
} RenderBlendData;
|
|
|
|
|
1999-06-22 06:12:07 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2000-01-14 20:41:00 +08:00
|
|
|
PixelRegion *PR;
|
|
|
|
guchar *row_data;
|
|
|
|
gint bytes;
|
|
|
|
gint width;
|
1997-11-25 06:05:25 +08:00
|
|
|
} PutPixelData;
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
/* the blend tool options */
|
1999-04-09 06:25:54 +08:00
|
|
|
static BlendOptions *blend_options = NULL;
|
|
|
|
|
|
|
|
/* variables for the shapeburst algs */
|
|
|
|
static PixelRegion distR =
|
|
|
|
{
|
|
|
|
NULL, /* data */
|
|
|
|
NULL, /* tiles */
|
|
|
|
0, /* rowstride */
|
|
|
|
0, 0, /* w, h */
|
|
|
|
0, 0, /* x, y */
|
|
|
|
4, /* bytes */
|
|
|
|
0 /* process count */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* local function prototypes */
|
1999-06-22 06:12:07 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void gradient_type_callback (GtkWidget *, gpointer);
|
|
|
|
static void blend_mode_callback (GtkWidget *, gpointer);
|
|
|
|
static void repeat_type_callback (GtkWidget *, gpointer);
|
|
|
|
|
1999-06-22 06:12:07 +08:00
|
|
|
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);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
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);
|
1999-09-26 03:49:58 +08:00
|
|
|
static double gradient_calc_linear_factor (double dist, double *vec, double offset,
|
1997-11-25 06:05:25 +08:00
|
|
|
double x, double y);
|
|
|
|
static double gradient_calc_bilinear_factor (double dist, double *vec, double offset,
|
|
|
|
double x, double y);
|
1999-01-05 07:56:37 +08:00
|
|
|
static double gradient_calc_spiral_factor (double dist, double *axis, double offset,
|
1999-09-26 03:49:58 +08:00
|
|
|
double x, double y, gint cwise);
|
1997-11-25 06:05:25 +08:00
|
|
|
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);
|
|
|
|
|
1999-09-26 03:49:58 +08:00
|
|
|
static double gradient_repeat_none (double val);
|
|
|
|
static double gradient_repeat_sawtooth (double val);
|
|
|
|
static double gradient_repeat_triangular (double val);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-26 03:49:58 +08:00
|
|
|
static void gradient_precalc_shapeburst (GImage *gimage, GimpDrawable *drawable,
|
|
|
|
PixelRegion *PR, double dist);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-09-26 03:49:58 +08:00
|
|
|
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);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
static void gradient_fill_region (GImage *gimage, GimpDrawable *drawable, PixelRegion *PR,
|
1997-11-25 06:05:25 +08:00
|
|
|
int width, int height,
|
|
|
|
BlendMode blend_mode, GradientType gradient_type,
|
|
|
|
double offset, RepeatMode repeat,
|
|
|
|
int supersample, int max_depth, double threshold,
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
double sx, double sy, double ex, double ey,
|
|
|
|
progress_func_t progress_callback,
|
|
|
|
void *progress_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
blend_mode_callback (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
gpointer client_data)
|
|
|
|
{
|
|
|
|
blend_options->blend_mode = (BlendMode) client_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gradient_type_callback (GtkWidget *widget,
|
1999-04-13 01:55:06 +08:00
|
|
|
gpointer client_data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-04-13 01:55:06 +08:00
|
|
|
blend_options->gradient_type = (GradientType) client_data;
|
|
|
|
gtk_widget_set_sensitive (blend_options->repeat_w,
|
|
|
|
(blend_options->gradient_type < 6));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-07-07 02:13:59 +08:00
|
|
|
repeat_type_callback (GtkWidget *widget,
|
|
|
|
gpointer client_data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
blend_options->repeat = (RepeatMode) client_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-04-13 01:55:06 +08:00
|
|
|
blend_options_reset ()
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
|
|
|
BlendOptions *options = blend_options;
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
paint_options_reset ((PaintOptions *) options);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
options->blend_mode = options->blend_mode_d;
|
|
|
|
options->gradient_type = options->gradient_type_d;
|
|
|
|
options->repeat = options->repeat_d;
|
|
|
|
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (blend_options->blend_mode_w), 0);
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (options->gradient_type_w), 0);
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (blend_options->repeat_w), 0);
|
|
|
|
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (blend_options->offset_w),
|
|
|
|
blend_options->offset_d);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (blend_options->supersample_w),
|
|
|
|
blend_options->supersample_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (blend_options->max_depth_w),
|
|
|
|
blend_options->max_depth_d);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (blend_options->threshold_w),
|
|
|
|
blend_options->threshold_d);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static BlendOptions *
|
1999-04-13 01:55:06 +08:00
|
|
|
blend_options_new ()
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
BlendOptions *options;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *vbox;
|
1999-04-13 01:55:06 +08:00
|
|
|
GtkWidget *menu;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *table;
|
1999-04-09 06:25:54 +08:00
|
|
|
GtkWidget *scale;
|
1999-04-13 01:55:06 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
|
|
|
|
static MenuItem blend_option_items[] =
|
|
|
|
{
|
1999-04-21 03:23:38 +08:00
|
|
|
{ N_("FG to BG (RGB)"), 0, 0, blend_mode_callback,
|
1999-04-13 01:55:06 +08:00
|
|
|
(gpointer) FG_BG_RGB_MODE, NULL, NULL },
|
1999-04-21 03:23:38 +08:00
|
|
|
{ N_("FG to BG (HSV)"), 0, 0, blend_mode_callback,
|
1999-04-13 01:55:06 +08:00
|
|
|
(gpointer) FG_BG_HSV_MODE, NULL, NULL },
|
|
|
|
{ N_("FG to Transparent"), 0, 0, blend_mode_callback,
|
|
|
|
(gpointer) FG_TRANS_MODE, NULL, NULL },
|
1999-12-14 22:10:34 +08:00
|
|
|
{ N_("Custom from Editor"), 0, 0, blend_mode_callback,
|
1999-04-13 01:55:06 +08:00
|
|
|
(gpointer) CUSTOM_MODE, NULL, NULL },
|
|
|
|
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
static MenuItem gradient_option_items[] =
|
|
|
|
{
|
|
|
|
{ N_("Linear"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) LINEAR, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Bi-Linear"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) BILINEAR, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Radial"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) RADIAL, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Square"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) SQUARE, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Conical (symmetric)"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) CONICAL_SYMMETRIC, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Conical (asymmetric)"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) CONICAL_ASYMMETRIC, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Shapeburst (angular)"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) SHAPEBURST_ANGULAR, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Shapeburst (spherical)"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) SHAPEBURST_SPHERICAL, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Shapeburst (dimpled)"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) SHAPEBURST_DIMPLED, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Spiral (clockwise)"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) SPIRAL_CLOCKWISE, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ N_("Spiral (anticlockwise)"), 0, 0, gradient_type_callback,
|
1999-04-19 05:22:41 +08:00
|
|
|
(gpointer) SPIRAL_ANTICLOCKWISE, NULL, NULL },
|
1999-04-13 01:55:06 +08:00
|
|
|
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
static MenuItem repeat_option_items[] =
|
|
|
|
{
|
|
|
|
{ N_("None"), 0, 0, repeat_type_callback,
|
|
|
|
(gpointer) REPEAT_NONE, NULL, NULL },
|
1999-12-14 22:10:34 +08:00
|
|
|
{ N_("Sawtooth Wave"), 0, 0, repeat_type_callback,
|
1999-04-13 01:55:06 +08:00
|
|
|
(gpointer) REPEAT_SAWTOOTH, NULL, NULL },
|
1999-12-14 22:10:34 +08:00
|
|
|
{ N_("Triangular Wave"), 0, 0, repeat_type_callback,
|
1999-04-13 01:55:06 +08:00
|
|
|
(gpointer) REPEAT_TRIANGULAR, NULL, NULL },
|
|
|
|
{ NULL, 0, 0, NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* the new blend tool options structure */
|
2000-01-14 20:41:00 +08:00
|
|
|
options = g_new (BlendOptions, 1);
|
1999-04-22 22:34:00 +08:00
|
|
|
paint_options_init ((PaintOptions *) options,
|
|
|
|
BLEND,
|
|
|
|
blend_options_reset);
|
1999-04-09 06:25:54 +08:00
|
|
|
options->offset = options->offset_d = 0.0;
|
|
|
|
options->blend_mode = options->blend_mode_d = FG_BG_RGB_MODE;
|
1999-04-19 05:22:41 +08:00
|
|
|
options->gradient_type = options->gradient_type_d = LINEAR;
|
1999-04-09 06:25:54 +08:00
|
|
|
options->repeat = options->repeat_d = REPEAT_NONE;
|
|
|
|
options->supersample = options->supersample_d = FALSE;
|
|
|
|
options->max_depth = options->max_depth_d = 3;
|
|
|
|
options->threshold = options->threshold_d = 0.2;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* the main vbox */
|
1999-04-22 22:34:00 +08:00
|
|
|
vbox = ((ToolOptions *) options)->main_vbox;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* the offset scale */
|
1999-04-13 01:55:06 +08:00
|
|
|
table = gtk_table_new (4, 2, FALSE);
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
options->offset_w =
|
|
|
|
gtk_adjustment_new (options->offset_d, 0.0, 100.0, 1.0, 1.0, 0.0);
|
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->offset_w));
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0,
|
|
|
|
_("Offset:"), 1.0, 1.0,
|
|
|
|
scale, FALSE);
|
1999-11-26 18:17:19 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (options->offset_w), "value_changed",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
1999-11-26 18:17:19 +08:00
|
|
|
&options->offset);
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* the blend mode menu */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->blend_mode_w = gtk_option_menu_new ();
|
1999-04-13 01:55:06 +08:00
|
|
|
menu = build_menu (blend_option_items, NULL);
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->blend_mode_w), menu);
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 1,
|
|
|
|
_("Blend:"), 1.0, 0.5,
|
|
|
|
options->blend_mode_w, TRUE);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* the gradient type menu */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->gradient_type_w = gtk_option_menu_new ();
|
1999-04-13 01:55:06 +08:00
|
|
|
menu = build_menu (gradient_option_items, NULL);
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->gradient_type_w), menu);
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 2,
|
1999-11-26 18:17:19 +08:00
|
|
|
_("Gradient:"), 1.0, 0.5,
|
1999-10-27 02:27:27 +08:00
|
|
|
options->gradient_type_w, TRUE);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
/* the repeat option */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->repeat_w = gtk_option_menu_new ();
|
1999-04-13 01:55:06 +08:00
|
|
|
menu = build_menu (repeat_option_items, NULL);
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (options->repeat_w), menu);
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 3,
|
|
|
|
_("Repeat:"), 1.0, 0.5,
|
|
|
|
options->repeat_w, TRUE);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
|
|
|
/* show the table */
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
1999-04-21 03:23:38 +08:00
|
|
|
/* frame for supersampling options */
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
/* vbox for the supersampling stuff */
|
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* supersampling toggle */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->supersample_w =
|
1999-12-14 22:10:34 +08:00
|
|
|
gtk_check_button_new_with_label (_("Adaptive Supersampling"));
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->supersample_w),
|
|
|
|
options->supersample_d);
|
1999-04-13 01:55:06 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (options->supersample_w), "toggled",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_toggle_button_update),
|
1999-04-13 01:55:06 +08:00
|
|
|
&options->supersample);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), options->supersample_w, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (options->supersample_w);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* table for supersampling options */
|
1999-04-09 06:25:54 +08:00
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
1999-04-22 22:34:00 +08:00
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
1999-04-21 03:23:38 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* automatically set the sensitive state of the table */
|
|
|
|
gtk_widget_set_sensitive (table, options->supersample_d);
|
|
|
|
gtk_object_set_data (GTK_OBJECT (options->supersample_w), "set_sensitive",
|
|
|
|
table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* max depth scale */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->max_depth_w =
|
|
|
|
gtk_adjustment_new (options->max_depth_d, 1.0, 10.0, 1.0, 1.0, 1.0);
|
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->max_depth_w));
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 0,
|
|
|
|
_("Max Depth:"), 1.0, 1.0,
|
|
|
|
scale, FALSE);
|
1999-11-26 18:17:19 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT(options->max_depth_w), "value_changed",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_int_adjustment_update),
|
1999-11-26 18:17:19 +08:00
|
|
|
&options->max_depth);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* threshold scale */
|
1999-04-09 06:25:54 +08:00
|
|
|
options->threshold_w =
|
|
|
|
gtk_adjustment_new (options->threshold_d, 0.0, 4.0, 0.01, 0.01, 0.0);
|
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (options->threshold_w));
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (scale), 2);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_table_attach_aligned (GTK_TABLE (table), 1,
|
|
|
|
_("Threshold:"), 1.0, 1.0,
|
|
|
|
scale, FALSE);
|
1999-11-26 18:17:19 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT(options->threshold_w), "value_changed",
|
2000-01-14 20:41:00 +08:00
|
|
|
GTK_SIGNAL_FUNC (gimp_double_adjustment_update),
|
1999-11-26 18:17:19 +08:00
|
|
|
&options->threshold);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* show the table */
|
1999-04-09 06:25:54 +08:00
|
|
|
gtk_widget_show (table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
blend_button_press (Tool *tool,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer gdisp_ptr)
|
|
|
|
{
|
|
|
|
GDisplay * gdisp;
|
|
|
|
BlendTool * blend_tool;
|
|
|
|
|
|
|
|
gdisp = (GDisplay *) gdisp_ptr;
|
|
|
|
blend_tool = (BlendTool *) tool->private;
|
|
|
|
|
|
|
|
switch (drawable_type (gimage_active_drawable (gdisp->gimage)))
|
|
|
|
{
|
|
|
|
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
g_message (_("Blend: Invalid for indexed images."));
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Keep the coordinates of the target */
|
|
|
|
gdisplay_untransform_coords (gdisp, bevent->x, bevent->y,
|
|
|
|
&blend_tool->startx, &blend_tool->starty, FALSE, 1);
|
|
|
|
|
|
|
|
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,
|
|
|
|
NULL, NULL, bevent->time);
|
|
|
|
|
|
|
|
tool->gdisp_ptr = gdisp_ptr;
|
|
|
|
tool->state = ACTIVE;
|
|
|
|
|
1998-07-27 05:49:42 +08:00
|
|
|
/* initialize the statusbar display */
|
|
|
|
blend_tool->context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (gdisp->statusbar), "blend");
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, _("Blend: 0, 0"));
|
1998-07-27 05:49:42 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Start drawing the blend tool */
|
|
|
|
draw_core_start (blend_tool->core, gdisp->canvas->window, tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
blend_button_release (Tool *tool,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer gdisp_ptr)
|
|
|
|
{
|
1998-07-27 05:49:42 +08:00
|
|
|
GDisplay * gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
GImage * gimage;
|
|
|
|
BlendTool * blend_tool;
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
#ifdef BLEND_UI_CALLS_VIA_PDB
|
1997-11-25 06:05:25 +08:00
|
|
|
Argument *return_vals;
|
|
|
|
int nreturn_vals;
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
#else
|
|
|
|
gimp_progress *progress;
|
|
|
|
#endif
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-07-27 05:49:42 +08:00
|
|
|
gdisp = (GDisplay *) gdisp_ptr;
|
|
|
|
gimage = gdisp->gimage;
|
1997-11-25 06:05:25 +08:00
|
|
|
blend_tool = (BlendTool *) tool->private;
|
|
|
|
|
|
|
|
gdk_pointer_ungrab (bevent->time);
|
|
|
|
gdk_flush ();
|
1998-07-27 05:49:42 +08:00
|
|
|
|
|
|
|
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
draw_core_stop (blend_tool->core, tool);
|
|
|
|
tool->state = INACTIVE;
|
|
|
|
|
|
|
|
/* if the 3rd button isn't pressed, fill the selected region */
|
|
|
|
if (! (bevent->state & GDK_BUTTON3_MASK) &&
|
|
|
|
((blend_tool->startx != blend_tool->endx) ||
|
|
|
|
(blend_tool->starty != blend_tool->endy)))
|
|
|
|
{
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
/* we can't do callbacks easily with the PDB, so this UI/backend
|
|
|
|
* separation (though good) is ignored for the moment */
|
|
|
|
#ifdef BLEND_UI_CALLS_VIA_PDB
|
1999-07-07 02:13:59 +08:00
|
|
|
return_vals =
|
1999-07-06 23:18:25 +08:00
|
|
|
procedural_db_run_proc ("gimp_blend",
|
|
|
|
&nreturn_vals,
|
|
|
|
PDB_DRAWABLE, drawable_ID (gimage_active_drawable (gimage)),
|
|
|
|
PDB_INT32, (gint32) blend_options->blend_mode,
|
1999-07-07 02:13:59 +08:00
|
|
|
PDB_INT32, (gint32) PAINT_OPTIONS_GET_PAINT_MODE (blend_options),
|
1999-07-06 23:18:25 +08:00
|
|
|
PDB_INT32, (gint32) blend_options->gradient_type,
|
1999-07-07 02:13:59 +08:00
|
|
|
PDB_FLOAT, (gdouble) PAINT_OPTIONS_GET_OPACITY (blend_options) * 100,
|
1999-07-06 23:18:25 +08:00
|
|
|
PDB_FLOAT, (gdouble) blend_options->offset,
|
|
|
|
PDB_INT32, (gint32) blend_options->repeat,
|
|
|
|
PDB_INT32, (gint32) blend_options->supersample,
|
|
|
|
PDB_INT32, (gint32) blend_options->max_depth,
|
|
|
|
PDB_FLOAT, (gdouble) blend_options->threshold,
|
|
|
|
PDB_FLOAT, (gdouble) blend_tool->startx,
|
|
|
|
PDB_FLOAT, (gdouble) blend_tool->starty,
|
|
|
|
PDB_FLOAT, (gdouble) blend_tool->endx,
|
|
|
|
PDB_FLOAT, (gdouble) blend_tool->endy,
|
|
|
|
PDB_END);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-21 07:03:31 +08:00
|
|
|
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisplays_flush ();
|
|
|
|
else
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
g_message (_("Blend operation failed."));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
procedural_db_destroy_args (return_vals, nreturn_vals);
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
|
|
|
|
#else /* ! BLEND_UI_CALLS_VIA_PDB */
|
|
|
|
|
|
|
|
progress = progress_start (gdisp, _("Blending..."), FALSE, NULL, NULL);
|
|
|
|
|
|
|
|
blend (gimage,
|
|
|
|
gimage_active_drawable (gimage),
|
|
|
|
blend_options->blend_mode,
|
1999-07-06 23:18:25 +08:00
|
|
|
gimp_context_get_paint_mode (NULL),
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
blend_options->gradient_type,
|
1999-07-06 23:18:25 +08:00
|
|
|
gimp_context_get_opacity (NULL) * 100,
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
blend_options->offset,
|
|
|
|
blend_options->repeat,
|
|
|
|
blend_options->supersample,
|
|
|
|
blend_options->max_depth,
|
|
|
|
blend_options->threshold,
|
|
|
|
blend_tool->startx,
|
|
|
|
blend_tool->starty,
|
|
|
|
blend_tool->endx,
|
|
|
|
blend_tool->endy,
|
|
|
|
progress? progress_update_and_flush : NULL, progress);
|
|
|
|
|
|
|
|
if (progress)
|
|
|
|
progress_end (progress);
|
|
|
|
|
|
|
|
gdisplays_flush ();
|
|
|
|
#endif /* ! BLEND_UI_CALLS_VIA_PDB */
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
blend_motion (Tool *tool,
|
|
|
|
GdkEventMotion *mevent,
|
|
|
|
gpointer gdisp_ptr)
|
|
|
|
{
|
|
|
|
GDisplay * gdisp;
|
|
|
|
BlendTool * blend_tool;
|
1998-07-27 05:49:42 +08:00
|
|
|
gchar vector[STATUSBAR_SIZE];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gdisp = (GDisplay *) gdisp_ptr;
|
|
|
|
blend_tool = (BlendTool *) tool->private;
|
|
|
|
|
|
|
|
/* undraw the current tool */
|
|
|
|
draw_core_pause (blend_tool->core, tool);
|
|
|
|
|
|
|
|
/* Get the current coordinates */
|
|
|
|
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
|
|
|
|
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
|
|
|
|
|
1999-09-03 02:56:39 +08:00
|
|
|
|
1999-11-25 09:59:14 +08:00
|
|
|
/* Restrict to multiples of 15 degrees if ctrl is pressed */
|
|
|
|
if (mevent->state & GDK_CONTROL_MASK)
|
1999-09-21 17:11:42 +08:00
|
|
|
{
|
1999-11-19 01:56:01 +08:00
|
|
|
int tangens2[6] = { 34, 106, 196, 334, 618, 1944 };
|
|
|
|
int cosinus[7] = { 256, 247, 222, 181, 128, 66, 0 };
|
1999-09-21 17:11:42 +08:00
|
|
|
int dx, dy, i, radius, frac;
|
|
|
|
|
|
|
|
dx = blend_tool->endx - blend_tool->startx;
|
|
|
|
dy = blend_tool->endy - blend_tool->starty;
|
1999-09-03 02:56:39 +08:00
|
|
|
|
1999-09-21 17:11:42 +08:00
|
|
|
if (dy)
|
|
|
|
{
|
|
|
|
radius = sqrt (SQR (dx) + SQR (dy));
|
|
|
|
frac = abs ((dx << 8) / dy);
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
1999-11-19 01:56:01 +08:00
|
|
|
if (frac < tangens2[i])
|
1999-09-21 17:11:42 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
dx = dx > 0 ? (cosinus[6-i] * radius) >> 8 : - ((cosinus[6-i] * radius) >> 8);
|
|
|
|
dy = dy > 0 ? (cosinus[i] * radius) >> 8 : - ((cosinus[i] * radius) >> 8);
|
|
|
|
}
|
|
|
|
blend_tool->endx = blend_tool->startx + dx;
|
|
|
|
blend_tool->endy = blend_tool->starty + dy;
|
|
|
|
}
|
1999-07-27 02:13:10 +08:00
|
|
|
|
1998-07-27 05:49:42 +08:00
|
|
|
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id);
|
1999-03-04 01:48:29 +08:00
|
|
|
if (gdisp->dot_for_dot)
|
|
|
|
{
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
g_snprintf (vector, sizeof (vector), gdisp->cursor_format_str,
|
1999-03-04 01:48:29 +08:00
|
|
|
_("Blend: "),
|
1999-08-14 20:34:08 +08:00
|
|
|
blend_tool->endx - blend_tool->startx,
|
1999-03-04 01:48:29 +08:00
|
|
|
", ",
|
1999-08-14 20:34:08 +08:00
|
|
|
blend_tool->endy - blend_tool->starty);
|
1999-03-04 01:48:29 +08:00
|
|
|
}
|
|
|
|
else /* show real world units */
|
|
|
|
{
|
1999-05-23 01:56:35 +08:00
|
|
|
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
|
1999-03-04 01:48:29 +08:00
|
|
|
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
g_snprintf (vector, sizeof (vector), gdisp->cursor_format_str,
|
1999-03-04 01:48:29 +08:00
|
|
|
_("Blend: "),
|
1999-08-14 20:34:08 +08:00
|
|
|
blend_tool->endx - blend_tool->startx * unit_factor /
|
1999-03-04 01:48:29 +08:00
|
|
|
gdisp->gimage->xresolution,
|
|
|
|
", ",
|
1999-08-14 20:34:08 +08:00
|
|
|
blend_tool->endy - blend_tool->starty * unit_factor /
|
1999-03-04 01:48:29 +08:00
|
|
|
gdisp->gimage->yresolution);
|
|
|
|
}
|
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id,
|
|
|
|
vector);
|
1998-07-27 05:49:42 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* redraw the current tool */
|
|
|
|
draw_core_resume (blend_tool->core, tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
blend_cursor_update (Tool *tool,
|
|
|
|
GdkEventMotion *mevent,
|
|
|
|
gpointer gdisp_ptr)
|
|
|
|
{
|
|
|
|
GDisplay * gdisp;
|
|
|
|
|
|
|
|
gdisp = (GDisplay *) gdisp_ptr;
|
|
|
|
|
|
|
|
switch (drawable_type (gimage_active_drawable (gdisp->gimage)))
|
|
|
|
{
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
case INDEXED_GIMAGE:
|
|
|
|
case INDEXEDA_GIMAGE:
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisplay_install_tool_cursor (gdisp, GDK_TOP_LEFT_ARROW);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
blend_draw (Tool *tool)
|
|
|
|
{
|
|
|
|
GDisplay * gdisp;
|
|
|
|
BlendTool * blend_tool;
|
|
|
|
int tx1, ty1, tx2, ty2;
|
|
|
|
|
|
|
|
gdisp = (GDisplay *) tool->gdisp_ptr;
|
|
|
|
blend_tool = (BlendTool *) tool->private;
|
|
|
|
|
|
|
|
gdisplay_transform_coords (gdisp, blend_tool->startx, blend_tool->starty,
|
|
|
|
&tx1, &ty1, 1);
|
|
|
|
gdisplay_transform_coords (gdisp, blend_tool->endx, blend_tool->endy,
|
|
|
|
&tx2, &ty2, 1);
|
|
|
|
|
|
|
|
/* Draw start target */
|
|
|
|
gdk_draw_line (blend_tool->core->win, blend_tool->core->gc,
|
|
|
|
tx1 - (TARGET_WIDTH >> 1), ty1,
|
|
|
|
tx1 + (TARGET_WIDTH >> 1), ty1);
|
|
|
|
gdk_draw_line (blend_tool->core->win, blend_tool->core->gc,
|
|
|
|
tx1, ty1 - (TARGET_HEIGHT >> 1),
|
|
|
|
tx1, ty1 + (TARGET_HEIGHT >> 1));
|
|
|
|
|
|
|
|
/* Draw end target */
|
|
|
|
gdk_draw_line (blend_tool->core->win, blend_tool->core->gc,
|
|
|
|
tx2 - (TARGET_WIDTH >> 1), ty2,
|
|
|
|
tx2 + (TARGET_WIDTH >> 1), ty2);
|
|
|
|
gdk_draw_line (blend_tool->core->win, blend_tool->core->gc,
|
|
|
|
tx2, ty2 - (TARGET_HEIGHT >> 1),
|
|
|
|
tx2, ty2 + (TARGET_HEIGHT >> 1));
|
|
|
|
|
|
|
|
/* Draw the line between the start and end coords */
|
|
|
|
gdk_draw_line (blend_tool->core->win, blend_tool->core->gc,
|
|
|
|
tx1, ty1, tx2, ty2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-06-22 06:12:07 +08:00
|
|
|
blend_control (Tool *tool,
|
|
|
|
ToolAction action,
|
|
|
|
gpointer gdisp_ptr)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
BlendTool * blend_tool;
|
|
|
|
|
|
|
|
blend_tool = (BlendTool *) tool->private;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
1999-06-22 06:12:07 +08:00
|
|
|
case PAUSE:
|
1997-11-25 06:05:25 +08:00
|
|
|
draw_core_pause (blend_tool->core, tool);
|
|
|
|
break;
|
1999-06-22 06:12:07 +08:00
|
|
|
|
|
|
|
case RESUME:
|
1997-11-25 06:05:25 +08:00
|
|
|
draw_core_resume (blend_tool->core, tool);
|
|
|
|
break;
|
1999-06-22 06:12:07 +08:00
|
|
|
|
|
|
|
case HALT:
|
1997-11-25 06:05:25 +08:00
|
|
|
draw_core_stop (blend_tool->core, tool);
|
|
|
|
break;
|
1999-06-22 06:12:07 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
|
|
|
|
/* The actual blending procedure */
|
1999-04-19 05:22:41 +08:00
|
|
|
void
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
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)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
TileManager *buf_tiles;
|
|
|
|
PixelRegion bufPR;
|
|
|
|
int has_alpha;
|
|
|
|
int has_selection;
|
|
|
|
int bytes;
|
|
|
|
int x1, y1, x2, y2;
|
|
|
|
|
1999-01-11 07:36:29 +08:00
|
|
|
gimp_add_busy_cursors();
|
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
has_selection = drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
has_alpha = drawable_has_alpha (drawable);
|
|
|
|
bytes = drawable_bytes (drawable);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Always create an alpha temp buf (for generality) */
|
|
|
|
if (! has_alpha)
|
|
|
|
{
|
|
|
|
has_alpha = TRUE;
|
|
|
|
bytes += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf_tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes);
|
|
|
|
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
|
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
gradient_fill_region (gimage, drawable,
|
1998-11-15 20:58:37 +08:00
|
|
|
&bufPR, (x2 - x1), (y2 - y1),
|
1997-11-25 06:05:25 +08:00
|
|
|
blend_mode, gradient_type, offset, repeat,
|
|
|
|
supersample, max_depth, threshold,
|
|
|
|
(startx - x1), (starty - y1),
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
(endx - x1), (endy - y1),
|
|
|
|
progress_callback, progress_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
|
1998-01-22 15:02:57 +08:00
|
|
|
gimage_apply_image (gimage, drawable, &bufPR, TRUE,
|
1997-11-25 06:05:25 +08:00
|
|
|
(opacity * 255) / 100, paint_mode, NULL, x1, y1);
|
|
|
|
|
|
|
|
/* update the image */
|
1998-01-22 15:02:57 +08:00
|
|
|
drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* free the temporary buffer */
|
|
|
|
tile_manager_destroy (buf_tiles);
|
1999-01-11 07:36:29 +08:00
|
|
|
|
1999-01-18 01:03:54 +08:00
|
|
|
gimp_remove_busy_cursors(NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_conical_sym_factor (double dist,
|
|
|
|
double *axis,
|
|
|
|
double offset,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
double vec[2];
|
|
|
|
double r;
|
|
|
|
double rat;
|
|
|
|
|
|
|
|
if (dist == 0.0)
|
|
|
|
rat = 0.0;
|
|
|
|
else
|
|
|
|
if ((x != 0) || (y != 0))
|
|
|
|
{
|
|
|
|
/* Calculate offset from the start in pixels */
|
|
|
|
|
|
|
|
r = sqrt(x * x + y * y);
|
|
|
|
|
|
|
|
vec[0] = x / r;
|
|
|
|
vec[1] = y / r;
|
|
|
|
|
|
|
|
rat = axis[0] * vec[0] + axis[1] * vec[1]; /* Dot product */
|
|
|
|
|
|
|
|
if (rat > 1.0)
|
|
|
|
rat = 1.0;
|
|
|
|
else if (rat < -1.0)
|
|
|
|
rat = -1.0;
|
|
|
|
|
|
|
|
/* This cool idea is courtesy Josh MacDonald,
|
|
|
|
* Ali Rahimi --- two more XCF losers. */
|
|
|
|
|
1999-08-05 07:22:29 +08:00
|
|
|
rat = acos(rat) / G_PI;
|
1997-11-25 06:05:25 +08:00
|
|
|
rat = pow(rat, (offset / 10) + 1);
|
|
|
|
|
|
|
|
rat = BOUNDS(rat, 0.0, 1.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rat = 0.5;
|
|
|
|
|
|
|
|
return rat;
|
|
|
|
} /* gradient_calc_conical_sym_factor */
|
|
|
|
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_conical_asym_factor (double dist,
|
|
|
|
double *axis,
|
|
|
|
double offset,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
double ang0, ang1;
|
|
|
|
double ang;
|
|
|
|
double rat;
|
|
|
|
|
|
|
|
if (dist == 0.0)
|
|
|
|
rat = 0.0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((x != 0) || (y != 0))
|
|
|
|
{
|
1999-08-05 07:22:29 +08:00
|
|
|
ang0 = atan2(axis[0], axis[1]) + G_PI;
|
|
|
|
ang1 = atan2(x, y) + G_PI;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
ang = ang1 - ang0;
|
|
|
|
|
|
|
|
if (ang < 0.0)
|
1999-08-05 07:22:29 +08:00
|
|
|
ang += (2.0 * G_PI);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-08-05 07:22:29 +08:00
|
|
|
rat = ang / (2.0 * G_PI);
|
1997-11-25 06:05:25 +08:00
|
|
|
rat = pow(rat, (offset / 10) + 1);
|
|
|
|
|
|
|
|
rat = BOUNDS(rat, 0.0, 1.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rat = 0.5; /* We are on middle point */
|
|
|
|
} /* else */
|
|
|
|
|
|
|
|
return rat;
|
|
|
|
} /* gradient_calc_conical_asym_factor */
|
|
|
|
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_square_factor (double dist,
|
|
|
|
double offset,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
double r;
|
|
|
|
double rat;
|
|
|
|
|
|
|
|
if (dist == 0.0)
|
|
|
|
rat = 0.0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Calculate offset from start as a value in [0, 1] */
|
|
|
|
|
|
|
|
offset = offset / 100.0;
|
|
|
|
|
|
|
|
r = MAXIMUM(abs(x), abs(y));
|
|
|
|
rat = r / dist;
|
|
|
|
|
|
|
|
if (rat < offset)
|
|
|
|
rat = 0.0;
|
1997-12-15 08:21:15 +08:00
|
|
|
else if (offset == 1)
|
|
|
|
rat = (rat>=1) ? 1 : 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
rat = (rat - offset) / (1.0 - offset);
|
|
|
|
} /* else */
|
|
|
|
|
|
|
|
return rat;
|
|
|
|
} /* gradient_calc_square_factor */
|
|
|
|
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_radial_factor (double dist,
|
|
|
|
double offset,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
double r;
|
|
|
|
double rat;
|
|
|
|
|
|
|
|
if (dist == 0.0)
|
|
|
|
rat = 0.0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Calculate radial offset from start as a value in [0, 1] */
|
|
|
|
|
|
|
|
offset = offset / 100.0;
|
|
|
|
|
|
|
|
r = sqrt(SQR(x) + SQR(y));
|
|
|
|
rat = r / dist;
|
|
|
|
|
|
|
|
if (rat < offset)
|
|
|
|
rat = 0.0;
|
1997-12-15 08:21:15 +08:00
|
|
|
else if (offset == 1)
|
|
|
|
rat = (rat>=1) ? 1 : 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
rat = (rat - offset) / (1.0 - offset);
|
|
|
|
} /* else */
|
|
|
|
|
|
|
|
return rat;
|
|
|
|
} /* gradient_calc_radial_factor */
|
|
|
|
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_linear_factor (double dist,
|
|
|
|
double *vec,
|
1999-09-26 03:49:58 +08:00
|
|
|
double offset,
|
1997-11-25 06:05:25 +08:00
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
double r;
|
|
|
|
double rat;
|
|
|
|
|
|
|
|
if (dist == 0.0)
|
|
|
|
rat = 0.0;
|
|
|
|
else
|
|
|
|
{
|
1999-09-26 03:49:58 +08:00
|
|
|
offset = offset / 100.0;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
r = vec[0] * x + vec[1] * y;
|
|
|
|
rat = r / dist;
|
1999-09-26 03:49:58 +08:00
|
|
|
|
|
|
|
if (rat < offset)
|
|
|
|
rat = 0.0;
|
|
|
|
else if (offset == 1)
|
|
|
|
rat = (rat>=1) ? 1 : 0;
|
|
|
|
else
|
|
|
|
rat = (rat - offset) / (1.0 - offset);
|
1997-11-25 06:05:25 +08:00
|
|
|
} /* else */
|
|
|
|
|
|
|
|
return rat;
|
|
|
|
} /* gradient_calc_linear_factor */
|
|
|
|
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_bilinear_factor (double dist,
|
|
|
|
double *vec,
|
|
|
|
double offset,
|
|
|
|
double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
double r;
|
|
|
|
double rat;
|
|
|
|
|
|
|
|
if (dist == 0.0)
|
|
|
|
rat = 0.0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Calculate linear offset from the start line outward */
|
|
|
|
|
|
|
|
offset = offset / 100.0;
|
|
|
|
|
|
|
|
r = vec[0] * x + vec[1] * y;
|
|
|
|
rat = r / dist;
|
|
|
|
|
|
|
|
if (fabs(rat) < offset)
|
|
|
|
rat = 0.0;
|
1997-12-15 08:21:15 +08:00
|
|
|
else if (offset == 1)
|
|
|
|
rat = (rat>=1) ? 1 : 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
rat = (fabs(rat) - offset) / (1.0 - offset);
|
|
|
|
} /* else */
|
|
|
|
|
|
|
|
return rat;
|
|
|
|
} /* gradient_calc_bilinear_factor */
|
|
|
|
|
1999-01-05 07:56:37 +08:00
|
|
|
static double
|
|
|
|
gradient_calc_spiral_factor (double dist,
|
|
|
|
double *axis,
|
|
|
|
double offset,
|
|
|
|
double x,
|
|
|
|
double y,
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
gint cwise)
|
1999-01-05 07:56:37 +08:00
|
|
|
{
|
|
|
|
double ang0, ang1;
|
|
|
|
double ang, r;
|
|
|
|
double rat;
|
|
|
|
|
|
|
|
if (dist == 0.0)
|
|
|
|
rat = 0.0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (x != 0.0 || y != 0.0)
|
|
|
|
{
|
1999-08-05 07:22:29 +08:00
|
|
|
ang0 = atan2 (axis[0], axis[1]) + G_PI;
|
|
|
|
ang1 = atan2 (x, y) + G_PI;
|
1999-01-05 07:56:37 +08:00
|
|
|
if(!cwise)
|
|
|
|
ang = ang0 - ang1;
|
|
|
|
else
|
|
|
|
ang = ang1 - ang0;
|
|
|
|
|
|
|
|
if (ang < 0.0)
|
1999-08-05 07:22:29 +08:00
|
|
|
ang += (2.0 * G_PI);
|
1999-01-05 07:56:37 +08:00
|
|
|
|
|
|
|
r = sqrt (x * x + y * y) / dist;
|
1999-08-05 07:22:29 +08:00
|
|
|
rat = ang / (2.0 * G_PI) + r + offset;
|
1999-01-05 07:56:37 +08:00
|
|
|
rat = fmod (rat, 1.0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rat = 0.5 ; /* We are on the middle point */
|
|
|
|
}
|
|
|
|
|
|
|
|
return rat;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_shapeburst_angular_factor (double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
int ix, iy;
|
|
|
|
Tile *tile;
|
|
|
|
float value;
|
|
|
|
|
|
|
|
ix = (int) BOUNDS (x, 0, distR.w);
|
|
|
|
iy = (int) BOUNDS (y, 0, distR.h);
|
1998-08-16 03:17:36 +08:00
|
|
|
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
1998-08-12 01:35:34 +08:00
|
|
|
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
1998-07-10 10:43:12 +08:00
|
|
|
tile_release (tile, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_shapeburst_spherical_factor (double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
int ix, iy;
|
|
|
|
Tile *tile;
|
|
|
|
float value;
|
|
|
|
|
|
|
|
ix = (int) BOUNDS (x, 0, distR.w);
|
|
|
|
iy = (int) BOUNDS (y, 0, distR.h);
|
1998-08-16 03:17:36 +08:00
|
|
|
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
1998-08-12 01:35:34 +08:00
|
|
|
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
1999-08-05 07:22:29 +08:00
|
|
|
value = 1.0 - sin (0.5 * G_PI * value);
|
1998-07-10 10:43:12 +08:00
|
|
|
tile_release (tile, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static double
|
|
|
|
gradient_calc_shapeburst_dimpled_factor (double x,
|
|
|
|
double y)
|
|
|
|
{
|
|
|
|
int ix, iy;
|
|
|
|
Tile *tile;
|
|
|
|
float value;
|
|
|
|
|
|
|
|
ix = (int) BOUNDS (x, 0, distR.w);
|
|
|
|
iy = (int) BOUNDS (y, 0, distR.h);
|
1998-08-16 03:17:36 +08:00
|
|
|
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
1998-08-12 01:35:34 +08:00
|
|
|
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
1999-08-05 07:22:29 +08:00
|
|
|
value = cos (0.5 * G_PI * value);
|
1998-07-10 10:43:12 +08:00
|
|
|
tile_release (tile, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static double
|
1999-05-15 08:02:47 +08:00
|
|
|
gradient_repeat_none (double val)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
return BOUNDS(val, 0.0, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static double
|
1999-05-15 08:02:47 +08:00
|
|
|
gradient_repeat_sawtooth (double val)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
if (val >= 0.0)
|
|
|
|
return fmod(val, 1.0);
|
|
|
|
else
|
|
|
|
return 1.0 - fmod(-val, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static double
|
1999-05-15 08:02:47 +08:00
|
|
|
gradient_repeat_triangular (double val)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
int ival;
|
|
|
|
|
|
|
|
if (val < 0.0)
|
|
|
|
val = -val;
|
|
|
|
|
|
|
|
ival = (int) val;
|
|
|
|
|
|
|
|
if (ival & 1)
|
|
|
|
return 1.0 - fmod(val, 1.0);
|
|
|
|
else
|
|
|
|
return fmod(val, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
static void
|
1999-07-07 02:13:59 +08:00
|
|
|
gradient_precalc_shapeburst (GImage *gimage,
|
1998-01-22 15:02:57 +08:00
|
|
|
GimpDrawable *drawable,
|
1999-07-07 02:13:59 +08:00
|
|
|
PixelRegion *PR,
|
|
|
|
double dist)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
Channel *mask;
|
|
|
|
PixelRegion tempR;
|
|
|
|
float max_iteration;
|
|
|
|
float *distp;
|
|
|
|
int size;
|
|
|
|
void * pr;
|
1998-01-25 09:24:46 +08:00
|
|
|
unsigned char white[1] = { OPAQUE_OPACITY };
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* allocate the distance map */
|
|
|
|
if (distR.tiles)
|
|
|
|
tile_manager_destroy (distR.tiles);
|
|
|
|
distR.tiles = tile_manager_new (PR->w, PR->h, sizeof (float));
|
|
|
|
|
|
|
|
/* allocate the selection mask copy */
|
|
|
|
tempR.tiles = tile_manager_new (PR->w, PR->h, 1);
|
|
|
|
pixel_region_init (&tempR, tempR.tiles, 0, 0, PR->w, PR->h, TRUE);
|
|
|
|
|
|
|
|
/* If the gimage mask is not empty, use it as the shape burst source */
|
|
|
|
if (! gimage_mask_is_empty (gimage))
|
|
|
|
{
|
|
|
|
PixelRegion maskR;
|
|
|
|
int x1, y1, x2, y2;
|
|
|
|
int offx, offy;
|
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
|
|
|
drawable_offsets (drawable, &offx, &offy);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* the selection mask */
|
|
|
|
mask = gimage_get_mask (gimage);
|
1998-01-22 15:02:57 +08:00
|
|
|
pixel_region_init (&maskR, drawable_data (GIMP_DRAWABLE(mask)),
|
|
|
|
x1 + offx, y1 + offy, (x2 - x1), (y2 - y1), FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* copy the mask to the temp mask */
|
|
|
|
copy_region (&maskR, &tempR);
|
|
|
|
}
|
|
|
|
/* otherwise... */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* If the intended drawable has an alpha channel, use that */
|
1998-01-22 15:02:57 +08:00
|
|
|
if (drawable_has_alpha (drawable))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
PixelRegion drawableR;
|
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
pixel_region_init (&drawableR, drawable_data (drawable), PR->x, PR->y, PR->w, PR->h, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
extract_alpha_region (&drawableR, NULL, &tempR);
|
|
|
|
}
|
|
|
|
/* Otherwise, just fill the shapeburst to white */
|
|
|
|
else
|
|
|
|
color_region (&tempR, white);
|
|
|
|
}
|
|
|
|
|
|
|
|
pixel_region_init (&tempR, tempR.tiles, 0, 0, PR->w, PR->h, TRUE);
|
|
|
|
pixel_region_init (&distR, distR.tiles, 0, 0, PR->w, PR->h, TRUE);
|
|
|
|
max_iteration = shapeburst_region (&tempR, &distR);
|
|
|
|
|
|
|
|
/* normalize the shapeburst with the max iteration */
|
|
|
|
if (max_iteration > 0)
|
|
|
|
{
|
|
|
|
pixel_region_init (&distR, distR.tiles, 0, 0, PR->w, PR->h, TRUE);
|
|
|
|
|
|
|
|
for (pr = pixel_regions_register (1, &distR); pr != NULL; pr = pixel_regions_process (pr))
|
|
|
|
{
|
|
|
|
distp = (float *) distR.data;
|
|
|
|
size = distR.w * distR.h;
|
|
|
|
|
|
|
|
while (size--)
|
|
|
|
*distp++ /= max_iteration;
|
|
|
|
}
|
|
|
|
|
|
|
|
pixel_region_init (&distR, distR.tiles, 0, 0, PR->w, PR->h, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
tile_manager_destroy (tempR.tiles);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
1999-07-07 02:13:59 +08:00
|
|
|
gradient_render_pixel (double x,
|
|
|
|
double y,
|
|
|
|
color_t *color,
|
|
|
|
void *render_data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
RenderBlendData *rbd;
|
|
|
|
double factor;
|
|
|
|
|
|
|
|
rbd = render_data;
|
|
|
|
|
|
|
|
/* Calculate blending factor */
|
|
|
|
|
|
|
|
switch (rbd->gradient_type)
|
|
|
|
{
|
1999-04-19 05:22:41 +08:00
|
|
|
case RADIAL:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_radial_factor (rbd->dist, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case CONICAL_SYMMETRIC:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_conical_sym_factor (rbd->dist, rbd->vec, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case CONICAL_ASYMMETRIC:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_conical_asym_factor (rbd->dist, rbd->vec, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SQUARE:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_square_factor (rbd->dist, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case LINEAR:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_linear_factor (rbd->dist, rbd->vec, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case BILINEAR:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_bilinear_factor (rbd->dist, rbd->vec, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SHAPEBURST_ANGULAR:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_shapeburst_angular_factor (x, y);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SHAPEBURST_SPHERICAL:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_shapeburst_spherical_factor (x, y);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SHAPEBURST_DIMPLED:
|
1999-09-26 03:49:58 +08:00
|
|
|
factor = gradient_calc_shapeburst_dimpled_factor (x, y);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SPIRAL_CLOCKWISE:
|
1999-01-05 07:56:37 +08:00
|
|
|
factor = gradient_calc_spiral_factor (rbd->dist, rbd->vec, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy,TRUE);
|
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SPIRAL_ANTICLOCKWISE:
|
1999-01-05 07:56:37 +08:00
|
|
|
factor = gradient_calc_spiral_factor (rbd->dist, rbd->vec, rbd->offset,
|
|
|
|
x - rbd->sx, y - rbd->sy,FALSE);
|
|
|
|
break;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
default:
|
1999-09-26 03:49:58 +08:00
|
|
|
gimp_fatal_error ("gradient_render_pixel(): Unknown gradient type %d",
|
|
|
|
(int) rbd->gradient_type);
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Adjust for repeat */
|
|
|
|
|
|
|
|
factor = (*rbd->repeat_func)(factor);
|
|
|
|
|
|
|
|
/* Blend the colors */
|
|
|
|
|
|
|
|
if (rbd->blend_mode == CUSTOM_MODE)
|
1999-10-27 02:27:27 +08:00
|
|
|
gradient_get_color_at (gimp_context_get_gradient (NULL),
|
|
|
|
factor, &color->r, &color->g, &color->b, &color->a);
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Blend values */
|
|
|
|
|
|
|
|
color->r = rbd->fg.r + (rbd->bg.r - rbd->fg.r) * factor;
|
|
|
|
color->g = rbd->fg.g + (rbd->bg.g - rbd->fg.g) * factor;
|
|
|
|
color->b = rbd->fg.b + (rbd->bg.b - rbd->fg.b) * factor;
|
|
|
|
color->a = rbd->fg.a + (rbd->bg.a - rbd->fg.a) * factor;
|
|
|
|
|
|
|
|
if (rbd->blend_mode == FG_BG_HSV_MODE)
|
2000-01-03 09:58:43 +08:00
|
|
|
gimp_hsv_to_rgb_double (&color->r, &color->g, &color->b);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-07-07 02:13:59 +08:00
|
|
|
gradient_put_pixel (int x,
|
|
|
|
int y,
|
|
|
|
color_t color,
|
|
|
|
void *put_pixel_data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
PutPixelData *ppd;
|
|
|
|
unsigned char *data;
|
|
|
|
|
|
|
|
ppd = put_pixel_data;
|
|
|
|
|
|
|
|
/* Paint */
|
|
|
|
|
|
|
|
data = ppd->row_data + ppd->bytes * x;
|
|
|
|
|
|
|
|
if (ppd->bytes >= 3)
|
|
|
|
{
|
|
|
|
*data++ = color.r * 255.0;
|
|
|
|
*data++ = color.g * 255.0;
|
|
|
|
*data++ = color.b * 255.0;
|
|
|
|
*data++ = color.a * 255.0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Convert to grayscale */
|
|
|
|
|
|
|
|
*data++ = 255.0 * (0.30 * color.r +
|
|
|
|
0.59 * color.g +
|
|
|
|
0.11 * color.b);
|
|
|
|
*data++ = color.a * 255.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Paint whole row if we are on the rightmost pixel */
|
|
|
|
|
|
|
|
if (x == (ppd->width - 1))
|
|
|
|
pixel_region_set_row(ppd->PR, 0, y, ppd->width, ppd->row_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
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)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
RenderBlendData rbd;
|
|
|
|
PutPixelData ppd;
|
|
|
|
unsigned char r, g, b;
|
|
|
|
int x, y;
|
|
|
|
int endx, endy;
|
|
|
|
void *pr;
|
|
|
|
unsigned char *data;
|
|
|
|
color_t color;
|
|
|
|
|
|
|
|
/* Get foreground and background colors, normalized */
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_context_get_foreground (NULL, &r, &g, &b);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
rbd.fg.r = r / 255.0;
|
|
|
|
rbd.fg.g = g / 255.0;
|
|
|
|
rbd.fg.b = b / 255.0;
|
|
|
|
rbd.fg.a = 1.0; /* Foreground is always opaque */
|
|
|
|
|
1999-10-27 02:27:27 +08:00
|
|
|
gimp_context_get_background (NULL, &r, &g, &b);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
rbd.bg.r = r / 255.0;
|
|
|
|
rbd.bg.g = g / 255.0;
|
|
|
|
rbd.bg.b = b / 255.0;
|
|
|
|
rbd.bg.a = 1.0; /* opaque, for now */
|
|
|
|
|
|
|
|
switch (blend_mode)
|
|
|
|
{
|
|
|
|
case FG_BG_RGB_MODE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FG_BG_HSV_MODE:
|
|
|
|
/* Convert to HSV */
|
|
|
|
|
2000-01-03 09:58:43 +08:00
|
|
|
gimp_rgb_to_hsv_double(&rbd.fg.r, &rbd.fg.g, &rbd.fg.b);
|
|
|
|
gimp_rgb_to_hsv_double(&rbd.bg.r, &rbd.bg.g, &rbd.bg.b);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FG_TRANS_MODE:
|
|
|
|
/* Color does not change, just the opacity */
|
|
|
|
|
|
|
|
rbd.bg = rbd.fg;
|
|
|
|
rbd.bg.a = 0.0; /* transparent */
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CUSTOM_MODE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1999-09-23 19:49:16 +08:00
|
|
|
gimp_fatal_error("gradient_fill_region(): Unknown blend mode %d",
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
(int) blend_mode);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate type-specific parameters */
|
|
|
|
|
|
|
|
switch (gradient_type)
|
|
|
|
{
|
1999-04-19 05:22:41 +08:00
|
|
|
case RADIAL:
|
1997-11-25 06:05:25 +08:00
|
|
|
rbd.dist = sqrt(SQR(ex - sx) + SQR(ey - sy));
|
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SQUARE:
|
1997-11-25 06:05:25 +08:00
|
|
|
rbd.dist = MAXIMUM(fabs(ex - sx), fabs(ey - sy));
|
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case CONICAL_SYMMETRIC:
|
|
|
|
case CONICAL_ASYMMETRIC:
|
|
|
|
case SPIRAL_CLOCKWISE:
|
|
|
|
case SPIRAL_ANTICLOCKWISE:
|
|
|
|
case LINEAR:
|
|
|
|
case BILINEAR:
|
1997-11-25 06:05:25 +08:00
|
|
|
rbd.dist = sqrt(SQR(ex - sx) + SQR(ey - sy));
|
|
|
|
|
|
|
|
if (rbd.dist > 0.0)
|
|
|
|
{
|
|
|
|
rbd.vec[0] = (ex - sx) / rbd.dist;
|
|
|
|
rbd.vec[1] = (ey - sy) / rbd.dist;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case SHAPEBURST_ANGULAR:
|
|
|
|
case SHAPEBURST_SPHERICAL:
|
|
|
|
case SHAPEBURST_DIMPLED:
|
1997-11-25 06:05:25 +08:00
|
|
|
rbd.dist = sqrt(SQR(ex - sx) + SQR(ey - sy));
|
1998-01-22 15:02:57 +08:00
|
|
|
gradient_precalc_shapeburst(gimage, drawable, PR, rbd.dist);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1999-09-23 19:49:16 +08:00
|
|
|
gimp_fatal_error("gradient_fill_region(): Unknown gradient type %d",
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
(int) gradient_type);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set repeat function */
|
|
|
|
|
|
|
|
switch (repeat)
|
|
|
|
{
|
|
|
|
case REPEAT_NONE:
|
|
|
|
rbd.repeat_func = gradient_repeat_none;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REPEAT_SAWTOOTH:
|
|
|
|
rbd.repeat_func = gradient_repeat_sawtooth;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REPEAT_TRIANGULAR:
|
|
|
|
rbd.repeat_func = gradient_repeat_triangular;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
1999-09-23 19:49:16 +08:00
|
|
|
gimp_fatal_error("gradient_fill_region(): Unknown repeat mode %d",
|
new ui for the "Layer Offset" dialog.
1999-07-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/channel_ops.[ch]: new ui for the "Layer Offset" dialog.
* app/channels_dialog.c
* app/layers_dialog.c: major code cleanup: Folded some callbacks
into common ones, "widget" instead of "w", indentation, ...
* app/commands.c
* app/interface.[ch]
* app/global_edit.c: the query boxes must be shown by the caller
now. There's no need to split up the string for the message box
manually as the Gtk 1.2 label widget handles newlines corectly.
Added the "edge_lock" toggle to the "Shrink Selection" dialog.
Nicer spacings for the query and message boxes.
* app/ink.c: tried to grab the pointer in the blob preview but
failed. Left the code there as a reminder (commented out).
* app/menus.c: reordered <Image>/Select.
I was bored and grep-ed the sources for ancient or deprecated stuff:
* app/about_dialog.[ch]
* app/actionarea.[ch]
* app/app_procs.c
* app/brush_edit.c
* app/brush_select.c
* app/color_select.c
* app/convert.c
* app/devices.c
* app/gdisplay.c
* app/gdisplay_ops.c
* app/histogram_tool.[ch]
* app/info_window.c
* app/install.c
* app/ops_buttons.c
* app/palette.c
* app/palette_select.c
* app/paths_dialog.c
* app/pattern_select.c
* app/resize.c
* app/scale_toolc.c
* app/text_tool.c:
s/container_border_width/container_set_border_width/g,
s/sprintf/g_snprintf/g, replaced some constant string lengths with
strlen(x).
* app/bezier_select.c
* app/blend.c
* app/boundary.c
* app/errors.[ch]
* app/free_select.c
* app/gimpbrushlist.c
* app/gimprc.c
* app/iscissors.c
* app/main.c
* app/patterns.[ch]
* app/text_tool.c: namespace fanaticism: prefixed all gimp error
functions with "gimp_" and formated the messages more uniformly.
* app/gradient.c
* app/gradient_select.c: same stuff as above for the ui
code. There are still some sub-dialogs which need cleanup.
Did some cleanup in most of these files: prototypes, removed tons
of #include's, i18n fixes, s/w/widget/ as above, indentation, ...
1999-07-23 00:21:10 +08:00
|
|
|
(int) repeat);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize render data */
|
|
|
|
|
|
|
|
rbd.offset = offset;
|
|
|
|
rbd.sx = sx;
|
|
|
|
rbd.sy = sy;
|
|
|
|
rbd.blend_mode = blend_mode;
|
|
|
|
rbd.gradient_type = gradient_type;
|
|
|
|
|
|
|
|
/* Render the gradient! */
|
|
|
|
|
|
|
|
if (supersample)
|
|
|
|
{
|
|
|
|
/* Initialize put pixel data */
|
|
|
|
|
|
|
|
ppd.PR = PR;
|
|
|
|
ppd.row_data = g_malloc(width * PR->bytes);
|
|
|
|
ppd.bytes = PR->bytes;
|
|
|
|
ppd.width = width;
|
|
|
|
|
|
|
|
/* Render! */
|
|
|
|
|
|
|
|
adaptive_supersample_area(0, 0, (width - 1), (height - 1),
|
|
|
|
max_depth, threshold,
|
|
|
|
gradient_render_pixel, &rbd,
|
|
|
|
gradient_put_pixel, &ppd,
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
progress_callback, progress_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Clean up */
|
|
|
|
|
|
|
|
g_free(ppd.row_data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
int max_progress = PR->w * PR->h;
|
|
|
|
int progress = 0;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
for (pr = pixel_regions_register(1, PR); pr != NULL; pr = pixel_regions_process(pr))
|
|
|
|
{
|
|
|
|
data = PR->data;
|
|
|
|
endx = PR->x + PR->w;
|
|
|
|
endy = PR->y + PR->h;
|
|
|
|
|
|
|
|
for (y = PR->y; y < endy; y++)
|
|
|
|
for (x = PR->x; x < endx; x++)
|
|
|
|
{
|
|
|
|
gradient_render_pixel(x, y, &color, &rbd);
|
|
|
|
|
|
|
|
if (PR->bytes >= 3)
|
|
|
|
{
|
|
|
|
*data++ = color.r * 255.0;
|
|
|
|
*data++ = color.g * 255.0;
|
|
|
|
*data++ = color.b * 255.0;
|
|
|
|
*data++ = color.a * 255.0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Convert to grayscale */
|
|
|
|
|
|
|
|
*data++ = 255.0 * (0.30 * color.r +
|
|
|
|
0.59 * color.g +
|
|
|
|
0.11 * color.b);
|
|
|
|
*data++ = color.a * 255.0;
|
|
|
|
}
|
|
|
|
}
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 08:57:33 +08:00
|
|
|
|
|
|
|
progress += PR->w * PR->h;
|
|
|
|
if (progress_callback)
|
|
|
|
(*progress_callback) (0, max_progress, progress, progress_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************/
|
|
|
|
/* Global blend functions */
|
|
|
|
/****************************/
|
|
|
|
|
|
|
|
Tool *
|
|
|
|
tools_new_blend ()
|
|
|
|
{
|
|
|
|
Tool * tool;
|
|
|
|
BlendTool * private;
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* The tool options */
|
1997-11-25 06:05:25 +08:00
|
|
|
if (! blend_options)
|
1999-04-13 01:55:06 +08:00
|
|
|
{
|
|
|
|
blend_options = blend_options_new ();
|
|
|
|
tools_register (BLEND, (ToolOptions *) blend_options);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
tool = tools_new_tool (BLEND);
|
|
|
|
private = g_new (BlendTool, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
private->core = draw_core_new (blend_draw);
|
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
tool->scroll_lock = TRUE; /* Disallow scrolling */
|
1999-06-26 19:16:47 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
tool->private = (void *) private;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
tool->button_press_func = blend_button_press;
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->button_release_func = blend_button_release;
|
1999-07-03 01:40:10 +08:00
|
|
|
tool->motion_func = blend_motion;
|
|
|
|
tool->cursor_update_func = blend_cursor_update;
|
|
|
|
tool->control_func = blend_control;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return tool;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tools_free_blend (Tool *tool)
|
|
|
|
{
|
|
|
|
BlendTool * blend_tool;
|
|
|
|
|
|
|
|
blend_tool = (BlendTool *) tool->private;
|
|
|
|
|
|
|
|
if (tool->state == ACTIVE)
|
|
|
|
draw_core_stop (blend_tool->core, tool);
|
|
|
|
|
|
|
|
draw_core_free (blend_tool->core);
|
|
|
|
|
|
|
|
/* free the distance map data if it exists */
|
|
|
|
if (distR.tiles)
|
|
|
|
tile_manager_destroy (distR.tiles);
|
|
|
|
distR.tiles = NULL;
|
|
|
|
|
|
|
|
g_free (blend_tool);
|
|
|
|
}
|