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"
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "apptypes.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "appenv.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "cursorutil.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "draw_core.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "drawable.h"
|
|
|
|
#include "gdisplay.h"
|
|
|
|
#include "gimage_mask.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "gimpcontext.h"
|
|
|
|
#include "gimpimage.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "paint_funcs.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "patterns.h"
|
|
|
|
#include "pixel_region.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "selection.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
#include "temp_buf.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
|
|
|
#include "clone.h"
|
|
|
|
#include "paint_core.h"
|
|
|
|
#include "paint_options.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "tools.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
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#define TARGET_HEIGHT 15
|
|
|
|
#define TARGET_WIDTH 15
|
|
|
|
|
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 */
|
|
|
|
|
|
|
|
static gpointer clone_paint_func (PaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
PaintState state);
|
|
|
|
static void clone_draw (Tool *tool);
|
|
|
|
static void clone_motion (PaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpDrawable *src_drawable,
|
|
|
|
PaintPressureOptions *pressure_options,
|
|
|
|
CloneType type,
|
|
|
|
gint offset_x,
|
|
|
|
gint offset_y);
|
|
|
|
static void clone_line_image (GImage *dest,
|
|
|
|
GImage *src,
|
|
|
|
GimpDrawable *d_drawable,
|
|
|
|
GimpDrawable *s_drawable,
|
|
|
|
guchar *s,
|
|
|
|
guchar *d,
|
|
|
|
gint has_alpha,
|
|
|
|
gint src_bytes,
|
|
|
|
gint dest_bytes,
|
|
|
|
gint width);
|
|
|
|
static void clone_line_pattern (GImage *dest,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GPattern *pattern,
|
|
|
|
guchar *d,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint bytes,
|
|
|
|
gint width);
|
|
|
|
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* the clone tool options */
|
1999-04-09 06:25:54 +08:00
|
|
|
static CloneOptions *clone_options = NULL;
|
|
|
|
|
|
|
|
/* local variables */
|
2000-12-31 12:07:42 +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;
|
|
|
|
static gint trans_tx, trans_ty; /* transformed target */
|
1999-04-09 06:25:54 +08:00
|
|
|
static GDisplay *the_src_gdisp = NULL; /* ID of source gdisplay */
|
|
|
|
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;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
static void
|
1999-04-13 01:55:06 +08:00
|
|
|
clone_options_reset (void)
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
|
|
|
CloneOptions *options = clone_options;
|
|
|
|
|
1999-04-22 22:34:00 +08:00
|
|
|
paint_options_reset ((PaintOptions *) options);
|
|
|
|
|
1999-04-18 07:18:43 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->aligned_w[options->aligned_d]), TRUE);
|
1999-04-09 06:25:54 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static CloneOptions *
|
1999-04-13 01:55:06 +08:00
|
|
|
clone_options_new (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
CloneOptions *options;
|
2000-12-31 12:07:42 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *frame;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* the new clone tool options structure */
|
2000-01-14 20:41:00 +08:00
|
|
|
options = g_new (CloneOptions, 1);
|
1999-04-22 22:34:00 +08:00
|
|
|
paint_options_init ((PaintOptions *) options,
|
|
|
|
CLONE,
|
|
|
|
clone_options_reset);
|
1999-07-20 06:42:49 +08:00
|
|
|
options->type = options->type_d = CLONE_DEFAULT_TYPE;
|
|
|
|
options->aligned = options->aligned_d = CLONE_DEFAULT_ALIGNED;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* the main vbox */
|
1999-04-22 22:34:00 +08:00
|
|
|
vbox = ((ToolOptions *) options)->main_vbox;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Source"),
|
|
|
|
gimp_radio_button_update,
|
|
|
|
&options->type, (gpointer) options->type,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
_("Image Source"), (gpointer) IMAGE_CLONE,
|
|
|
|
&options->type_w[0],
|
|
|
|
_("Pattern Source"), (gpointer) PATTERN_CLONE,
|
|
|
|
&options->type_w[1],
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
1999-02-05 17:55:44 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
frame = gimp_radio_group_new2 (TRUE, _("Alignment"),
|
|
|
|
gimp_radio_button_update,
|
|
|
|
&options->aligned, (gpointer) options->aligned,
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
_("Non Aligned"), (gpointer) ALIGN_NO,
|
|
|
|
&options->aligned_w[0],
|
|
|
|
_("Aligned"), (gpointer) ALIGN_YES,
|
|
|
|
&options->aligned_w[1],
|
|
|
|
_("Registered"), (gpointer) ALIGN_REGISTERED,
|
|
|
|
&options->aligned_w[2],
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
1999-02-05 17:55:44 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
1999-02-05 17:55:44 +08:00
|
|
|
static void
|
1999-06-22 06:12:07 +08:00
|
|
|
clone_src_drawable_destroyed_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;
|
|
|
|
if (src_drawable_)
|
2000-01-14 20:41:00 +08:00
|
|
|
gtk_signal_disconnect_by_data (GTK_OBJECT (src_drawable_), &src_drawable_);
|
1999-02-05 17:55:44 +08:00
|
|
|
src_drawable_ = drawable;
|
|
|
|
if (drawable)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
|
|
|
gtk_signal_connect (GTK_OBJECT (drawable), "destroy",
|
|
|
|
GTK_SIGNAL_FUNC (clone_src_drawable_destroyed_cb),
|
|
|
|
&src_drawable_);
|
|
|
|
}
|
1999-02-05 17:55:44 +08:00
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static gpointer
|
1999-06-22 06:12:07 +08:00
|
|
|
clone_paint_func (PaintCore *paint_core,
|
1998-01-22 15:02:57 +08:00
|
|
|
GimpDrawable *drawable,
|
2000-12-31 12:07:42 +08:00
|
|
|
PaintState state)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-31 12:07:42 +08:00
|
|
|
GDisplay *gdisp;
|
|
|
|
GDisplay *src_gdisp;
|
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
static gint orig_src_x, orig_src_y;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
gdisp = (GDisplay *) active_tool->gdisp;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
2000-01-14 20:41:00 +08:00
|
|
|
case PRETRACE_PAINT:
|
1999-12-26 05:32:52 +08:00
|
|
|
draw_core_pause (paint_core->core, active_tool);
|
|
|
|
break;
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
case MOTION_PAINT:
|
1997-11-25 06:05:25 +08:00
|
|
|
x1 = paint_core->curx;
|
|
|
|
y1 = paint_core->cury;
|
|
|
|
x2 = paint_core->lastx;
|
|
|
|
y2 = paint_core->lasty;
|
|
|
|
|
|
|
|
/* If the control key is down, move the src target and return */
|
1999-02-21 07:20:54 +08:00
|
|
|
if (paint_core->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
|
|
|
|
1999-12-23 07:30:43 +08:00
|
|
|
if (clone_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
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
clone_motion (paint_core, drawable, src_drawable_,
|
|
|
|
clone_options->paint_options.pressure_options,
|
|
|
|
clone_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:
|
1999-02-21 07:20:54 +08:00
|
|
|
if (paint_core->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);
|
1997-11-25 06:05:25 +08:00
|
|
|
src_x = paint_core->curx;
|
|
|
|
src_y = paint_core->cury;
|
|
|
|
first = TRUE;
|
|
|
|
}
|
1999-12-23 07:30:43 +08:00
|
|
|
else if (clone_options->aligned == ALIGN_NO)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
|
|
|
first = TRUE;
|
|
|
|
orig_src_x = src_x;
|
|
|
|
orig_src_y = src_y;
|
|
|
|
}
|
1999-04-19 05:22:41 +08:00
|
|
|
if (clone_options->type == PATTERN_CLONE)
|
1999-10-27 02:27:27 +08:00
|
|
|
if (! gimp_context_get_pattern (NULL))
|
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:
|
1997-11-25 06:05:25 +08:00
|
|
|
draw_core_stop (paint_core->core, active_tool);
|
1999-12-23 07:30:43 +08:00
|
|
|
if (clone_options->aligned == ALIGN_NO && !first)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
|
|
|
src_x = orig_src_x;
|
|
|
|
src_y = orig_src_y;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
return NULL;
|
|
|
|
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;
|
1997-11-25 06:05:25 +08:00
|
|
|
if (!src_gdisp)
|
|
|
|
{
|
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)
|
|
|
|
/* Initialize the tool drawing core */
|
|
|
|
draw_core_start (paint_core->core,
|
|
|
|
src_gdisp->canvas->window,
|
|
|
|
active_tool);
|
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 */
|
|
|
|
gdisplay_transform_coords (src_gdisp, src_x, src_y,
|
|
|
|
&trans_tx, &trans_ty, 1);
|
|
|
|
draw_core_resume (paint_core->core, active_tool);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1999-05-15 20:13:43 +08:00
|
|
|
void
|
1999-06-22 06:12:07 +08:00
|
|
|
clone_cursor_update (Tool *tool,
|
|
|
|
GdkEventMotion *mevent,
|
2000-12-31 12:07:42 +08:00
|
|
|
GDisplay *gdisp)
|
1999-05-15 20:13:43 +08:00
|
|
|
{
|
2000-12-31 12:07:42 +08:00
|
|
|
Layer *layer;
|
|
|
|
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
|
|
|
|
gint x, y;
|
1999-05-15 20:13:43 +08:00
|
|
|
|
|
|
|
gdisplay_untransform_coords (gdisp, (double) mevent->x, (double) mevent->y,
|
|
|
|
&x, &y, TRUE, FALSE);
|
|
|
|
|
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
|
|
|
|
|
|
|
if (x >= off_x && y >= off_y &&
|
2001-01-15 05:11:52 +08:00
|
|
|
x < (off_x + gimp_drawable_width (GIMP_DRAWABLE (layer))) &&
|
|
|
|
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?
|
|
|
|
*/
|
|
|
|
if (gimage_mask_is_empty (gdisp->gimage))
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_MOUSE_CURSOR;
|
1999-05-15 20:13:43 +08:00
|
|
|
else if (gimage_mask_value (gdisp->gimage, x, 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
|
|
|
|
|
|
|
if (clone_options->type == IMAGE_CLONE)
|
2000-01-14 20:41:00 +08:00
|
|
|
{
|
|
|
|
if (mevent->state & GDK_CONTROL_MASK)
|
2000-06-14 18:59:16 +08:00
|
|
|
ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
|
2000-01-14 20:41:00 +08:00
|
|
|
else if (!src_drawable_)
|
|
|
|
ctype = GIMP_BAD_CURSOR;
|
|
|
|
}
|
1999-07-27 16:47:31 +08:00
|
|
|
|
2000-06-14 18:59:16 +08:00
|
|
|
gdisplay_install_tool_cursor (gdisp, ctype,
|
|
|
|
ctype == GIMP_CROSSHAIR_SMALL_CURSOR ?
|
|
|
|
TOOL_TYPE_NONE : CLONE,
|
|
|
|
CURSOR_MODIFIER_NONE,
|
|
|
|
FALSE);
|
1999-05-15 20:13:43 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
Tool *
|
2000-01-14 20:41:00 +08:00
|
|
|
tools_new_clone (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
Tool * tool;
|
|
|
|
PaintCore * private;
|
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
/* The tool options */
|
1997-11-25 06:05:25 +08:00
|
|
|
if (! clone_options)
|
1999-04-13 01:55:06 +08:00
|
|
|
{
|
|
|
|
clone_options = clone_options_new ();
|
|
|
|
tools_register (CLONE, (ToolOptions *) clone_options);
|
1999-04-18 07:18:43 +08:00
|
|
|
|
|
|
|
/* press all default buttons */
|
|
|
|
clone_options_reset ();
|
1999-04-13 01:55:06 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
tool = paint_core_new (CLONE);
|
1999-05-15 20:13:43 +08:00
|
|
|
/* the clone tool provides its own cursor_update_function
|
|
|
|
until I figure out somethinh nicer -- Sven */
|
|
|
|
tool->cursor_update_func = clone_cursor_update;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
private = (PaintCore *) tool->private;
|
|
|
|
private->paint_func = clone_paint_func;
|
|
|
|
private->core->draw_func = clone_draw;
|
1999-12-26 05:32:52 +08:00
|
|
|
private->flags |= TOOL_TRACES_ON_WINDOW;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
return tool;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tools_free_clone (Tool *tool)
|
|
|
|
{
|
|
|
|
paint_core_free (tool);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clone_draw (Tool *tool)
|
|
|
|
{
|
|
|
|
PaintCore * paint_core;
|
|
|
|
|
|
|
|
paint_core = (PaintCore *) tool->private;
|
|
|
|
|
1999-05-15 20:13:43 +08:00
|
|
|
if (paint_core->core->gc != NULL && clone_options->type == IMAGE_CLONE)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
gdk_draw_line (paint_core->core->win, paint_core->core->gc,
|
|
|
|
trans_tx - (TARGET_WIDTH >> 1), trans_ty,
|
|
|
|
trans_tx + (TARGET_WIDTH >> 1), trans_ty);
|
|
|
|
gdk_draw_line (paint_core->core->win, paint_core->core->gc,
|
|
|
|
trans_tx, trans_ty - (TARGET_HEIGHT >> 1),
|
|
|
|
trans_tx, trans_ty + (TARGET_HEIGHT >> 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-09-09 09:47:54 +08:00
|
|
|
clone_motion (PaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpDrawable *src_drawable,
|
|
|
|
PaintPressureOptions *pressure_options,
|
|
|
|
CloneType type,
|
|
|
|
int offset_x,
|
|
|
|
int offset_y)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
GImage *gimage;
|
1998-10-19 04:37:43 +08:00
|
|
|
GImage *src_gimage = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
unsigned char * s;
|
|
|
|
unsigned char * d;
|
|
|
|
TempBuf * orig;
|
|
|
|
TempBuf * area;
|
|
|
|
void * pr;
|
|
|
|
int y;
|
|
|
|
int x1, y1, x2, y2;
|
1998-10-19 04:37:43 +08:00
|
|
|
int has_alpha = -1;
|
1997-11-25 06:05:25 +08:00
|
|
|
PixelRegion srcPR, destPR;
|
1999-11-14 18:50:19 +08:00
|
|
|
GPattern *pattern;
|
1999-07-10 00:41:58 +08:00
|
|
|
gint opacity;
|
1999-09-09 09:47:54 +08:00
|
|
|
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
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
if (pressure_options->size)
|
|
|
|
scale = paint_core->curpressure;
|
|
|
|
else
|
|
|
|
scale = 1.0;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Get a region which can be used to paint to */
|
1999-09-09 09:47:54 +08:00
|
|
|
if (! (area = paint_core_get_paint_area (paint_core, 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 */
|
1998-01-22 15:02:57 +08:00
|
|
|
orig = paint_core_get_orig_image (paint_core, 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:
|
1999-10-27 02:27:27 +08:00
|
|
|
pattern = gimp_context_get_pattern (NULL);
|
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:
|
1998-01-22 15:02:57 +08:00
|
|
|
clone_line_image (gimage, src_gimage, drawable, src_drawable, s, d,
|
1997-11-25 06:05:25 +08:00
|
|
|
has_alpha, srcPR.bytes, destPR.bytes, destPR.w);
|
|
|
|
s += srcPR.rowstride;
|
|
|
|
break;
|
1999-04-19 05:22:41 +08:00
|
|
|
case PATTERN_CLONE:
|
1998-01-22 15:02:57 +08:00
|
|
|
clone_line_pattern (gimage, drawable, pattern, d,
|
1997-11-25 06:05:25 +08:00
|
|
|
area->x + offset_x, area->y + y + offset_y,
|
|
|
|
destPR.bytes, destPR.w);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
d += destPR.rowstride;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
opacity = 255.0 * gimp_context_get_opacity (NULL);
|
|
|
|
if (pressure_options->opacity)
|
|
|
|
opacity = opacity * 2.0 * paint_core->curpressure;
|
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 */
|
1999-09-09 09:47:54 +08:00
|
|
|
paint_core_paste_canvas (paint_core, drawable,
|
|
|
|
MIN (opacity, 255),
|
1999-07-06 23:18:25 +08:00
|
|
|
(int) (gimp_context_get_opacity (NULL) * 255),
|
|
|
|
gimp_context_get_paint_mode (NULL),
|
1999-09-09 09:47:54 +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
|
|
|
|
clone_line_image (GImage *dest,
|
|
|
|
GImage *src,
|
1998-01-22 15:02:57 +08:00
|
|
|
GimpDrawable *d_drawable,
|
|
|
|
GimpDrawable *s_drawable,
|
1997-11-25 06:05:25 +08:00
|
|
|
unsigned char *s,
|
|
|
|
unsigned char *d,
|
|
|
|
int has_alpha,
|
|
|
|
int src_bytes,
|
|
|
|
int dest_bytes,
|
|
|
|
int width)
|
|
|
|
{
|
|
|
|
unsigned char rgb[3];
|
|
|
|
int src_alpha, dest_alpha;
|
|
|
|
|
|
|
|
src_alpha = src_bytes - 1;
|
|
|
|
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);
|
2000-12-29 23:22:01 +08:00
|
|
|
gimp_image_transform_color (dest, d_drawable, rgb, d, 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
|
|
|
|
clone_line_pattern (GImage *dest,
|
1998-01-22 15:02:57 +08:00
|
|
|
GimpDrawable *drawable,
|
1999-11-14 18:50:19 +08:00
|
|
|
GPattern *pattern,
|
1997-11-25 06:05:25 +08:00
|
|
|
unsigned char *d,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int bytes,
|
|
|
|
int width)
|
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
guchar *pat, *p;
|
|
|
|
gint color, 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;
|
|
|
|
color = (pattern->mask->bytes == 3) ? RGB : GRAY;
|
|
|
|
|
|
|
|
alpha = bytes - 1;
|
|
|
|
|
|
|
|
for (i = 0; i < width; i++)
|
|
|
|
{
|
|
|
|
p = pat + ((i + x) % pattern->mask->width) * pattern->mask->bytes;
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
gimp_image_transform_color (dest, drawable, p, d, color);
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static gpointer
|
|
|
|
clone_non_gui_paint_func (PaintCore *paint_core,
|
1998-01-22 15:02:57 +08:00
|
|
|
GimpDrawable *drawable,
|
2000-12-31 12:07:42 +08:00
|
|
|
PaintState state)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2000-12-29 23:22:01 +08:00
|
|
|
clone_motion (paint_core, drawable, non_gui_src_drawable,
|
|
|
|
&non_gui_pressure_options,
|
1997-11-25 06:05:25 +08:00
|
|
|
non_gui_type, non_gui_offset_x, non_gui_offset_y);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1999-07-20 06:42:49 +08:00
|
|
|
gboolean
|
|
|
|
clone_non_gui_default (GimpDrawable *drawable,
|
2000-12-31 12:07:42 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
return clone_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
|
|
|
|
clone_non_gui (GimpDrawable *drawable,
|
|
|
|
GimpDrawable *src_drawable,
|
|
|
|
CloneType clone_type,
|
2000-12-31 12:07:42 +08:00
|
|
|
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
|
|
|
|
1999-04-19 05:22:41 +08:00
|
|
|
if (paint_core_init (&non_gui_paint_core, 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];
|
|
|
|
|
|
|
|
non_gui_offset_x = (int) (src_x - non_gui_paint_core.startx);
|
|
|
|
non_gui_offset_y = (int) (src_y - non_gui_paint_core.starty);
|
|
|
|
|
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++)
|
|
|
|
{
|
|
|
|
non_gui_paint_core.curx = stroke_array[i * 2 + 0];
|
|
|
|
non_gui_paint_core.cury = stroke_array[i * 2 + 1];
|
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
paint_core_interpolate (&non_gui_paint_core, drawable);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
non_gui_paint_core.lastx = non_gui_paint_core.curx;
|
|
|
|
non_gui_paint_core.lasty = non_gui_paint_core.cury;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|