2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1998-06-15 06:42:36 +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
|
|
|
|
* 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"
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
#include <string.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
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
2004-05-26 23:34:45 +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-07 23:58:26 +08:00
|
|
|
#include "paint-funcs/paint-funcs.h"
|
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2007-02-04 02:48:00 +08:00
|
|
|
#include "core/gimpimage-undo.h"
|
2001-09-26 07:23:09 +08:00
|
|
|
|
2003-02-05 22:39:40 +08:00
|
|
|
#include "gimpinkoptions.h"
|
2004-05-26 23:34:45 +08:00
|
|
|
#include "gimpink.h"
|
|
|
|
#include "gimpink-blob.h"
|
2007-02-04 02:48:00 +08:00
|
|
|
#include "gimpinkundo.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2001-02-28 08:10:58 +08:00
|
|
|
#define SUBSAMPLE 8
|
1999-04-10 22:55:17 +08:00
|
|
|
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
/* local function prototypes */
|
1999-04-13 01:55:06 +08:00
|
|
|
|
2004-07-19 22:37:40 +08:00
|
|
|
static void gimp_ink_finalize (GObject *object);
|
|
|
|
|
|
|
|
static void gimp_ink_paint (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpPaintState paint_state,
|
|
|
|
guint32 time);
|
|
|
|
static TempBuf * gimp_ink_get_paint_area (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options);
|
2007-02-04 02:48:00 +08:00
|
|
|
static GimpUndo* gimp_ink_push_undo (GimpPaintCore *core,
|
|
|
|
GimpImage *image,
|
|
|
|
const gchar *undo_desc);
|
2004-07-19 22:37:40 +08:00
|
|
|
|
|
|
|
static void gimp_ink_motion (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
guint32 time);
|
|
|
|
|
|
|
|
static Blob * ink_pen_ellipse (GimpInkOptions *options,
|
|
|
|
gdouble x_center,
|
|
|
|
gdouble y_center,
|
|
|
|
gdouble pressure,
|
|
|
|
gdouble xtilt,
|
|
|
|
gdouble ytilt,
|
|
|
|
gdouble velocity);
|
|
|
|
|
|
|
|
static void render_blob (Blob *blob,
|
|
|
|
PixelRegion *dest);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-02-28 08:10:58 +08:00
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
G_DEFINE_TYPE (GimpInk, gimp_ink, GIMP_TYPE_PAINT_CORE)
|
2005-12-08 05:11:53 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_ink_parent_class
|
2000-12-31 12:07:42 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-02-28 08:10:58 +08:00
|
|
|
void
|
2004-05-26 23:34:45 +08:00
|
|
|
gimp_ink_register (Gimp *gimp,
|
|
|
|
GimpPaintRegisterCallback callback)
|
2001-02-28 08:10:58 +08:00
|
|
|
{
|
2004-05-26 23:34:45 +08:00
|
|
|
(* callback) (gimp,
|
|
|
|
GIMP_TYPE_INK,
|
2003-02-05 22:39:40 +08:00
|
|
|
GIMP_TYPE_INK_OPTIONS,
|
2005-12-28 02:57:01 +08:00
|
|
|
"gimp-ink",
|
|
|
|
_("Ink"),
|
|
|
|
"gimp-tool-ink");
|
2001-02-28 08:10:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-05-26 23:34:45 +08:00
|
|
|
gimp_ink_class_init (GimpInkClass *klass)
|
2001-02-28 08:10:58 +08:00
|
|
|
{
|
2004-05-26 23:34:45 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
|
2001-02-28 08:10:58 +08:00
|
|
|
|
2005-12-08 05:11:53 +08:00
|
|
|
object_class->finalize = gimp_ink_finalize;
|
2001-02-28 08:10:58 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
paint_core_class->paint = gimp_ink_paint;
|
|
|
|
paint_core_class->get_paint_area = gimp_ink_get_paint_area;
|
2005-01-15 04:13:54 +08:00
|
|
|
paint_core_class->push_undo = gimp_ink_push_undo;
|
2001-02-28 08:10:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-05-26 23:34:45 +08:00
|
|
|
gimp_ink_init (GimpInk *ink)
|
2001-02-28 08:10:58 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-05-26 23:34:45 +08:00
|
|
|
gimp_ink_finalize (GObject *object)
|
2001-02-28 08:10:58 +08:00
|
|
|
{
|
2004-05-26 23:34:45 +08:00
|
|
|
GimpInk *ink = GIMP_INK (object);
|
2001-02-28 08:10:58 +08:00
|
|
|
|
2005-01-15 04:13:54 +08:00
|
|
|
if (ink->start_blob)
|
|
|
|
{
|
|
|
|
g_free (ink->start_blob);
|
|
|
|
ink->start_blob = NULL;
|
|
|
|
}
|
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
if (ink->last_blob)
|
2001-08-14 22:53:55 +08:00
|
|
|
{
|
2004-05-26 23:34:45 +08:00
|
|
|
g_free (ink->last_blob);
|
|
|
|
ink->last_blob = NULL;
|
2001-08-14 22:53:55 +08:00
|
|
|
}
|
2001-02-28 08:10:58 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-02-28 08:10:58 +08:00
|
|
|
}
|
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
static void
|
2004-07-19 22:37:40 +08:00
|
|
|
gimp_ink_paint (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpPaintState paint_state,
|
|
|
|
guint32 time)
|
1999-04-13 01:55:06 +08:00
|
|
|
{
|
2004-05-27 03:50:56 +08:00
|
|
|
GimpInk *ink = GIMP_INK (paint_core);
|
2004-05-26 23:34:45 +08:00
|
|
|
|
|
|
|
switch (paint_state)
|
2001-11-20 21:53:21 +08:00
|
|
|
{
|
2004-07-19 22:37:40 +08:00
|
|
|
case GIMP_PAINT_STATE_INIT:
|
2005-01-15 04:13:54 +08:00
|
|
|
if (paint_core->cur_coords.x == paint_core->last_coords.x &&
|
2004-05-27 03:50:56 +08:00
|
|
|
paint_core->cur_coords.y == paint_core->last_coords.y)
|
|
|
|
{
|
2005-01-15 04:13:54 +08:00
|
|
|
/* start with new blobs if we're not interpolating */
|
|
|
|
|
|
|
|
if (ink->start_blob)
|
|
|
|
{
|
|
|
|
g_free (ink->start_blob);
|
|
|
|
ink->start_blob = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ink->last_blob)
|
|
|
|
{
|
|
|
|
g_free (ink->last_blob);
|
|
|
|
ink->last_blob = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ink->last_blob)
|
|
|
|
{
|
|
|
|
/* save the start blob of the line for undo otherwise */
|
|
|
|
|
|
|
|
if (ink->start_blob)
|
|
|
|
g_free (ink->start_blob);
|
|
|
|
|
|
|
|
ink->start_blob = blob_duplicate (ink->last_blob);
|
2004-05-27 03:50:56 +08:00
|
|
|
}
|
2001-11-20 21:53:21 +08:00
|
|
|
break;
|
1999-04-22 22:34:00 +08:00
|
|
|
|
2004-07-19 22:37:40 +08:00
|
|
|
case GIMP_PAINT_STATE_MOTION:
|
2004-05-26 23:34:45 +08:00
|
|
|
gimp_ink_motion (paint_core, drawable, paint_options, time);
|
2001-11-20 21:53:21 +08:00
|
|
|
break;
|
2002-02-19 01:00:09 +08:00
|
|
|
|
2004-07-19 22:37:40 +08:00
|
|
|
case GIMP_PAINT_STATE_FINISH:
|
2004-05-26 23:34:45 +08:00
|
|
|
break;
|
|
|
|
}
|
2001-11-20 21:53:21 +08:00
|
|
|
}
|
2000-04-16 20:10:24 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
static TempBuf *
|
|
|
|
gimp_ink_get_paint_area (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options)
|
2001-11-20 21:53:21 +08:00
|
|
|
{
|
2007-12-20 21:37:55 +08:00
|
|
|
GimpInk *ink = GIMP_INK (paint_core);
|
2004-05-27 03:50:56 +08:00
|
|
|
gint x, y;
|
|
|
|
gint width, height;
|
|
|
|
gint dwidth, dheight;
|
|
|
|
gint x1, y1, x2, y2;
|
|
|
|
gint bytes;
|
2000-04-16 20:10:24 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
bytes = gimp_drawable_bytes_with_alpha (drawable);
|
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
|
|
|
|
2005-01-15 04:13:54 +08:00
|
|
|
blob_bounds (ink->cur_blob, &x, &y, &width, &height);
|
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
|
|
|
|
2008-11-03 08:09:01 +08:00
|
|
|
dwidth = gimp_item_get_width (GIMP_ITEM (drawable));
|
|
|
|
dheight = gimp_item_get_height (GIMP_ITEM (drawable));
|
1999-04-10 22:55:17 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
x1 = CLAMP (x / SUBSAMPLE - 1, 0, dwidth);
|
|
|
|
y1 = CLAMP (y / SUBSAMPLE - 1, 0, dheight);
|
|
|
|
x2 = CLAMP ((x + width) / SUBSAMPLE + 2, 0, dwidth);
|
|
|
|
y2 = CLAMP ((y + height) / SUBSAMPLE + 2, 0, dheight);
|
1999-04-10 22:55:17 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
/* configure the canvas buffer */
|
|
|
|
if ((x2 - x1) && (y2 - y1))
|
|
|
|
paint_core->canvas_buf = temp_buf_resize (paint_core->canvas_buf, bytes,
|
|
|
|
x1, y1,
|
|
|
|
(x2 - x1), (y2 - y1));
|
|
|
|
else
|
|
|
|
return NULL;
|
1998-11-26 15:44:17 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
return paint_core->canvas_buf;
|
2001-11-20 21:53:21 +08:00
|
|
|
}
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2007-02-04 02:48:00 +08:00
|
|
|
static GimpUndo *
|
|
|
|
gimp_ink_push_undo (GimpPaintCore *core,
|
|
|
|
GimpImage *image,
|
|
|
|
const gchar *undo_desc)
|
|
|
|
{
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_INK_UNDO,
|
|
|
|
GIMP_UNDO_INK, undo_desc,
|
|
|
|
0,
|
|
|
|
"paint-core", core,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2001-11-20 21:53:21 +08:00
|
|
|
static void
|
2004-05-26 23:34:45 +08:00
|
|
|
gimp_ink_motion (GimpPaintCore *paint_core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
guint32 time)
|
2001-11-20 21:53:21 +08:00
|
|
|
{
|
2004-05-26 23:34:45 +08:00
|
|
|
GimpInk *ink = GIMP_INK (paint_core);
|
|
|
|
GimpInkOptions *options = GIMP_INK_OPTIONS (paint_options);
|
|
|
|
GimpContext *context = GIMP_CONTEXT (paint_options);
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2004-05-27 03:50:56 +08:00
|
|
|
Blob *blob_union = NULL;
|
|
|
|
Blob *blob_to_render;
|
2004-05-26 23:34:45 +08:00
|
|
|
TempBuf *area;
|
|
|
|
guchar col[MAX_CHANNELS];
|
|
|
|
PixelRegion blob_maskPR;
|
2001-11-21 07:00:47 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
2003-02-10 19:38:03 +08:00
|
|
|
|
2004-05-27 03:50:56 +08:00
|
|
|
if (! ink->last_blob)
|
|
|
|
{
|
|
|
|
ink->last_blob = ink_pen_ellipse (options,
|
|
|
|
paint_core->cur_coords.x,
|
|
|
|
paint_core->cur_coords.y,
|
|
|
|
paint_core->cur_coords.pressure,
|
|
|
|
paint_core->cur_coords.xtilt,
|
|
|
|
paint_core->cur_coords.ytilt,
|
2008-01-15 04:34:37 +08:00
|
|
|
100);
|
1999-04-18 07:18:43 +08:00
|
|
|
|
2005-01-15 04:13:54 +08:00
|
|
|
if (ink->start_blob)
|
|
|
|
g_free (ink->start_blob);
|
|
|
|
|
|
|
|
ink->start_blob = blob_duplicate (ink->last_blob);
|
|
|
|
|
2004-05-27 03:50:56 +08:00
|
|
|
blob_to_render = ink->last_blob;
|
2001-11-20 21:53:21 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-10 22:34:26 +08:00
|
|
|
Blob *blob = ink_pen_ellipse (options,
|
|
|
|
paint_core->cur_coords.x,
|
|
|
|
paint_core->cur_coords.y,
|
|
|
|
paint_core->cur_coords.pressure,
|
|
|
|
paint_core->cur_coords.xtilt,
|
|
|
|
paint_core->cur_coords.ytilt,
|
|
|
|
paint_core->cur_coords.velocity * 100);
|
2004-05-27 03:50:56 +08:00
|
|
|
|
|
|
|
blob_union = blob_convex_union (ink->last_blob, blob);
|
2008-03-10 22:34:26 +08:00
|
|
|
|
2004-05-27 03:50:56 +08:00
|
|
|
g_free (ink->last_blob);
|
|
|
|
ink->last_blob = blob;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2004-05-27 03:50:56 +08:00
|
|
|
blob_to_render = blob_union;
|
|
|
|
}
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2006-09-03 00:58:43 +08:00
|
|
|
/* Get the buffer */
|
2005-01-15 04:13:54 +08:00
|
|
|
ink->cur_blob = blob_to_render;
|
2004-05-26 23:34:45 +08:00
|
|
|
area = gimp_paint_core_get_paint_area (paint_core, drawable, paint_options);
|
2005-01-15 04:13:54 +08:00
|
|
|
ink->cur_blob = NULL;
|
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
if (! area)
|
|
|
|
return;
|
2000-04-16 20:10:24 +08:00
|
|
|
|
2006-10-26 06:14:36 +08:00
|
|
|
gimp_image_get_foreground (image, context, gimp_drawable_type (drawable),
|
|
|
|
col);
|
1999-04-18 07:18:43 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
/* set the alpha channel */
|
|
|
|
col[paint_core->canvas_buf->bytes - 1] = OPAQUE_OPACITY;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
/* color the pixels */
|
|
|
|
color_pixels (temp_buf_data (paint_core->canvas_buf), col,
|
|
|
|
area->width * area->height, area->bytes);
|
|
|
|
|
|
|
|
gimp_paint_core_validate_canvas_tiles (paint_core,
|
|
|
|
paint_core->canvas_buf->x,
|
|
|
|
paint_core->canvas_buf->y,
|
|
|
|
paint_core->canvas_buf->width,
|
|
|
|
paint_core->canvas_buf->height);
|
|
|
|
|
|
|
|
/* draw the blob directly to the canvas_tiles */
|
|
|
|
pixel_region_init (&blob_maskPR, paint_core->canvas_tiles,
|
|
|
|
paint_core->canvas_buf->x,
|
|
|
|
paint_core->canvas_buf->y,
|
|
|
|
paint_core->canvas_buf->width,
|
|
|
|
paint_core->canvas_buf->height,
|
|
|
|
TRUE);
|
|
|
|
|
2004-05-27 03:50:56 +08:00
|
|
|
render_blob (blob_to_render, &blob_maskPR);
|
2004-05-26 23:34:45 +08:00
|
|
|
|
|
|
|
/* draw the canvas_buf using the just rendered canvas_tiles as mask */
|
|
|
|
pixel_region_init (&blob_maskPR, paint_core->canvas_tiles,
|
|
|
|
paint_core->canvas_buf->x,
|
|
|
|
paint_core->canvas_buf->y,
|
|
|
|
paint_core->canvas_buf->width,
|
|
|
|
paint_core->canvas_buf->height,
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
gimp_paint_core_paste (paint_core, &blob_maskPR, drawable,
|
|
|
|
GIMP_OPACITY_OPAQUE,
|
|
|
|
gimp_context_get_opacity (context),
|
|
|
|
gimp_context_get_paint_mode (context),
|
|
|
|
GIMP_PAINT_CONSTANT);
|
2002-02-05 01:43:01 +08:00
|
|
|
|
2004-05-27 03:50:56 +08:00
|
|
|
if (blob_union)
|
|
|
|
g_free (blob_union);
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Blob *
|
2003-02-05 22:39:40 +08:00
|
|
|
ink_pen_ellipse (GimpInkOptions *options,
|
|
|
|
gdouble x_center,
|
2006-04-12 20:49:29 +08:00
|
|
|
gdouble y_center,
|
|
|
|
gdouble pressure,
|
|
|
|
gdouble xtilt,
|
|
|
|
gdouble ytilt,
|
|
|
|
gdouble velocity)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
2004-05-26 23:34:45 +08:00
|
|
|
BlobFunc blob_function;
|
2003-02-08 23:27:51 +08:00
|
|
|
gdouble size;
|
|
|
|
gdouble tsin, tcos;
|
|
|
|
gdouble aspect, radmin;
|
|
|
|
gdouble x,y;
|
|
|
|
gdouble tscale;
|
|
|
|
gdouble tscale_c;
|
|
|
|
gdouble tscale_s;
|
2001-11-21 07:00:47 +08:00
|
|
|
|
1999-04-10 22:55:17 +08:00
|
|
|
/* Adjust the size depending on pressure. */
|
|
|
|
|
2003-02-09 05:12:03 +08:00
|
|
|
size = options->size * (1.0 + options->size_sensitivity *
|
2004-05-26 23:34:45 +08:00
|
|
|
(2.0 * pressure - 1.0));
|
1999-04-10 22:55:17 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
/* Adjust the size further depending on pointer velocity and
|
|
|
|
* velocity-sensitivity. These 'magic constants' are 'feels
|
|
|
|
* natural' tigert-approved. --ADM
|
|
|
|
*/
|
1999-04-10 22:55:17 +08:00
|
|
|
|
|
|
|
if (velocity < 3.0)
|
|
|
|
velocity = 3.0;
|
|
|
|
|
|
|
|
#ifdef VERBOSE
|
2004-03-12 21:50:36 +08:00
|
|
|
g_printerr ("%g (%g) -> ", size, velocity);
|
2003-08-22 09:42:57 +08:00
|
|
|
#endif
|
1999-04-10 22:55:17 +08:00
|
|
|
|
2003-02-09 05:12:03 +08:00
|
|
|
size = (options->vel_sensitivity *
|
|
|
|
((4.5 * size) / (1.0 + options->vel_sensitivity * (2.0 * velocity)))
|
|
|
|
+ (1.0 - options->vel_sensitivity) * size);
|
1999-04-10 22:55:17 +08:00
|
|
|
|
|
|
|
#ifdef VERBOSE
|
2004-03-12 21:50:36 +08:00
|
|
|
g_printerr ("%g\n", (gfloat) size);
|
1999-04-10 22:55:17 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Clamp resulting size to sane limits */
|
|
|
|
|
2003-02-09 05:12:03 +08:00
|
|
|
if (size > options->size * (1.0 + options->size_sensitivity))
|
|
|
|
size = options->size * (1.0 + options->size_sensitivity);
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2003-02-09 05:12:03 +08:00
|
|
|
if (size * SUBSAMPLE < 1.0)
|
|
|
|
size = 1.0 / SUBSAMPLE;
|
1999-04-10 22:55:17 +08:00
|
|
|
|
|
|
|
/* Add brush angle/aspect to tilt vectorially */
|
1998-06-15 06:42:36 +08:00
|
|
|
|
1998-11-26 15:44:17 +08:00
|
|
|
/* I'm not happy with the way the brush widget info is combined with
|
2004-05-26 23:34:45 +08:00
|
|
|
* tilt info from the brush. My personal feeling is that
|
|
|
|
* representing both as affine transforms would make the most
|
|
|
|
* sense. -RLL
|
|
|
|
*/
|
1998-11-26 15:44:17 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
tscale = options->tilt_sensitivity * 10.0;
|
2001-11-21 07:00:47 +08:00
|
|
|
tscale_c = tscale * cos (gimp_deg_to_rad (options->tilt_angle));
|
|
|
|
tscale_s = tscale * sin (gimp_deg_to_rad (options->tilt_angle));
|
|
|
|
|
2003-02-08 23:27:51 +08:00
|
|
|
x = (options->blob_aspect * cos (options->blob_angle) +
|
2001-11-21 07:00:47 +08:00
|
|
|
xtilt * tscale_c - ytilt * tscale_s);
|
2003-02-08 23:27:51 +08:00
|
|
|
y = (options->blob_aspect * sin (options->blob_angle) +
|
2001-11-21 07:00:47 +08:00
|
|
|
ytilt * tscale_c + xtilt * tscale_s);
|
|
|
|
|
1998-11-26 15:44:17 +08:00
|
|
|
#ifdef VERBOSE
|
2004-03-12 21:50:36 +08:00
|
|
|
g_printerr ("angle %g aspect %g; %g %g; %g %g\n",
|
|
|
|
options->blob_angle, options->blob_aspect,
|
|
|
|
tscale_c, tscale_s, x, y);
|
1998-11-26 15:44:17 +08:00
|
|
|
#endif
|
2003-02-08 23:27:51 +08:00
|
|
|
|
2007-12-20 21:37:55 +08:00
|
|
|
aspect = sqrt (SQR (x) + SQR (y));
|
1998-06-15 06:42:36 +08:00
|
|
|
|
|
|
|
if (aspect != 0)
|
|
|
|
{
|
2003-02-08 23:27:51 +08:00
|
|
|
tcos = x / aspect;
|
|
|
|
tsin = y / aspect;
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-02-08 23:27:51 +08:00
|
|
|
tsin = sin (options->blob_angle);
|
|
|
|
tcos = cos (options->blob_angle);
|
|
|
|
}
|
|
|
|
|
|
|
|
aspect = CLAMP (aspect, 1.0, 10.0);
|
|
|
|
|
|
|
|
radmin = MAX (1.0, SUBSAMPLE * size / aspect);
|
|
|
|
|
|
|
|
switch (options->blob_type)
|
|
|
|
{
|
|
|
|
case GIMP_INK_BLOB_TYPE_ELLIPSE:
|
2004-05-26 23:34:45 +08:00
|
|
|
blob_function = blob_ellipse;
|
2003-02-08 23:27:51 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_INK_BLOB_TYPE_SQUARE:
|
2004-05-26 23:34:45 +08:00
|
|
|
blob_function = blob_square;
|
2003-02-08 23:27:51 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_INK_BLOB_TYPE_DIAMOND:
|
2004-05-26 23:34:45 +08:00
|
|
|
blob_function = blob_diamond;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_return_val_if_reached (NULL);
|
2003-02-08 23:27:51 +08:00
|
|
|
break;
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
return (* blob_function) (x_center * SUBSAMPLE,
|
|
|
|
y_center * SUBSAMPLE,
|
|
|
|
radmin * aspect * tcos,
|
|
|
|
radmin * aspect * tsin,
|
|
|
|
-radmin * tsin,
|
|
|
|
radmin * tcos);
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
|
2005-03-22 05:51:29 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
/*********************************/
|
|
|
|
/* Rendering functions */
|
|
|
|
/*********************************/
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
/* Some of this stuff should probably be combined with the
|
1998-06-15 06:42:36 +08:00
|
|
|
* code it was copied from in paint_core.c; but I wanted
|
|
|
|
* to learn this stuff, so I've kept it simple.
|
|
|
|
*
|
|
|
|
* The following only supports CONSTANT mode. Incremental
|
|
|
|
* would, I think, interact strangely with the way we
|
|
|
|
* do things. But it wouldn't be hard to implement at all.
|
|
|
|
*/
|
|
|
|
|
2007-12-20 21:37:55 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ROW_START,
|
|
|
|
ROW_STOP
|
|
|
|
};
|
1998-06-15 06:42:36 +08:00
|
|
|
|
|
|
|
/* The insertion sort here, for SUBSAMPLE = 8, tends to beat out
|
|
|
|
* qsort() by 4x with CFLAGS=-O2, 2x with CFLAGS=-g
|
|
|
|
*/
|
2000-12-31 12:07:42 +08:00
|
|
|
static void
|
|
|
|
insert_sort (gint *data,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint n)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
2000-12-31 12:07:42 +08:00
|
|
|
gint i, j, k;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
for (i = 2; i < 2 * n; i += 2)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
2007-12-20 21:37:55 +08:00
|
|
|
gint tmp1 = data[i];
|
|
|
|
gint tmp2 = data[i + 1];
|
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
j = 0;
|
2007-12-20 21:37:55 +08:00
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
while (data[j] < tmp1)
|
2006-04-12 20:49:29 +08:00
|
|
|
j += 2;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
for (k = i; k > j; k -= 2)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
data[k] = data[k - 2];
|
|
|
|
data[k + 1] = data[k - 1];
|
|
|
|
}
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2004-05-26 23:34:45 +08:00
|
|
|
data[j] = tmp1;
|
|
|
|
data[j + 1] = tmp2;
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fill_run (guchar *dest,
|
2006-04-12 20:49:29 +08:00
|
|
|
guchar alpha,
|
|
|
|
gint w)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
|
|
|
if (alpha == 255)
|
|
|
|
{
|
|
|
|
memset (dest, 255, w);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (w--)
|
2004-05-26 23:34:45 +08:00
|
|
|
{
|
|
|
|
*dest = MAX (*dest, alpha);
|
|
|
|
dest++;
|
|
|
|
}
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-12-31 12:07:42 +08:00
|
|
|
render_blob_line (Blob *blob,
|
2006-04-12 20:49:29 +08:00
|
|
|
guchar *dest,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
2001-02-28 08:10:58 +08:00
|
|
|
gint buf[4 * SUBSAMPLE];
|
|
|
|
gint *data = buf;
|
|
|
|
gint n = 0;
|
2000-12-31 12:07:42 +08:00
|
|
|
gint i, j;
|
|
|
|
gint current = 0; /* number of filled rows at this point
|
2006-04-12 20:49:29 +08:00
|
|
|
* in the scan line
|
|
|
|
*/
|
2000-12-31 12:07:42 +08:00
|
|
|
gint last_x;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
|
|
|
/* Sort start and ends for all lines */
|
2003-08-22 09:42:57 +08:00
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
j = y * SUBSAMPLE - blob->y;
|
2001-02-28 08:10:58 +08:00
|
|
|
for (i = 0; i < SUBSAMPLE; i++)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
|
|
|
if (j >= blob->height)
|
2006-04-12 20:49:29 +08:00
|
|
|
break;
|
2001-02-28 08:10:58 +08:00
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
if ((j > 0) && (blob->data[j].left <= blob->data[j].right))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
data[2 * n] = blob->data[j].left;
|
|
|
|
data[2 * n + 1] = ROW_START;
|
|
|
|
data[2 * SUBSAMPLE + 2 * n] = blob->data[j].right;
|
|
|
|
data[2 * SUBSAMPLE + 2 * n + 1] = ROW_STOP;
|
|
|
|
n++;
|
|
|
|
}
|
1998-06-15 06:42:36 +08:00
|
|
|
j++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we have less than SUBSAMPLE rows, compress */
|
|
|
|
if (n < SUBSAMPLE)
|
|
|
|
{
|
2001-02-28 08:10:58 +08:00
|
|
|
for (i = 0; i < 2 * n; i++)
|
2006-04-12 20:49:29 +08:00
|
|
|
data[2 * n + i] = data[2 * SUBSAMPLE + i];
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now count start and end separately */
|
|
|
|
n *= 2;
|
|
|
|
|
|
|
|
insert_sort (data, n);
|
|
|
|
|
|
|
|
/* Discard portions outside of tile */
|
|
|
|
|
|
|
|
while ((n > 0) && (data[0] < SUBSAMPLE*x))
|
|
|
|
{
|
|
|
|
if (data[1] == ROW_START)
|
2006-04-12 20:49:29 +08:00
|
|
|
current++;
|
1998-06-15 06:42:36 +08:00
|
|
|
else
|
2006-04-12 20:49:29 +08:00
|
|
|
current--;
|
1998-06-15 06:42:36 +08:00
|
|
|
data += 2;
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((n > 0) && (data[2*(n-1)] >= SUBSAMPLE*(x+width)))
|
|
|
|
n--;
|
2003-08-22 09:42:57 +08:00
|
|
|
|
1998-06-15 06:42:36 +08:00
|
|
|
/* Render the row */
|
|
|
|
|
|
|
|
last_x = 0;
|
2001-02-28 08:10:58 +08:00
|
|
|
for (i = 0; i < n;)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
2001-02-28 08:10:58 +08:00
|
|
|
gint cur_x = data[2 * i] / SUBSAMPLE - x;
|
2000-12-31 12:07:42 +08:00
|
|
|
gint pixel;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
|
|
|
/* Fill in portion leading up to this pixel */
|
|
|
|
if (current && cur_x != last_x)
|
2006-04-12 20:49:29 +08:00
|
|
|
fill_run (dest + last_x, (255 * current) / SUBSAMPLE, cur_x - last_x);
|
1998-06-15 06:42:36 +08:00
|
|
|
|
|
|
|
/* Compute the value for this pixel */
|
2003-08-22 09:42:57 +08:00
|
|
|
pixel = current * SUBSAMPLE;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
|
|
|
while (i<n)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
gint tmp_x = data[2 * i] / SUBSAMPLE;
|
|
|
|
|
|
|
|
if (tmp_x - x != cur_x)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (data[2 * i + 1] == ROW_START)
|
|
|
|
{
|
|
|
|
current++;
|
|
|
|
pixel += ((tmp_x + 1) * SUBSAMPLE) - data[2 * i];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
current--;
|
|
|
|
pixel -= ((tmp_x + 1) * SUBSAMPLE) - data[2 * i];
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
dest[cur_x] = MAX (dest[cur_x], (pixel * 255) / (SUBSAMPLE * SUBSAMPLE));
|
1998-06-15 06:42:36 +08:00
|
|
|
|
|
|
|
last_x = cur_x + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current != 0)
|
2001-02-28 08:10:58 +08:00
|
|
|
fill_run (dest + last_x, (255 * current)/ SUBSAMPLE, width - last_x);
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-05-26 23:34:45 +08:00
|
|
|
render_blob (Blob *blob,
|
|
|
|
PixelRegion *dest)
|
1998-06-15 06:42:36 +08:00
|
|
|
{
|
2000-12-31 12:07:42 +08:00
|
|
|
gpointer pr;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
for (pr = pixel_regions_register (1, dest);
|
|
|
|
pr != NULL;
|
1998-06-15 06:42:36 +08:00
|
|
|
pr = pixel_regions_process (pr))
|
|
|
|
{
|
2007-12-20 21:37:55 +08:00
|
|
|
guchar *d = dest->data;
|
|
|
|
gint h = dest->h;
|
|
|
|
gint y;
|
1998-06-15 06:42:36 +08:00
|
|
|
|
2007-12-20 21:37:55 +08:00
|
|
|
for (y = 0; y < h; y++, d += dest->rowstride)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
2007-12-20 21:37:55 +08:00
|
|
|
render_blob_line (blob, d, dest->x, dest->y + y, dest->w);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
1998-06-15 06:42:36 +08:00
|
|
|
}
|
|
|
|
}
|