1999-07-02 00:52:50 +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
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
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"
|
|
|
|
|
2003-02-08 01:12:21 +08:00
|
|
|
#include <glib-object.h>
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#include "paint-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-12 01:20:34 +08:00
|
|
|
#include "paint-funcs/paint-funcs.h"
|
|
|
|
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpbrush.h"
|
|
|
|
#include "core/gimpdrawable.h"
|
2001-07-07 20:17:23 +08:00
|
|
|
#include "core/gimpimage.h"
|
2004-07-14 07:04:05 +08:00
|
|
|
#include "core/gimppickable.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#include "gimpsmudge.h"
|
2003-02-05 22:39:40 +08:00
|
|
|
#include "gimpsmudgeoptions.h"
|
2001-04-12 01:20:34 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
|
2004-07-19 22:37:40 +08:00
|
|
|
static void gimp_smudge_finalize (GObject *object);
|
|
|
|
|
|
|
|
static void gimp_smudge_paint (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpPaintState paint_state,
|
|
|
|
guint32 time);
|
|
|
|
static gboolean gimp_smudge_start (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options);
|
|
|
|
static void gimp_smudge_motion (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options);
|
1999-07-20 06:42:49 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
static void gimp_smudge_nonclipped_painthit_coords (GimpPaintCore *paint_core,
|
|
|
|
gint *x,
|
2003-07-14 22:50:41 +08:00
|
|
|
gint *y,
|
2002-02-15 03:31:16 +08:00
|
|
|
gint *w,
|
|
|
|
gint *h);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2000-01-14 20:41:00 +08:00
|
|
|
|
2005-12-08 05:11:53 +08:00
|
|
|
G_DEFINE_TYPE (GimpSmudge, gimp_smudge, GIMP_TYPE_BRUSH_CORE);
|
|
|
|
|
|
|
|
#define parent_class gimp_smudge_parent_class
|
2001-11-21 07:00:47 +08:00
|
|
|
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2002-02-27 21:57:49 +08:00
|
|
|
void
|
|
|
|
gimp_smudge_register (Gimp *gimp,
|
|
|
|
GimpPaintRegisterCallback callback)
|
|
|
|
{
|
2003-02-14 22:14:29 +08:00
|
|
|
(* callback) (gimp,
|
|
|
|
GIMP_TYPE_SMUDGE,
|
|
|
|
GIMP_TYPE_SMUDGE_OPTIONS,
|
|
|
|
_("Smudge"));
|
2002-02-27 21:57:49 +08:00
|
|
|
}
|
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
static void
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_smudge_class_init (GimpSmudgeClass *klass)
|
1999-07-02 00:52:50 +08:00
|
|
|
{
|
2004-05-26 04:41:09 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
|
2004-05-26 17:32:03 +08:00
|
|
|
GimpBrushCoreClass *brush_core_class = GIMP_BRUSH_CORE_CLASS (klass);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2004-05-26 17:32:03 +08:00
|
|
|
object_class->finalize = gimp_smudge_finalize;
|
|
|
|
|
|
|
|
paint_core_class->paint = gimp_smudge_paint;
|
2002-06-09 21:56:09 +08:00
|
|
|
|
2004-05-26 17:32:03 +08:00
|
|
|
brush_core_class->use_scale = FALSE;
|
2001-04-12 01:20:34 +08:00
|
|
|
}
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
static void
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_smudge_init (GimpSmudge *smudge)
|
2001-04-12 01:20:34 +08:00
|
|
|
{
|
2002-06-09 21:56:09 +08:00
|
|
|
smudge->initialized = FALSE;
|
|
|
|
smudge->accum_data = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_smudge_finalize (GObject *object)
|
|
|
|
{
|
2004-05-26 04:41:09 +08:00
|
|
|
GimpSmudge *smudge = GIMP_SMUDGE (object);
|
2002-06-09 21:56:09 +08:00
|
|
|
|
|
|
|
if (smudge->accum_data)
|
|
|
|
{
|
|
|
|
g_free (smudge->accum_data);
|
|
|
|
smudge->accum_data = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
1999-07-02 00:52:50 +08:00
|
|
|
}
|
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
static void
|
2004-07-19 22:37:40 +08:00
|
|
|
gimp_smudge_paint (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpPaintState paint_state,
|
|
|
|
guint32 time)
|
1999-07-02 00:52:50 +08:00
|
|
|
{
|
2004-05-26 04:41:09 +08:00
|
|
|
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
|
2001-11-20 21:53:21 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
switch (paint_state)
|
1999-07-02 00:52:50 +08:00
|
|
|
{
|
2004-07-19 22:37:40 +08:00
|
|
|
case GIMP_PAINT_STATE_MOTION:
|
2002-06-09 21:56:09 +08:00
|
|
|
/* initialization fails if the user starts outside the drawable */
|
|
|
|
if (! smudge->initialized)
|
2004-05-26 17:32:03 +08:00
|
|
|
smudge->initialized = gimp_smudge_start (paint_core, drawable,
|
|
|
|
paint_options);
|
2002-06-09 21:56:09 +08:00
|
|
|
|
|
|
|
if (smudge->initialized)
|
|
|
|
gimp_smudge_motion (paint_core, drawable, paint_options);
|
1999-07-02 00:52:50 +08:00
|
|
|
break;
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2004-07-19 22:37:40 +08:00
|
|
|
case GIMP_PAINT_STATE_FINISH:
|
2002-06-09 21:56:09 +08:00
|
|
|
if (smudge->accum_data)
|
|
|
|
{
|
|
|
|
g_free (smudge->accum_data);
|
|
|
|
smudge->accum_data = NULL;
|
|
|
|
}
|
|
|
|
smudge->initialized = FALSE;
|
1999-07-02 00:52:50 +08:00
|
|
|
break;
|
2000-12-31 12:07:42 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
1999-07-02 00:52:50 +08:00
|
|
|
}
|
|
|
|
|
2001-04-12 01:20:34 +08:00
|
|
|
return;
|
1999-07-02 00:52:50 +08:00
|
|
|
}
|
|
|
|
|
2000-01-15 02:45:36 +08:00
|
|
|
static gboolean
|
2004-05-26 17:32:03 +08:00
|
|
|
gimp_smudge_start (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options)
|
1999-07-02 00:52:50 +08:00
|
|
|
{
|
2004-05-26 04:41:09 +08:00
|
|
|
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
|
2001-04-12 01:20:34 +08:00
|
|
|
GimpImage *gimage;
|
2000-12-31 12:07:42 +08:00
|
|
|
TempBuf *area;
|
1999-07-02 00:52:50 +08:00
|
|
|
PixelRegion srcPR;
|
2005-09-04 01:16:58 +08:00
|
|
|
gint bytes;
|
2000-12-31 12:07:42 +08:00
|
|
|
gint x, y, w, h;
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
if (gimp_drawable_is_indexed (drawable))
|
2000-01-15 02:45:36 +08:00
|
|
|
return FALSE;
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2004-05-26 17:32:03 +08:00
|
|
|
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
|
|
|
if (! area)
|
2000-01-15 02:45:36 +08:00
|
|
|
return FALSE;
|
2003-06-13 19:12:04 +08:00
|
|
|
|
2000-01-15 02:45:36 +08:00
|
|
|
/* adjust the x and y coordinates to the upper left corner of the brush */
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_smudge_nonclipped_painthit_coords (paint_core, &x, &y, &w, &h);
|
2003-06-09 23:24:30 +08:00
|
|
|
|
2005-09-04 01:16:58 +08:00
|
|
|
|
2003-06-09 23:24:30 +08:00
|
|
|
/* Allocate the accumulation buffer */
|
2005-09-04 01:16:58 +08:00
|
|
|
bytes = gimp_drawable_bytes (drawable);
|
|
|
|
smudge->accum_data = g_malloc (w * h * bytes);
|
2003-06-13 19:12:04 +08:00
|
|
|
|
2003-06-13 19:16:08 +08:00
|
|
|
/* If clipped, prefill the smudge buffer
|
|
|
|
with the color at the brush position. */
|
|
|
|
if (x != area->x || y != area->y || w != area->width || h != area->height)
|
2003-06-13 19:12:04 +08:00
|
|
|
{
|
|
|
|
guchar *fill;
|
|
|
|
|
2004-07-14 07:04:05 +08:00
|
|
|
fill = gimp_pickable_get_color_at (GIMP_PICKABLE (drawable),
|
2003-06-13 19:12:04 +08:00
|
|
|
CLAMP ((gint) paint_core->cur_coords.x,
|
|
|
|
0, gimp_item_width (GIMP_ITEM (drawable)) - 1),
|
|
|
|
CLAMP ((gint) paint_core->cur_coords.y,
|
|
|
|
0, gimp_item_height (GIMP_ITEM (drawable)) - 1));
|
|
|
|
g_return_val_if_fail (fill != NULL, FALSE);
|
|
|
|
|
2005-09-04 01:16:58 +08:00
|
|
|
pixel_region_init_data (&srcPR, smudge->accum_data,
|
|
|
|
bytes, bytes * w,
|
|
|
|
0, 0, w, h);
|
2003-07-14 22:50:41 +08:00
|
|
|
|
2003-06-13 19:12:04 +08:00
|
|
|
color_region (&srcPR, fill);
|
|
|
|
g_free (fill);
|
|
|
|
}
|
1999-09-26 12:53:59 +08:00
|
|
|
|
2003-07-14 22:50:41 +08:00
|
|
|
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
2001-01-15 05:11:52 +08:00
|
|
|
area->x, area->y, area->width, area->height, FALSE);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2005-09-04 01:16:58 +08:00
|
|
|
pixel_region_init_data (&smudge->accumPR, smudge->accum_data,
|
|
|
|
bytes, bytes * w,
|
|
|
|
area->x - x,
|
|
|
|
area->y - y,
|
|
|
|
area->width,
|
|
|
|
area->height);
|
|
|
|
|
1999-07-02 00:52:50 +08:00
|
|
|
/* copy the region under the original painthit. */
|
2002-06-09 21:56:09 +08:00
|
|
|
copy_region (&srcPR, &smudge->accumPR);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2005-09-04 01:16:58 +08:00
|
|
|
pixel_region_init_data (&smudge->accumPR, smudge->accum_data,
|
|
|
|
bytes, bytes * w,
|
|
|
|
area->x - x,
|
|
|
|
area->y - y,
|
|
|
|
area->width,
|
|
|
|
area->height);
|
1999-09-26 12:53:59 +08:00
|
|
|
|
2000-01-15 02:45:36 +08:00
|
|
|
return TRUE;
|
1999-07-02 00:52:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-06-09 21:56:09 +08:00
|
|
|
gimp_smudge_motion (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options)
|
1999-07-02 00:52:50 +08:00
|
|
|
{
|
2004-05-26 04:41:09 +08:00
|
|
|
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
|
|
|
|
GimpSmudgeOptions *options = GIMP_SMUDGE_OPTIONS (paint_options);
|
|
|
|
GimpContext *context = GIMP_CONTEXT (paint_options);
|
|
|
|
GimpPressureOptions *pressure_options = paint_options->pressure_options;
|
2003-02-06 00:59:04 +08:00
|
|
|
GimpImage *gimage;
|
2002-06-09 21:56:09 +08:00
|
|
|
TempBuf *area;
|
|
|
|
PixelRegion srcPR, destPR, tempPR;
|
|
|
|
gdouble rate;
|
|
|
|
gdouble opacity;
|
|
|
|
gint x, y, w, h;
|
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2001-01-15 05:11:52 +08:00
|
|
|
if (gimp_drawable_is_indexed (drawable))
|
1999-07-02 00:52:50 +08:00
|
|
|
return;
|
|
|
|
|
2003-07-16 19:25:37 +08:00
|
|
|
opacity = gimp_paint_options_get_fade (paint_options, gimage,
|
|
|
|
paint_core->pixel_dist);
|
|
|
|
if (opacity == 0.0)
|
|
|
|
return;
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_smudge_nonclipped_painthit_coords (paint_core, &x, &y, &w, &h);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2003-07-16 19:25:37 +08:00
|
|
|
/* Get the paint area (Smudge won't scale!) */
|
2004-05-26 17:32:03 +08:00
|
|
|
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
|
|
|
if (! area)
|
1999-07-02 00:52:50 +08:00
|
|
|
return;
|
|
|
|
|
2003-06-09 23:24:30 +08:00
|
|
|
/* srcPR will be the pixels under the current painthit from the drawable */
|
2003-07-14 22:50:41 +08:00
|
|
|
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
2000-01-14 20:41:00 +08:00
|
|
|
area->x, area->y, area->width, area->height, FALSE);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
1999-11-13 09:02:27 +08:00
|
|
|
/* Enable pressure sensitive rate */
|
|
|
|
if (pressure_options->rate)
|
2004-05-24 21:11:43 +08:00
|
|
|
rate = MIN (options->rate / 100.0 * PRESSURE_SCALE *
|
|
|
|
paint_core->cur_coords.pressure, 1.0);
|
1999-09-09 09:47:54 +08:00
|
|
|
else
|
2002-06-09 21:56:09 +08:00
|
|
|
rate = options->rate / 100.0;
|
1999-09-09 09:47:54 +08:00
|
|
|
|
2003-07-14 22:50:41 +08:00
|
|
|
/* The tempPR will be the built up buffer (for smudge) */
|
2005-09-04 01:16:58 +08:00
|
|
|
pixel_region_init_data (&tempPR, smudge->accum_data,
|
|
|
|
smudge->accumPR.bytes,
|
|
|
|
smudge->accumPR.rowstride,
|
|
|
|
area->x - x,
|
|
|
|
area->y - y,
|
|
|
|
area->width,
|
|
|
|
area->height);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2003-07-14 22:50:41 +08:00
|
|
|
/* The dest will be the paint area we got above (= canvas_buf) */
|
2005-09-04 01:16:58 +08:00
|
|
|
pixel_region_init_temp_buf (&destPR, area,
|
|
|
|
0, 0, area->width, area->height);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
2002-06-09 21:56:09 +08:00
|
|
|
/* Smudge uses the buffer Accum.
|
|
|
|
* For each successive painthit Accum is built like this
|
|
|
|
* Accum = rate*Accum + (1-rate)*I.
|
2003-07-14 22:50:41 +08:00
|
|
|
* where I is the pixels under the current painthit.
|
|
|
|
* Then the paint area (canvas_buf) is built as
|
2002-06-09 21:56:09 +08:00
|
|
|
* (Accum,1) (if no alpha),
|
|
|
|
*/
|
1999-07-02 00:52:50 +08:00
|
|
|
|
1999-11-13 09:02:27 +08:00
|
|
|
blend_region (&srcPR, &tempPR, &tempPR, ROUND (rate * 255.0));
|
1999-07-02 00:52:50 +08:00
|
|
|
|
|
|
|
/* re-init the tempPR */
|
2005-09-04 01:16:58 +08:00
|
|
|
pixel_region_init_data (&tempPR, smudge->accum_data,
|
|
|
|
smudge->accumPR.bytes,
|
|
|
|
smudge->accumPR.rowstride,
|
|
|
|
area->x - x,
|
|
|
|
area->y - y,
|
|
|
|
area->width,
|
|
|
|
area->height);
|
2002-06-09 21:56:09 +08:00
|
|
|
|
|
|
|
if (! gimp_drawable_has_alpha (drawable))
|
|
|
|
add_alpha_region (&tempPR, &destPR);
|
|
|
|
else
|
2000-02-09 04:48:48 +08:00
|
|
|
copy_region (&tempPR, &destPR);
|
1999-07-02 00:52:50 +08:00
|
|
|
|
1999-09-09 09:47:54 +08:00
|
|
|
if (pressure_options->opacity)
|
2004-05-24 21:11:43 +08:00
|
|
|
opacity *= PRESSURE_SCALE * paint_core->cur_coords.pressure;
|
1999-09-09 09:47:54 +08:00
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
2002-03-04 01:38:12 +08:00
|
|
|
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
2003-07-16 19:25:37 +08:00
|
|
|
gimp_context_get_opacity (context),
|
2003-07-14 22:50:41 +08:00
|
|
|
gimp_paint_options_get_brush_mode (paint_options),
|
2002-06-09 21:56:09 +08:00
|
|
|
GIMP_PAINT_INCREMENTAL);
|
1999-07-02 00:52:50 +08:00
|
|
|
}
|
2001-04-12 01:20:34 +08:00
|
|
|
|
2003-07-14 22:50:41 +08:00
|
|
|
static void
|
2002-02-15 03:31:16 +08:00
|
|
|
gimp_smudge_nonclipped_painthit_coords (GimpPaintCore *paint_core,
|
2003-07-14 22:50:41 +08:00
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *w,
|
2002-02-15 03:31:16 +08:00
|
|
|
gint *h)
|
2001-04-12 01:20:34 +08:00
|
|
|
{
|
2004-05-26 04:41:09 +08:00
|
|
|
GimpBrushCore *brush_core = GIMP_BRUSH_CORE (paint_core);
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
/* Note: these are the brush mask size plus a border of 1 pixel */
|
2004-05-26 04:41:09 +08:00
|
|
|
*x = (gint) paint_core->cur_coords.x - brush_core->brush->mask->width / 2 - 1;
|
|
|
|
*y = (gint) paint_core->cur_coords.y - brush_core->brush->mask->height / 2 - 1;
|
|
|
|
*w = brush_core->brush->mask->width + 2;
|
|
|
|
*h = brush_core->brush->mask->height + 2;
|
2001-04-12 01:20:34 +08:00
|
|
|
}
|