gimp/plug-ins/common/mosaic.c

2773 lines
84 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
1997-11-25 06:05:25 +08:00
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +08:00
*/
/* Mosaic is a filter which transforms an image into
* what appears to be a mosaic, composed of small primitives,
* each of constant color and of an approximate size.
* Copyright (C) 1996 Spencer Kimball
* Speedups by Elliot Lee
1997-11-25 06:05:25 +08:00
*/
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.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.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc 1999-09-01 Tor Lillqvist <tml@iki.fi> * app/appenv.h * libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc from app/appenv.h here, so plug-ins can use them, too. Remove some commented-out old stuff in appenv.h. * libgimp/gimp.h: Include gimpmath.h. * libgimp/gimp.c (gimp_main): Win32: Don't install signal handlers, we can't do anything useful in the handler ourselves anyway (it would be nice to print out a backtrace, but that seems pretty hard to do, even if not impossible). Let Windows inform the user about the crash. If the plug-in was compiled with MSVC, and the user also has it, she is offered a chance to start the debugger automatically anyway. * app/*several*.c: Include gimpmath.h for G_PI etc. Don't include <math.h>, as gimpmath.h includes it. * plug-ins/*/*many*.c: Include config.h. Don't include <math.h>. Remove all the duplicated definitions of G_PI and rint(). Use RINT() instead of rint(). * app/app_procs.[ch]: app_exit() takes a gboolean. * app/batch.c * app/commands.c * app/interface.c: Call app_exit() with FALSE or TRUE. * app/main.c (on_error): Call gimp_fatal_error. (main): Don't install any signal handler on Win32 here, either. * app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format the message and call MessageBox with it. g_on_error_query doesn't do anything useful on Win32, and printf'ing a message to stdout or stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
#include "config.h"
1997-11-25 06:05:25 +08:00
#include <string.h>
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
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "libgimp/stdplugins-intl.h"
1997-11-25 06:05:25 +08:00
#define PLUG_IN_PROC "plug-in-mosaic"
#define PLUG_IN_BINARY "mosaic"
1997-11-25 06:05:25 +08:00
#define SCALE_WIDTH 150
1997-11-25 06:05:25 +08:00
#define HORIZONTAL 0
#define VERTICAL 1
#define SUPERSAMPLE 3
#define MAG_THRESHOLD 7.5
#define COUNT_THRESHOLD 0.1
#define MAX_POINTS 12
1997-11-25 06:05:25 +08:00
typedef enum
{
SQUARES = 0,
HEXAGONS = 1,
OCTAGONS = 2,
TRIANGLES = 3
} TileType;
#define SMOOTH 0
#define ROUGH 1
#define BW 0
#define FG_BG 1
1997-11-25 06:05:25 +08:00
typedef struct
{
gdouble x, y;
} Vertex;
typedef struct
{
guint npts;
1997-11-25 06:05:25 +08:00
Vertex pts[MAX_POINTS];
} Polygon;
typedef struct
{
gdouble base_x, base_y;
gdouble norm_x, norm_y;
gdouble light;
} SpecVec;
typedef struct
{
gdouble tile_size;
gdouble tile_height;
gdouble tile_spacing;
gdouble tile_neatness;
gboolean tile_allow_split;
gdouble light_dir;
gdouble color_variation;
gboolean antialiasing;
gint color_averaging;
TileType tile_type;
gint tile_surface;
gint grout_color;
gboolean update_preview;
1997-11-25 06:05:25 +08:00
} MosaicVals;
/* Declare local functions.
*/
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static void mosaic (GimpDrawable *drawable,
GimpPreview *preview);
1997-11-25 06:05:25 +08:00
/* user interface functions */
static gboolean mosaic_dialog (GimpDrawable *drawable);
1997-11-25 06:05:25 +08:00
/* gradient finding machinery */
static void find_gradients (GimpDrawable *drawable,
gdouble std_dev,
gint x1,
gint y1,
gint width,
gint height,
GimpPreview *preview);
static void find_max_gradient (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn);
1997-11-25 06:05:25 +08:00
/* gaussian & 1st derivative */
static void gaussian_deriv (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn,
gint direction,
gdouble std_dev,
gint *prog,
gint max_prog,
gint ith_prog,
gint x1,
gint y1,
gint x2,
gint y2,
GimpPreview *preview);
static void make_curve (gint *curve,
gint *sum,
gdouble std_dev,
gint length);
static void make_curve_d (gint *curve,
gint *sum,
gdouble std_dev,
gint length);
1997-11-25 06:05:25 +08:00
/* grid creation and localization machinery */
static gdouble fp_rand (gdouble val);
static void grid_create_squares (gint x1,
gint y1,
gint x2,
gint y2);
static void grid_create_hexagons (gint x1,
gint y1,
gint x2,
gint y2);
static void grid_create_octagons (gint x1,
gint y1,
gint x2,
gint y2);
static void grid_create_triangles (gint x1,
gint y1,
gint x2,
gint y2);
static void grid_localize (gint x1,
gint y1,
gint x2,
gint y2);
static void grid_render (GimpDrawable *drawable,
gint x1,
gint y1,
gint x2,
gint y2,
GimpPreview *preview);
static void split_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble *dir,
gdouble color_vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest);
static void clip_poly (gdouble *vec,
gdouble *pt,
Polygon *poly,
Polygon *new_poly);
static void clip_point (gdouble *dir,
gdouble *pt,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
Polygon *poly);
static void process_poly (Polygon *poly,
gboolean allow_split,
GimpDrawable *drawable,
guchar *col,
gboolean vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest);
static void render_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest);
static void find_poly_dir (Polygon *poly,
guchar *m_gr,
guchar *h_gr,
guchar *v_gr,
gdouble *dir,
gdouble *loc,
gint x1,
gint y1,
gint x2,
gint y2);
static void find_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
double vary,
gint x1,
gint y1,
gint x2,
gint y2);
static void scale_poly (Polygon *poly,
gdouble cx,
gdouble cy,
gdouble scale);
static void fill_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest);
static void fill_poly_image (Polygon *poly,
GimpDrawable *drawable,
gdouble vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest);
static void calc_spec_vec (SpecVec *vec,
gint xs,
gint ys,
gint xe,
gint ye);
static gdouble calc_spec_contrib (SpecVec *vec,
gint n,
gdouble x,
gdouble y);
static void convert_segment (gint x1,
gint y1,
gint x2,
gint y2,
gint offset,
gint *min,
gint *max);
static void polygon_add_point (Polygon *poly,
gdouble x,
gdouble y);
static gboolean polygon_find_center (Polygon *poly,
gdouble *x,
gdouble *y);
static void polygon_translate (Polygon *poly,
gdouble tx,
gdouble ty);
static void polygon_scale (Polygon *poly,
gdouble scale);
static gboolean polygon_extents (Polygon *poly,
gdouble *min_x,
gdouble *min_y,
gdouble *max_x,
gdouble *max_y);
static void polygon_reset (Polygon *poly);
1997-11-25 06:05:25 +08:00
/*
* Some static variables
*/
static gdouble std_dev = 1.0;
static gdouble light_x;
static gdouble light_y;
static gdouble scale;
static guchar *h_grad;
static guchar *v_grad;
static guchar *m_grad;
static Vertex *grid;
static gint grid_rows;
static gint grid_cols;
static gint grid_row_pad;
static gint grid_col_pad;
static gint grid_multiple;
static gint grid_rowstride;
static guchar back[4];
static guchar fore[4];
static SpecVec vecs[MAX_POINTS];
1997-11-25 06:05:25 +08:00
static MosaicVals mvals =
{
15.0, /* tile_size */
4.0, /* tile_height */
1.0, /* tile_spacing */
0.65, /* tile_neatness */
TRUE, /* tile_allow_split */
1997-11-25 06:05:25 +08:00
135, /* light_dir */
0.2, /* color_variation */
TRUE, /* antialiasing */
1997-11-25 06:05:25 +08:00
1, /* color_averaging */
HEXAGONS, /* tile_type */
SMOOTH, /* tile_surface */
BW, /* grout_color */
TRUE /* preview */
1997-11-25 06:05:25 +08:00
};
const GimpPlugInInfo PLUG_IN_INFO =
1997-11-25 06:05:25 +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 */
1997-11-25 06:05:25 +08:00
};
MAIN ()
static void
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
query (void)
1997-11-25 06:05:25 +08:00
{
static const GimpParamDef args[] =
1997-11-25 06:05:25 +08:00
{
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_FLOAT, "tile-size", "Average diameter of each tile (in pixels)" },
{ GIMP_PDB_FLOAT, "tile-height", "Apparent height of each tile (in pixels)" },
{ GIMP_PDB_FLOAT, "tile-spacing", "Inter-tile spacing (in pixels)" },
{ GIMP_PDB_FLOAT, "tile-neatness", "Deviation from perfectly formed tiles (0.0 - 1.0)" },
{ GIMP_PDB_INT32, "tile-allow-split", "Allows splitting tiles at hard edges" },
{ GIMP_PDB_FLOAT, "light-dir", "Direction of light-source (in degrees)" },
{ GIMP_PDB_FLOAT, "color-variation", "Magnitude of random color variations (0.0 - 1.0)" },
{ GIMP_PDB_INT32, "antialiasing", "Enables smoother tile output at the cost of speed" },
{ GIMP_PDB_INT32, "color-averaging", "Tile color based on average of subsumed pixels" },
{ GIMP_PDB_INT32, "tile-type", "Tile geometry: { SQUARES (0), HEXAGONS (1), OCTAGONS (2), TRIANGLES (3) }" },
{ GIMP_PDB_INT32, "tile-surface", "Surface characteristics: { SMOOTH (0), ROUGH (1) }" },
{ GIMP_PDB_INT32, "grout-color", "Grout color (black/white or fore/background): { BW (0), FG_BG (1) }" }
1997-11-25 06:05:25 +08:00
};
gimp_install_procedure (PLUG_IN_PROC,
Bill Skaggs <weskaggs@primate.ucdavis.edu> * plug-ins/common/AlienMap2.c * plug-ins/common/CML_explorer.c * plug-ins/common/align_layers.c * plug-ins/common/animationplay.c * plug-ins/common/animoptimize.c * plug-ins/common/apply_lens.c * plug-ins/common/autocrop.c * plug-ins/common/autostretch_hsv.c * plug-ins/common/blinds.c * plug-ins/common/blur.c * plug-ins/common/borderaverage.c * plug-ins/common/bumpmap.c * plug-ins/common/c_astretch.c * plug-ins/common/cartoon.c * plug-ins/common/ccanalyze.c * plug-ins/common/channel_mixer.c * plug-ins/common/checkerboard.c * plug-ins/common/color_enhance.c * plug-ins/common/colorify.c * plug-ins/common/colortoalpha.c * plug-ins/common/compose.c * plug-ins/common/convmatrix.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/decompose.c * plug-ins/common/deinterlace.c * plug-ins/common/depthmerge.c * plug-ins/common/despeckle.c * plug-ins/common/destripe.c * plug-ins/common/diffraction.c * plug-ins/common/displace.c * plug-ins/common/dog.c * plug-ins/common/edge.c * plug-ins/common/emboss.c * plug-ins/common/engrave.c * plug-ins/common/exchange.c * plug-ins/common/film.c * plug-ins/common/flarefx.c * plug-ins/common/fp.c * plug-ins/common/fractaltrace.c * plug-ins/common/gauss.c * plug-ins/common/gee.c * plug-ins/common/gee_zoom.c * plug-ins/common/glasstile.c * plug-ins/common/gnomeprint.c * plug-ins/common/gqbist.c * plug-ins/common/gradmap.c * plug-ins/common/grid.c * plug-ins/common/guillotine.c * plug-ins/common/hot.c * plug-ins/common/illusion.c * plug-ins/common/iwarp.c * plug-ins/common/jigsaw.c * plug-ins/common/laplace.c * plug-ins/common/lic.c * plug-ins/common/mail.c * plug-ins/common/mapcolor.c * plug-ins/common/max_rgb.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/neon.c * plug-ins/common/newsprint.c * plug-ins/common/nlfilt.c * plug-ins/common/noisify.c * plug-ins/common/normalize.c * plug-ins/common/nova.c * plug-ins/common/oilify.c * plug-ins/common/papertile.c * plug-ins/common/photocopy.c * plug-ins/common/pixelize.c * plug-ins/common/plasma.c * plug-ins/common/plugin-browser.c * plug-ins/common/polar.c * plug-ins/common/procedure-browser.c * plug-ins/common/randomize.c * plug-ins/common/retinex.c * plug-ins/common/ripple.c * plug-ins/common/sample_colorize.c * plug-ins/common/scatter_hsv.c * plug-ins/common/screenshot.c * plug-ins/common/sel_gauss.c * plug-ins/common/semiflatten.c * plug-ins/common/sharpen.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/sobel.c * plug-ins/common/softglow.c * plug-ins/common/sparkle.c * plug-ins/common/spheredesigner.c * plug-ins/common/spread.c * plug-ins/common/struc.c * plug-ins/common/threshold_alpha.c * plug-ins/common/tile.c * plug-ins/common/tileit.c * plug-ins/common/tiler.c * plug-ins/common/uniteditor.c * plug-ins/common/unsharp.c * plug-ins/common/video.c * plug-ins/common/vinvert.c * plug-ins/common/vpropagate.c * plug-ins/common/warp.c * plug-ins/common/waves.c * plug-ins/common/whirlpinch.c * plug-ins/common/wind.c * plug-ins/common/winprint.c * plug-ins/common/zealouscrop.c: Give "helpful" blurbs to menu- accessible plugins, and mark them for translation. Probably there is room for improvement in some of them. Still needs to be done for plug-ins not in "common".
2006-03-16 05:10:34 +08:00
N_("Convert the image into irregular tiles"),
"Help not yet written for this plug-in",
"Spencer Kimball",
"Spencer Kimball & Peter Mattis",
"1996",
N_("_Mosaic..."),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (args), 0,
args, NULL);
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Distorts");
1997-11-25 06:05:25 +08:00
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
1997-11-25 06:05:25 +08:00
{
static GimpParam values[1];
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpDrawable *drawable;
1997-11-25 06:05:25 +08:00
run_mode = param[0].data.d_int32;
INIT_I18N ();
1997-11-25 06:05:25 +08:00
*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;
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
values[0].data.d_status = status;
1997-11-25 06:05:25 +08:00
/* Get the active drawable */
drawable = gimp_drawable_get (param[2].data.d_drawable);
/* set the tile cache size so that the gaussian blur works well */
gimp_tile_cache_ntiles (2 * (MAX (drawable->width,
drawable->height) /
gimp_tile_width () + 1));
1997-11-25 06:05:25 +08:00
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
1997-11-25 06:05:25 +08:00
/* Possibly retrieve data */
gimp_get_data (PLUG_IN_PROC, &mvals);
1997-11-25 06:05:25 +08:00
/* First acquire information with a dialog */
if (! mosaic_dialog (drawable))
return;
1997-11-25 06:05:25 +08:00
break;
case GIMP_RUN_NONINTERACTIVE:
1997-11-25 06:05:25 +08:00
/* Make sure all the arguments are there! */
if (nparams != 15)
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS)
{
mvals.tile_size = param[3].data.d_float;
mvals.tile_height = param[4].data.d_float;
mvals.tile_spacing = param[5].data.d_float;
mvals.tile_neatness = param[6].data.d_float;
mvals.tile_allow_split = (param[7].data.d_int32) ? TRUE : FALSE;
mvals.light_dir = param[8].data.d_float;
mvals.color_variation = param[9].data.d_float;
mvals.antialiasing = (param[10].data.d_int32) ? TRUE : FALSE;
mvals.color_averaging = (param[11].data.d_int32) ? TRUE : FALSE;
mvals.tile_type = param[12].data.d_int32;
mvals.tile_surface = param[13].data.d_int32;
mvals.grout_color = param[14].data.d_int32;
}
if (status == GIMP_PDB_SUCCESS &&
(mvals.tile_type < SQUARES || mvals.tile_type > TRIANGLES))
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS &&
(mvals.tile_surface < SMOOTH || mvals.tile_surface > ROUGH))
status = GIMP_PDB_CALLING_ERROR;
if (status == GIMP_PDB_SUCCESS &&
(mvals.grout_color < BW || mvals.grout_color > FG_BG))
status = GIMP_PDB_CALLING_ERROR;
1997-11-25 06:05:25 +08:00
break;
case GIMP_RUN_WITH_LAST_VALS:
1997-11-25 06:05:25 +08:00
/* Possibly retrieve data */
gimp_get_data (PLUG_IN_PROC, &mvals);
1997-11-25 06:05:25 +08:00
break;
default:
break;
}
/* Create the mosaic */
if ((status == GIMP_PDB_SUCCESS) &&
(gimp_drawable_is_rgb (drawable->drawable_id) ||
gimp_drawable_is_gray (drawable->drawable_id)))
1997-11-25 06:05:25 +08:00
{
/* run the effect */
mosaic (drawable, NULL);
1997-11-25 06:05:25 +08:00
/* If the run mode is interactive, flush the displays */
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
1997-11-25 06:05:25 +08:00
/* Store mvals data */
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_set_data (PLUG_IN_PROC, &mvals, sizeof (MosaicVals));
1997-11-25 06:05:25 +08:00
}
else if (status == GIMP_PDB_SUCCESS)
1997-11-25 06:05:25 +08:00
{
/* gimp_message ("mosaic: cannot operate on indexed color images"); */
status = GIMP_PDB_EXECUTION_ERROR;
1997-11-25 06:05:25 +08:00
}
values[0].data.d_status = status;
gimp_drawable_detach (drawable);
1997-11-25 06:05:25 +08:00
}
static void
mosaic (GimpDrawable *drawable,
GimpPreview *preview)
1997-11-25 06:05:25 +08:00
{
gint x1, y1, x2, y2;
gint width, height;
gint alpha;
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
GimpRGB color;
1997-11-25 06:05:25 +08:00
/* Find the mask bounds */
if (preview)
{
gimp_preview_get_position (preview, &x1, &y1);
gimp_preview_get_size (preview, &width, &height);
x2 = x1 + width;
y2 = y1 + height;
}
else
{
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
width = (x2 - x1);
height = (y2 - y1);
1997-11-25 06:05:25 +08:00
/* progress bar for gradient finding */
gimp_progress_init (_("Finding edges"));
}
1997-11-25 06:05:25 +08:00
/* Find the gradients */
find_gradients (drawable, std_dev, x1, y1, width, height, preview);
1997-11-25 06:05:25 +08:00
/* Create the tile geometry grid */
switch (mvals.tile_type)
{
case SQUARES:
grid_create_squares (x1, y1, x2, y2);
break;
case HEXAGONS:
grid_create_hexagons (x1, y1, x2, y2);
break;
case OCTAGONS:
grid_create_octagons (x1, y1, x2, y2);
break;
case TRIANGLES:
grid_create_triangles(x1, y1, x2, y2);
break;
1997-11-25 06:05:25 +08:00
default:
break;
}
/* Deform the tiles based on image content */
grid_localize (x1, y1, x2, y2);
switch (mvals.grout_color)
{
case BW:
fore[0] = fore[1] = fore[2] = 255;
back[0] = back[1] = back[2] = 0;
break;
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
1997-11-25 06:05:25 +08:00
case FG_BG:
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);
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
gimp_drawable_get_color_uchar (drawable->drawable_id, &color, fore);
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_background (&color);
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
gimp_drawable_get_color_uchar (drawable->drawable_id, &color, back);
1997-11-25 06:05:25 +08:00
break;
}
alpha = drawable->bpp - 1;
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc 1999-09-01 Tor Lillqvist <tml@iki.fi> * app/appenv.h * libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc from app/appenv.h here, so plug-ins can use them, too. Remove some commented-out old stuff in appenv.h. * libgimp/gimp.h: Include gimpmath.h. * libgimp/gimp.c (gimp_main): Win32: Don't install signal handlers, we can't do anything useful in the handler ourselves anyway (it would be nice to print out a backtrace, but that seems pretty hard to do, even if not impossible). Let Windows inform the user about the crash. If the plug-in was compiled with MSVC, and the user also has it, she is offered a chance to start the debugger automatically anyway. * app/*several*.c: Include gimpmath.h for G_PI etc. Don't include <math.h>, as gimpmath.h includes it. * plug-ins/*/*many*.c: Include config.h. Don't include <math.h>. Remove all the duplicated definitions of G_PI and rint(). Use RINT() instead of rint(). * app/app_procs.[ch]: app_exit() takes a gboolean. * app/batch.c * app/commands.c * app/interface.c: Call app_exit() with FALSE or TRUE. * app/main.c (on_error): Call gimp_fatal_error. (main): Don't install any signal handler on Win32 here, either. * app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format the message and call MessageBox with it. g_on_error_query doesn't do anything useful on Win32, and printf'ing a message to stdout or stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
light_x = -cos (mvals.light_dir * G_PI / 180.0);
light_y = sin (mvals.light_dir * G_PI / 180.0);
1997-11-25 06:05:25 +08:00
scale = (mvals.tile_spacing > mvals.tile_size / 2.0) ?
0.5 : 1.0 - mvals.tile_spacing / mvals.tile_size;
if (!preview)
{
/* Progress bar for rendering tiles */
gimp_progress_init (_("Rendering tiles"));
}
1997-11-25 06:05:25 +08:00
/* Render the tiles */
grid_render (drawable, x1, y1, x2, y2, preview);
1997-11-25 06:05:25 +08:00
if (!preview)
{
/* merge the shadow, update the drawable */
gimp_drawable_flush (drawable);
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
gimp_drawable_update (drawable->drawable_id, x1, y1,
(x2 - x1), (y2 - y1));
}
1997-11-25 06:05:25 +08:00
}
static gboolean
mosaic_dialog (GimpDrawable *drawable)
1997-11-25 06:05:25 +08:00
{
GtkWidget *dialog;
GtkWidget *main_vbox;
GtkWidget *preview;
1997-11-25 06:05:25 +08:00
GtkWidget *toggle;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *combo;
1997-11-25 06:05:25 +08:00
GtkWidget *table;
GtkObject *scale_data;
gint row = 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
gboolean run;
gimprc.in replaced "color-cube" by "min-colors". 2000-04-30 Michael Natterer <mitch@gimp.org> * gimprc.in * app/gimprc.[ch]: replaced "color-cube" by "min-colors". * app/app_procs.c: read unitrc/gimprc before displaying the splash. * app/colormaps.c: set min_colors and install_cmap before initializing GdkRGB. * app/gimprc.[ch] * app/gimpunit.c: don't call the splash's progress_update function. * app/plug_in.c: pass min_colors instead of color_cube to plugins. * app/preferences_dialog.c: widget for min_colors. * libgimp/gimp.[ch]: s/color_cube/min_colors/ but left gimp_color_cube() there for source level compatibility. * libgimp/gimpprotocol.[ch]: changed the GPConfig message accordinly and increased the gimp protocol version number because the change breaks binary compatibility. Also actually pass the use_xshm variable over the wire (was only in the GPConfig struct before). Was it the right thing to do to increase the version number?? * libgimp/gimpui.c (gimp_ui_init): use the same code as the app for initializing GdkRGB. Never explicitly activate Gdk's SHM usage (only switch it off). * app/main.c * libgimp/gimp.c: reverted the handling of all signals except SIGCHLD back to plain old signal() because those signals are fatal anyway and sigaction() as used by gimp_signal_*() made debugging (stacktrace) impossible. * plug-ins/AlienMap/AlienMap.c * plug-ins/AlienMap2/AlienMap2.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/bmp/bmp.c * plug-ins/borderaverage/borderaverage.c * plug-ins/dbbrowser/dbbrowser.c * plug-ins/faxg3/faxg3.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp.c * plug-ins/fp/fp_gtk.c * plug-ins/gdyntext/Makefile.am * plug-ins/gdyntext/gdyntext_ui.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/gimpressionist.c * plug-ins/helpbrowser/helpbrowser.c * plug-ins/ifscompose/ifscompose.c * plug-ins/imagemap/Makefile.am * plug-ins/imagemap/imap_main.c * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print.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/Makefile.am * plug-ins/sel2path/sel2path.c * plug-ins/sgi/sgi.c * plug-ins/sinus/sinus.c * plug-ins/struc/struc.c * plug-ins/webbrowser/webbrowser.c * plug-ins/winsnap/winsnap.c * plug-ins/xjt/xjt.c: use gimp_ui_init(). * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c: only switch Gdk SHM usage off, never on. Don't use gimp_ui_init() here because of libgck.
2000-05-01 02:17:55 +08:00
gimp_ui_init (PLUG_IN_BINARY, TRUE);
1997-11-25 06:05:25 +08:00
dialog = gimp_dialog_new (_("Mosaic"), PLUG_IN_BINARY,
NULL, 0,
gimp_standard_help_func, PLUG_IN_PROC,
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_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
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_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
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 (dialog));
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
gtk_widget_show (main_vbox);
/* A preview */
preview = gimp_drawable_preview_new (drawable, &mvals.update_preview);
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
gtk_widget_show (preview);
g_signal_connect_swapped (preview, "invalidated",
G_CALLBACK (mosaic),
drawable);
/* The hbox -- splits the scripts and the info vbox */
hbox = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
1997-11-25 06:05:25 +08:00
table = gtk_table_new (7, 3, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_widget_show (table);
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
combo = gimp_int_combo_box_new (_("Squares"), SQUARES,
_("Hexagons"), HEXAGONS,
_("Octagons & squares"), OCTAGONS,
_("Triangles"), TRIANGLES,
NULL);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
mvals.tile_type,
G_CALLBACK (gimp_int_combo_box_get_active),
&mvals.tile_type);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("_Tiling primitives:"), 0.0, 0.5,
combo, 2, FALSE);
g_signal_connect_swapped (combo, "changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Tile _size:"), SCALE_WIDTH, 5,
mvals.tile_size, 5.0, 100.0, 1.0, 10.0, 1,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.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.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
G_CALLBACK (gimp_double_adjustment_update),
&mvals.tile_size);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
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
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Tile _height:"), SCALE_WIDTH, 5,
mvals.tile_height, 1.0, 50.0, 1.0, 10.0, 1,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.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.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
G_CALLBACK (gimp_double_adjustment_update),
&mvals.tile_height);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
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
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Til_e spacing:"), SCALE_WIDTH, 5,
mvals.tile_spacing, 1.0, 50.0, 1.0, 10.0, 1,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.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.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
G_CALLBACK (gimp_double_adjustment_update),
&mvals.tile_spacing);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
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
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Tile _neatness:"), SCALE_WIDTH, 5,
mvals.tile_neatness,
0.0, 1.0, 0.10, 0.1, 2,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.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.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
G_CALLBACK (gimp_double_adjustment_update),
&mvals.tile_neatness);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
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
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Light _direction:"), SCALE_WIDTH, 5,
mvals.light_dir, 0.0, 360.0, 1.0, 15.0, 1,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.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.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
G_CALLBACK (gimp_double_adjustment_update),
&mvals.light_dir);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
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
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
_("Color _variation:"), SCALE_WIDTH, 5,
mvals.color_variation,
0.0, 1.0, 0.01, 0.1, 2,
TRUE, 0, 0,
NULL, NULL);
g_signal_connect (scale_data, "value-changed",
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.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.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 21:26:29 +08:00
G_CALLBACK (gimp_double_adjustment_update),
&mvals.color_variation);
g_signal_connect_swapped (scale_data, "value-changed",
G_CALLBACK (gimp_preview_invalidate),
preview);
1997-11-25 06:05:25 +08:00
/* the vertical box and its toggle buttons */
vbox = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
toggle = gtk_check_button_new_with_mnemonic (_("_Antialiasing"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), mvals.antialiasing);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&mvals.antialiasing);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
toggle = gtk_check_button_new_with_mnemonic ( _("Co_lor averaging"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
mvals.color_averaging);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&mvals.color_averaging);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
toggle = gtk_check_button_new_with_mnemonic ( _("Allo_w tile splitting"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
mvals.tile_allow_split);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&mvals.tile_allow_split);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
toggle = gtk_check_button_new_with_mnemonic ( _("_Pitted surfaces"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
(mvals.tile_surface == ROUGH));
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&mvals.tile_surface);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
toggle = gtk_check_button_new_with_mnemonic ( _("_FG/BG lighting"));
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
(mvals.grout_color == FG_BG));
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&mvals.grout_color);
g_signal_connect_swapped (toggle, "toggled",
G_CALLBACK (gimp_preview_invalidate),
preview);
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_widget_show (dialog);
1997-11-25 06:05:25 +08:00
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
1997-11-25 06:05:25 +08:00
gtk_widget_destroy (dialog);
1997-11-25 06:05:25 +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
return run;
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
}
1997-11-25 06:05:25 +08:00
/*
* Gradient finding machinery
*/
static void
find_gradients (GimpDrawable *drawable,
gdouble std_dev,
gint x1,
gint y1,
gint width,
gint height,
GimpPreview *preview)
1997-11-25 06:05:25 +08:00
{
GimpPixelRgn src_rgn;
GimpPixelRgn dest_rgn;
gint bytes;
gint i, j;
guchar *gr, *dh, *dv;
gint hmax, vmax;
gint row, rows;
gint ith_row;
1997-11-25 06:05:25 +08:00
bytes = drawable->bpp;
/* allocate the gradient maps */
h_grad = g_new (guchar, width * height);
v_grad = g_new (guchar, width * height);
m_grad = g_new (guchar, width * height);
1997-11-25 06:05:25 +08:00
/* Calculate total number of rows to be processed */
rows = width * 2 + height * 2;
ith_row = rows / 256;
if (!ith_row)
ith_row = 1;
1997-11-25 06:05:25 +08:00
row = 0;
/* Get the horizontal derivative */
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, width, height,
FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable,
x1, y1, width, height,
preview == NULL, TRUE);
gaussian_deriv (&src_rgn, &dest_rgn,
HORIZONTAL, std_dev, &row, rows, ith_row,
x1, y1, x1 + width, y1 + height, preview);
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, width, height,
FALSE, TRUE);
1997-11-25 06:05:25 +08:00
dest_rgn.x = dest_rgn.y = 0;
dest_rgn.w = width;
dest_rgn.h = height;
dest_rgn.bpp = 1;
dest_rgn.rowstride = width;
dest_rgn.data = h_grad;
find_max_gradient (&src_rgn, &dest_rgn);
/* Get the vertical derivative */
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, width, height,
FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable,
x1, y1, width, height,
preview == NULL, TRUE);
gaussian_deriv (&src_rgn, &dest_rgn,
VERTICAL, std_dev, &row, rows, ith_row,
x1, y1, x1 + width, y1 + height, preview);
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, width, height,
FALSE, TRUE);
1997-11-25 06:05:25 +08:00
dest_rgn.x = dest_rgn.y = 0;
dest_rgn.w = width;
dest_rgn.h = height;
dest_rgn.bpp = 1;
dest_rgn.rowstride = width;
dest_rgn.data = v_grad;
find_max_gradient (&src_rgn, &dest_rgn);
if (!preview)
gimp_progress_update (1.0);
1997-11-25 06:05:25 +08:00
/* fill in the gradient map */
gr = m_grad;
dh = h_grad;
dv = v_grad;
for (i = 0; i < height; i++)
{
for (j = 0; j < width; j++, dh++, dv++, gr++)
{
/* Find the gradient */
if (!j || !i || (j == width - 1) || (i == height - 1))
{
*gr = MAG_THRESHOLD;
}
else
{
hmax = *dh - 128;
vmax = *dv - 128;
*gr = (guchar) sqrt (SQR (hmax) + SQR (vmax));
}
}
1997-11-25 06:05:25 +08:00
}
}
static void
find_max_gradient (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn)
1997-11-25 06:05:25 +08:00
{
guchar *s, *d, *s_iter, *s_end;
gpointer pr;
gint i, j;
gint val;
gint max;
1997-11-25 06:05:25 +08:00
/* Find the maximum value amongst intensity channels */
pr = gimp_pixel_rgns_register (2, src_rgn, dest_rgn);
while (pr)
{
s = src_rgn->data;
d = dest_rgn->data;
for (i = 0; i < src_rgn->h; i++)
{
for (j = 0; j < src_rgn->w; j++)
{
max = 0;
#ifndef SLOW_CODE
#define ABSVAL(x) ((x) >= 0 ? (x) : -(x))
for (s_iter = s, s_end = s + src_rgn->bpp;
s_iter < s_end; s_iter++) {
val = *s;
if (ABSVAL(val) > ABSVAL(max))
max = val;
}
*d++ = max;
#else
for (b = 0; b < src_rgn->bpp; b++)
{
val = (gint) s[b] - 128;
if (abs (val) > abs (max))
max = val;
}
*d++ = (max + 128);
#endif
s += src_rgn->bpp;
}
1997-11-25 06:05:25 +08:00
s += (src_rgn->rowstride - src_rgn->w * src_rgn->bpp);
d += (dest_rgn->rowstride - dest_rgn->w);
}
1997-11-25 06:05:25 +08:00
pr = gimp_pixel_rgns_process (pr);
}
}
/*********************************************/
/* Functions for gaussian convolutions */
/*********************************************/
static void
gaussian_deriv (GimpPixelRgn *src_rgn,
GimpPixelRgn *dest_rgn,
gint type,
gdouble std_dev,
gint *prog,
gint max_prog,
gint ith_prog,
gint x1,
gint y1,
gint x2,
gint y2,
GimpPreview *preview)
1997-11-25 06:05:25 +08:00
{
guchar *dest, *dp;
guchar *src, *sp, *s;
guchar *data;
gint *buf, *b;
gint chan;
gint i, row, col;
gint start, end;
gint curve_array [9];
gint sum_array [9];
gint *curve;
gint *sum;
gint bytes;
gint val;
gint total;
gint length;
gint initial_p[4], initial_m[4];
1997-11-25 06:05:25 +08:00
bytes = src_rgn->bpp;
/* allocate buffers for get/set pixel region rows/cols */
length = MAX (src_rgn->w, src_rgn->h) * bytes;
data = g_new (guchar, length * 2);
1997-11-25 06:05:25 +08:00
src = data;
dest = data + length;
#ifdef UNOPTIMIZED_CODE
1997-11-25 06:05:25 +08:00
length = 3; /* static for speed */
#else
/* badhack :) */
# define length 3
#endif
1997-11-25 06:05:25 +08:00
/* initialize */
curve = curve_array + length;
sum = sum_array + length;
buf = g_new (gint, MAX ((x2 - x1), (y2 - y1)) * bytes);
1997-11-25 06:05:25 +08:00
if (type == VERTICAL)
{
make_curve_d (curve, sum, std_dev, length);
total = sum[0] * -2;
}
else
{
make_curve (curve, sum, std_dev, length);
total = sum[length] + curve[length];
}
for (col = x1; col < x2; col++)
{
gimp_pixel_rgn_get_col (src_rgn, src, col, y1, (y2 - y1));
sp = src;
dp = dest;
b = buf;
for (chan = 0; chan < bytes; chan++)
{
initial_p[chan] = sp[chan];
initial_m[chan] = sp[(y2 - y1 - 1) * bytes + chan];
}
1997-11-25 06:05:25 +08:00
for (row = y1; row < y2; row++)
{
start = ((row - y1) < length) ? (y1 - row) : -length;
end = ((y2 - row - 1) < length) ? (y2 - row - 1) : length;
1997-11-25 06:05:25 +08:00
for (chan = 0; chan < bytes; chan++)
{
s = sp + (start * bytes) + chan;
val = 0;
i = start;
1997-11-25 06:05:25 +08:00
if (start != -length)
val += initial_p[chan] * (sum[start] - sum[-length]);
1997-11-25 06:05:25 +08:00
while (i <= end)
{
val += *s * curve[i++];
s += bytes;
}
1997-11-25 06:05:25 +08:00
if (end != length)
val += initial_m[chan] * (sum[length] + curve[length] - sum[end+1]);
1997-11-25 06:05:25 +08:00
*b++ = val / total;
}
1997-11-25 06:05:25 +08:00
sp += bytes;
}
1997-11-25 06:05:25 +08:00
b = buf;
if (type == VERTICAL)
for (row = y1; row < y2; row++)
{
for (chan = 0; chan < bytes; chan++)
{
b[chan] += 128;
dp[chan] = CLAMP0255 (b[chan]);
}
b += bytes;
dp += bytes;
}
1997-11-25 06:05:25 +08:00
else
for (row = y1; row < y2; row++)
{
for (chan = 0; chan < bytes; chan++)
{
dp[chan] = CLAMP0255 (b[chan]);
}
b += bytes;
dp += bytes;
}
1997-11-25 06:05:25 +08:00
gimp_pixel_rgn_set_col (dest_rgn, dest, col, y1, (y2 - y1));
if (! ((*prog)++ % ith_prog) && !preview)
gimp_progress_update ((gdouble) *prog / (gdouble) max_prog);
1997-11-25 06:05:25 +08:00
}
if (type == HORIZONTAL)
{
make_curve_d (curve, sum, std_dev, length);
total = sum[0] * -2;
}
else
{
make_curve (curve, sum, std_dev, length);
total = sum[length] + curve[length];
}
for (row = y1; row < y2; row++)
{
gimp_pixel_rgn_get_row (dest_rgn, src, x1, row, (x2 - x1));
sp = src;
dp = dest;
b = buf;
for (chan = 0; chan < bytes; chan++)
{
initial_p[chan] = sp[chan];
initial_m[chan] = sp[(x2 - x1 - 1) * bytes + chan];
}
1997-11-25 06:05:25 +08:00
for (col = x1; col < x2; col++)
{
start = ((col - x1) < length) ? (x1 - col) : -length;
end = ((x2 - col - 1) < length) ? (x2 - col - 1) : length;
1997-11-25 06:05:25 +08:00
for (chan = 0; chan < bytes; chan++)
{
s = sp + (start * bytes) + chan;
val = 0;
i = start;
1997-11-25 06:05:25 +08:00
if (start != -length)
val += initial_p[chan] * (sum[start] - sum[-length]);
1997-11-25 06:05:25 +08:00
while (i <= end)
{
val += *s * curve[i++];
s += bytes;
}
1997-11-25 06:05:25 +08:00
if (end != length)
val += initial_m[chan] * (sum[length] + curve[length] - sum[end+1]);
1997-11-25 06:05:25 +08:00
*b++ = val / total;
}
1997-11-25 06:05:25 +08:00
sp += bytes;
}
1997-11-25 06:05:25 +08:00
b = buf;
if (type == HORIZONTAL)
for (col = x1; col < x2; col++)
{
for (chan = 0; chan < bytes; chan++)
{
b[chan] += 128;
dp[chan] = CLAMP0255 (b[chan]);
}
b += bytes;
dp += bytes;
}
1997-11-25 06:05:25 +08:00
else
for (col = x1; col < x2; col++)
{
for (chan = 0; chan < bytes; chan++)
{
dp[chan] = CLAMP0255 (b[chan]);
}
b += bytes;
dp += bytes;
}
1997-11-25 06:05:25 +08:00
gimp_pixel_rgn_set_row (dest_rgn, dest, x1, row, (x2 - x1));
if (! ((*prog)++ % ith_prog) && !preview)
gimp_progress_update ((gdouble) *prog / (gdouble) max_prog);
1997-11-25 06:05:25 +08:00
}
g_free (buf);
g_free (data);
#ifndef UNOPTIMIZED_CODE
/* end bad hack */
#undef length
#endif
1997-11-25 06:05:25 +08:00
}
/*
* The equations: g(r) = exp (- r^2 / (2 * sigma^2))
* r = sqrt (x^2 + y ^2)
*/
static void
make_curve (gint *curve,
gint *sum,
gdouble sigma,
gint length)
1997-11-25 06:05:25 +08:00
{
gdouble sigma2;
gint i;
sigma2 = sigma * sigma;
curve[0] = 255;
for (i = 1; i <= length; i++)
{
curve[i] = (gint) (exp (- (i * i) / (2 * sigma2)) * 255);
curve[-i] = curve[i];
}
sum[-length] = 0;
for (i = -length+1; i <= length; i++)
sum[i] = sum[i-1] + curve[i-1];
}
/*
* The equations: d_g(r) = -r * exp (- r^2 / (2 * sigma^2)) / sigma^2
* r = sqrt (x^2 + y ^2)
*/
static void
make_curve_d (gint *curve,
gint *sum,
gdouble sigma,
gint length)
1997-11-25 06:05:25 +08:00
{
gdouble sigma2;
gint i;
1997-11-25 06:05:25 +08:00
sigma2 = sigma * sigma;
curve[0] = 0;
for (i = 1; i <= length; i++)
{
curve[i] = (gint) ((i * exp (- (i * i) / (2 * sigma2)) / sigma2) * 255);
curve[-i] = -curve[i];
}
sum[-length] = 0;
sum[0] = 0;
for (i = 1; i <= length; i++)
{
sum[-length + i] = sum[-length + i - 1] + curve[-length + i - 1];
sum[i] = sum[i - 1] + curve[i - 1];
}
}
/*********************************************/
/* Functions for grid manipulation */
/*********************************************/
static gdouble
fp_rand (gdouble val)
{
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
return g_random_double () * val;
1997-11-25 06:05:25 +08:00
}
static void
grid_create_squares (gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
gint rows, cols;
gint width, height;
gint i, j;
gint size = (gint) mvals.tile_size;
1997-11-25 06:05:25 +08:00
Vertex *pt;
width = x2 - x1;
1997-11-25 06:05:25 +08:00
height = y2 - y1;
rows = (height + size - 1) / size;
cols = (width + size - 1) / size;
grid = g_new (Vertex, (cols + 2) * (rows + 2));
1997-11-25 06:05:25 +08:00
grid += (cols + 2) + 1;
for (i = -1; i <= rows; i++)
for (j = -1; j <= cols; j++)
{
pt = grid + (i * (cols + 2) + j);
1997-11-25 06:05:25 +08:00
pt->x = x1 + j * size + size / 2;
pt->y = y1 + i * size + size / 2;
1997-11-25 06:05:25 +08:00
}
grid_rows = rows;
grid_cols = cols;
grid_row_pad = 1;
grid_col_pad = 1;
grid_multiple = 1;
grid_rowstride = cols + 2;
}
static void
grid_create_hexagons (gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
gint rows, cols;
gint width, height;
gint i, j;
gdouble hex_l1, hex_l2, hex_l3;
gdouble hex_width;
gdouble hex_height;
Vertex *pt;
width = x2 - x1;
1997-11-25 06:05:25 +08:00
height = y2 - y1;
hex_l1 = mvals.tile_size / 2.0;
hex_l2 = hex_l1 * 2.0 / sqrt (3.0);
hex_l3 = hex_l1 / sqrt (3.0);
hex_width = 6 * hex_l1 / sqrt (3.0);
hex_height = mvals.tile_size;
rows = ((height + hex_height - 1) / hex_height);
cols = ((width + hex_width * 2 - 1) / hex_width);
grid = g_new (Vertex, (cols + 2) * 4 * (rows + 2));
1997-11-25 06:05:25 +08:00
grid += (cols + 2) * 4 + 4;
for (i = -1; i <= rows; i++)
for (j = -1; j <= cols; j++)
{
pt = grid + (i * (cols + 2) * 4 + j * 4);
pt[0].x = x1 + hex_width * j + hex_l3;
pt[0].y = y1 + hex_height * i;
pt[1].x = pt[0].x + hex_l2;
pt[1].y = pt[0].y;
pt[2].x = pt[1].x + hex_l3;
pt[2].y = pt[1].y + hex_l1;
pt[3].x = pt[0].x - hex_l3;
pt[3].y = pt[0].y + hex_l1;
1997-11-25 06:05:25 +08:00
}
grid_rows = rows;
grid_cols = cols;
grid_row_pad = 1;
grid_col_pad = 1;
grid_multiple = 4;
grid_rowstride = (cols + 2) * 4;
}
static void
grid_create_octagons (gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
gint rows, cols;
gint width, height;
gint i, j;
gdouble ts, side, leg;
gdouble oct_size;
Vertex *pt;
1997-11-25 06:05:25 +08:00
width = x2 - x1;
height = y2 - y1;
ts = mvals.tile_size;
side = ts / (sqrt (2.0) + 1.0);
leg = side * sqrt (2.0) * 0.5;
oct_size = ts + side;
rows = ((height + oct_size - 1) / oct_size);
cols = ((width + oct_size * 2 - 1) / oct_size);
grid = g_new (Vertex, (cols + 2) * 8 * (rows + 2));
1997-11-25 06:05:25 +08:00
grid += (cols + 2) * 8 + 8;
for (i = -1; i < rows + 1; i++)
for (j = -1; j < cols + 1; j++)
{
pt = grid + (i * (cols + 2) * 8 + j * 8);
pt[0].x = x1 + oct_size * j;
pt[0].y = y1 + oct_size * i;
pt[1].x = pt[0].x + side;
pt[1].y = pt[0].y;
pt[2].x = pt[0].x + leg + side;
pt[2].y = pt[0].y + leg;
pt[3].x = pt[2].x;
pt[3].y = pt[0].y + leg + side;
pt[4].x = pt[1].x;
pt[4].y = pt[0].y + 2 * leg + side;
pt[5].x = pt[0].x;
pt[5].y = pt[4].y;
pt[6].x = pt[0].x - leg;
pt[6].y = pt[3].y;
pt[7].x = pt[6].x;
pt[7].y = pt[2].y;
1997-11-25 06:05:25 +08:00
}
grid_rows = rows;
grid_cols = cols;
grid_row_pad = 1;
grid_col_pad = 1;
grid_multiple = 8;
grid_rowstride = (cols + 2) * 8;
}
static void
grid_create_triangles (gint x1,
gint y1,
gint x2,
gint y2)
{
gint rows, cols;
gint width, height;
gint i, j;
gdouble tri_mid, tri_height;
Vertex *pt;
width = x2 - x1;
height = y2 - y1;
tri_mid = mvals.tile_size / 2.0; /* cos 60 */
tri_height = mvals.tile_size / 2.0 * sqrt (3.0); /* sin 60 */
rows = (height + 2 * tri_height - 1) / (2 * tri_height);
cols = (width + mvals.tile_size - 1) / mvals.tile_size;
grid = g_new (Vertex, (cols + 2) * 2 * (rows + 2));
grid += (cols + 2) * 2 + 2;
for (i = -1; i <= rows; i++)
for (j = -1; j <= cols; j++)
{
pt = grid + (i * (cols + 2) * 2 + j * 2);
pt[0].x = x1 + mvals.tile_size * j;
pt[0].y = y1 + (tri_height*2) * i;
pt[1].x = pt[0].x + tri_mid;
pt[1].y = pt[0].y + tri_height;
}
grid_rows = rows;
grid_cols = cols;
grid_row_pad = 1;
grid_col_pad = 1;
grid_multiple = 2;
grid_rowstride = (cols + 2) * 2;
}
1997-11-25 06:05:25 +08:00
static void
grid_localize (gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
gint width, height;
gint i, j;
gint k, l;
gint x3, y3, x4, y4;
gint size;
gint max_x, max_y;
gint max;
guchar *data;
gdouble rand_localize;
Vertex *pt;
width = x2 - x1;
1997-11-25 06:05:25 +08:00
height = y2 - y1;
size = (gint) mvals.tile_size;
rand_localize = size * (1.0 - mvals.tile_neatness);
for (i = -grid_row_pad; i < grid_rows + grid_row_pad; i++)
for (j = -grid_col_pad * grid_multiple; j < (grid_cols + grid_col_pad) * grid_multiple; j++)
{
pt = grid + (i * grid_rowstride + j);
max_x = pt->x + (gint) (fp_rand (rand_localize) - rand_localize/2.0);
max_y = pt->y + (gint) (fp_rand (rand_localize) - rand_localize/2.0);
x3 = pt->x - (gint) (rand_localize / 2.0);
y3 = pt->y - (gint) (rand_localize / 2.0);
x4 = x3 + (gint) rand_localize;
y4 = y3 + (gint) rand_localize;
x3 = CLAMP (x3, x1, x2 - 1);
y3 = CLAMP (y3, y1, y2 - 1);
x4 = CLAMP (x4, x1, x2 - 1);
y4 = CLAMP (y4, y1, y2 - 1);
max = *(m_grad + (y3 - y1) * width + (x3 - x1));
data = m_grad + width * (y3 - y1);
for (k = y3; k <= y4; k++)
{
for (l = x3; l <= x4; l++)
{
if (data[l - x1] > max)
{
max_y = k;
max_x = l;
max = data[l - x1];
}
}
data += width;
}
pt->x = max_x;
pt->y = max_y;
1997-11-25 06:05:25 +08:00
}
}
static void
grid_render (GimpDrawable *drawable,
gint x1,
gint y1,
gint x2,
gint y2,
GimpPreview *preview)
1997-11-25 06:05:25 +08:00
{
GimpPixelRgn src_rgn;
gint i, j, k;
guchar *dest = NULL, *d;
guchar col[4];
gint bytes;
gint size, frac_size;
gint count;
gint index;
gint vary;
Polygon poly;
gpointer pr;
1997-11-25 06:05:25 +08:00
bytes = drawable->bpp;
if (preview)
1997-11-25 06:05:25 +08:00
{
dest = g_new (guchar, bytes * (x2 - x1) * (y2 - y1));
d = dest;
for (i = 0; i < (x2 - x1) * (y2 - y1); i++, d += bytes)
memcpy (d, back, bytes);
}
else
{
/* Fill the image with the background color */
gimp_pixel_rgn_init (&src_rgn, drawable,
x1, y1, (x2 - x1), (y2 - y1),
TRUE, TRUE);
for (pr = gimp_pixel_rgns_register (1, &src_rgn);
pr != NULL;
pr = gimp_pixel_rgns_process (pr))
{
size = src_rgn.w * src_rgn.h;
dest = src_rgn.data;
for (i = 0; i < src_rgn.h ; i++)
{
d = dest;
for (j = 0; j < src_rgn.w ; j++)
{
for (k = 0; k < bytes; k++)
d[k] = back[k];
d += bytes;
}
dest += src_rgn.rowstride;
}
}
dest = NULL;
1997-11-25 06:05:25 +08:00
}
size = (grid_rows + grid_row_pad) * (grid_cols + grid_col_pad);
frac_size = (gint) (size * mvals.color_variation);
count = 0;
for (i = -grid_row_pad; i < grid_rows; i++)
for (j = -grid_col_pad; j < grid_cols; j++)
{
vary = ((g_random_int_range (0, size)) < frac_size) ? 1 : 0;
index = i * grid_rowstride + j * grid_multiple;
switch (mvals.tile_type)
{
case SQUARES:
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index].x,
grid[index].y);
polygon_add_point (&poly,
grid[index + 1].x,
grid[index + 1].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + 1].x,
grid[index + grid_rowstride + 1].y);
polygon_add_point (&poly,
grid[index + grid_rowstride].x,
grid[index + grid_rowstride].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
break;
case HEXAGONS:
/* The main hexagon */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index].x,
grid[index].y);
polygon_add_point (&poly,
grid[index + 1].x,
grid[index + 1].y);
polygon_add_point (&poly,
grid[index + 2].x,
grid[index + 2].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + 1].x,
grid[index + grid_rowstride + 1].y);
polygon_add_point (&poly,
grid[index + grid_rowstride].x,
grid[index + grid_rowstride].y);
polygon_add_point (&poly,
grid[index + 3].x,
grid[index + 3].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
/* The auxillary hexagon */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index + 2].x,
grid[index + 2].y);
polygon_add_point (&poly,
grid[index + grid_multiple * 2 - 1].x,
grid[index + grid_multiple * 2 - 1].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + grid_multiple].x,
grid[index + grid_rowstride + grid_multiple].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + grid_multiple + 3].x,
grid[index + grid_rowstride + grid_multiple + 3].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + 2].x,
grid[index + grid_rowstride + 2].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + 1].x,
grid[index + grid_rowstride + 1].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
break;
case OCTAGONS:
/* The main octagon */
polygon_reset (&poly);
for (k = 0; k < 8; k++)
polygon_add_point (&poly,
grid[index + k].x,
grid[index + k].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
/* The auxillary octagon */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index + 3].x,
grid[index + 3].y);
polygon_add_point (&poly,
grid[index + grid_multiple * 2 - 2].x,
grid[index + grid_multiple * 2 - 2].y);
polygon_add_point (&poly,
grid[index + grid_multiple * 2 - 3].x,
grid[index + grid_multiple * 2 - 3].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + grid_multiple].x,
grid[index + grid_rowstride + grid_multiple].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + grid_multiple * 2 - 1].x,
grid[index + grid_rowstride + grid_multiple * 2 - 1].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + 2].x,
grid[index + grid_rowstride + 2].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + 1].x,
grid[index + grid_rowstride + 1].y);
polygon_add_point (&poly,
grid[index + 4].x,
grid[index + 4].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
/* The main square */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index + 2].x,
grid[index + 2].y);
polygon_add_point (&poly,
grid[index + grid_multiple * 2 - 1].x,
grid[index + grid_multiple * 2 - 1].y);
polygon_add_point (&poly,
grid[index + grid_multiple * 2 - 2].x,
grid[index + grid_multiple * 2 - 2].y);
polygon_add_point (&poly,
grid[index + 3].x,
grid[index + 3].y);
process_poly (&poly, FALSE, drawable, col, vary,
x1, y1, x2, y2, dest);
/* The auxillary square */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index + 5].x,
grid[index + 5].y);
polygon_add_point (&poly,
grid[index + 4].x,
grid[index + 4].y);
polygon_add_point (&poly,
grid[index + grid_rowstride + 1].x,
grid[index + grid_rowstride + 1].y);
polygon_add_point (&poly,
grid[index + grid_rowstride].x,
grid[index + grid_rowstride].y);
process_poly (&poly, FALSE, drawable, col, vary,
x1, y1, x2, y2, dest);
break;
case TRIANGLES:
/* Lower left */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index].x,
grid[index].y);
polygon_add_point (&poly,
grid[index + grid_multiple].x,
grid[index + grid_multiple].y);
polygon_add_point (&poly,
grid[index + 1].x,
grid[index + 1].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
/* lower right */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index + 1].x,
grid[index + 1].y);
polygon_add_point (&poly,
grid[index + grid_multiple].x,
grid[index + grid_multiple].y);
polygon_add_point (&poly,
grid[index + grid_multiple + 1].x,
grid[index + grid_multiple + 1].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
/* upper left */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index + 1].x,
grid[index + 1].y);
polygon_add_point (&poly,
grid[index + grid_multiple + grid_rowstride].x,
grid[index + grid_multiple + grid_rowstride].y);
polygon_add_point (&poly,
grid[index + grid_rowstride].x,
grid[index + grid_rowstride].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
/* upper right */
polygon_reset (&poly);
polygon_add_point (&poly,
grid[index + 1].x,
grid[index + 1].y);
polygon_add_point (&poly,
grid[index + grid_multiple +1 ].x,
grid[index + grid_multiple +1 ].y);
polygon_add_point (&poly,
grid[index + grid_multiple + grid_rowstride].x,
grid[index + grid_multiple + grid_rowstride].y);
process_poly (&poly, mvals.tile_allow_split, drawable, col, vary,
x1, y1, x2, y2, dest);
break;
}
if (!preview)
gimp_progress_update ((double) count++ / (double) size);
1997-11-25 06:05:25 +08:00
}
if (preview)
{
gimp_preview_draw_buffer (preview,
dest,
(x2 - x1) * bytes);
}
else
gimp_progress_update (1.0);
1997-11-25 06:05:25 +08:00
}
static void
process_poly (Polygon *poly,
gboolean allow_split,
GimpDrawable *drawable,
guchar *col,
gboolean vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest)
1997-11-25 06:05:25 +08:00
{
gdouble dir[2];
gdouble loc[2];
gdouble cx = 0.0, cy = 0.0;
1997-11-25 06:05:25 +08:00
gdouble magnitude;
gdouble distance;
gdouble color_vary;
/* determine the variation of tile color based on tile number */
color_vary = vary ? fp_rand (mvals.color_variation) : 0;
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
color_vary = (g_random_int_range (0, 2)) ? color_vary * 127 : -color_vary * 127;
1997-11-25 06:05:25 +08:00
/* Determine direction of edges inside polygon, if any */
find_poly_dir (poly, m_grad, h_grad, v_grad, dir, loc, x1, y1, x2, y2);
magnitude = sqrt (SQR (dir[0] - 128) + SQR (dir[1] - 128));
/* Find the center of the polygon */
polygon_find_center (poly, &cx, &cy);
distance = sqrt (SQR (loc[0] - cx) + SQR (loc[1] - cy));
/* If the magnitude of direction inside the polygon is greater than
* THRESHOLD, split the polygon into two new polygons
*/
if (magnitude > MAG_THRESHOLD && (2 * distance / mvals.tile_size) < 0.5 && allow_split)
split_poly (poly, drawable, col, dir, color_vary, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
/* Otherwise, render the original polygon
*/
else
render_poly (poly, drawable, col, color_vary, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
}
static void
render_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest)
1997-11-25 06:05:25 +08:00
{
gdouble cx = 0.0, cy = 0.0;
1997-11-25 06:05:25 +08:00
polygon_find_center (poly, &cx, &cy);
if (mvals.color_averaging)
find_poly_color (poly, drawable, col, vary, x1, y1, x2, y2);
1997-11-25 06:05:25 +08:00
scale_poly (poly, cx, cy, scale);
if (mvals.color_averaging)
fill_poly_color (poly, drawable, col, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
else
fill_poly_image (poly, drawable, vary, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
}
static void
split_poly (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble *dir,
gdouble vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest)
1997-11-25 06:05:25 +08:00
{
Polygon new_poly;
gdouble spacing;
gdouble cx = 0.0, cy = 0.0;
1997-11-25 06:05:25 +08:00
gdouble magnitude;
gdouble vec[2];
gdouble pt[2];
spacing = mvals.tile_spacing / (2.0 * scale);
polygon_find_center (poly, &cx, &cy);
polygon_translate (poly, -cx, -cy);
magnitude = sqrt (SQR (dir[0] - 128) + SQR (dir[1] - 128));
vec[0] = -(dir[1] - 128) / magnitude;
vec[1] = (dir[0] - 128) / magnitude;
pt[0] = -vec[1] * spacing;
pt[1] = vec[0] * spacing;
polygon_reset (&new_poly);
clip_poly (vec, pt, poly, &new_poly);
polygon_translate (&new_poly, cx, cy);
if (new_poly.npts)
{
if (mvals.color_averaging)
find_poly_color (&new_poly, drawable, col, vary, x1, y1, x2, y2);
1997-11-25 06:05:25 +08:00
scale_poly (&new_poly, cx, cy, scale);
if (mvals.color_averaging)
fill_poly_color (&new_poly, drawable, col, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
else
fill_poly_image (&new_poly, drawable, vary, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
}
vec[0] = -vec[0];
vec[1] = -vec[1];
pt[0] = -pt[0];
pt[1] = -pt[1];
polygon_reset (&new_poly);
clip_poly (vec, pt, poly, &new_poly);
polygon_translate (&new_poly, cx, cy);
if (new_poly.npts)
{
if (mvals.color_averaging)
find_poly_color (&new_poly, drawable, col, vary, x1, y1, x2, y2);
1997-11-25 06:05:25 +08:00
scale_poly (&new_poly, cx, cy, scale);
if (mvals.color_averaging)
fill_poly_color (&new_poly, drawable, col, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
else
fill_poly_image (&new_poly, drawable, vary, x1, y1, x2, y2, dest);
1997-11-25 06:05:25 +08:00
}
}
static void
clip_poly (gdouble *dir,
gdouble *pt,
Polygon *poly,
Polygon *poly_new)
1997-11-25 06:05:25 +08:00
{
gint i;
gdouble x1, y1, x2, y2;
1997-11-25 06:05:25 +08:00
for (i = 0; i < poly->npts; i++)
{
x1 = (i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x;
y1 = (i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y;
x2 = poly->pts[i].x;
y2 = poly->pts[i].y;
clip_point (dir, pt, x1, y1, x2, y2, poly_new);
}
}
static void
clip_point (gdouble *dir,
gdouble *pt,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
Polygon *poly_new)
1997-11-25 06:05:25 +08:00
{
gdouble det, m11, m12, m21, m22;
gdouble side1, side2;
gdouble t;
gdouble vec[2];
x1 -= pt[0]; x2 -= pt[0];
y1 -= pt[1]; y2 -= pt[1];
side1 = x1 * -dir[1] + y1 * dir[0];
side2 = x2 * -dir[1] + y2 * dir[0];
/* If both points are to be clipped, ignore */
if (side1 < 0.0 && side2 < 0.0)
return;
/* If both points are non-clipped, set point */
else if (side1 >= 0.0 && side2 >= 0.0)
{
polygon_add_point (poly_new, x2 + pt[0], y2 + pt[1]);
return;
}
/* Otherwise, there is an intersection... */
else
{
vec[0] = x1 - x2;
vec[1] = y1 - y2;
det = dir[0] * vec[1] - dir[1] * vec[0];
if (det == 0.0)
{
polygon_add_point (poly_new, x2 + pt[0], y2 + pt[1]);
return;
}
1997-11-25 06:05:25 +08:00
m11 = vec[1] / det;
m12 = -vec[0] / det;
m21 = -dir[1] / det;
m22 = dir[0] / det;
t = m11 * x1 + m12 * y1;
/* If the first point is clipped, set intersection and point */
if (side1 < 0.0 && side2 > 0.0)
{
polygon_add_point (poly_new, dir[0] * t + pt[0], dir[1] * t + pt[1]);
polygon_add_point (poly_new, x2 + pt[0], y2 + pt[1]);
}
1997-11-25 06:05:25 +08:00
else
polygon_add_point (poly_new, dir[0] * t + pt[0], dir[1] * t + pt[1]);
1997-11-25 06:05:25 +08:00
}
}
static void
find_poly_dir (Polygon *poly,
guchar *m_gr,
guchar *h_gr,
guchar *v_gr,
gdouble *dir,
gdouble *loc,
gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
gdouble dmin_x = 0.0, dmin_y = 0.0;
gdouble dmax_x = 0.0, dmax_y = 0.0;
gint xs, ys;
gint xe, ye;
gint min_x, min_y;
gint max_x, max_y;
gint size_x, size_y;
gint *max_scanlines;
gint *min_scanlines;
1997-11-25 06:05:25 +08:00
guchar *dm, *dv, *dh;
gint count, total;
gint rowstride;
gint i, j;
1997-11-25 06:05:25 +08:00
rowstride = (x2 - x1);
count = 0;
total = 0;
dir[0] = 0.0;
dir[1] = 0.0;
loc[0] = 0.0;
loc[1] = 0.0;
polygon_extents (poly, &dmin_x, &dmin_y, &dmax_x, &dmax_y);
min_x = (gint) dmin_x;
min_y = (gint) dmin_y;
max_x = (gint) dmax_x;
max_y = (gint) dmax_y;
1997-11-25 06:05:25 +08:00
size_y = max_y - min_y;
size_x = max_x - min_x;
min_scanlines = g_new (gint, size_y);
max_scanlines = g_new (gint, size_y);
1997-11-25 06:05:25 +08:00
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x;
max_scanlines[i] = min_x;
}
for (i = 0; i < poly->npts; i++)
{
xs = (gint) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (gint) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (gint) poly->pts[i].x;
ye = (gint) poly->pts[i].y;
1997-11-25 06:05:25 +08:00
convert_segment (xs, ys, xe, ye, min_y,
min_scanlines, max_scanlines);
1997-11-25 06:05:25 +08:00
}
for (i = 0; i < size_y; i++)
{
if ((i + min_y) >= y1 && (i + min_y) < y2)
{
dm = m_gr + (i + min_y - y1) * rowstride - x1;
dh = h_gr + (i + min_y - y1) * rowstride - x1;
dv = v_gr + (i + min_y - y1) * rowstride - x1;
for (j = min_scanlines[i]; j < max_scanlines[i]; j++)
{
if (j >= x1 && j < x2)
{
if (dm[j] > MAG_THRESHOLD)
{
dir[0] += dh[j];
dir[1] += dv[j];
loc[0] += j;
loc[1] += i + min_y;
count++;
}
total++;
}
}
}
1997-11-25 06:05:25 +08:00
}
if (!total)
return;
if ((gdouble) count / (gdouble) total > COUNT_THRESHOLD)
{
dir[0] /= count;
dir[1] /= count;
loc[0] /= count;
loc[1] /= count;
}
else
{
dir[0] = 128.0;
dir[1] = 128.0;
loc[0] = 0.0;
loc[1] = 0.0;
}
g_free (min_scanlines);
g_free (max_scanlines);
1997-11-25 06:05:25 +08:00
}
static void
find_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gdouble color_var,
gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
GimpPixelRgn src_rgn;
gdouble dmin_x = 0.0, dmin_y = 0.0;
gdouble dmax_x = 0.0, dmax_y = 0.0;
gint xs, ys;
gint xe, ye;
gint min_x, min_y;
gint max_x, max_y;
gint size_x, size_y;
gint *max_scanlines;
gint *min_scanlines;
gint col_sum[4] = {0, 0, 0, 0};
gint bytes;
gint b, count;
gint i, j, y;
1997-11-25 06:05:25 +08:00
count = 0;
bytes = drawable->bpp;
polygon_extents (poly, &dmin_x, &dmin_y, &dmax_x, &dmax_y);
min_x = (gint) dmin_x;
min_y = (gint) dmin_y;
max_x = (gint) dmax_x;
max_y = (gint) dmax_y;
size_y = max_y - min_y;
size_x = max_x - min_x;
min_scanlines = g_new (int, size_y);
max_scanlines = g_new (int, size_y);
1997-11-25 06:05:25 +08:00
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x;
max_scanlines[i] = min_x;
}
for (i = 0; i < poly->npts; i++)
{
xs = (gint) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (gint) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (gint) poly->pts[i].x;
ye = (gint) poly->pts[i].y;
convert_segment (xs, ys, xe, ye, min_y,
min_scanlines, max_scanlines);
1997-11-25 06:05:25 +08:00
}
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0,
drawable->width, drawable->height,
FALSE, FALSE);
1997-11-25 06:05:25 +08:00
for (i = 0; i < size_y; i++)
{
y = i + min_y;
if (y >= y1 && y < y2)
{
for (j = min_scanlines[i]; j < max_scanlines[i]; j++)
{
if (j >= x1 && j < x2)
{
gimp_pixel_rgn_get_pixel (&src_rgn, col, j, y);
for (b = 0; b < bytes; b++)
col_sum[b] += col[b];
count++;
}
}
}
1997-11-25 06:05:25 +08:00
}
if (count)
for (b = 0; b < bytes; b++)
{
col_sum[b] = (gint) (col_sum[b] / count + color_var);
col[b] = CLAMP0255 (col_sum[b]);
1997-11-25 06:05:25 +08:00
}
g_free (min_scanlines);
g_free (max_scanlines);
1997-11-25 06:05:25 +08:00
}
static void
scale_poly (Polygon *poly,
gdouble tx,
gdouble ty,
gdouble poly_scale)
1997-11-25 06:05:25 +08:00
{
polygon_translate (poly, -tx, -ty);
polygon_scale (poly, poly_scale);
polygon_translate (poly, tx, ty);
}
static void
fill_poly_color (Polygon *poly,
GimpDrawable *drawable,
guchar *col,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest)
1997-11-25 06:05:25 +08:00
{
GimpPixelRgn src_rgn;
gdouble dmin_x = 0.0, dmin_y = 0.0;
gdouble dmax_x = 0.0, dmax_y = 0.0;
gint xs, ys;
gint xe, ye;
gint min_x, min_y;
gint max_x, max_y;
gint size_x, size_y;
gint *max_scanlines, *max_scanlines_iter;
gint *min_scanlines, *min_scanlines_iter;
gint *vals;
gint val;
gint pixel;
gint bytes;
guchar buf[4];
gint b, i, j, k, x, y;
gdouble contrib;
gdouble xx, yy;
gint supersample;
gint supersample2;
Vertex *pts_tmp;
const gint poly_npts = poly->npts;
1997-11-25 06:05:25 +08:00
/* Determine antialiasing */
if (mvals.antialiasing)
{
supersample = SUPERSAMPLE;
supersample2 = SQR (supersample);
}
else
{
supersample = supersample2 = 1;
}
bytes = drawable->bpp;
/* begin loop */
if(poly_npts) {
pts_tmp = poly->pts;
xs = (gint) pts_tmp[poly_npts - 1].x;
ys = (gint) pts_tmp[poly_npts - 1].y;
xe = (gint) pts_tmp->x;
ye = (gint) pts_tmp->y;
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
calc_spec_vec (vecs, xs, ys, xe, ye);
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
for (i = 1; i < poly_npts; i++)
{
xs = (gint) (pts_tmp->x);
ys = (gint) (pts_tmp->y);
pts_tmp++;
xe = (gint) pts_tmp->x;
ye = (gint) pts_tmp->y;
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
calc_spec_vec (vecs+i, xs, ys, xe, ye);
}
}
/* end loop */
1997-11-25 06:05:25 +08:00
polygon_extents (poly, &dmin_x, &dmin_y, &dmax_x, &dmax_y);
min_x = (gint) dmin_x;
min_y = (gint) dmin_y;
max_x = (gint) dmax_x;
max_y = (gint) dmax_y;
size_y = (max_y - min_y) * supersample;
size_x = (max_x - min_x) * supersample;
min_scanlines = min_scanlines_iter = g_new (gint, size_y);
max_scanlines = max_scanlines_iter = g_new (gint, size_y);
1997-11-25 06:05:25 +08:00
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x * supersample;
max_scanlines[i] = min_x * supersample;
}
/* begin loop */
if(poly_npts) {
pts_tmp = poly->pts;
xs = (gint) pts_tmp[poly_npts-1].x;
ys = (gint) pts_tmp[poly_npts-1].y;
xe = (gint) pts_tmp->x;
ye = (gint) pts_tmp->y;
1997-11-25 06:05:25 +08:00
xs *= supersample;
ys *= supersample;
xe *= supersample;
ye *= supersample;
1997-11-25 06:05:25 +08:00
convert_segment (xs, ys, xe, ye, min_y * supersample,
min_scanlines, max_scanlines);
for (i = 1; i < poly_npts; i++)
{
xs = (gint) pts_tmp->x;
ys = (gint) pts_tmp->y;
pts_tmp++;
xe = (gint) pts_tmp->x;
ye = (gint) pts_tmp->y;
xs *= supersample;
ys *= supersample;
xe *= supersample;
ye *= supersample;
convert_segment (xs, ys, xe, ye, min_y * supersample,
min_scanlines, max_scanlines);
}
}
/* end loop */
1997-11-25 06:05:25 +08:00
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0,
drawable->width, drawable->height,
dest == NULL, TRUE);
1997-11-25 06:05:25 +08:00
vals = g_new (gint, size_x);
for (i = 0; i < size_y; i++, min_scanlines_iter++, max_scanlines_iter++)
1997-11-25 06:05:25 +08:00
{
if (! (i % supersample))
memset (vals, 0, sizeof (gint) * size_x);
1997-11-25 06:05:25 +08:00
yy = (gdouble) i / (gdouble) supersample + min_y;
for (j = *min_scanlines_iter; j < *max_scanlines_iter; j++)
{
x = j - min_x * supersample;
vals[x] += 255;
}
1997-11-25 06:05:25 +08:00
if (! ((i + 1) % supersample))
{
y = (i / supersample) + min_y;
if (y >= y1 && y < y2)
{
for (j = 0; j < size_x; j += supersample)
{
x = (j / supersample) + min_x;
if (x >= x1 && x < x2)
{
val = 0;
for (k = 0; k < supersample; k++)
val += vals[j + k];
val /= supersample2;
if (val > 0)
{
xx = (gdouble) j / (gdouble) supersample + min_x;
contrib = calc_spec_contrib (vecs, poly_npts, xx, yy);
for (b = 0; b < bytes; b++)
{
pixel = col[b] + (gint) (((contrib < 0.0)?(col[b] - back[b]):(fore[b] - col[b])) * contrib);
buf[b] = ((pixel * val) + (back[b] * (255 - val))) / 255;
}
if (dest)
memcpy (dest + ((y - y1) * (x2 - x1) + (x - x1)) * bytes, buf, bytes);
else
gimp_pixel_rgn_set_pixel (&src_rgn, buf, x, y);
}
}
}
}
}
}
g_free (vals);
g_free (min_scanlines);
g_free (max_scanlines);
1997-11-25 06:05:25 +08:00
}
static void
fill_poly_image (Polygon *poly,
GimpDrawable *drawable,
gdouble vary,
gint x1,
gint y1,
gint x2,
gint y2,
guchar *dest)
1997-11-25 06:05:25 +08:00
{
GimpPixelRgn src_rgn, dest_rgn;
gdouble dmin_x = 0.0, dmin_y = 0.0;
gdouble dmax_x = 0.0, dmax_y = 0.0;
gint xs, ys;
gint xe, ye;
gint min_x, min_y;
gint max_x, max_y;
gint size_x, size_y;
gint *max_scanlines;
gint *min_scanlines;
gint *vals;
gint val;
gint pixel;
gint bytes;
guchar buf[4];
gint b, i, j, k, x, y;
gdouble contrib;
gdouble xx, yy;
gint supersample;
gint supersample2;
1997-11-25 06:05:25 +08:00
/* Determine antialiasing */
if (mvals.antialiasing)
{
supersample = SUPERSAMPLE;
supersample2 = SQR (supersample);
}
else
{
supersample = supersample2 = 1;
}
bytes = drawable->bpp;
for (i = 0; i < poly->npts; i++)
{
xs = (gint) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (gint) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (gint) poly->pts[i].x;
ye = (gint) poly->pts[i].y;
calc_spec_vec (vecs+i, xs, ys, xe, ye);
}
polygon_extents (poly, &dmin_x, &dmin_y, &dmax_x, &dmax_y);
min_x = (gint) dmin_x;
min_y = (gint) dmin_y;
max_x = (gint) dmax_x;
max_y = (gint) dmax_y;
size_y = (max_y - min_y) * supersample;
size_x = (max_x - min_x) * supersample;
min_scanlines = g_new (gint, size_y);
max_scanlines = g_new (gint, size_y);
1997-11-25 06:05:25 +08:00
for (i = 0; i < size_y; i++)
{
min_scanlines[i] = max_x * supersample;
max_scanlines[i] = min_x * supersample;
}
for (i = 0; i < poly->npts; i++)
{
xs = (gint) ((i) ? poly->pts[i-1].x : poly->pts[poly->npts-1].x);
ys = (gint) ((i) ? poly->pts[i-1].y : poly->pts[poly->npts-1].y);
xe = (gint) poly->pts[i].x;
ye = (gint) poly->pts[i].y;
xs *= supersample;
ys *= supersample;
xe *= supersample;
ye *= supersample;
convert_segment (xs, ys, xe, ye, min_y * supersample,
min_scanlines, max_scanlines);
1997-11-25 06:05:25 +08:00
}
gimp_pixel_rgn_init (&src_rgn, drawable, 0, 0,
drawable->width, drawable->height,
FALSE, FALSE);
if (!dest)
gimp_pixel_rgn_init (&dest_rgn, drawable, 0, 0,
drawable->width, drawable->height,
TRUE, TRUE);
vals = g_new (gint, size_x);
1997-11-25 06:05:25 +08:00
for (i = 0; i < size_y; i++)
{
if (! (i % supersample))
memset (vals, 0, sizeof (gint) * size_x);
1997-11-25 06:05:25 +08:00
yy = (gdouble) i / (gdouble) supersample + min_y;
for (j = min_scanlines[i]; j < max_scanlines[i]; j++)
{
x = j - min_x * supersample;
vals[x] += 255;
}
1997-11-25 06:05:25 +08:00
if (! ((i + 1) % supersample))
{
y = (i / supersample) + min_y;
if (y >= y1 && y < y2)
{
for (j = 0; j < size_x; j += supersample)
{
x = (j / supersample) + min_x;
if (x >= x1 && x < x2)
{
val = 0;
for (k = 0; k < supersample; k++)
val += vals[j + k];
val /= supersample2;
if (val > 0)
{
xx = (double) j / (double) supersample + min_x;
contrib = calc_spec_contrib (vecs, poly->npts, xx, yy);
gimp_pixel_rgn_get_pixel (&src_rgn, buf, x, y);
for (b = 0; b < bytes; b++)
{
if (contrib < 0.0)
pixel = buf[b] + (int) ((buf[b] - back[b]) * contrib);
else
pixel = buf[b] + (int) ((fore[b] - buf[b]) * contrib);
/* factor in per-tile intensity variation */
pixel += vary;
pixel = CLAMP (pixel, 0, 255);
buf[b] = ((back[b] << 8) + (pixel - back[b]) * val) >> 8;
}
if (dest)
memcpy (dest + ((y - y1) * (x2 - x1) + (x - x1)) * bytes, buf, bytes);
else
gimp_pixel_rgn_set_pixel (&dest_rgn, buf, x, y);
}
}
}
}
}
}
g_free (vals);
g_free (min_scanlines);
g_free (max_scanlines);
1997-11-25 06:05:25 +08:00
}
static void
calc_spec_vec (SpecVec *vec,
gint x1,
gint y1,
gint x2,
gint y2)
1997-11-25 06:05:25 +08:00
{
gdouble r;
vec->base_x = x1;
vec->base_y = y1;
1997-11-25 06:05:25 +08:00
r = sqrt (SQR (x2 - x1) + SQR (y2 - y1));
if (r > 0.0)
{
vec->norm_x = -(y2 - y1) / r;
vec->norm_y = (x2 - x1) / r;
}
else
{
vec->norm_x = 0;
vec->norm_y = 0;
}
vec->light = vec->norm_x * light_x + vec->norm_y * light_y;
}
static double
calc_spec_contrib (SpecVec *vecs,
gint n,
gdouble x,
gdouble y)
1997-11-25 06:05:25 +08:00
{
gint i;
gdouble contrib = 0;
for (i = 0; i < n; i++)
{
gdouble x_p, y_p;
gdouble dist;
1997-11-25 06:05:25 +08:00
x_p = x - vecs[i].base_x;
y_p = y - vecs[i].base_y;
dist = fabs (x_p * vecs[i].norm_x + y_p * vecs[i].norm_y);
if (mvals.tile_surface == ROUGH)
{
/* If the surface is rough, randomly perturb the distance */
dist -= dist * g_random_double ();
}
1997-11-25 06:05:25 +08:00
/* If the distance to an edge is less than the tile_spacing, there
* will be no highlight as the tile blends to background here
*/
if (dist < 1.0)
contrib += vecs[i].light;
1997-11-25 06:05:25 +08:00
else if (dist <= mvals.tile_height)
contrib += vecs[i].light * (1.0 - (dist / mvals.tile_height));
1997-11-25 06:05:25 +08:00
}
return contrib / 4.0;
}
static void
convert_segment (gint x1,
gint y1,
gint x2,
gint y2,
gint offset,
gint *min,
gint *max)
1997-11-25 06:05:25 +08:00
{
gint ydiff, y, tmp;
1997-11-25 06:05:25 +08:00
gdouble xinc, xstart;
if (y1 > y2)
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
{
tmp = y2; y2 = y1; y1 = tmp;
Cleaned up the remaining libgimp API issues: 2004-03-12 Michael Natterer <mitch@gimp.org> Cleaned up the remaining libgimp API issues: * libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode): added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we can actually use the bg_color feature of the GimpPixelFetcher. (gimp_pixel_fetcher_new): added "gboolean shadow" parameter because it must not change while the GimpPixelFetcher exists. (gimp_pixel_fetcher_set_shadow): removed. (gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color" parameter and don't call gimp_palette_get_foreground(). (gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up the function. (gimp_get_bg_guchar) (gimp_get_fg_guchar): removed these functions... * libgimp/gimpdrawable.[ch]: ...and added gimp_drawable_get_color_uchar() instead. * libgimp/gimp.def * plug-ins/common/blinds.c * plug-ins/common/checkerboard.c * plug-ins/common/cubism.c * plug-ins/common/curve_bend.c * plug-ins/common/displace.c * plug-ins/common/edge.c * plug-ins/common/illusion.c * plug-ins/common/mblur.c * plug-ins/common/mosaic.c * plug-ins/common/plasma.c * plug-ins/common/polar.c * plug-ins/common/ripple.c * plug-ins/common/shift.c * plug-ins/common/spread.c * plug-ins/common/tileit.c * plug-ins/common/whirlpinch.c * plug-ins/gflare/gflare.c * plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly. (Didn't test the changed plug-ins because I wanted to get this API change into CVS as soon as possible)
2004-03-13 06:46:25 +08:00
tmp = x2; x2 = x1; x1 = tmp;
}
ydiff = y2 - y1;
1997-11-25 06:05:25 +08:00
if (ydiff)
1997-11-25 06:05:25 +08:00
{
xinc = (gdouble) (x2 - x1) / (gdouble) ydiff;
xstart = x1 + 0.5 * xinc;
for (y = y1; y < y2; y++)
{
min[y - offset] = MIN (min[y - offset], xstart);
max[y - offset] = MAX (max[y - offset], xstart);
xstart += xinc;
}
1997-11-25 06:05:25 +08:00
}
}
static void
polygon_add_point (Polygon *poly,
gdouble x,
gdouble y)
1997-11-25 06:05:25 +08:00
{
if (poly->npts < 12)
{
poly->pts[poly->npts].x = x;
poly->pts[poly->npts].y = y;
poly->npts++;
}
else
g_print ( _("Unable to add additional point.\n"));
1997-11-25 06:05:25 +08:00
}
static gboolean
1997-11-25 06:05:25 +08:00
polygon_find_center (Polygon *poly,
gdouble *cx,
gdouble *cy)
1997-11-25 06:05:25 +08:00
{
guint i;
1997-11-25 06:05:25 +08:00
if (!poly->npts)
return FALSE;
1997-11-25 06:05:25 +08:00
*cx = 0.0;
*cy = 0.0;
for (i = 0; i < poly->npts; i++)
{
*cx += poly->pts[i].x;
*cy += poly->pts[i].y;
}
*cx /= poly->npts;
*cy /= poly->npts;
return TRUE;
1997-11-25 06:05:25 +08:00
}
static void
polygon_translate (Polygon *poly,
gdouble tx,
gdouble ty)
1997-11-25 06:05:25 +08:00
{
guint i;
1997-11-25 06:05:25 +08:00
for (i = 0; i < poly->npts; i++)
{
poly->pts[i].x += tx;
poly->pts[i].y += ty;
}
}
static void
polygon_scale (Polygon *poly,
gdouble poly_scale)
1997-11-25 06:05:25 +08:00
{
guint i;
1997-11-25 06:05:25 +08:00
for (i = 0; i < poly->npts; i++)
{
poly->pts[i].x *= poly_scale;
poly->pts[i].y *= poly_scale;
}
}
static gboolean
1997-11-25 06:05:25 +08:00
polygon_extents (Polygon *poly,
gdouble *min_x,
gdouble *min_y,
gdouble *max_x,
gdouble *max_y)
1997-11-25 06:05:25 +08:00
{
guint i;
1997-11-25 06:05:25 +08:00
if (!poly->npts)
return FALSE;
1997-11-25 06:05:25 +08:00
*min_x = *max_x = poly->pts[0].x;
*min_y = *max_y = poly->pts[0].y;
1997-11-25 06:05:25 +08:00
for (i = 1; i < poly->npts; i++)
{
*min_x = MIN (*min_x, poly->pts[i].x);
*max_x = MAX (*max_x, poly->pts[i].x);
*min_y = MIN (*min_y, poly->pts[i].y);
*max_y = MAX (*max_y, poly->pts[i].y);
1997-11-25 06:05:25 +08:00
}
return TRUE;
1997-11-25 06:05:25 +08:00
}
static void
polygon_reset (Polygon *poly)
{
poly->npts = 0;
}