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
|
|
|
*/
|
2000-12-17 05:37:03 +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>
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#include "core/gimpdrawable.h"
|
2001-11-10 00:54:56 +08:00
|
|
|
#include "core/gimpdrawable-blend.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpgradient.h"
|
|
|
|
#include "core/gimpimage.h"
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2002-02-22 23:08:47 +08:00
|
|
|
#include "display/gimpprogress.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2001-11-10 00:54:56 +08:00
|
|
|
#include "widgets/gimpdnd.h"
|
2002-06-12 21:48:47 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
|
|
|
#include "widgets/gimpdock.h"
|
2002-03-18 02:36:52 +08:00
|
|
|
#include "widgets/gimpenummenu.h"
|
2002-06-12 21:48:47 +08:00
|
|
|
#include "widgets/gimppreview.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-05 22:39:40 +08:00
|
|
|
#include "gimpblendoptions.h"
|
2001-03-12 04:01:14 +08:00
|
|
|
#include "gimpblendtool.h"
|
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
|
|
|
|
1998-07-08 14:41:58 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
#define TARGET_SIZE 15
|
1998-07-27 05:49:42 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
/* local function prototypes */
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
static void gimp_blend_tool_class_init (GimpBlendToolClass *klass);
|
|
|
|
static void gimp_blend_tool_init (GimpBlendTool *blend_tool);
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-07-18 04:50:01 +08:00
|
|
|
static void gimp_blend_tool_button_press (GimpTool *tool,
|
2001-11-09 03:14:51 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp);
|
2001-07-18 04:50:01 +08:00
|
|
|
static void gimp_blend_tool_button_release (GimpTool *tool,
|
2001-11-09 03:14:51 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp);
|
2001-07-18 04:50:01 +08:00
|
|
|
static void gimp_blend_tool_motion (GimpTool *tool,
|
2001-11-09 03:14:51 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp);
|
2001-07-18 04:50:01 +08:00
|
|
|
static void gimp_blend_tool_cursor_update (GimpTool *tool,
|
2001-11-09 03:14:51 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp);
|
2001-07-18 04:50:01 +08:00
|
|
|
|
|
|
|
static void gimp_blend_tool_draw (GimpDrawTool *draw_tool);
|
2001-03-12 04:01:14 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-10 00:54:56 +08:00
|
|
|
/* private variables */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
static GimpDrawToolClass *parent_class = NULL;
|
2000-02-14 06:26:41 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-11-10 00:54:56 +08:00
|
|
|
/* public functions */
|
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_blend_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
2001-03-12 04:01:14 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_BLEND_TOOL,
|
2003-02-05 22:39:40 +08:00
|
|
|
GIMP_TYPE_BLEND_OPTIONS,
|
|
|
|
gimp_blend_options_gui,
|
2001-11-21 07:00:47 +08:00
|
|
|
TRUE,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-blend-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Blend"),
|
|
|
|
_("Fill with a color gradient"),
|
|
|
|
N_("/Tools/Paint Tools/Blend"), "L",
|
|
|
|
NULL, "tools/blend.html",
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_BLEND,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
1999-04-09 06:25:54 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-03-12 04:01:14 +08:00
|
|
|
gimp_blend_tool_get_type (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-03-12 04:01:14 +08:00
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
sizeof (GimpBlendToolClass),
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_blend_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
2001-03-12 04:01:14 +08:00
|
|
|
sizeof (GimpBlendTool),
|
2001-08-14 22:53:55 +08:00
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_blend_tool_init,
|
2001-03-12 04:01:14 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_DRAW_TOOL,
|
|
|
|
"GimpBlendTool",
|
|
|
|
&tool_info, 0);
|
2001-03-12 04:01:14 +08:00
|
|
|
}
|
2000-02-14 06:26:41 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
return tool_type;
|
|
|
|
}
|
2000-02-14 06:26:41 +08:00
|
|
|
|
2001-11-10 00:54:56 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
static void
|
|
|
|
gimp_blend_tool_class_init (GimpBlendToolClass *klass)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
GObjectClass *object_class;
|
2001-03-12 04:01:14 +08:00
|
|
|
GimpToolClass *tool_class;
|
|
|
|
GimpDrawToolClass *draw_tool_class;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
2000-02-14 06:26:41 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2000-02-14 06:26:41 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
tool_class->button_press = gimp_blend_tool_button_press;
|
|
|
|
tool_class->button_release = gimp_blend_tool_button_release;
|
|
|
|
tool_class->motion = gimp_blend_tool_motion;
|
|
|
|
tool_class->cursor_update = gimp_blend_tool_cursor_update;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
draw_tool_class->draw = gimp_blend_tool_draw;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
static void
|
|
|
|
gimp_blend_tool_init (GimpBlendTool *blend_tool)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
1999-04-21 03:23:38 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
tool = GIMP_TOOL (blend_tool);
|
|
|
|
|
2002-05-03 19:31:08 +08:00
|
|
|
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
|
|
|
|
gimp_tool_control_set_tool_cursor (tool->control, GIMP_BLEND_TOOL_CURSOR);
|
2002-02-05 01:43:01 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_blend_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-05 19:35:03 +08:00
|
|
|
GimpBlendTool *blend_tool;
|
2003-02-04 07:54:19 +08:00
|
|
|
GimpDrawable *drawable;
|
2002-02-05 19:35:03 +08:00
|
|
|
gint off_x, off_y;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
blend_tool = GIMP_BLEND_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-04 07:54:19 +08:00
|
|
|
drawable = gimp_image_active_drawable (gdisp->gimage);
|
|
|
|
|
|
|
|
switch (gimp_drawable_type (drawable))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-12-12 02:11:56 +08:00
|
|
|
case GIMP_INDEXED_IMAGE: case GIMP_INDEXEDA_IMAGE:
|
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;
|
|
|
|
}
|
|
|
|
|
2003-02-04 07:54:19 +08:00
|
|
|
gimp_drawable_offsets (drawable, &off_x, &off_y);
|
2001-11-10 00:54:56 +08:00
|
|
|
|
|
|
|
blend_tool->endx = blend_tool->startx = coords->x - off_x;
|
|
|
|
blend_tool->endy = blend_tool->starty = coords->y - off_y;
|
|
|
|
|
|
|
|
tool->gdisp = gdisp;
|
2002-03-29 11:50:29 +08:00
|
|
|
|
2002-05-03 19:31:08 +08:00
|
|
|
gimp_tool_control_activate (tool->control);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-07-27 05:49:42 +08:00
|
|
|
/* initialize the statusbar display */
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_push_status (tool, _("Blend: 0, 0"));
|
1998-07-27 05:49:42 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Start drawing the blend tool */
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_blend_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-05 22:39:40 +08:00
|
|
|
GimpBlendTool *blend_tool;
|
|
|
|
GimpBlendOptions *options;
|
|
|
|
GimpImage *gimage;
|
|
|
|
GimpProgress *progress;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
blend_tool = GIMP_BLEND_TOOL (tool);
|
2003-02-05 22:39:40 +08:00
|
|
|
options = GIMP_BLEND_OPTIONS (tool->tool_info->tool_options);
|
2001-11-20 21:53:21 +08:00
|
|
|
|
1998-07-27 05:49:42 +08:00
|
|
|
gimage = gdisp->gimage;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_pop_status (tool);
|
1998-07-27 05:49:42 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
|
|
|
|
|
2003-01-03 21:59:23 +08:00
|
|
|
gimp_tool_control_halt (tool->control);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* if the 3rd button isn't pressed, fill the selected region */
|
2001-11-09 03:14:51 +08:00
|
|
|
if (! (state & GDK_BUTTON3_MASK) &&
|
1997-11-25 06:05:25 +08:00
|
|
|
((blend_tool->startx != blend_tool->endx) ||
|
|
|
|
(blend_tool->starty != blend_tool->endy)))
|
|
|
|
{
|
2002-02-22 23:08:47 +08:00
|
|
|
progress = gimp_progress_start (gdisp, _("Blending..."), FALSE,
|
|
|
|
NULL, 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
|
|
|
|
2001-11-10 00:54:56 +08:00
|
|
|
gimp_drawable_blend (gimp_image_active_drawable (gimage),
|
2002-06-12 21:48:47 +08:00
|
|
|
GIMP_CUSTOM_MODE,
|
2001-11-10 00:54:56 +08:00
|
|
|
gimp_context_get_paint_mode (gimp_get_current_context (gimage->gimp)),
|
2001-11-20 21:53:21 +08:00
|
|
|
options->gradient_type,
|
2001-11-16 07:15:52 +08:00
|
|
|
gimp_context_get_opacity (gimp_get_current_context (gimage->gimp)),
|
2001-11-20 21:53:21 +08:00
|
|
|
options->offset,
|
|
|
|
options->repeat,
|
|
|
|
options->supersample,
|
|
|
|
options->max_depth,
|
|
|
|
options->threshold,
|
2001-11-10 00:54:56 +08:00
|
|
|
blend_tool->startx,
|
|
|
|
blend_tool->starty,
|
|
|
|
blend_tool->endx,
|
|
|
|
blend_tool->endy,
|
2002-02-22 23:08:47 +08:00
|
|
|
progress ? gimp_progress_update_and_flush : NULL,
|
2001-11-10 00:54:56 +08:00
|
|
|
progress);
|
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
|
|
|
|
|
|
|
if (progress)
|
2002-02-22 23:08:47 +08:00
|
|
|
gimp_progress_end (progress);
|
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
|
|
|
|
2002-05-09 01:48:24 +08:00
|
|
|
gimp_image_flush (gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_blend_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-01 05:20:09 +08:00
|
|
|
GimpBlendTool *blend_tool;
|
2001-11-09 03:14:51 +08:00
|
|
|
gint off_x, off_y;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
blend_tool = GIMP_BLEND_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage),
|
|
|
|
&off_x, &off_y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
/* Get the current coordinates */
|
|
|
|
blend_tool->endx = coords->x - off_x;
|
|
|
|
blend_tool->endy = coords->y - off_y;
|
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 */
|
2001-11-09 03:14:51 +08:00
|
|
|
if (state & GDK_CONTROL_MASK)
|
1999-09-21 17:11:42 +08:00
|
|
|
{
|
2001-03-12 04:01:14 +08:00
|
|
|
gint tangens2[6] = { 34, 106, 196, 334, 618, 1944 };
|
|
|
|
gint cosinus[7] = { 256, 247, 222, 181, 128, 66, 0 };
|
|
|
|
gint dx, dy, i, radius, frac;
|
1999-09-21 17:11:42 +08:00
|
|
|
|
|
|
|
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);
|
2002-04-28 22:35:01 +08:00
|
|
|
|
1999-09-21 17:11:42 +08:00
|
|
|
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;
|
|
|
|
}
|
2002-04-28 22:35:01 +08:00
|
|
|
|
|
|
|
dx = dx > 0 ?
|
|
|
|
(cosinus[6-i] * radius) >> 8 : - ((cosinus[6-i] * radius) >> 8);
|
|
|
|
|
|
|
|
dy = dy > 0 ?
|
|
|
|
(cosinus[i] * radius) >> 8 : - ((cosinus[i] * radius) >> 8);
|
1999-09-21 17:11:42 +08:00
|
|
|
}
|
2002-04-28 22:35:01 +08:00
|
|
|
|
1999-09-21 17:11:42 +08:00
|
|
|
blend_tool->endx = blend_tool->startx + dx;
|
|
|
|
blend_tool->endy = blend_tool->starty + dy;
|
|
|
|
}
|
1999-07-27 02:13:10 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_pop_status (tool);
|
2001-03-12 04:01:14 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_tool_push_status_coords (tool,
|
|
|
|
_("Blend: "),
|
|
|
|
blend_tool->endx - blend_tool->startx,
|
|
|
|
", ",
|
|
|
|
blend_tool->endy - blend_tool->starty);
|
1998-07-27 05:49:42 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_blend_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
switch (gimp_drawable_type (gimp_image_active_drawable (gdisp->gimage)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-12-12 02:11:56 +08:00
|
|
|
case GIMP_INDEXED_IMAGE:
|
|
|
|
case GIMP_INDEXEDA_IMAGE:
|
2002-05-03 19:31:08 +08:00
|
|
|
gimp_tool_control_set_cursor (tool->control, GIMP_BAD_CURSOR);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
default:
|
2002-05-03 19:31:08 +08:00
|
|
|
gimp_tool_control_set_cursor (tool->control, GIMP_MOUSE_CURSOR);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
2002-02-05 01:43:01 +08:00
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-03-12 04:01:14 +08:00
|
|
|
gimp_blend_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-12 04:01:14 +08:00
|
|
|
GimpBlendTool *blend_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-12 04:01:14 +08:00
|
|
|
blend_tool = GIMP_BLEND_TOOL (draw_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Draw start target */
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_draw_handle (draw_tool,
|
|
|
|
GIMP_HANDLE_CROSS,
|
|
|
|
floor (blend_tool->startx) + 0.5,
|
|
|
|
floor (blend_tool->starty) + 0.5,
|
|
|
|
TARGET_SIZE,
|
|
|
|
TARGET_SIZE,
|
|
|
|
GTK_ANCHOR_CENTER,
|
|
|
|
TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Draw end target */
|
2001-11-16 05:17:36 +08:00
|
|
|
gimp_draw_tool_draw_handle (draw_tool,
|
|
|
|
GIMP_HANDLE_CROSS,
|
|
|
|
floor (blend_tool->endx) + 0.5,
|
|
|
|
floor (blend_tool->endy) + 0.5,
|
|
|
|
TARGET_SIZE,
|
|
|
|
TARGET_SIZE,
|
|
|
|
GTK_ANCHOR_CENTER,
|
|
|
|
TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Draw the line between the start and end coords */
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_draw_line (draw_tool,
|
|
|
|
floor (blend_tool->startx) + 0.5,
|
|
|
|
floor (blend_tool->starty) + 0.5,
|
|
|
|
floor (blend_tool->endx) + 0.5,
|
|
|
|
floor (blend_tool->endy) + 0.5,
|
|
|
|
TRUE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|