gimp/plug-ins/common/warp.c

1709 lines
60 KiB
C
Raw Normal View History

/* Warp --- image filter plug-in for GIMP
1999-09-04 07:14:44 +08:00
* Copyright (C) 1997 John P. Beale
* Much of the 'warp' is from the Displace plug-in: 1996 Stephen Robert Norris
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
* Much of the 'displace' code taken in turn from the pinch plug-in
1999-09-04 07:14:44 +08:00
* which is by 1996 Federico Mena Quintero
*
* This program is free software: you can redistribute it and/or modify
1999-09-04 07:14:44 +08:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
1999-09-04 07:14:44 +08:00
* (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, see <http://www.gnu.org/licenses/>.
1999-09-04 07:14:44 +08:00
*
* You can contact me (the warp author) at beale@best.com
* Please send me any patches or enhancements to this code.
* You can contact the original GIMP authors at gimp@xcf.berkeley.edu
1999-09-04 07:14:44 +08:00
*
* --------------------------------------------------------------------
* Warp Program structure: after running the user interface and setting the
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
* parameters, warp generates a brand-new image (later to be deleted
1999-09-04 07:14:44 +08:00
* before the user ever sees it) which contains two grayscale layers,
* representing the X and Y gradients of the "control" image. For this
* purpose, all channels of the control image are summed for a scalar
* value at each pixel coordinate for the gradient operation.
*
* The X,Y components of the calculated gradient are then used to
* displace pixels from the source image into the destination
* image. The displacement vector is rotated a user-specified amount
* first. This displacement operation happens iteratively, generating
* a new displaced image from each prior image.
1999-09-04 07:14:44 +08:00
* -------------------------------------------------------------------
*
* Revision History:
* Version 0.37 12/19/98 Fixed Tooltips and freeing memory
* Version 0.36 11/9/97 Changed XY vector layers back to own image
* fixed 'undo' problem (hopefully)
*
* Version 0.35 11/3/97 Added vector-map, mag-map, grad-map to
* diff vector instead of separate operation
* further futzing with drawable updates
* starting adding tooltips
*
* Version 0.34 10/30/97 'Fixed' drawable update problem
* Added 16-bit resolution to differential map
* Added substep increments for finer control
1999-09-04 07:14:44 +08:00
*
* Version 0.33 10/26/97 Added 'angle increment' to user interface
*
* Version 0.32 10/25/97 Added magnitude control map (secondary control)
* Changed undo behavior to be one undo-step per warp call.
*
* Version 0.31 10/25/97 Fixed src/dest pixregions so program works
* with multiple-layer images. Still don't know
* exactly what I did to fix it :-/ Also, added 'color' option
* for border pixels to use the current selected foreground color.
1999-09-04 07:14:44 +08:00
*
* Version 0.3 10/20/97 Initial release for Gimp 0.99.xx
*/
#include "config.h"
1999-09-04 07:14:44 +08:00
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "libgimp/stdplugins-intl.h"
1999-09-04 07:14:44 +08:00
1999-09-04 07:14:44 +08:00
/* Some useful macros */
#define PLUG_IN_PROC "plug-in-warp"
#define PLUG_IN_BINARY "warp"
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
#define ENTRY_WIDTH 75
#define TILE_CACHE_SIZE 30 /* was 48. There is a cache flush problem in GIMP preventing sequential updates */
#define MIN_ARGS 6 /* minimum number of arguments required */
1999-09-04 07:14:44 +08:00
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
enum
{
WRAP,
SMEAR,
BLACK,
COLOR
};
1999-09-04 07:14:44 +08:00
typedef struct
{
1999-09-04 07:14:44 +08:00
gdouble amount;
gint warp_map;
gint iter;
gdouble dither;
gdouble angle;
gint wrap_type;
gint mag_map;
gint mag_use;
gint substeps;
gint grad_map;
gdouble grad_scale;
gint vector_map;
gdouble vector_scale;
gdouble vector_angle;
} WarpVals;
/*
* Function prototypes.
*/
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
1999-09-04 07:14:44 +08:00
static void blur16 (GimpDrawable *drawable);
1999-09-04 07:14:44 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
static void diff (GimpDrawable *drawable,
gint32 *xl_id,
gint32 *yl_id);
1999-09-04 07:14:44 +08:00
static void diff_prepare_row (GimpPixelRgn *pixel_rgn,
guchar *data,
gint x,
gint y,
gint w);
1999-09-04 07:14:44 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
static void warp_one (GimpDrawable *draw,
GimpDrawable *new,
GimpDrawable *map_x,
GimpDrawable *map_y,
GimpDrawable *mag_draw,
gboolean first_time,
gint step);
1999-09-04 07:14:44 +08:00
static void warp (GimpDrawable *drawable);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
static gboolean warp_dialog (GimpDrawable *drawable);
static GimpTile *warp_pixel (GimpDrawable *drawable,
GimpTile *tile,
gint width,
gint height,
gint x1,
gint y1,
gint x2,
gint y2,
gint x,
gint y,
gint *row,
gint *col,
guchar *pixel);
static gboolean warp_map_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
static gdouble warp_map_mag_give_value (guchar *pt,
gint alpha,
gint bytes);
1999-09-04 07:14:44 +08:00
/* -------------------------------------------------------------------------- */
/* Variables global over entire plug-in scope */
/* -------------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
const GimpPlugInInfo PLUG_IN_INFO =
1999-09-04 07:14:44 +08:00
{
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
1999-09-04 07:14:44 +08:00
};
static WarpVals dvals =
{
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
10.0, /* amount */
-1, /* warp_map */
5, /* iterations */
0.0, /* dither */
90.0, /* angle */
WRAP, /* wrap_type */
-1, /* mag_map */
FALSE, /* mag_use */
1, /* substeps */
-1, /* grad_map */
0.0, /* grad_scale */
-1, /* vector_map */
0.0, /* vector_scale */
0.0 /* vector_angle */
1999-09-04 07:14:44 +08:00
};
/* -------------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
static gint progress = 0; /* progress indicator bar */
static guint tile_width, tile_height; /* size of an image tile */
static GimpRunMode run_mode; /* interactive, non-, etc. */
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
static guchar color_pixel[4] = {0, 0, 0, 255}; /* current fg color */
1999-09-04 07:14:44 +08:00
/* -------------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
/***** Functions *****/
MAIN ()
static void
query (void)
1999-09-04 07:14:44 +08:00
{
static const GimpParamDef args[] =
1999-09-04 07:14:44 +08:00
{
{ GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" },
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_FLOAT, "amount", "Pixel displacement multiplier" },
{ GIMP_PDB_DRAWABLE, "warp-map", "Displacement control map" },
{ GIMP_PDB_INT32, "iter", "Iteration count (last required argument)" },
{ GIMP_PDB_FLOAT, "dither", "Random dither amount (first optional argument)" },
{ GIMP_PDB_FLOAT, "angle", "Angle of gradient vector rotation" },
{ GIMP_PDB_INT32, "wrap-type", "Edge behavior: { WRAP (0), SMEAR (1), BLACK (2), COLOR (3) }" },
{ GIMP_PDB_DRAWABLE, "mag-map", "Magnitude control map" },
{ GIMP_PDB_INT32, "mag-use", "Use magnitude map: { FALSE (0), TRUE (1) }" },
{ GIMP_PDB_INT32, "substeps", "Substeps between image updates" },
{ GIMP_PDB_INT32, "grad-map", "Gradient control map" },
{ GIMP_PDB_FLOAT, "grad-scale", "Scaling factor for gradient map (0=don't use)" },
{ GIMP_PDB_INT32, "vector-map", "Fixed vector control map" },
{ GIMP_PDB_FLOAT, "vector-scale", "Scaling factor for fixed vector map (0=don't use)" },
{ GIMP_PDB_FLOAT, "vector-angle", "Angle for fixed vector map" }
1999-09-04 07:14:44 +08:00
};
gimp_install_procedure (PLUG_IN_PROC,
N_("Twist or smear image in many different ways"),
"Smears an image along vector paths calculated as "
"the gradient of a separate control matrix. The "
"effect can look like brushstrokes of acrylic or "
"watercolor paint, in some cases.",
"John P. Beale",
"John P. Beale",
"1997",
N_("_Warp..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Map");
1999-09-04 07:14:44 +08:00
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
1999-09-04 07:14:44 +08:00
{
static GimpParam values[1];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpDrawable *drawable;
GimpRGB color;
1999-09-04 07:14:44 +08:00
run_mode = param[0].data.d_int32;
INIT_I18N ();
tile_width = gimp_tile_width (); /* initialize some globals */
tile_height = gimp_tile_height ();
1999-09-04 07:14:44 +08:00
/* get currently selected foreground pixel color */
tools/pdbgen/Makefile.am tools/pdbgen/groups.pl removed the "Palette" pdb 2004-09-22 Michael Natterer <mitch@gimp.org> * tools/pdbgen/Makefile.am * tools/pdbgen/groups.pl * tools/pdbgen/pdb/palette.pdb: removed the "Palette" pdb group... * tools/pdbgen/pdb/context.pdb: and added its functions to the "Context" namespace instead. * app/pdb/Makefile.am * app/pdb/palette_cmds.c: removed. * app/pdb/procedural_db.c: added them to the pdb_compat hash table. * libgimp/Makefile.am * libgimp/gimppalette_pdb.[ch]: removed. * libgimp/gimppalette.[ch]: new files holding compat functions which call gimp_context_*() functions. * libgimp/gimp.h * libgimp/gimpui.c: changed accordingly. * app/pdb/context_cmds.c * app/pdb/internal_procs.c * libgimp/gimp_pdb.h * libgimp/gimpcontext_pdb.[ch]: regenerated. * plug-ins/MapObject/mapobject_image.c * plug-ins/MapObject/mapobject_preview.c * plug-ins/common/apply_lens.c * plug-ins/common/blinds.c * plug-ins/common/borderaverage.c * plug-ins/common/checkerboard.c * plug-ins/common/colortoalpha.c * plug-ins/common/cubism.c * plug-ins/common/exchange.c * plug-ins/common/film.c * plug-ins/common/gif.c * plug-ins/common/grid.c * plug-ins/common/mapcolor.c * plug-ins/common/mblur.c * plug-ins/common/mng.c * plug-ins/common/mosaic.c * plug-ins/common/papertile.c * plug-ins/common/png.c * plug-ins/common/polar.c * plug-ins/common/semiflatten.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/whirlpinch.c * plug-ins/gfig/gfig-style.c * plug-ins/gfli/gfli.c * plug-ins/ifscompose/ifscompose.c * plug-ins/maze/handy.c * plug-ins/pagecurl/pagecurl.c * plug-ins/pygimp/gimpmodule.c * plug-ins/script-fu/scripts/*.scm: changed accordingly.
2004-09-23 02:43:09 +08:00
gimp_context_get_foreground (&color);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
gimp_rgb_get_uchar (&color,
&color_pixel[0],
&color_pixel[1],
&color_pixel[2]);
1999-09-04 07:14:44 +08:00
/* Get the specified drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
*nreturn_vals = 1;
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
1999-09-04 07:14:44 +08:00
values[0].data.d_status = status;
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
1999-09-04 07:14:44 +08:00
/* Possibly retrieve data */
gimp_get_data (PLUG_IN_PROC, &dvals);
1999-09-04 07:14:44 +08:00
/* First acquire information with a dialog */
if (! warp_dialog (drawable))
return;
1999-09-04 07:14:44 +08:00
break;
case GIMP_RUN_NONINTERACTIVE:
/* Make sure minimum args
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
* (mode, image, draw, amount, warp_map, iter) are there
*/
1999-09-04 07:14:44 +08:00
if (nparams < MIN_ARGS)
{
status = GIMP_PDB_CALLING_ERROR;
}
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
else
{
gint pcnt = MIN_ARGS;
dvals.amount = param[3].data.d_float;
dvals.warp_map = param[4].data.d_int32;
dvals.iter = param[5].data.d_int32;
if (nparams > pcnt++) dvals.dither = param[6].data.d_float;
if (nparams > pcnt++) dvals.angle = param[7].data.d_float;
if (nparams > pcnt++) dvals.wrap_type = param[8].data.d_int32;
if (nparams > pcnt++) dvals.mag_map = param[9].data.d_int32;
if (nparams > pcnt++) dvals.mag_use = param[10].data.d_int32;
if (nparams > pcnt++) dvals.substeps = param[11].data.d_int32;
if (nparams > pcnt++) dvals.grad_map = param[12].data.d_int32;
if (nparams > pcnt++) dvals.grad_scale = param[13].data.d_float;
if (nparams > pcnt++) dvals.vector_map = param[14].data.d_int32;
if (nparams > pcnt++) dvals.vector_scale = param[15].data.d_float;
if (nparams > pcnt++) dvals.vector_angle = param[16].data.d_float;
}
1999-09-04 07:14:44 +08:00
break;
case GIMP_RUN_WITH_LAST_VALS:
1999-09-04 07:14:44 +08:00
/* Possibly retrieve data */
gimp_get_data (PLUG_IN_PROC, &dvals);
1999-09-04 07:14:44 +08:00
break;
default:
break;
}
if (status == GIMP_PDB_SUCCESS)
1999-09-04 07:14:44 +08:00
{
/* set the tile cache size */
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
/* run the warp effect */
warp (drawable);
1999-09-04 07:14:44 +08:00
/* Store data */
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_set_data (PLUG_IN_PROC, &dvals, sizeof (WarpVals));
1999-09-04 07:14:44 +08:00
}
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
gimp_drawable_detach (drawable);
values[0].data.d_status = status;
1999-09-04 07:14:44 +08:00
}
static gboolean
warp_dialog (GimpDrawable *drawable)
1999-09-04 07:14:44 +08:00
{
GtkWidget *dlg;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *toggle;
GtkWidget *toggle_hbox;
GtkWidget *frame;
GtkWidget *table;
GtkWidget *spinbutton;
GtkObject *adj;
GtkWidget *combo;
GtkSizeGroup *label_group;
GtkSizeGroup *spin_group;
GSList *group = NULL;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
1999-09-04 07:14:44 +08:00
dlg = gimp_dialog_new (_("Warp"), PLUG_IN_BINARY,
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
1999-09-04 07:14:44 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
1999-09-04 07:14:44 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
NULL);
1999-09-04 07:14:44 +08:00
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
Added parent window API to the GimpProgress interface and to the libgimp 2005-09-09 Michael Natterer <mitch@gimp.org> Added parent window API to the GimpProgress interface and to the libgimp progress stuff. Might look strange, but does the right thing in almost all cases (image window, file dialog, script-fu dialog etc). Fixes bug #62988. * app/core/gimpprogress.[ch]: added GimpProgress::get_window() which should return a toplevel window ID if the progress is in a window that wants to be the transient parent of plug-in dialogs. * app/widgets/gimpwidgets-utils.[ch] (gimp_window_get_native): new function which returns the window handle of a GtkWindow's GdkWindow. * app/widgets/gimpfiledialog.c: implement ::get_window(). * app/display/gimpdisplay.[ch]: ditto. Removed window handle API. * app/gui/gui-vtable.c: changed accordingly. * libgimpbase/gimpbaseenums.[ch] (enum GimpProgressCommand): added GIMP_PROGRESS_COMMAND_GET_WINDOW. * app/plug-in/plug-in-progress.[ch] (plug_in_progress_get_window): new function. Also renamed some functions to match the GimpProgress interface, and not the legacy PDB procedure names. * tools/pdbgen/pdb/progress.pdb * app/core/gimppdbprogress.c: implement get_window() on both sides of the wire, keeping backward compatibility (hopefully). * libgimp/gimpprogress.[ch]: deprecated gimp_progress_install() and added gimp_progress_install_vtable() which takes a vtable with padding to be extensible. Added get_window() vtable entry and dispatch it accordingly. Also added pulse() which was implemented in a hackish way before. Everything is of course backward compatible. * libgimp/gimpprogressbar.c: inmplement the get_window() stuff so a plug-in dialog containing a progress can be the transient parent of another dialog in another plug-in. * libgimp/gimpui.[ch] (gimp_ui_get_progress_window): new function which returns a foreign GdkWindow of this plug-ins progress window. Renamed gimp_window_set_transient_for_default_display() to gimp_window_set_transient() and make it use the progress' window handle instead of the display's (which is the right thing to do in almost all cases). * libgimp/gimp.def * libgimp/gimpui.def: add the new functions. * tools/pdbgen/enums.pl * app/pdb/internal_procs.c * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.[ch]: regenerated. * libgimp/gimpexport.c * plug-ins/*/*.c: follow API change.
2005-09-10 02:07:31 +08:00
gimp_window_set_transient (GTK_WINDOW (dlg));
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
frame = gimp_frame_new (_("Basic Options"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
1999-09-04 07:14:44 +08:00
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 12);
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
1999-09-04 07:14:44 +08:00
spin_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
label_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
/* amount, iter */
spinbutton = gimp_spin_button_new (&adj, dvals.amount,
-1000, 1000, /* ??? */
1, 10, 0, 1, 2);
gtk_size_group_add_widget (spin_group, spinbutton);
g_object_unref (spin_group);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Step size:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_object_unref (label_group);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&dvals.amount);
1999-09-04 07:14:44 +08:00
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
spinbutton = gimp_spin_button_new (&adj, dvals.iter,
1, 100, 1, 5, 0, 1, 0);
gtk_size_group_add_widget (spin_group, spinbutton);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Iterations:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_int_adjustment_update),
&dvals.iter);
1999-09-04 07:14:44 +08:00
/* Displacement map menu */
label = gtk_label_new (_("Displacement map:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
1999-09-04 07:14:44 +08:00
gtk_widget_show (label);
combo = gimp_drawable_combo_box_new (warp_map_constrain, drawable);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), dvals.warp_map,
G_CALLBACK (gimp_int_combo_box_get_active),
&dvals.warp_map);
gtk_table_attach (GTK_TABLE (table), combo, 2, 3, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (combo);
1999-09-04 07:14:44 +08:00
/* ======================================================================= */
1999-09-04 07:14:44 +08:00
/* Displacement Type */
label = gtk_label_new (_("On edges:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
GTK_FILL, GTK_FILL, 0, 0);
1999-09-04 07:14:44 +08:00
gtk_widget_show (label);
toggle_hbox = gtk_hbox_new (FALSE, 6);
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
gtk_table_attach (GTK_TABLE (table), toggle_hbox, 1, 3, 2, 3,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (toggle_hbox);
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
toggle = gtk_radio_button_new_with_label (group, _("Wrap"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
1999-09-04 07:14:44 +08:00
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (WRAP));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_radio_button_update),
&dvals.wrap_type);
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
dvals.wrap_type == WRAP);
1999-09-04 07:14:44 +08:00
toggle = gtk_radio_button_new_with_label (group, _("Smear"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
1999-09-04 07:14:44 +08:00
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (SMEAR));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_radio_button_update),
&dvals.wrap_type);
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
dvals.wrap_type == SMEAR);
1999-09-04 07:14:44 +08:00
toggle = gtk_radio_button_new_with_label (group, _("Black"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
1999-09-04 07:14:44 +08:00
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (BLACK));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_radio_button_update),
&dvals.wrap_type);
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
dvals.wrap_type == BLACK);
1999-09-04 07:14:44 +08:00
toggle = gtk_radio_button_new_with_label (group, _("Foreground color"));
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (toggle));
1999-09-04 07:14:44 +08:00
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (COLOR));
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_radio_button_update),
&dvals.wrap_type);
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
dvals.wrap_type == COLOR);
1999-09-04 07:14:44 +08:00
/* -------------------------------------------------------------------- */
/* --------- The secondary table -------------------------- */
frame = gimp_frame_new (_("Advanced Options"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
1999-09-04 07:14:44 +08:00
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 12);
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
1999-09-04 07:14:44 +08:00
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
spinbutton = gimp_spin_button_new (&adj, dvals.dither,
0, 100, 1, 10, 0, 1, 2);
gtk_size_group_add_widget (spin_group, spinbutton);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Dither size:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&dvals.dither);
1999-09-04 07:14:44 +08:00
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
spinbutton = gimp_spin_button_new (&adj, dvals.angle,
0, 360, 1, 15, 0, 1, 1);
gtk_size_group_add_widget (spin_group, spinbutton);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Rotation angle:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&dvals.angle);
1999-09-04 07:14:44 +08:00
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
spinbutton = gimp_spin_button_new (&adj, dvals.substeps,
1, 100, 1, 5, 0, 1, 0);
gtk_size_group_add_widget (spin_group, spinbutton);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Substeps:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_int_adjustment_update),
&dvals.substeps);
1999-09-04 07:14:44 +08:00
/* Magnitude map menu */
label = gtk_label_new (_("Magnitude map:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1,
GTK_FILL, GTK_FILL, 0, 0);
1999-09-04 07:14:44 +08:00
gtk_widget_show (label);
combo = gimp_drawable_combo_box_new (warp_map_constrain, drawable);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), dvals.mag_map,
G_CALLBACK (gimp_int_combo_box_get_active),
&dvals.mag_map);
gtk_table_attach (GTK_TABLE (table), combo, 2, 3, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (combo);
1999-09-04 07:14:44 +08:00
/* Magnitude Usage */
toggle_hbox = gtk_hbox_new (FALSE, 4);
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_container_set_border_width (GTK_CONTAINER (toggle_hbox), 1);
gtk_table_attach (GTK_TABLE (table), toggle_hbox, 2, 3, 2, 3,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (toggle_hbox);
1999-09-04 07:14:44 +08:00
toggle = gtk_check_button_new_with_label (_("Use magnitude map"));
1999-09-04 07:14:44 +08:00
gtk_box_pack_start (GTK_BOX (toggle_hbox), toggle, FALSE, FALSE, 0);
added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. 2000-08-28 Michael Natterer <mitch@gimp.org> * configure.in: added -DGTK_DISABLE_COMPAT_H to CPPFLAGS. * app/app_procs.c * app/gdisplay.c * app/layers_dialog.c * app/menus.c * app/tips_dialog.c * libgimp/gimpcolorbutton.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/bmp/bmpwrite.c * plug-ins/common/AlienMap.c * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/animationplay.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/deinterlace.c * plug-ins/common/gee.c * plug-ins/common/glasstile.c * plug-ins/common/iwarp.c * plug-ins/common/mail.c * plug-ins/common/pat.c * plug-ins/common/pixelize.c * plug-ins/common/plugindetails.c * plug-ins/common/png.c * plug-ins/common/sample_colorize.c * plug-ins/common/sel_gauss.c * plug-ins/common/sinus.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/tga.c * plug-ins/common/tileit.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/wmf.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/gap/gap_arr_dialog.c * plug-ins/gap/gap_dbbrowser_utils.c * plug-ins/gap/gap_mov_dialog.c * plug-ins/gap/gap_navigator_dialog.c * plug-ins/gap/gap_resi_dialog.c * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gimpressionist/brush.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/gimp_main_window.c * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/xjt/xjt.c: removed COMPAT_CRUFT.
2000-08-28 08:42:32 +08:00
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), dvals.mag_use);
1999-09-04 07:14:44 +08:00
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&dvals.mag_use);
1999-09-04 07:14:44 +08:00
/* -------------------------------------------------------------------- */
/* --------- The "other" table -------------------------- */
frame = gimp_frame_new (_("More Advanced Options"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
1999-09-04 07:14:44 +08:00
table = gtk_table_new (3, 3, FALSE);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 12);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_widget_show (table);
1999-09-04 07:14:44 +08:00
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
spinbutton = gimp_spin_button_new (&adj, dvals.grad_scale,
-1000, 1000, /* ??? */
0.01, 0.1, 0, 1, 3);
gtk_size_group_add_widget (spin_group, spinbutton);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Gradient scale:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&dvals.grad_scale);
1999-09-04 07:14:44 +08:00
/* --------- Gradient map menu ---------------- */
combo = gimp_drawable_combo_box_new (warp_map_constrain, drawable);
gtk_table_attach (GTK_TABLE (table), combo, 2, 3, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (combo);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), dvals.grad_map,
G_CALLBACK (gimp_int_combo_box_get_active),
&dvals.grad_map);
gimp_help_set_help_data (combo, _("Gradient map selection menu"), NULL);
1999-09-04 07:14:44 +08:00
/* ---------------------------------------------- */
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
spinbutton = gimp_spin_button_new (&adj, dvals.vector_scale,
-1000, 1000, /* ??? */
0.01, 0.1, 0, 1, 3);
gtk_size_group_add_widget (spin_group, spinbutton);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Vector mag:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&dvals.vector_scale);
1999-09-04 07:14:44 +08:00
/* -------------------------------------------------------- */
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
spinbutton = gimp_spin_button_new (&adj, dvals.vector_angle,
0, 360, 1, 15, 0, 1, 1);
gtk_size_group_add_widget (spin_group, spinbutton);
label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Angle:"), 0.0, 0.5,
spinbutton, 1, FALSE);
gtk_size_group_add_widget (label_group, label);
g_signal_connect (adj, "value-changed",
G_CALLBACK (gimp_double_adjustment_update),
&dvals.vector_angle);
1999-09-04 07:14:44 +08:00
/* --------- Vector map menu ---------------- */
combo = gimp_drawable_combo_box_new (warp_map_constrain, drawable);
gtk_table_attach (GTK_TABLE (table), combo, 2, 3, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (combo);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), dvals.vector_map,
G_CALLBACK (gimp_int_combo_box_get_active),
&dvals.vector_map);
gimp_help_set_help_data (combo,
_("Fixed-direction-vector map selection menu"),
NULL);
1999-09-04 07:14:44 +08:00
gtk_widget_show (dlg);
run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
1999-09-04 07:14:44 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
gtk_widget_destroy (dlg);
return run;
1999-09-04 07:14:44 +08:00
}
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
1999-09-04 07:14:44 +08:00
/* ---------------------------------------------------------------------- */
static void
blur16 (GimpDrawable *drawable)
configure.in po-plug-ins/POTFILES.in plug-ins/common/Makefile.am 2000-01-25 Michael Natterer <mitch@gimp.org> * configure.in * po-plug-ins/POTFILES.in * plug-ins/common/Makefile.am * plug-ins/common/plugin-defs.pl * plug-ins/megawidget/*: removed. (There were only 3 functions left which were used by ~5 plugins, so I moved the resp. functions to the plugins). More preview stuff to come... * app/airbrush_blob.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use G_PI instead of M_PI. * app/procedural_db.h * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: new PDB return value STATUS_CANCEL which indicates that "Cancel" was pressed in a plugin dialog. (Useful only for file load/save plugins). * app/fileops.[ch] * app/menus.c: changes to handle STATUS_CANCEL correctly. Did some code cleanup in fileops.[ch]. Pop up a warning if File->Save failed. * app/plug_in.c: return_val[0] is of type PDB_STATUS, not PDB_INT32. * libgimp/gimpmath.h: new constant G_MAXRAND which equals to RAND_MAX if it exists or to G_MAXINT otherwise. * libgimp/gimpwidgets.[ch]: new function gimp_random_seed_new() which creates a spinbutton and a "Time" toggle. Call the function which does the "set_sensitive" magic from the radio button callback. * plug-ins/[75 plugins]: - Return STATUS_CANCEL in all file load/save dialogs if "Cancel" was pressed. - Standardized the file plugins' "run" functions. - Use G_PI and G_MAXRAND everywhere. - Added tons of scales and spinbuttons instead of text entries. - Applied uniform packing/spacings all over the place. - Reorganized some UIs (stuff like moving the preview to the top left corner of the dialog). - Removed many ui helper functions and callbacks and use the stuff from libgimp instead. - I tried not to restrict the range of possible values when I replaced entries with spinbuttons/scales but may have failed, though in some cases. Please test ;-) - #include <libgimp/gimpmath.h> where appropriate and use it's constants. - Indentation, s/int/gint/ et.al., code cleanup. RFC: The plugins are definitely not useable with GIMP 1.0 any more, so shouldn't we remove all the remaining compatibility stuff ??? (like "#ifdef GIMP_HAVE_PARASITES")
2000-01-26 01:46:56 +08:00
{
/* blur a 2-or-more byte-per-pixel drawable,
* 1st 2 bytes interpreted as a 16-bit height field.
*/
GimpPixelRgn srcPR, destPR;
1999-09-04 07:14:44 +08:00
gint width, height;
gint src_bytes;
gint dest_bytes;
gint dest_bytes_inc;
gint offb, off1;
guchar *dest, *d; /* pointers to rows of X and Y diff. data */
guchar *prev_row, *pr;
guchar *cur_row, *cr;
guchar *next_row, *nr;
guchar *tmp;
gint row, col; /* relating to indexing into pixel row arrays */
gint x1, y1, x2, y2;
gdouble pval; /* average pixel value of pixel & neighbors */
/* --------------------------------------- */
if (! gimp_drawable_mask_intersect (drawable->drawable_id,
&x1, &y1, &width, &height))
return;
1999-09-04 07:14:44 +08:00
x2 = x1 + width;
y2 = y1 + height;
1999-09-04 07:14:44 +08:00
width = drawable->width; /* size of input drawable*/
height = drawable->height;
src_bytes = drawable->bpp; /* bytes per pixel in SOURCE drawable, must be 2 or more */
dest_bytes = drawable->bpp; /* bytes per pixel in SOURCE drawable, >= 2 */
dest_bytes_inc = dest_bytes - 2; /* this is most likely zero, but I guess it's more conservative... */
/* allocate row buffers for source & dest. data */
prev_row = g_new (guchar, (x2 - x1 + 2) * src_bytes);
cur_row = g_new (guchar, (x2 - x1 + 2) * src_bytes);
next_row = g_new (guchar, (x2 - x1 + 2) * src_bytes);
dest = g_new (guchar, (x2 - x1) * src_bytes);
1999-09-04 07:14:44 +08:00
/* initialize the pixel regions (read from source, write into dest) */
gimp_pixel_rgn_init (&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&destPR, drawable, 0, 0, width, height, TRUE, TRUE);
pr = prev_row + src_bytes; /* row arrays are prepared for indexing to -1 (!) */
cr = cur_row + src_bytes;
nr = next_row + src_bytes;
diff_prepare_row (&srcPR, pr, x1, y1, (x2 - x1));
diff_prepare_row (&srcPR, cr, x1, y1+1, (x2 - x1));
/* loop through the rows, applying the smoothing function */
for (row = y1; row < y2; row++)
{
/* prepare the next row */
diff_prepare_row (&srcPR, nr, x1, row + 1, (x2 - x1));
d = dest;
for (col = 0; col < (x2 - x1); col++) /* over columns of pixels */
{
offb = col*src_bytes; /* base of byte pointer offset */
off1 = offb+1; /* offset into row arrays */
pval = (256.0 * pr[offb - src_bytes] + pr[off1 - src_bytes] +
256.0 * pr[offb] + pr[off1] +
256.0 * pr[offb + src_bytes] + pr[off1 + src_bytes] +
256.0 * cr[offb - src_bytes] + cr[off1 - src_bytes] +
256.0 * cr[offb] + cr[off1] +
256.0 * cr[offb + src_bytes] + cr[off1 + src_bytes] +
256.0 * nr[offb - src_bytes] + nr[off1 - src_bytes] +
256.0 * nr[offb] + nr[off1] +
256.0 * nr[offb + src_bytes]) + nr[off1 + src_bytes];
pval /= 9.0; /* take the average */
*d++ = (guchar) (((gint) pval) >> 8); /* high-order byte */
*d++ = (guchar) (((gint) pval) % 256); /* low-order byte */
d += dest_bytes_inc; /* move data pointer on to next destination pixel */
}
1999-09-04 07:14:44 +08:00
/* store the dest */
gimp_pixel_rgn_set_row (&destPR, dest, x1, row, (x2 - x1));
/* shuffle the row pointers */
tmp = pr;
pr = cr;
cr = nr;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
nr = tmp;
1999-09-04 07:14:44 +08:00
if ((row % 8) == 0)
gimp_progress_update ((double) row / (double) (y2 - y1));
1999-09-04 07:14:44 +08:00
}
/* update the region */
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
gimp_drawable_update (drawable->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
1999-09-04 07:14:44 +08:00
g_free (prev_row); /* row buffers allocated at top of fn. */
g_free (cur_row);
g_free (next_row);
g_free (dest);
1999-09-04 07:14:44 +08:00
} /* end blur16() */
/* ====================================================================== */
/* Get one row of pixels from the PixelRegion and put them in 'data' */
static void
diff_prepare_row (GimpPixelRgn *pixel_rgn,
guchar *data,
gint x,
gint y,
gint w)
1999-09-04 07:14:44 +08:00
{
gint b;
1999-09-04 07:14:44 +08:00
y = CLAMP (y, 0, pixel_rgn->h - 1);
gimp_pixel_rgn_get_row (pixel_rgn, data, x, y, w);
1999-09-04 07:14:44 +08:00
/* Fill in edge pixels */
for (b = 0; b < pixel_rgn->bpp; b++)
{
data[b - (gint) pixel_rgn->bpp] = data[b];
1999-09-04 07:14:44 +08:00
data[w * pixel_rgn->bpp + b] = data[(w - 1) * pixel_rgn->bpp + b];
}
}
/* -------------------------------------------------------------------------- */
/* 'diff' combines the input drawables to prepare the two */
/* 16-bit (X,Y) vector displacement maps */
/* -------------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
static void
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
diff (GimpDrawable *drawable,
gint32 *xl_id,
gint32 *yl_id)
1999-09-04 07:14:44 +08:00
{
GimpDrawable *draw_xd, *draw_yd; /* vector disp. drawables */
GimpDrawable *mdraw, *vdraw, *gdraw;
gint32 image_id; /* image holding X and Y diff. arrays */
gint32 new_image_id; /* image holding X and Y diff. layers */
gint32 layer_active; /* currently active layer */
gint32 xlayer_id, ylayer_id; /* individual X and Y layer ID numbers */
GimpPixelRgn srcPR, destxPR, destyPR;
GimpPixelRgn vecPR, magPR, gradPR;
1999-09-04 07:14:44 +08:00
gint width, height;
gint src_bytes;
gint mbytes = 0;
gint vbytes = 0;
gint gbytes = 0; /* bytes-per-pixel of various source drawables */
1999-09-04 07:14:44 +08:00
gint dest_bytes;
gint dest_bytes_inc;
gint do_gradmap = FALSE; /* whether to add in gradient of gradmap to final diff. map */
gint do_vecmap = FALSE; /* whether to add in a fixed vector scaled by the vector map */
gint do_magmap = FALSE; /* whether to multiply result by the magnitude map */
1999-09-04 07:14:44 +08:00
guchar *destx, *dx, *desty, *dy; /* pointers to rows of X and Y diff. data */
guchar *tmp;
guchar *prev_row, *pr;
guchar *cur_row, *cr;
guchar *next_row, *nr;
guchar *prev_row_g, *prg = NULL; /* pointers to gradient map data */
guchar *cur_row_g, *crg = NULL;
guchar *next_row_g, *nrg = NULL;
guchar *cur_row_v, *crv = NULL; /* pointers to vector map data */
guchar *cur_row_m, *crm = NULL; /* pointers to magnitude map data */
gint row, col, offb, off, bytes; /* relating to indexing into pixel row arrays */
1999-09-04 07:14:44 +08:00
gint x1, y1, x2, y2;
gint dvalx, dvaly; /* differential value at particular pixel */
gdouble tx, ty; /* temporary x,y differential value increments from gradmap, etc. */
gdouble rdx, rdy; /* x,y differential values: real #s */
gdouble rscalefac; /* scaling factor for x,y differential of 'curl' map */
gdouble gscalefac; /* scaling factor for x,y differential of 'gradient' map */
gdouble r, theta, dtheta; /* rectangular<-> spherical coordinate transform for vector rotation */
gdouble scale_vec_x, scale_vec_y; /* fixed vector X,Y component scaling factors */
1999-09-04 07:14:44 +08:00
gint has_alpha, ind;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
/* ----------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
if (dvals.grad_scale != 0.0)
do_gradmap = TRUE; /* add in gradient of gradmap if scale != 0.000 */
if (dvals.vector_scale != 0.0) /* add in gradient of vectormap if scale != 0.000 */
do_vecmap = TRUE;
do_magmap = (dvals.mag_use == TRUE); /* multiply by magnitude map if so requested */
1999-09-04 07:14:44 +08:00
/* Get the input area. This is the bounding box of the selection in
* the image (or the entire image if there is no selection). Only
* operating on the input area is simply an optimization. It doesn't
* need to be done for correct operation. (It simply makes it go
* faster, since fewer pixels need to be operated on).
*/
if (! gimp_drawable_mask_intersect (drawable->drawable_id,
&x1, &y1, &width, &height))
return;
1999-09-04 07:14:44 +08:00
x2 = x1 + width;
y2 = y1 + height;
1999-09-04 07:14:44 +08:00
/* Get the size of the input image. (This will/must be the same
* as the size of the output image.
*/
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
width = drawable->width;
height = drawable->height;
src_bytes = drawable->bpp;
has_alpha = gimp_drawable_has_alpha (drawable->drawable_id);
1999-09-04 07:14:44 +08:00
/* -- Add two layers: X and Y Displacement vectors -- */
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
/* -- I'm using a RGB drawable and using the first two bytes for a
16-bit pixel value. This is either clever, or a kluge,
1999-09-04 07:14:44 +08:00
depending on your point of view. */
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
image_id = gimp_drawable_get_image (drawable->drawable_id);
layer_active = gimp_image_get_active_layer (image_id);
1999-09-04 07:14:44 +08:00
/* create new image for X,Y diff */
new_image_id = gimp_image_new (width, height, GIMP_RGB);
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
xlayer_id = gimp_layer_new (new_image_id, "Warp_X_Vectors",
width, height,
GIMP_RGB_IMAGE, 100.0, GIMP_NORMAL_MODE);
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
ylayer_id = gimp_layer_new (new_image_id, "Warp_Y_Vectors",
width, height,
GIMP_RGB_IMAGE, 100.0, GIMP_NORMAL_MODE);
1999-09-04 07:14:44 +08:00
draw_yd = gimp_drawable_get (ylayer_id);
draw_xd = gimp_drawable_get (xlayer_id);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
gimp_image_add_layer (new_image_id, xlayer_id, 1);
gimp_image_add_layer (new_image_id, ylayer_id, 1);
gimp_drawable_fill (xlayer_id, GIMP_BACKGROUND_FILL);
gimp_drawable_fill (ylayer_id, GIMP_BACKGROUND_FILL);
gimp_image_set_active_layer (image_id, layer_active);
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
dest_bytes = draw_xd->bpp;
1999-09-04 07:14:44 +08:00
/* for a GRAYA drawable, I would expect this to be two bytes; any more would be excess */
dest_bytes_inc = dest_bytes - 2;
/* allocate row buffers for source & dest. data */
prev_row = g_new (guchar, (x2 - x1 + 2) * src_bytes);
cur_row = g_new (guchar, (x2 - x1 + 2) * src_bytes);
next_row = g_new (guchar, (x2 - x1 + 2) * src_bytes);
1999-09-04 07:14:44 +08:00
prev_row_g = g_new (guchar, (x2 - x1 + 2) * src_bytes);
cur_row_g = g_new (guchar, (x2 - x1 + 2) * src_bytes);
next_row_g = g_new (guchar, (x2 - x1 + 2) * src_bytes);
1999-09-04 07:14:44 +08:00
cur_row_v = g_new (guchar, (x2 - x1 + 2) * src_bytes); /* vector map */
cur_row_m = g_new (guchar, (x2 - x1 + 2) * src_bytes); /* magnitude map */
1999-09-04 07:14:44 +08:00
destx = g_new (guchar, (x2 - x1) * dest_bytes);
desty = g_new (guchar, (x2 - x1) * dest_bytes);
1999-09-04 07:14:44 +08:00
/* initialize the source and destination pixel regions */
/* 'curl' vector-rotation input */
gimp_pixel_rgn_init (&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
/* destination: X diff output */
gimp_pixel_rgn_init (&destxPR, draw_xd, 0, 0, width, height, TRUE, FALSE);
/* Y diff output */
gimp_pixel_rgn_init (&destyPR, draw_yd, 0, 0, width, height, TRUE, FALSE);
1999-09-04 07:14:44 +08:00
pr = prev_row + src_bytes;
cr = cur_row + src_bytes;
nr = next_row + src_bytes;
diff_prepare_row (&srcPR, pr, x1, y1, (x2 - x1));
diff_prepare_row (&srcPR, cr, x1, y1+1, (x2 - x1));
/* fixed-vector (x,y) component scale factors */
scale_vec_x = (dvals.vector_scale *
cos ((90 - dvals.vector_angle) * G_PI / 180.0) * 256.0 / 10);
scale_vec_y = (dvals.vector_scale *
sin ((90 - dvals.vector_angle) * G_PI / 180.0) * 256.0 / 10);
if (do_vecmap)
{
vdraw = gimp_drawable_get(dvals.vector_map);
vbytes = vdraw->bpp; /* bytes per pixel in SOURCE drawable */
/* fixed-vector scale-map */
gimp_pixel_rgn_init (&vecPR, vdraw, 0, 0, width, height, FALSE, FALSE);
crv = cur_row_v + vbytes;
diff_prepare_row (&vecPR, crv, x1, y1, (x2 - x1));
}
if (do_gradmap)
{
gdraw = gimp_drawable_get(dvals.grad_map);
gbytes = gdraw->bpp;
/* fixed-vector scale-map */
gimp_pixel_rgn_init (&gradPR, gdraw, 0, 0, width, height, FALSE, FALSE);
prg = prev_row_g + gbytes;
crg = cur_row_g + gbytes;
nrg = next_row_g + gbytes;
diff_prepare_row (&gradPR, prg, x1, y1 - 1, (x2 - x1));
diff_prepare_row (&gradPR, crg, x1, y1, (x2 - x1));
}
if (do_magmap)
{
mdraw = gimp_drawable_get(dvals.mag_map);
mbytes = mdraw->bpp;
/* fixed-vector scale-map */
gimp_pixel_rgn_init (&magPR, mdraw, 0, 0, width, height, FALSE, FALSE);
crm = cur_row_m + mbytes;
diff_prepare_row (&magPR, crm, x1, y1, (x2 - x1));
}
1999-09-04 07:14:44 +08:00
dtheta = dvals.angle * G_PI / 180.0;
/* note that '3' is rather arbitrary here. */
rscalefac = 256.0 / (3 * src_bytes);
/* scale factor for gradient map components */
gscalefac = dvals.grad_scale * 256.0 / (3 * gbytes);
1999-09-04 07:14:44 +08:00
/* loop through the rows, applying the differential convolution */
for (row = y1; row < y2; row++)
{
/* prepare the next row */
diff_prepare_row (&srcPR, nr, x1, row + 1, (x2 - x1));
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
1999-09-04 07:14:44 +08:00
if (do_magmap)
diff_prepare_row (&magPR, crm, x1, row + 1, (x2 - x1));
if (do_vecmap)
diff_prepare_row (&vecPR, crv, x1, row + 1, (x2 - x1));
if (do_gradmap)
diff_prepare_row (&gradPR, crg, x1, row + 1, (x2 - x1));
dx = destx;
dy = desty;
ind = 0;
for (col = 0; col < (x2 - x1); col++) /* over columns of pixels */
{
rdx = 0.0;
rdy = 0.0;
ty = 0.0;
tx = 0.0;
offb = col * src_bytes; /* base of byte pointer offset */
for (bytes=0; bytes < src_bytes; bytes++) /* add all channels together */
{
off = offb+bytes; /* offset into row arrays */
rdx += ((gint) -pr[off - src_bytes] + (gint) pr[off + src_bytes] +
(gint) -2*cr[off - src_bytes] + (gint) 2*cr[off + src_bytes] +
(gint) -nr[off - src_bytes] + (gint) nr[off + src_bytes]);
rdy += ((gint) -pr[off - src_bytes] - (gint)2*pr[off] - (gint) pr[off + src_bytes] +
(gint) nr[off - src_bytes] + (gint)2*nr[off] + (gint) nr[off + src_bytes]);
}
rdx *= rscalefac; /* take average, then reduce. Assume max. rdx now 65535 */
rdy *= rscalefac; /* take average, then reduce */
theta = atan2(rdy,rdx); /* convert to polar, then back to rectang. coords */
r = sqrt(rdy*rdy + rdx*rdx);
theta += dtheta; /* rotate gradient vector by this angle (radians) */
rdx = r * cos(theta);
rdy = r * sin(theta);
if (do_gradmap)
{
offb = col*gbytes; /* base of byte pointer offset into pixel values (R,G,B,Alpha, etc.) */
for (bytes=0; bytes < src_bytes; bytes++) /* add all channels together */
{
off = offb+bytes; /* offset into row arrays */
tx += ((gint) -prg[off - gbytes] + (gint) prg[off + gbytes] +
(gint) -2*crg[off - gbytes] + (gint) 2*crg[off + gbytes] +
(gint) -nrg[off - gbytes] + (gint) nrg[off + gbytes]);
1999-09-04 07:14:44 +08:00
ty += ((gint) -prg[off - gbytes] - (gint)2*prg[off] - (gint) prg[off + gbytes] +
(gint) nrg[off - gbytes] + (gint)2*nrg[off] + (gint) nrg[off + gbytes]);
}
tx *= gscalefac;
ty *= gscalefac;
1999-09-04 07:14:44 +08:00
rdx += tx; /* add gradient component in to the other one */
rdy += ty;
1999-09-04 07:14:44 +08:00
} /* if (do_gradmap) */
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
if (do_vecmap)
{ /* add in fixed vector scaled by vec. map data */
tx = (gdouble) crv[col*vbytes]; /* use first byte only */
rdx += scale_vec_x * tx;
rdy += scale_vec_y * tx;
} /* if (do_vecmap) */
1999-09-04 07:14:44 +08:00
if (do_magmap)
{ /* multiply result by mag. map data */
tx = (gdouble) crm[col*mbytes];
rdx = (rdx * tx)/(255.0);
rdy = (rdy * tx)/(255.0);
} /* if do_magmap */
1999-09-04 07:14:44 +08:00
dvalx = rdx + (2<<14); /* take zero point to be 2^15, since this is two bytes */
dvaly = rdy + (2<<14);
1999-09-04 07:14:44 +08:00
if (dvalx < 0)
dvalx = 0;
1999-09-04 07:14:44 +08:00
if (dvalx > 65535)
dvalx = 65535;
1999-09-04 07:14:44 +08:00
*dx++ = (guchar) (dvalx >> 8); /* store high order byte in value channel */
*dx++ = (guchar) (dvalx % 256); /* store low order byte in alpha channel */
dx += dest_bytes_inc; /* move data pointer on to next destination pixel */
1999-09-04 07:14:44 +08:00
if (dvaly < 0)
dvaly = 0;
1999-09-04 07:14:44 +08:00
if (dvaly > 65535)
dvaly = 65535;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
*dy++ = (guchar) (dvaly >> 8);
*dy++ = (guchar) (dvaly % 256);
dy += dest_bytes_inc;
1999-09-04 07:14:44 +08:00
} /* ------------------------------- for (col...) ---------------- */
1999-09-04 07:14:44 +08:00
/* store the dest */
gimp_pixel_rgn_set_row (&destxPR, destx, x1, row, (x2 - x1));
gimp_pixel_rgn_set_row (&destyPR, desty, x1, row, (x2 - x1));
/* swap around the pointers to row buffers */
tmp = pr;
pr = cr;
cr = nr;
nr = tmp;
if (do_gradmap)
{
tmp = prg;
prg = crg;
crg = nrg;
nrg = tmp;
}
1999-09-04 07:14:44 +08:00
if ((row % 8) == 0)
gimp_progress_update ((gdouble) row / (gdouble) (y2 - y1));
1999-09-04 07:14:44 +08:00
} /* for (row..) */
/* update the region */
gimp_drawable_flush (draw_xd);
gimp_drawable_flush (draw_yd);
gimp_drawable_update (draw_xd->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
gimp_drawable_update (draw_yd->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
1999-09-04 07:14:44 +08:00
gimp_displays_flush(); /* make sure layer is visible */
gimp_progress_init (_("Smoothing X gradient"));
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
blur16(draw_xd);
gimp_progress_init (_("Smoothing Y gradient"));
1999-09-04 07:14:44 +08:00
blur16(draw_yd);
g_free (prev_row); /* row buffers allocated at top of fn. */
g_free (cur_row);
g_free (next_row);
g_free (prev_row_g); /* row buffers allocated at top of fn. */
g_free (cur_row_g);
g_free (next_row_g);
g_free (cur_row_v);
g_free (cur_row_m);
g_free (destx);
g_free (desty);
1999-09-04 07:14:44 +08:00
*xl_id = xlayer_id; /* pass back the X and Y layer ID numbers */
*yl_id = ylayer_id;
} /* end diff() */
/* -------------------------------------------------------------------------- */
/* The Warp displacement is done here. */
/* -------------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
static void
warp (GimpDrawable *orig_draw)
1999-09-04 07:14:44 +08:00
{
GimpDrawable *disp_map; /* Displacement map, ie, control array */
GimpDrawable *mag_draw; /* Magnitude multiplier factor map */
GimpDrawable *map_x;
GimpDrawable *map_y;
gboolean first_time = TRUE;
gint width;
gint height;
gint bytes;
gint orig_image_id;
gint image_type;
gint x1, y1, x2, y2;
gint32 xdlayer = -1;
gint32 ydlayer = -1;
gint32 image_ID;
/* index var. over all "warp" Displacement iterations */
gint warp_iter;
1999-09-04 07:14:44 +08:00
disp_map = gimp_drawable_get (dvals.warp_map);
mag_draw = gimp_drawable_get (dvals.mag_map);
1999-09-04 07:14:44 +08:00
/* calculate new X,Y Displacement image maps */
gimp_progress_init (_("Finding XY gradient"));
1999-09-04 07:14:44 +08:00
/* Get selection area */
if (! gimp_drawable_mask_intersect (orig_draw->drawable_id,
&x1, &y1, &width, &height))
return;
1999-09-04 07:14:44 +08:00
x2 = x1 + width;
y2 = y1 + height;
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
width = orig_draw->width;
height = orig_draw->height;
bytes = orig_draw->bpp;
image_type = gimp_drawable_type (orig_draw->drawable_id);
1999-09-04 07:14:44 +08:00
/* generate x,y differential images (arrays) */
diff (disp_map, &xdlayer, &ydlayer);
1999-09-04 07:14:44 +08:00
map_x = gimp_drawable_get (xdlayer);
map_y = gimp_drawable_get (ydlayer);
1999-09-04 07:14:44 +08:00
orig_image_id = gimp_drawable_get_image (orig_draw->drawable_id);
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
for (warp_iter = 0; warp_iter < dvals.iter; warp_iter++)
{
gimp_progress_init_printf (_("Flow step %d"), warp_iter+1);
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
progress = 0;
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
warp_one (orig_draw, orig_draw,
map_x, map_y, mag_draw, first_time, warp_iter);
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
gimp_drawable_update (orig_draw->drawable_id,
x1, y1, (x2 - x1), (y2 - y1));
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
1999-09-04 07:14:44 +08:00
renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry 2003-12-04 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/drawable.pdb: renamed gimp_drawable_image() to gimp_drawable_get_image() for symmetry with gimp_drawable_set_image(). * libgimp/gimpchannel.h: removed gimp_channel_get_image_id #define. * libgimp/gimpdrawable.h: removed gimp_drawable_image_id #define. * libgimp/gimplayer.h:: removed gimp_layer_get_image_id #define. * libgimp/gimpcompat.h: added the old stuff here. * app/pdb/drawable_cmds.c * libgimp/gimpdrawable_pdb.[ch]: regenerated. * libgimp/gimpmiscui.c * plug-ins/Lighting/lighting_main.c * plug-ins/MapObject/mapobject_main.c * plug-ins/common/curve_bend.c * plug-ins/common/film.c * plug-ins/common/newsprint.c * plug-ins/common/pixelize.c * plug-ins/common/ps.c * plug-ins/common/sample_colorize.c * plug-ins/common/smooth_palette.c * plug-ins/common/warp.c * plug-ins/imagemap/imap_cmd_gimp_guides.c * plug-ins/imagemap/imap_main.c * plug-ins/imagemap/imap_preview.c * plug-ins/maze/maze.c * plug-ins/pygimp/pygimp-drawable.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/scripts/addborder.scm * plug-ins/script-fu/scripts/carve-it.scm * plug-ins/script-fu/scripts/weave.scm: changed accordingly. * plug-ins/maze/maze.c: completely reindented. * plug-ins/script-fu/siod/trace.c: removed trailing whitespace. 2003-12-04 Michael Natterer <mitch@gimp.org> * libgimp/libgimp-sections.txt * libgimp/tmpl/gimpchannel.sgml * libgimp/tmpl/gimpdrawable.sgml * libgimp/tmpl/gimplayer.sgml: updated after gimp_drawable_get_image() cleanup.
2003-12-04 21:21:27 +08:00
first_time = FALSE;
}
1999-09-04 07:14:44 +08:00
image_ID = gimp_drawable_get_image (map_x->drawable_id);
1999-09-04 07:14:44 +08:00
gimp_drawable_detach (map_x);
gimp_drawable_detach (map_y);
gimp_image_delete (image_ID);
}
1999-09-04 07:14:44 +08:00
/* -------------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
static void
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
warp_one (GimpDrawable *draw,
GimpDrawable *new,
GimpDrawable *map_x,
GimpDrawable *map_y,
GimpDrawable *mag_draw,
gboolean first_time,
gint step)
1999-09-04 07:14:44 +08:00
{
GimpPixelRgn src_rgn;
GimpPixelRgn dest_rgn;
GimpPixelRgn map_x_rgn;
GimpPixelRgn map_y_rgn;
GimpPixelRgn mag_rgn;
GimpTile * tile = NULL;
GimpTile * xtile = NULL;
GimpTile * ytile = NULL;
1999-09-04 07:14:44 +08:00
gint row=-1;
gint xrow=-1;
gint yrow=-1;
gint col=-1;
gint xcol=-1;
gint ycol=-1;
gpointer pr;
gint width = -1;
gint height = -1;
gint dest_bytes=-1;
gint dmap_bytes=-1;
guchar *destrow, *dest;
guchar *srcrow, *src;
guchar *mxrow=NULL, *mx; /* NULL ptr. to make gcc's -Wall fn. happy */
guchar *myrow=NULL, *my;
guchar *mmagrow=NULL, *mmag=NULL;
guchar pixel[4][4];
gint x1, y1, x2, y2;
gint x, y;
gint max_progress;
gdouble needx, needy;
gdouble xval=0; /* initialize to quiet compiler grumbles */
gdouble yval=0; /* interpolated vector displacement */
gdouble scalefac; /* multiplier for vector displacement scaling */
gdouble dscalefac; /* multiplier for incremental displacement vectors */
gint xi, yi;
gint substep; /* loop variable counting displacement vector substeps */
guchar values[4];
guint32 ivalues[4];
1999-09-04 07:14:44 +08:00
guchar val;
gint k;
gdouble dx, dy; /* X and Y Displacement, integer from GRAY map */
gint xm_alpha = 0;
gint ym_alpha = 0;
gint mmag_alpha = 0;
gint xm_bytes = 1;
gint ym_bytes = 1;
gint mmag_bytes = 1;
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c 2002-11-20 Dave Neary <bolsh@gimp.org> * configure.in * app/core/gimpbrushpipe.c * app/gui/about-dialog.c * app/paint-funcs/paint-funcs-generic.h * app/paint-funcs/paint-funcs.c * libgimpmath/gimpmath.h * libgimpwidgets/gimpwidgets.c * plug-ins/common/CML_explorer.c * plug-ins/common/blur.c * plug-ins/common/cubism.c * plug-ins/common/gee.c * plug-ins/common/gee_zoom.c * plug-ins/common/gqbist.c * plug-ins/common/jigsaw.c * plug-ins/common/lic.c * plug-ins/common/noisify.c * plug-ins/common/nova.c * plug-ins/common/papertile.c * plug-ins/common/plasma.c * plug-ins/common/randomize.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/shift.c * plug-ins/common/sinus.c * plug-ins/common/smooth_palette.c * plug-ins/common/snoise.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/spread.c * plug-ins/common/warp.c * plug-ins/common/wind.c * plug-ins/flame/cmap.c * plug-ins/flame/flame.c * plug-ins/flame/libifs.c * plug-ins/gflare/gflare.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/gimpressionist/gimpressionist.h * plug-ins/gimpressionist/plasma.c * plug-ins/gimpressionist/repaint.c * plug-ins/ifscompose/ifscompose_utils.c * plug-ins/maze/algorithms.c * plug-ins/maze/maze.c * plug-ins/maze/maze.h * plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX, G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(), srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand* equivalent. Programs which require seed setting for reproducible results, and anything in the core, gets a dedicated GRand * for the lifetime required. Programs which only ever used random numbers for tossing a coin, rolling a dice, etc use g_random functions. For the rest, judgement was used. Where it was easy, a GRand * object was used and g_rand_* functions were preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
GRand *gr;
1999-09-04 07:14:44 +08:00
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c 2002-11-20 Dave Neary <bolsh@gimp.org> * configure.in * app/core/gimpbrushpipe.c * app/gui/about-dialog.c * app/paint-funcs/paint-funcs-generic.h * app/paint-funcs/paint-funcs.c * libgimpmath/gimpmath.h * libgimpwidgets/gimpwidgets.c * plug-ins/common/CML_explorer.c * plug-ins/common/blur.c * plug-ins/common/cubism.c * plug-ins/common/gee.c * plug-ins/common/gee_zoom.c * plug-ins/common/gqbist.c * plug-ins/common/jigsaw.c * plug-ins/common/lic.c * plug-ins/common/noisify.c * plug-ins/common/nova.c * plug-ins/common/papertile.c * plug-ins/common/plasma.c * plug-ins/common/randomize.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/shift.c * plug-ins/common/sinus.c * plug-ins/common/smooth_palette.c * plug-ins/common/snoise.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/spread.c * plug-ins/common/warp.c * plug-ins/common/wind.c * plug-ins/flame/cmap.c * plug-ins/flame/flame.c * plug-ins/flame/libifs.c * plug-ins/gflare/gflare.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/gimpressionist/gimpressionist.h * plug-ins/gimpressionist/plasma.c * plug-ins/gimpressionist/repaint.c * plug-ins/ifscompose/ifscompose_utils.c * plug-ins/maze/algorithms.c * plug-ins/maze/maze.c * plug-ins/maze/maze.h * plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX, G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(), srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand* equivalent. Programs which require seed setting for reproducible results, and anything in the core, gets a dedicated GRand * for the lifetime required. Programs which only ever used random numbers for tossing a coin, rolling a dice, etc use g_random functions. For the rest, judgement was used. Where it was easy, a GRand * object was used and g_rand_* functions were preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
gr = g_rand_new (); /* Seed Pseudo Random Number Generator */
1999-09-04 07:14:44 +08:00
/* ================ Outer Loop calculation ================================ */
1999-09-04 07:14:44 +08:00
/* Get selection area */
if (! gimp_drawable_mask_intersect (draw->drawable_id,
&x1, &y1, &width, &height))
return;
x2 = x1 + width;
y2 = y1 + height;
width = draw->width;
height = draw->height;
dest_bytes = draw->bpp;
1999-09-04 07:14:44 +08:00
dmap_bytes = map_x->bpp;
1999-09-04 07:14:44 +08:00
max_progress = (x2 - x1) * (y2 - y1);
/* --------- Register the (many) pixel regions ---------- */
gimp_pixel_rgn_init (&src_rgn, draw,
x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
1999-09-04 07:14:44 +08:00
/* only push undo-stack the first time through. Thanks Spencer! */
if (first_time)
gimp_pixel_rgn_init (&dest_rgn,
new, x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
1999-09-04 07:14:44 +08:00
else
gimp_pixel_rgn_init (&dest_rgn,
new, x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
1999-09-04 07:14:44 +08:00
gimp_pixel_rgn_init (&map_x_rgn,
map_x, x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
if (gimp_drawable_has_alpha(map_x->drawable_id))
xm_alpha = 1;
xm_bytes = gimp_drawable_bpp(map_x->drawable_id);
1999-09-04 07:14:44 +08:00
gimp_pixel_rgn_init (&map_y_rgn,
map_y, x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
if (gimp_drawable_has_alpha(map_y->drawable_id))
ym_alpha = 1;
ym_bytes = gimp_drawable_bpp(map_y->drawable_id);
1999-09-04 07:14:44 +08:00
if (dvals.mag_use)
{
gimp_pixel_rgn_init (&mag_rgn,
mag_draw, x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
if (gimp_drawable_has_alpha(mag_draw->drawable_id))
mmag_alpha = 1;
1999-09-04 07:14:44 +08:00
mmag_bytes = gimp_drawable_bpp(mag_draw->drawable_id);
1999-09-04 07:14:44 +08:00
pr = gimp_pixel_rgns_register (5,
&src_rgn, &dest_rgn,
&map_x_rgn, &map_y_rgn, &mag_rgn);
}
else
{
pr = gimp_pixel_rgns_register (4,
&src_rgn, &dest_rgn,
&map_x_rgn, &map_y_rgn);
}
1999-09-04 07:14:44 +08:00
/* substep displacement vector scale factor */
dscalefac = dvals.amount / (256 * 127.5 * dvals.substeps);
1999-09-04 07:14:44 +08:00
for (pr = pr; pr != NULL; pr = gimp_pixel_rgns_process (pr))
{
srcrow = src_rgn.data;
destrow = dest_rgn.data;
mxrow = map_x_rgn.data;
myrow = map_y_rgn.data;
if (dvals.mag_use)
mmagrow = mag_rgn.data;
/* loop over destination pixels */
for (y = dest_rgn.y; y < (dest_rgn.y + dest_rgn.h); y++)
{
src = srcrow;
dest = destrow;
mx = mxrow;
my = myrow;
if (dvals.mag_use == TRUE)
mmag = mmagrow;
for (x = dest_rgn.x; x < (dest_rgn.x + dest_rgn.w); x++)
{
/* ----- Find displacement vector (amnt_x, amnt_y) ------------ */
dx = dscalefac * ((256.0 * mx[0]) + mx[1] -32768); /* 16-bit values */
dy = dscalefac * ((256.0 * my[0]) + my[1] -32768);
if (dvals.mag_use)
{
scalefac = warp_map_mag_give_value (mmag,
mmag_alpha,
mmag_bytes) / 255.0;
dx *= scalefac;
dy *= scalefac;
}
if (dvals.dither != 0.0)
{ /* random dither is +/- dvals.dither pixels */
dx += g_rand_double_range (gr, -dvals.dither, dvals.dither);
dy += g_rand_double_range (gr, -dvals.dither, dvals.dither);
}
if (dvals.substeps != 1)
{ /* trace (substeps) iterations of displacement vector */
for (substep = 1; substep < dvals.substeps; substep++)
{
/* In this (substep) loop, (x,y) remain fixed. (dx,dy) vary each step. */
needx = x + dx;
needy = y + dy;
if (needx >= 0.0)
xi = (gint) needx;
else
xi = -((gint) -needx + 1);
if (needy >= 0.0)
yi = (gint) needy;
else
yi = -((gint) -needy + 1);
/* get 4 neighboring DX values from DiffX drawable for linear interpolation */
xtile = warp_pixel (map_x, xtile, width, height, x1, y1, x2, y2, xi, yi, &xrow, &xcol, pixel[0]);
xtile = warp_pixel (map_x, xtile, width, height, x1, y1, x2, y2, xi + 1, yi, &xrow, &xcol, pixel[1]);
xtile = warp_pixel (map_x, xtile, width, height, x1, y1, x2, y2, xi, yi + 1, &xrow, &xcol, pixel[2]);
xtile = warp_pixel (map_x, xtile, width, height, x1, y1, x2, y2, xi + 1, yi + 1, &xrow, &xcol, pixel[3]);
ivalues[0] = 256 * pixel[0][0] + pixel[0][1];
ivalues[1] = 256 * pixel[1][0] + pixel[1][1];
ivalues[2] = 256 * pixel[2][0] + pixel[2][1];
ivalues[3] = 256 * pixel[3][0] + pixel[3][1];
xval = gimp_bilinear_32 (needx, needy, ivalues);
/* get 4 neighboring DY values from DiffY drawable for linear interpolation */
ytile = warp_pixel (map_y, ytile, width, height, x1, y1, x2, y2, xi, yi, &yrow, &ycol, pixel[0]);
ytile = warp_pixel (map_y, ytile, width, height, x1, y1, x2, y2, xi + 1, yi, &yrow, &ycol, pixel[1]);
ytile = warp_pixel (map_y, ytile, width, height, x1, y1, x2, y2, xi, yi + 1, &yrow, &ycol, pixel[2]);
ytile = warp_pixel (map_y, ytile, width, height, x1, y1, x2, y2, xi + 1, yi + 1, &yrow, &ycol, pixel[3]);
ivalues[0] = 256 * pixel[0][0] + pixel[0][1];
ivalues[1] = 256 * pixel[1][0] + pixel[1][1];
ivalues[2] = 256 * pixel[2][0] + pixel[2][1];
ivalues[3] = 256 * pixel[3][0] + pixel[3][1];
yval = gimp_bilinear_32 (needx, needy, ivalues);
/* move displacement vector to this new value */
dx += dscalefac * (xval - 32768);
dy += dscalefac * (yval - 32768);
} /* for (substep) */
} /* if (substeps != 0) */
1999-09-04 07:14:44 +08:00
/* --------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
needx = x + dx;
needy = y + dy;
1999-09-04 07:14:44 +08:00
mx += xm_bytes; /* pointers into x,y displacement maps */
my += ym_bytes;
1999-09-04 07:14:44 +08:00
if (dvals.mag_use == TRUE)
mmag += mmag_bytes;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
/* Calculations complete; now copy the proper pixel */
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
if (needx >= 0.0)
xi = (gint) needx;
else
xi = -((gint) -needx + 1);
1999-09-04 07:14:44 +08:00
if (needy >= 0.0)
yi = (gint) needy;
else
yi = -((gint) -needy + 1);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
/* get 4 neighboring pixel values from source drawable for linear interpolation */
tile = warp_pixel (draw, tile, width, height, x1, y1, x2, y2, xi, yi, &row, &col, pixel[0]);
tile = warp_pixel (draw, tile, width, height, x1, y1, x2, y2, xi + 1, yi, &row, &col, pixel[1]);
tile = warp_pixel (draw, tile, width, height, x1, y1, x2, y2, xi, yi + 1, &row, &col, pixel[2]);
tile = warp_pixel (draw, tile, width, height, x1, y1, x2, y2, xi + 1, yi + 1, &row, &col, pixel[3]);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
for (k = 0; k < dest_bytes; k++)
{
values[0] = pixel[0][k];
values[1] = pixel[1][k];
values[2] = pixel[2][k];
values[3] = pixel[3][k];
val = gimp_bilinear_8 (needx, needy, values);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
*dest++ = val;
} /* for k */
1999-09-04 07:14:44 +08:00
} /* for x */
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
/* srcrow += src_rgn.rowstride; */
srcrow += src_rgn.rowstride;
destrow += dest_rgn.rowstride;
mxrow += map_x_rgn.rowstride;
myrow += map_y_rgn.rowstride;
1999-09-04 07:14:44 +08:00
if (dvals.mag_use == TRUE)
mmagrow += mag_rgn.rowstride;
1999-09-04 07:14:44 +08:00
} /* for y */
1999-09-04 07:14:44 +08:00
progress += (dest_rgn.w * dest_rgn.h);
gimp_progress_update ((double) progress / (double) max_progress);
} /* for pr */
if (tile != NULL)
gimp_tile_unref (tile, FALSE);
if (xtile != NULL)
gimp_tile_unref (xtile, FALSE);
if (ytile != NULL)
gimp_tile_unref (ytile, FALSE);
/* update the region */
gimp_drawable_flush (new);
gimp_drawable_merge_shadow (draw->drawable_id, first_time);
configure.in app/core/gimpbrushpipe.c app/gui/about-dialog.c 2002-11-20 Dave Neary <bolsh@gimp.org> * configure.in * app/core/gimpbrushpipe.c * app/gui/about-dialog.c * app/paint-funcs/paint-funcs-generic.h * app/paint-funcs/paint-funcs.c * libgimpmath/gimpmath.h * libgimpwidgets/gimpwidgets.c * plug-ins/common/CML_explorer.c * plug-ins/common/blur.c * plug-ins/common/cubism.c * plug-ins/common/gee.c * plug-ins/common/gee_zoom.c * plug-ins/common/gqbist.c * plug-ins/common/jigsaw.c * plug-ins/common/lic.c * plug-ins/common/noisify.c * plug-ins/common/nova.c * plug-ins/common/papertile.c * plug-ins/common/plasma.c * plug-ins/common/randomize.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/shift.c * plug-ins/common/sinus.c * plug-ins/common/smooth_palette.c * plug-ins/common/snoise.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/spread.c * plug-ins/common/warp.c * plug-ins/common/wind.c * plug-ins/flame/cmap.c * plug-ins/flame/flame.c * plug-ins/flame/libifs.c * plug-ins/gflare/gflare.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/gimpressionist/gimpressionist.h * plug-ins/gimpressionist/plasma.c * plug-ins/gimpressionist/repaint.c * plug-ins/ifscompose/ifscompose_utils.c * plug-ins/maze/algorithms.c * plug-ins/maze/maze.c * plug-ins/maze/maze.h * plug-ins/mosaic/mosaic.c: Change all occurrences of RAND_MAX, G_MAXRAND, rand(), srand(), lrand48(), srand48(), random(), srandom(), RAND_FUNC and SRAND_FUNC to the appropriate g_rand* equivalent. Programs which require seed setting for reproducible results, and anything in the core, gets a dedicated GRand * for the lifetime required. Programs which only ever used random numbers for tossing a coin, rolling a dice, etc use g_random functions. For the rest, judgement was used. Where it was easy, a GRand * object was used and g_rand_* functions were preferred. This fixes bug #67386 in HEAD.
2002-11-20 17:27:48 +08:00
g_rand_free (gr);
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
1999-09-04 07:14:44 +08:00
} /* warp_one */
/* ------------------------------------------------------------------------- */
1999-09-04 07:14:44 +08:00
static gdouble
warp_map_mag_give_value (guchar *pt,
gint alpha,
gint bytes)
1999-09-04 07:14:44 +08:00
{
gdouble ret, val_alpha;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
1999-09-04 07:14:44 +08:00
if (bytes >= 3)
ret = (pt[0] + pt[1] + pt[2])/3.0;
else
ret = (gdouble) *pt;
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
1999-09-04 07:14:44 +08:00
if (alpha)
{
val_alpha = pt[bytes - 1];
ret = (ret * val_alpha / 255.0);
};
removed our own action_area API and use GtkDialog's one. Create all 2003-11-06 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.[ch]: removed our own action_area API and use GtkDialog's one. Create all dialogs without separator. Changed almost everything else too. Fixes bug #125143. * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c: changed accordingly. * libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType to GimpExportReturn. * libgimp/gimpcompat.h: added a #define for the old name. * themes/Default/gtkrc: increased action_area border to 6 pixels. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-scale.c * app/display/gimpprogress.c * app/gui/brush-select.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-new-dialog.c * app/gui/font-select.c * app/gui/gradient-editor-commands.c * app/gui/gradient-select.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/palette-select.c * app/gui/pattern-select.c * app/gui/preferences-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/user-install-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpimagemaptool.c * app/tools/gimpmeasuretool.c * app/tools/gimptransformtool.c * app/widgets/gimptexteditor.c * app/widgets/gimptooldialog.[ch] * app/widgets/gimpviewabledialog.[ch] * app/widgets/gimpwidgets-utils.c: changed accordingly and increased the dialogs' outer borders to 6 pixels all over the place. * plug-ins/*/*.c: changed accordingly. The plug-ins may be arbitrarily broken, I tested none of them.
2003-11-06 23:27:05 +08:00
1999-09-04 07:14:44 +08:00
return (ret);
}
static GimpTile *
warp_pixel (GimpDrawable *drawable,
GimpTile *tile,
gint width,
gint height,
gint x1,
gint y1,
gint x2,
gint y2,
gint x,
gint y,
gint *row,
gint *col,
guchar *pixel)
1999-09-04 07:14:44 +08:00
{
static guchar empty_pixel[4] = {0, 0, 0, 0};
guchar *data;
gint b;
1999-09-04 07:14:44 +08:00
/* Tile the image. */
if (dvals.wrap_type == WRAP)
{
if (x < 0)
x = width - (-x % width);
1999-09-04 07:14:44 +08:00
else
x %= width;
1999-09-04 07:14:44 +08:00
if (y < 0)
y = height - (-y % height);
1999-09-04 07:14:44 +08:00
else
y %= height;
1999-09-04 07:14:44 +08:00
}
/* Smear out the edges of the image by repeating pixels. */
else if (dvals.wrap_type == SMEAR)
{
if (x < 0)
x = 0;
1999-09-04 07:14:44 +08:00
else if (x > width - 1)
x = width - 1;
1999-09-04 07:14:44 +08:00
if (y < 0)
y = 0;
1999-09-04 07:14:44 +08:00
else if (y > height - 1)
y = height - 1;
1999-09-04 07:14:44 +08:00
}
if (x >= x1 && y >= y1 && x < x2 && y < y2)
{
if ((((guint) (x / tile_width)) != *col) ||
(((guint) (y / tile_height)) != *row))
{
*col = x / tile_width;
*row = y / tile_height;
if (tile)
gimp_tile_unref (tile, FALSE);
tile = gimp_drawable_get_tile (drawable, FALSE, *row, *col);
gimp_tile_ref (tile);
}
1999-09-04 07:14:44 +08:00
data = (tile->data +
tile->bpp * (tile->ewidth * (y % tile_height) + (x % tile_width)));
1999-09-04 07:14:44 +08:00
}
else
{
if (dvals.wrap_type == BLACK)
data = empty_pixel;
else
data = color_pixel; /* must have selected COLOR type */
}
for (b = 0; b < drawable->bpp; b++)
pixel[b] = data[b];
return tile;
}
/* Warp interface functions */
static gboolean
1999-09-04 07:14:44 +08:00
warp_map_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data)
1999-09-04 07:14:44 +08:00
{
GimpDrawable *drawable = data;
1999-09-04 07:14:44 +08:00
return (gimp_drawable_width (drawable_id) == drawable->width &&
gimp_drawable_height (drawable_id) == drawable->height);
1999-09-04 07:14:44 +08:00
}