2000-01-14 20:41:00 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
1997-11-25 06:05:25 +08:00
|
|
|
* 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
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/pixel-region.h"
|
|
|
|
#include "base/temp-buf.h"
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
#include "paint-funcs/paint-funcs.h"
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "core/gimp.h"
|
2001-11-20 21:53:21 +08:00
|
|
|
#include "core/gimpbrush.h"
|
|
|
|
#include "core/gimpcontext.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "core/gimpimage-mask.h"
|
|
|
|
#include "core/gimppattern.h"
|
2001-11-20 21:53:21 +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"
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
#include "gimpclonetool.h"
|
|
|
|
#include "paint_options.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"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2001-11-12 22:45:58 +08:00
|
|
|
#define TARGET_WIDTH 15
|
|
|
|
#define TARGET_HEIGHT 15
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-07-20 06:42:49 +08:00
|
|
|
/* default types */
|
1999-12-23 07:30:43 +08:00
|
|
|
#define CLONE_DEFAULT_TYPE IMAGE_CLONE
|
|
|
|
#define CLONE_DEFAULT_ALIGNED ALIGN_NO
|
1999-07-20 06:42:49 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* the clone structures */
|
|
|
|
|
1999-02-05 17:55:44 +08:00
|
|
|
typedef enum
|
|
|
|
{
|
1999-12-23 07:30:43 +08:00
|
|
|
ALIGN_NO,
|
|
|
|
ALIGN_YES,
|
|
|
|
ALIGN_REGISTERED
|
1999-02-05 17:55:44 +08:00
|
|
|
} AlignType;
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
typedef struct _CloneOptions CloneOptions;
|
2000-01-14 20:41:00 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
struct _CloneOptions
|
|
|
|
{
|
1999-04-22 22:34:00 +08:00
|
|
|
PaintOptions paint_options;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
CloneType type;
|
|
|
|
CloneType type_d;
|
|
|
|
GtkWidget *type_w[2]; /* 2 radio buttons */
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
AlignType aligned;
|
|
|
|
AlignType aligned_d;
|
|
|
|
GtkWidget *aligned_w[3]; /* 3 radio buttons */
|
1999-04-09 06:25:54 +08:00
|
|
|
};
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
/* forward function declarations */
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void gimp_clone_tool_class_init (GimpCloneToolClass *klass);
|
|
|
|
static void gimp_clone_tool_init (GimpCloneTool *tool);
|
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
static void gimp_clone_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void gimp_clone_tool_draw (GimpDrawTool *draw_tool);
|
|
|
|
|
2001-07-18 04:50:01 +08:00
|
|
|
static void gimp_clone_tool_paint (GimpPaintTool *paint_tool,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
PaintState state);
|
|
|
|
static void gimp_clone_tool_motion (GimpPaintTool *paint_tool,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpDrawable *src_drawable,
|
2001-04-19 21:01:44 +08:00
|
|
|
PaintPressureOptions *pressure_options,
|
2001-07-18 04:50:01 +08:00
|
|
|
CloneType type,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y);
|
|
|
|
static void gimp_clone_tool_line_image (GimpImage *dest,
|
|
|
|
GimpImage *src,
|
|
|
|
GimpDrawable *d_drawable,
|
|
|
|
GimpDrawable *s_drawable,
|
|
|
|
guchar *s,
|
|
|
|
guchar *d,
|
|
|
|
gint has_alpha,
|
|
|
|
gint src_bytes,
|
|
|
|
gint dest_bytes,
|
|
|
|
gint width);
|
|
|
|
static void gimp_clone_tool_line_pattern (GimpImage *dest,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPattern *pattern,
|
|
|
|
guchar *d,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint bytes,
|
|
|
|
gint width);
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpToolOptions * clone_options_new (GimpToolInfo *tool_info);
|
|
|
|
static void clone_options_reset (GimpToolOptions *options);
|
2001-04-19 21:01:44 +08:00
|
|
|
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* local variables */
|
2001-04-19 21:01:44 +08:00
|
|
|
static gint src_x = 0; /* */
|
|
|
|
static gint src_y = 0; /* position of clone src */
|
|
|
|
static gint dest_x = 0; /* */
|
|
|
|
static gint dest_y = 0; /* position of clone src */
|
|
|
|
static gint offset_x = 0; /* */
|
|
|
|
static gint offset_y = 0; /* offset for cloning */
|
|
|
|
static gint first = TRUE;
|
2001-11-12 22:45:58 +08:00
|
|
|
static gint trans_tx = 0; /* transformed target */
|
2001-04-19 21:01:44 +08:00
|
|
|
static gint trans_ty = 0; /* transformed target */
|
2001-10-29 19:47:11 +08:00
|
|
|
static GimpDisplay *the_src_gdisp = NULL; /* ID of source gdisplay */
|
1999-04-09 06:25:54 +08:00
|
|
|
static GimpDrawable *src_drawable_ = NULL; /* source drawable */
|
|
|
|
|
|
|
|
static GimpDrawable *non_gui_src_drawable;
|
2000-12-31 12:07:42 +08:00
|
|
|
static gint non_gui_offset_x;
|
|
|
|
static gint non_gui_offset_y;
|
1999-04-09 06:25:54 +08:00
|
|
|
static CloneType non_gui_type;
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpPaintToolClass *parent_class;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
/* public functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
void
|
2001-11-21 07:00:47 +08:00
|
|
|
gimp_clone_tool_register (Gimp *gimp,
|
|
|
|
GimpToolRegisterCallback callback)
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
2001-11-21 07:00:47 +08:00
|
|
|
(* callback) (gimp,
|
|
|
|
GIMP_TYPE_CLONE_TOOL,
|
|
|
|
clone_options_new,
|
|
|
|
TRUE,
|
|
|
|
"gimp:clone_tool",
|
|
|
|
_("Clone"),
|
|
|
|
_("Paint using Patterns or Image Regions"),
|
|
|
|
N_("/Tools/Paint Tools/Clone"), "C",
|
|
|
|
NULL, "tools/clone.html",
|
|
|
|
GIMP_STOCK_TOOL_CLONE);
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
1999-04-22 22:34:00 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpCloneToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_clone_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpCloneTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_clone_tool_init,
|
2001-04-19 21:01:44 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
|
|
|
|
"GimpCloneTool",
|
|
|
|
&tool_info, 0);
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
1999-04-09 06:25:54 +08:00
|
|
|
}
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
/* static functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_clone_tool_class_init (GimpCloneToolClass *klass)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-04-19 21:01:44 +08:00
|
|
|
GimpToolClass *tool_class;
|
2001-08-14 22:53:55 +08:00
|
|
|
GimpDrawToolClass *draw_tool_class;
|
|
|
|
GimpPaintToolClass *paint_tool_class;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
|
|
|
paint_tool_class = GIMP_PAINT_TOOL_CLASS (klass);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
tool_class->cursor_update = gimp_clone_tool_cursor_update;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
draw_tool_class->draw = gimp_clone_tool_draw;
|
2001-08-14 22:53:55 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
paint_tool_class->paint = gimp_clone_tool_paint;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void
|
|
|
|
gimp_clone_tool_init (GimpCloneTool *clone)
|
|
|
|
{
|
|
|
|
GimpTool *tool;
|
|
|
|
GimpPaintTool *paint_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
tool = GIMP_TOOL (clone);
|
|
|
|
paint_tool = GIMP_PAINT_TOOL (clone);
|
1999-02-05 17:55:44 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
tool->tool_cursor = GIMP_CLONE_TOOL_CURSOR;
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2002-02-05 01:43:01 +08:00
|
|
|
paint_tool->flags |= TOOL_CAN_HANDLE_CHANGING_BRUSH;
|
|
|
|
paint_tool->flags |= TOOL_TRACES_ON_WINDOW;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-02-05 17:55:44 +08:00
|
|
|
static void
|
2001-08-12 05:10:44 +08:00
|
|
|
clone_src_drawable_disconnect_cb (GimpDrawable *drawable,
|
|
|
|
GimpDrawable **src_drawable)
|
1999-02-05 17:55:44 +08:00
|
|
|
{
|
|
|
|
if (drawable == *src_drawable)
|
1999-06-22 06:12:07 +08:00
|
|
|
{
|
|
|
|
*src_drawable = NULL;
|
|
|
|
the_src_gdisp = NULL;
|
|
|
|
}
|
1999-02-05 17:55:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-14 20:41:00 +08:00
|
|
|
clone_set_src_drawable (GimpDrawable *drawable)
|
1999-02-05 17:55:44 +08:00
|
|
|
{
|
|
|
|
if (src_drawable_ == drawable)
|
|
|
|
return;
|
2001-07-25 08:27:41 +08:00
|
|
|
|
1999-02-05 17:55:44 +08:00
|
|
|
if (src_drawable_)
|
2001-07-25 08:27:41 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (G_OBJECT (src_drawable_),
|
2001-08-12 05:10:44 +08:00
|
|
|
G_CALLBACK (clone_src_drawable_disconnect_cb),
|
2001-07-25 08:27:41 +08:00
|
|
|
&src_drawable_);
|
|
|
|
|
1999-02-05 17:55:44 +08:00
|
|
|
src_drawable_ = drawable;
|
|
|
|
if (drawable)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
2001-08-12 05:10:44 +08:00
|
|
|
g_signal_connect (G_OBJECT (drawable), "disconnect",
|
|
|
|
G_CALLBACK (clone_src_drawable_disconnect_cb),
|
2001-07-25 08:27:41 +08:00
|
|
|
&src_drawable_);
|
2000-01-14 20:41:00 +08:00
|
|
|
}
|
1999-02-05 17:55:44 +08:00
|
|
|
}
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
static void
|
2001-07-07 20:17:23 +08:00
|
|
|
gimp_clone_tool_paint (GimpPaintTool *paint_tool,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
PaintState state)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-20 21:53:21 +08:00
|
|
|
GimpTool *tool;
|
|
|
|
GimpDrawTool *draw_tool;
|
|
|
|
CloneOptions *options;
|
2001-10-29 19:47:11 +08:00
|
|
|
GimpDisplay *gdisp;
|
|
|
|
GimpDisplay *src_gdisp;
|
2001-07-07 20:17:23 +08:00
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
static gint orig_src_x, orig_src_y;
|
|
|
|
GimpContext *context;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
tool = GIMP_TOOL (paint_tool);
|
2001-07-07 20:17:23 +08:00
|
|
|
draw_tool = GIMP_DRAW_TOOL (paint_tool);
|
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
options = (CloneOptions *) tool->tool_info->tool_options;
|
|
|
|
|
|
|
|
gdisp = tool->gdisp;
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
context = gimp_get_current_context (gdisp->gimage->gimp);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
2000-01-14 20:41:00 +08:00
|
|
|
case PRETRACE_PAINT:
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_draw_tool_pause (draw_tool);
|
1999-12-26 05:32:52 +08:00
|
|
|
break;
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
case MOTION_PAINT:
|
2001-11-14 00:21:34 +08:00
|
|
|
x1 = paint_tool->cur_coords.x;
|
|
|
|
y1 = paint_tool->cur_coords.y;
|
|
|
|
x2 = paint_tool->last_coords.x;
|
|
|
|
y2 = paint_tool->last_coords.y;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* If the control key is down, move the src target and return */
|
2001-04-19 21:01:44 +08:00
|
|
|
if (paint_tool->state & GDK_CONTROL_MASK)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
src_x = x1;
|
|
|
|
src_y = y1;
|
|
|
|
first = TRUE;
|
|
|
|
}
|
|
|
|
/* otherwise, update the target */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dest_x = x1;
|
|
|
|
dest_y = y1;
|
1999-02-05 17:55:44 +08:00
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
if (options->aligned == ALIGN_REGISTERED)
|
1999-02-05 17:55:44 +08:00
|
|
|
{
|
|
|
|
offset_x = 0;
|
|
|
|
offset_y = 0;
|
|
|
|
}
|
|
|
|
else if (first)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
offset_x = src_x - dest_x;
|
|
|
|
offset_y = src_y - dest_y;
|
|
|
|
first = FALSE;
|
|
|
|
}
|
1999-02-05 17:55:44 +08:00
|
|
|
|
|
|
|
src_x = dest_x + offset_x;
|
|
|
|
src_y = dest_y + offset_y;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_motion (paint_tool, drawable, src_drawable_,
|
2001-11-20 21:53:21 +08:00
|
|
|
options->paint_options.pressure_options,
|
|
|
|
options->type,
|
|
|
|
offset_x, offset_y);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
case INIT_PAINT:
|
2001-04-19 21:01:44 +08:00
|
|
|
if (paint_tool->state & GDK_CONTROL_MASK)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1998-06-30 23:31:32 +08:00
|
|
|
the_src_gdisp = gdisp;
|
1999-02-05 17:55:44 +08:00
|
|
|
clone_set_src_drawable(drawable);
|
2001-11-14 00:21:34 +08:00
|
|
|
src_x = paint_tool->cur_coords.x;
|
|
|
|
src_y = paint_tool->cur_coords.y;
|
1997-11-25 06:05:25 +08:00
|
|
|
first = TRUE;
|
|
|
|
}
|
2001-11-20 21:53:21 +08:00
|
|
|
else if (options->aligned == ALIGN_NO)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
|
|
|
first = TRUE;
|
|
|
|
orig_src_x = src_x;
|
|
|
|
orig_src_y = src_y;
|
|
|
|
}
|
2001-11-20 21:53:21 +08:00
|
|
|
|
|
|
|
if (options->type == PATTERN_CLONE)
|
2001-07-07 20:17:23 +08:00
|
|
|
if (! gimp_context_get_pattern (context))
|
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 (_("No patterns available for this operation."));
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
case FINISH_PAINT:
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_draw_tool_stop (draw_tool);
|
2001-11-20 21:53:21 +08:00
|
|
|
if (options->aligned == ALIGN_NO && !first)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
|
|
|
src_x = orig_src_x;
|
|
|
|
src_y = orig_src_y;
|
2001-07-07 20:17:23 +08:00
|
|
|
}
|
2001-04-19 21:01:44 +08:00
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
default:
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate the coordinates of the target */
|
1998-06-30 23:31:32 +08:00
|
|
|
src_gdisp = the_src_gdisp;
|
2001-11-01 05:20:09 +08:00
|
|
|
if (! src_gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1998-06-30 23:31:32 +08:00
|
|
|
the_src_gdisp = gdisp;
|
|
|
|
src_gdisp = the_src_gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (state == INIT_PAINT)
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_draw_tool_start (draw_tool, src_gdisp);
|
2001-11-01 05:20:09 +08:00
|
|
|
}
|
1999-12-26 05:32:52 +08:00
|
|
|
else if (state == POSTTRACE_PAINT)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
|
|
|
/* Find the target cursor's location onscreen */
|
2002-02-05 19:35:03 +08:00
|
|
|
gdisplay_transform_coords (src_gdisp,
|
|
|
|
src_x, src_y,
|
|
|
|
&trans_tx, &trans_ty,
|
|
|
|
TRUE);
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_draw_tool_resume (draw_tool);
|
2000-01-14 20:41:00 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-05-15 20:13:43 +08:00
|
|
|
void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_clone_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
2002-02-05 01:43:01 +08:00
|
|
|
CloneOptions *options;
|
|
|
|
GimpLayer *layer;
|
|
|
|
GdkCursorType ctype = GIMP_MOUSE_CURSOR;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
options = (CloneOptions *) tool->tool_info->tool_options;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
if ((layer = gimp_image_get_active_layer (gdisp->gimage)))
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
|
|
|
int off_x, off_y;
|
2001-01-15 05:11:52 +08:00
|
|
|
|
|
|
|
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
1999-05-15 20:13:43 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
if (coords->x >= off_x &&
|
|
|
|
coords->y >= off_y &&
|
|
|
|
coords->x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) &&
|
|
|
|
coords->y < (off_y + gimp_drawable_height (GIMP_DRAWABLE (layer))))
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
|
|
|
/* One more test--is there a selected region?
|
|
|
|
* if so, is cursor inside?
|
|
|
|
*/
|
2001-11-29 06:42:19 +08:00
|
|
|
if (gimp_image_mask_is_empty (gdisp->gimage))
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_MOUSE_CURSOR;
|
2001-11-29 06:42:19 +08:00
|
|
|
else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y))
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_MOUSE_CURSOR;
|
1999-05-15 20:13:43 +08:00
|
|
|
}
|
|
|
|
}
|
1999-07-27 16:47:31 +08:00
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
if (options->type == IMAGE_CLONE)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
2001-11-09 03:14:51 +08:00
|
|
|
if (state & GDK_CONTROL_MASK)
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
|
2001-11-09 03:14:51 +08:00
|
|
|
else if (! src_drawable_)
|
2000-01-14 20:41:00 +08:00
|
|
|
ctype = GIMP_BAD_CURSOR;
|
|
|
|
}
|
1999-07-27 16:47:31 +08:00
|
|
|
|
2002-02-05 01:43:01 +08:00
|
|
|
tool->cursor = ctype;
|
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, gdisp);
|
1999-05-15 20:13:43 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-20 21:53:21 +08:00
|
|
|
CloneOptions *options;
|
|
|
|
|
|
|
|
options = (CloneOptions *) GIMP_TOOL (draw_tool)->tool_info->tool_options;
|
|
|
|
|
|
|
|
if (draw_tool->gc != NULL && options->type == IMAGE_CLONE)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-04-19 21:01:44 +08:00
|
|
|
gdk_draw_line (draw_tool->win, draw_tool->gc,
|
1997-11-25 06:05:25 +08:00
|
|
|
trans_tx - (TARGET_WIDTH >> 1), trans_ty,
|
|
|
|
trans_tx + (TARGET_WIDTH >> 1), trans_ty);
|
2001-04-19 21:01:44 +08:00
|
|
|
gdk_draw_line (draw_tool->win, draw_tool->gc,
|
1997-11-25 06:05:25 +08:00
|
|
|
trans_tx, trans_ty - (TARGET_HEIGHT >> 1),
|
|
|
|
trans_tx, trans_ty + (TARGET_HEIGHT >> 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_motion (GimpPaintTool *paint_tool,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpDrawable *src_drawable,
|
|
|
|
PaintPressureOptions *pressure_options,
|
|
|
|
CloneType type,
|
|
|
|
int offset_x,
|
|
|
|
int offset_y)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-02-05 01:34:30 +08:00
|
|
|
GimpImage *gimage;
|
|
|
|
GimpImage *src_gimage = NULL;
|
2001-07-07 20:17:23 +08:00
|
|
|
GimpContext *context;
|
2001-02-05 01:34:30 +08:00
|
|
|
guchar *s;
|
|
|
|
guchar *d;
|
|
|
|
TempBuf *orig;
|
|
|
|
TempBuf *area;
|
|
|
|
gpointer pr;
|
|
|
|
gint y;
|
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
gint has_alpha = -1;
|
|
|
|
PixelRegion srcPR, destPR;
|
|
|
|
GimpPattern *pattern;
|
|
|
|
gint opacity;
|
|
|
|
gdouble scale;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
pr = NULL;
|
|
|
|
pattern = NULL;
|
|
|
|
|
1998-10-19 04:37:43 +08:00
|
|
|
/* Make sure we still have a source if we are doing image cloning */
|
1999-04-19 05:22:41 +08:00
|
|
|
if (type == IMAGE_CLONE)
|
1998-10-19 04:37:43 +08:00
|
|
|
{
|
|
|
|
if (!src_drawable)
|
|
|
|
return;
|
2001-01-15 05:11:52 +08:00
|
|
|
if (! (src_gimage = gimp_drawable_gimage (src_drawable)))
|
1998-10-19 04:37:43 +08:00
|
|
|
return;
|
|
|
|
/* Determine whether the source image has an alpha channel */
|
2001-01-15 05:11:52 +08:00
|
|
|
has_alpha = gimp_drawable_has_alpha (src_drawable);
|
1998-10-19 04:37:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We always need a destination image */
|
2001-01-15 05:11:52 +08:00
|
|
|
if (! (gimage = gimp_drawable_gimage (drawable)))
|
1998-07-10 10:17:20 +08:00
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
context = gimp_get_current_context (gimage->gimp);
|
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
if (pressure_options->size)
|
2001-11-14 00:21:34 +08:00
|
|
|
scale = paint_tool->cur_coords.pressure;
|
1999-09-09 09:47:54 +08:00
|
|
|
else
|
|
|
|
scale = 1.0;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Get a region which can be used to paint to */
|
2001-04-19 21:01:44 +08:00
|
|
|
if (! (area = gimp_paint_tool_get_paint_area (paint_tool, drawable, scale)))
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
1999-04-19 05:22:41 +08:00
|
|
|
case IMAGE_CLONE:
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Set the paint area to transparent */
|
2001-01-03 03:14:24 +08:00
|
|
|
temp_buf_data_clear (area);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* If the source gimage is different from the destination,
|
|
|
|
* then we should copy straight from the destination image
|
|
|
|
* to the canvas.
|
|
|
|
* Otherwise, we need a call to get_orig_image to make sure
|
|
|
|
* we get a copy of the unblemished (offset) image
|
|
|
|
*/
|
1998-01-22 15:02:57 +08:00
|
|
|
if (src_drawable != drawable)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
x1 = CLAMP (area->x + offset_x, 0, gimp_drawable_width (src_drawable));
|
|
|
|
y1 = CLAMP (area->y + offset_y, 0, gimp_drawable_height (src_drawable));
|
2000-01-26 07:06:12 +08:00
|
|
|
x2 = CLAMP (area->x + offset_x + area->width,
|
2001-01-15 05:11:52 +08:00
|
|
|
0, gimp_drawable_width (src_drawable));
|
2000-01-26 07:06:12 +08:00
|
|
|
y2 = CLAMP (area->y + offset_y + area->height,
|
2001-01-15 05:11:52 +08:00
|
|
|
0, gimp_drawable_height (src_drawable));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (!(x2 - x1) || !(y2 - y1))
|
|
|
|
return;
|
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
pixel_region_init (&srcPR, gimp_drawable_data (src_drawable),
|
|
|
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
x1 = CLAMP (area->x + offset_x, 0, gimp_drawable_width (drawable));
|
|
|
|
y1 = CLAMP (area->y + offset_y, 0, gimp_drawable_height (drawable));
|
2000-01-26 07:06:12 +08:00
|
|
|
x2 = CLAMP (area->x + offset_x + area->width,
|
2001-01-15 05:11:52 +08:00
|
|
|
0, gimp_drawable_width (drawable));
|
2000-01-26 07:06:12 +08:00
|
|
|
y2 = CLAMP (area->y + offset_y + area->height,
|
2001-01-15 05:11:52 +08:00
|
|
|
0, gimp_drawable_height (drawable));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (!(x2 - x1) || !(y2 - y1))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* get the original image */
|
2001-04-19 21:01:44 +08:00
|
|
|
orig = gimp_paint_tool_get_orig_image (paint_tool, drawable, x1, y1, x2, y2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
srcPR.bytes = orig->bytes;
|
|
|
|
srcPR.x = 0; srcPR.y = 0;
|
|
|
|
srcPR.w = x2 - x1;
|
|
|
|
srcPR.h = y2 - y1;
|
|
|
|
srcPR.rowstride = srcPR.bytes * orig->width;
|
|
|
|
srcPR.data = temp_buf_data (orig);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset_x = x1 - (area->x + offset_x);
|
|
|
|
offset_y = y1 - (area->y + offset_y);
|
|
|
|
|
|
|
|
/* configure the destination */
|
|
|
|
destPR.bytes = area->bytes;
|
|
|
|
destPR.x = 0; destPR.y = 0;
|
|
|
|
destPR.w = srcPR.w;
|
|
|
|
destPR.h = srcPR.h;
|
|
|
|
destPR.rowstride = destPR.bytes * area->width;
|
|
|
|
destPR.data = temp_buf_data (area) + offset_y * destPR.rowstride +
|
|
|
|
offset_x * destPR.bytes;
|
|
|
|
|
|
|
|
pr = pixel_regions_register (2, &srcPR, &destPR);
|
|
|
|
break;
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
case PATTERN_CLONE:
|
2001-07-07 20:17:23 +08:00
|
|
|
pattern = gimp_context_get_pattern (context);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (!pattern)
|
|
|
|
return;
|
|
|
|
|
|
|
|
destPR.bytes = area->bytes;
|
|
|
|
destPR.x = 0; destPR.y = 0;
|
|
|
|
destPR.w = area->width;
|
|
|
|
destPR.h = area->height;
|
|
|
|
destPR.rowstride = destPR.bytes * area->width;
|
|
|
|
destPR.data = temp_buf_data (area);
|
|
|
|
|
|
|
|
pr = pixel_regions_register (1, &destPR);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; pr != NULL; pr = pixel_regions_process (pr))
|
|
|
|
{
|
|
|
|
s = srcPR.data;
|
|
|
|
d = destPR.data;
|
|
|
|
for (y = 0; y < destPR.h; y++)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
1999-04-19 05:22:41 +08:00
|
|
|
case IMAGE_CLONE:
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_line_image (gimage, src_gimage, drawable,
|
|
|
|
src_drawable, s, d, has_alpha,
|
|
|
|
srcPR.bytes, destPR.bytes, destPR.w);
|
1997-11-25 06:05:25 +08:00
|
|
|
s += srcPR.rowstride;
|
|
|
|
break;
|
1999-04-19 05:22:41 +08:00
|
|
|
case PATTERN_CLONE:
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_line_pattern (gimage, drawable, pattern, d,
|
|
|
|
area->x + offset_x,
|
|
|
|
area->y + y + offset_y,
|
|
|
|
destPR.bytes, destPR.w);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
d += destPR.rowstride;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
opacity = 255.0 * gimp_context_get_opacity (context);
|
1999-09-09 09:47:54 +08:00
|
|
|
if (pressure_options->opacity)
|
2001-11-14 00:21:34 +08:00
|
|
|
opacity = opacity * 2.0 * paint_tool->cur_coords.pressure;
|
1999-07-10 00:41:58 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* paste the newly painted canvas to the gimage which is being worked on */
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_paint_tool_paste_canvas (paint_tool, drawable,
|
|
|
|
MIN (opacity, 255),
|
2001-07-07 20:17:23 +08:00
|
|
|
(gint) (gimp_context_get_opacity (context) * 255),
|
|
|
|
gimp_context_get_paint_mode (context),
|
2001-04-19 21:01:44 +08:00
|
|
|
pressure_options->pressure ? PRESSURE : SOFT,
|
|
|
|
scale, CONSTANT);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-05-15 20:13:43 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_line_image (GimpImage *dest,
|
|
|
|
GimpImage *src,
|
|
|
|
GimpDrawable *d_drawable,
|
|
|
|
GimpDrawable *s_drawable,
|
|
|
|
guchar *s,
|
|
|
|
guchar *d,
|
|
|
|
gint has_alpha,
|
|
|
|
gint src_bytes,
|
|
|
|
gint dest_bytes,
|
|
|
|
gint width)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-04-19 21:01:44 +08:00
|
|
|
guchar rgb[3];
|
|
|
|
gint src_alpha, dest_alpha;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
src_alpha = src_bytes - 1;
|
1997-11-25 06:05:25 +08:00
|
|
|
dest_alpha = dest_bytes - 1;
|
|
|
|
|
|
|
|
while (width--)
|
|
|
|
{
|
2001-01-15 05:11:52 +08:00
|
|
|
gimp_image_get_color (src, gimp_drawable_type (s_drawable), rgb, s);
|
2001-12-11 23:58:07 +08:00
|
|
|
gimp_image_transform_color (dest, d_drawable, rgb, d, GIMP_RGB);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (has_alpha)
|
|
|
|
d[dest_alpha] = s[src_alpha];
|
|
|
|
else
|
1998-01-25 09:24:46 +08:00
|
|
|
d[dest_alpha] = OPAQUE_OPACITY;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
s += src_bytes;
|
|
|
|
d += dest_bytes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_line_pattern (GimpImage *dest,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPattern *pattern,
|
|
|
|
guchar *d,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint bytes,
|
|
|
|
gint width)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-12-14 23:30:31 +08:00
|
|
|
guchar *pat, *p;
|
|
|
|
GimpImageBaseType color_type;
|
|
|
|
gint alpha;
|
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Make sure x, y are positive */
|
|
|
|
while (x < 0)
|
|
|
|
x += pattern->mask->width;
|
|
|
|
while (y < 0)
|
|
|
|
y += pattern->mask->height;
|
|
|
|
|
|
|
|
/* Get a pointer to the appropriate scanline of the pattern buffer */
|
|
|
|
pat = temp_buf_data (pattern->mask) +
|
|
|
|
(y % pattern->mask->height) * pattern->mask->width * pattern->mask->bytes;
|
2001-12-14 23:30:31 +08:00
|
|
|
|
|
|
|
color_type = (pattern->mask->bytes == 3) ? GIMP_RGB : GIMP_GRAY;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
alpha = bytes - 1;
|
|
|
|
|
|
|
|
for (i = 0; i < width; i++)
|
|
|
|
{
|
|
|
|
p = pat + ((i + x) % pattern->mask->width) * pattern->mask->bytes;
|
|
|
|
|
2001-12-14 23:30:31 +08:00
|
|
|
gimp_image_transform_color (dest, drawable, p, d, color_type);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-01-25 09:24:46 +08:00
|
|
|
d[alpha] = OPAQUE_OPACITY;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
d += bytes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
#if 0 /* leave these to the stub functions. */
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static gpointer
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_non_gui_paint_func (GimpPaintTool *paint_tool,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
PaintState state)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_motion (paint_tool, drawable, non_gui_src_drawable,
|
|
|
|
&non_gui_pressure_options,
|
|
|
|
non_gui_type, non_gui_offset_x, non_gui_offset_y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1999-07-20 06:42:49 +08:00
|
|
|
gboolean
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_non_gui_default (GimpDrawable *drawable,
|
|
|
|
gint num_strokes,
|
|
|
|
gdouble *stroke_array)
|
1999-07-20 06:42:49 +08:00
|
|
|
{
|
|
|
|
GimpDrawable *src_drawable = NULL;
|
|
|
|
CloneType clone_type = CLONE_DEFAULT_TYPE;
|
2000-12-31 12:07:42 +08:00
|
|
|
gdouble local_src_x = 0.0;
|
|
|
|
gdouble local_src_y = 0.0;
|
1999-07-20 06:42:49 +08:00
|
|
|
CloneOptions *options = clone_options;
|
2000-12-31 12:07:42 +08:00
|
|
|
|
|
|
|
if (options)
|
1999-07-20 06:42:49 +08:00
|
|
|
{
|
|
|
|
clone_type = options->type;
|
|
|
|
src_drawable = src_drawable_;
|
|
|
|
local_src_x = src_x;
|
|
|
|
local_src_y = src_y;
|
|
|
|
}
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
return gimp_clone_tool_non_gui (drawable,
|
|
|
|
src_drawable,
|
|
|
|
clone_type,
|
|
|
|
local_src_x,local_src_y,
|
|
|
|
num_strokes, stroke_array);
|
1999-07-20 06:42:49 +08:00
|
|
|
}
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
gboolean
|
2001-04-19 21:01:44 +08:00
|
|
|
gimp_clone_tool_non_gui (GimpDrawable *drawable,
|
|
|
|
GimpDrawable *src_drawable,
|
|
|
|
CloneType clone_type,
|
|
|
|
gdouble src_x,
|
|
|
|
gdouble src_y,
|
|
|
|
gint num_strokes,
|
|
|
|
gdouble *stroke_array)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-31 12:07:42 +08:00
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
if (gimp_paint_tool_start (&non_gui_paint_tool, drawable,
|
|
|
|
stroke_array[0], stroke_array[1]))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-04-19 05:22:41 +08:00
|
|
|
/* Set the paint core's paint func */
|
1997-11-25 06:05:25 +08:00
|
|
|
non_gui_paint_core.paint_func = clone_non_gui_paint_func;
|
1999-07-20 06:42:49 +08:00
|
|
|
|
|
|
|
non_gui_type = clone_type;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
non_gui_src_drawable = src_drawable;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0];
|
|
|
|
non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1];
|
|
|
|
|
2001-11-14 00:21:34 +08:00
|
|
|
non_gui_offset_x = (int) (src_x - non_gui_paint_core.start_coords.x);
|
|
|
|
non_gui_offset_y = (int) (src_y - non_gui_paint_core.start_coords.y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-07-23 07:11:46 +08:00
|
|
|
clone_non_gui_paint_func (&non_gui_paint_core, drawable, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
for (i = 1; i < num_strokes; i++)
|
|
|
|
{
|
2001-11-14 00:21:34 +08:00
|
|
|
non_gui_paint_core.cur_coords.x = stroke_array[i * 2 + 0];
|
|
|
|
non_gui_paint_core.cur_coords.y = stroke_array[i * 2 + 1];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
paint_core_interpolate (&non_gui_paint_core, drawable);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-14 00:21:34 +08:00
|
|
|
non_gui_paint_core.last_coords.x = non_gui_paint_core.cur_coords.x;
|
|
|
|
non_gui_paint_core.last_coords.y = non_gui_paint_core.cur_coords.y;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
/* Finish the painting */
|
1998-01-22 15:02:57 +08:00
|
|
|
paint_core_finish (&non_gui_paint_core, drawable, -1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
/* Cleanup */
|
1997-11-25 06:05:25 +08:00
|
|
|
paint_core_cleanup ();
|
1999-04-19 05:22:41 +08:00
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-04-19 05:22:41 +08:00
|
|
|
else
|
|
|
|
return FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2001-04-19 21:01:44 +08:00
|
|
|
|
|
|
|
#endif /* 0 - non-gui functions */
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpToolOptions *
|
|
|
|
clone_options_new (GimpToolInfo *tool_info)
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
|
|
|
CloneOptions *options;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
options = g_new0 (CloneOptions, 1);
|
|
|
|
|
|
|
|
paint_options_init ((PaintOptions *) options, tool_info);
|
|
|
|
|
|
|
|
((GimpToolOptions *) options)->reset_func = clone_options_reset;
|
|
|
|
|
2001-04-19 21:01:44 +08:00
|
|
|
options->type = options->type_d = CLONE_DEFAULT_TYPE;
|
|
|
|
options->aligned = options->aligned_d = CLONE_DEFAULT_ALIGNED;
|
|
|
|
|
|
|
|
/* the main vbox */
|
2001-07-18 04:50:01 +08:00
|
|
|
vbox = ((GimpToolOptions *) options)->main_vbox;
|
2001-04-19 21:01:44 +08:00
|
|
|
|
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Source"),
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
2001-11-23 01:11:52 +08:00
|
|
|
&options->type,
|
|
|
|
GINT_TO_POINTER (options->type),
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2001-11-23 01:11:52 +08:00
|
|
|
_("Image Source"),
|
|
|
|
GINT_TO_POINTER (IMAGE_CLONE),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->type_w[0],
|
2001-11-23 01:11:52 +08:00
|
|
|
|
|
|
|
_("Pattern Source"),
|
|
|
|
GINT_TO_POINTER (PATTERN_CLONE),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->type_w[1],
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Alignment"),
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
2001-11-23 01:11:52 +08:00
|
|
|
&options->aligned,
|
|
|
|
GINT_TO_POINTER (options->aligned),
|
2001-04-19 21:01:44 +08:00
|
|
|
|
2001-11-23 01:11:52 +08:00
|
|
|
_("Non Aligned"),
|
|
|
|
GINT_TO_POINTER (ALIGN_NO),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->aligned_w[0],
|
2001-11-23 01:11:52 +08:00
|
|
|
|
|
|
|
_("Aligned"),
|
|
|
|
GINT_TO_POINTER (ALIGN_YES),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->aligned_w[1],
|
2001-11-23 01:11:52 +08:00
|
|
|
|
|
|
|
_("Registered"),
|
|
|
|
GINT_TO_POINTER (ALIGN_REGISTERED),
|
2001-04-19 21:01:44 +08:00
|
|
|
&options->aligned_w[2],
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
return (GimpToolOptions *) options;
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-07-18 04:50:01 +08:00
|
|
|
clone_options_reset (GimpToolOptions *tool_options)
|
2001-04-19 21:01:44 +08:00
|
|
|
{
|
|
|
|
CloneOptions *options;
|
|
|
|
|
|
|
|
options = (CloneOptions *) tool_options;
|
|
|
|
|
|
|
|
paint_options_reset (tool_options);
|
|
|
|
|
2001-11-23 01:11:52 +08:00
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->type_w[0]),
|
|
|
|
GINT_TO_POINTER (options->type_d));
|
|
|
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->aligned_w[0]),
|
|
|
|
GINT_TO_POINTER (options->aligned_d));
|
2001-04-19 21:01:44 +08:00
|
|
|
}
|