1998-10-22 19:39:32 +08:00
|
|
|
/*
|
2007-06-06 16:44:52 +08:00
|
|
|
* jigsaw - a plug-in for GIMP
|
1998-10-22 19:39:32 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) Nigel Wetten
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1998-10-22 19:39:32 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1998-10-22 19:39:32 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1998-10-22 19:39:32 +08:00
|
|
|
*
|
|
|
|
* Contact info: nigel@cs.nwu.edu
|
|
|
|
*
|
|
|
|
* Version: 1.0.0
|
2000-05-23 21:00:40 +08:00
|
|
|
*
|
|
|
|
* Version: 1.0.1
|
|
|
|
*
|
|
|
|
* tim coppefield [timecop@japan.co.jp]
|
|
|
|
*
|
|
|
|
* Added dynamic preview mode.
|
|
|
|
*
|
|
|
|
* Damn, this plugin is the tightest piece of code I ever seen.
|
|
|
|
* I wish all filters in the plugins operated on guchar *buffer
|
|
|
|
* of the entire image :) sweet stuff.
|
|
|
|
*
|
1998-10-22 19:39:32 +08:00
|
|
|
*/
|
|
|
|
|
2000-01-07 18:39:33 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-10-01 04:13:06 +08:00
|
|
|
#include <string.h>
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
#include <libgimp/gimp.h>
|
|
|
|
#include <libgimp/gimpui.h>
|
2000-01-07 18:39:33 +08:00
|
|
|
|
1999-12-29 04:04:19 +08:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2005-03-04 23:12:29 +08:00
|
|
|
|
2005-08-14 08:41:26 +08:00
|
|
|
#define PLUG_IN_PROC "plug-in-jigsaw"
|
|
|
|
#define PLUG_IN_BINARY "jigsaw"
|
2011-04-09 02:31:34 +08:00
|
|
|
#define PLUG_IN_ROLE "gimp-jigsaw"
|
2005-08-14 08:41:26 +08:00
|
|
|
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
typedef enum
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
BEZIER_1,
|
2000-05-23 21:00:40 +08:00
|
|
|
BEZIER_2
|
|
|
|
} style_t;
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
typedef enum
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
LEFT,
|
|
|
|
RIGHT,
|
|
|
|
UP,
|
2000-05-23 21:00:40 +08:00
|
|
|
DOWN
|
|
|
|
} bump_t;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
#define XFACTOR2 0.0833
|
|
|
|
#define XFACTOR3 0.2083
|
|
|
|
#define XFACTOR4 0.2500
|
|
|
|
|
|
|
|
#define XFACTOR5 0.2500
|
|
|
|
#define XFACTOR6 0.2083
|
|
|
|
#define XFACTOR7 0.0833
|
|
|
|
|
|
|
|
#define YFACTOR2 0.1000
|
|
|
|
#define YFACTOR3 0.2200
|
|
|
|
#define YFACTOR4 0.1000
|
|
|
|
|
|
|
|
#define YFACTOR5 0.1000
|
|
|
|
#define YFACTOR6 0.4666
|
|
|
|
#define YFACTOR7 0.1000
|
|
|
|
#define YFACTOR8 0.2000
|
|
|
|
|
|
|
|
#define MAX_VALUE 255
|
|
|
|
#define MIN_VALUE 0
|
|
|
|
#define DELTA 0.15
|
|
|
|
|
|
|
|
#define BLACK_R 30
|
|
|
|
#define BLACK_G 30
|
|
|
|
#define BLACK_B 30
|
|
|
|
|
|
|
|
#define WALL_XFACTOR2 0.05
|
|
|
|
#define WALL_XFACTOR3 0.05
|
|
|
|
#define WALL_YFACTOR2 0.05
|
|
|
|
#define WALL_YFACTOR3 0.05
|
|
|
|
|
|
|
|
#define WALL_XCONS2 0.2
|
|
|
|
#define WALL_XCONS3 0.3
|
|
|
|
#define WALL_YCONS2 0.2
|
|
|
|
#define WALL_YCONS3 0.3
|
|
|
|
|
|
|
|
#define FUDGE 1.2
|
|
|
|
|
|
|
|
#define MIN_XTILES 1
|
|
|
|
#define MAX_XTILES 20
|
|
|
|
#define MIN_YTILES 1
|
|
|
|
#define MAX_YTILES 20
|
|
|
|
#define MIN_BLEND_LINES 0
|
|
|
|
#define MAX_BLEND_LINES 10
|
|
|
|
#define MIN_BLEND_AMOUNT 0
|
|
|
|
#define MAX_BLEND_AMOUNT 1.0
|
|
|
|
|
|
|
|
#define SCALE_WIDTH 200
|
|
|
|
|
|
|
|
#define DRAW_POINT(buffer, bufsize, index) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if ((index) >= 0 && (index) + 2 < (bufsize)) \
|
|
|
|
{ \
|
|
|
|
buffer[(index) + 0] = BLACK_R; \
|
|
|
|
buffer[(index) + 1] = BLACK_G; \
|
|
|
|
buffer[(index) + 2] = BLACK_B; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
while (0)
|
|
|
|
|
|
|
|
#define DARKEN_POINT(buffer, bufsize, index, delta, temp) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if ((index) >= 0 && (index) + 2 < (bufsize)) \
|
|
|
|
{ \
|
|
|
|
temp = MAX (buffer[(index) + 0] * (1.0 - (delta)), MIN_VALUE); \
|
|
|
|
buffer[(index) + 0] = temp; \
|
|
|
|
temp = MAX (buffer[(index) + 1] * (1.0 - (delta)), MIN_VALUE); \
|
|
|
|
buffer[(index) + 1] = temp; \
|
|
|
|
temp = MAX (buffer[(index) + 2] * (1.0 - (delta)), MIN_VALUE); \
|
|
|
|
buffer[(index) + 2] = temp; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
while (0)
|
|
|
|
|
|
|
|
#define LIGHTEN_POINT(buffer, bufsize, index, delta, temp) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if ((index) >= 0 && (index) + 2 < (bufsize)) \
|
|
|
|
{ \
|
|
|
|
temp = MIN (buffer[(index) + 0] * (1.0 + (delta)), MAX_VALUE); \
|
|
|
|
buffer[(index) + 0] = temp; \
|
|
|
|
temp = MIN (buffer[(index) + 1] * (1.0 + (delta)), MAX_VALUE); \
|
|
|
|
buffer[(index) + 1] = temp; \
|
|
|
|
temp = MIN (buffer[(index) + 2] * (1.0 + (delta)), MAX_VALUE); \
|
|
|
|
buffer[(index) + 2] = temp; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
while (0)
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct config_tag config_t;
|
|
|
|
|
|
|
|
struct config_tag
|
|
|
|
{
|
|
|
|
gint x;
|
|
|
|
gint y;
|
|
|
|
style_t style;
|
|
|
|
gint blend_lines;
|
|
|
|
gdouble blend_amount;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct globals_tag globals_t;
|
|
|
|
|
|
|
|
struct globals_tag
|
|
|
|
{
|
|
|
|
gint *cachex1[4];
|
|
|
|
gint *cachex2[4];
|
|
|
|
gint *cachey1[4];
|
|
|
|
gint *cachey2[4];
|
|
|
|
gint steps[4];
|
|
|
|
gint *gridx;
|
|
|
|
gint *gridy;
|
|
|
|
gint **blend_outer_cachex1[4];
|
|
|
|
gint **blend_outer_cachex2[4];
|
|
|
|
gint **blend_outer_cachey1[4];
|
|
|
|
gint **blend_outer_cachey2[4];
|
|
|
|
gint **blend_inner_cachex1[4];
|
|
|
|
gint **blend_inner_cachex2[4];
|
|
|
|
gint **blend_inner_cachey1[4];
|
|
|
|
gint **blend_inner_cachey2[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _Jigsaw Jigsaw;
|
|
|
|
typedef struct _JigsawClass JigsawClass;
|
|
|
|
|
|
|
|
struct _Jigsaw
|
|
|
|
{
|
|
|
|
GimpPlugIn parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _JigsawClass
|
|
|
|
{
|
|
|
|
GimpPlugInClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define JIGSAW_TYPE (jigsaw_get_type ())
|
|
|
|
#define JIGSAW (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JIGSAW_TYPE, Jigsaw))
|
|
|
|
|
|
|
|
GType jigsaw_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
static GList * jigsaw_query_procedures (GimpPlugIn *plug_in);
|
|
|
|
static GimpProcedure * jigsaw_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name);
|
|
|
|
|
|
|
|
static GimpValueArray * jigsaw_run (GimpProcedure *procedure,
|
|
|
|
GimpRunMode run_mode,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
gpointer run_data);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2019-08-13 23:31:13 +08:00
|
|
|
static void jigsaw (GimpDrawable *drawable,
|
2019-06-26 23:26:53 +08:00
|
|
|
GimpPreview *preview);
|
2019-08-13 23:31:13 +08:00
|
|
|
static void jigsaw_preview (GimpDrawable *drawable,
|
2004-10-12 04:39:20 +08:00
|
|
|
GimpPreview *preview);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2019-08-13 23:31:13 +08:00
|
|
|
static gboolean jigsaw_dialog (GimpDrawable *drawable);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
2004-10-12 04:39:20 +08:00
|
|
|
static void draw_jigsaw (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bytes,
|
|
|
|
gboolean preview_mode);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_vertical_border (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint height,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint bytes, gint x_offset, gint ytiles,
|
|
|
|
gint blend_lines, gdouble blend_amount);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_horizontal_border (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
|
|
|
gint y_offset, gint xtiles,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint blend_lines, gdouble blend_amount);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_vertical_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint px[2], gint py[2]);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_horizontal_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint px[2], gint py[2]);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void darken_vertical_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint *px, gint *py, gdouble delta);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void lighten_vertical_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint *px, gint *py, gdouble delta);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void darken_horizontal_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint *px, gint *py, gdouble delta);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void lighten_horizontal_line(guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint *px, gint *py, gdouble delta);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_right_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint curve_start_offset,
|
|
|
|
gint steps);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_left_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint curve_start_offset,
|
|
|
|
gint steps);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_up_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint y_offset, gint curve_start_offset,
|
|
|
|
gint steps);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_down_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint y_offset, gint curve_start_offset,
|
|
|
|
gint steps);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void darken_right_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint curve_start_offset,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void lighten_right_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint curve_start_offset,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void darken_left_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint curve_start_offset,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void lighten_left_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint curve_start_offset,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void darken_up_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint y_offset, gint curve_start_offest,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void lighten_up_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint y_offset, gint curve_start_offset,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void darken_down_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint y_offset, gint curve_start_offset,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void lighten_down_bump (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint y_offset, gint curve_start_offset,
|
|
|
|
gint steps, gdouble delta, gint counter);
|
2000-05-24 02:52:14 +08:00
|
|
|
static void generate_grid (gint width, gint height, gint xtiles, gint ytiles,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint *x, gint *y);
|
2000-05-24 02:52:14 +08:00
|
|
|
static void generate_bezier (gint px[4], gint py[4], gint steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint *cachex, gint *cachey);
|
2000-05-24 02:52:14 +08:00
|
|
|
static void malloc_cache (void);
|
|
|
|
static void free_cache (void);
|
|
|
|
static void init_right_bump (gint width, gint height);
|
|
|
|
static void init_left_bump (gint width, gint height);
|
|
|
|
static void init_up_bump (gint width, gint height);
|
|
|
|
static void init_down_bump (gint width, gint height);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_bezier_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint steps, gint *cx, gint *cy);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void darken_bezier_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint y_offset, gint steps,
|
|
|
|
gint *cx, gint *cy, gdouble delta);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void lighten_bezier_line (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint y_offset, gint steps,
|
|
|
|
gint *cx, gint *cy, gdouble delta);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_bezier_vertical_border (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint height,
|
|
|
|
gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint xtiles,
|
|
|
|
gint ytiles, gint blend_lines,
|
|
|
|
gdouble blend_amount, gint steps);
|
2003-05-10 03:24:39 +08:00
|
|
|
static void draw_bezier_horizontal_border (guchar *buffer, gint bufsize,
|
|
|
|
gint width, gint height,
|
|
|
|
gint bytes,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint x_offset, gint xtiles,
|
|
|
|
gint ytiles, gint blend_lines,
|
|
|
|
gdouble blend_amount, gint steps);
|
2000-05-24 02:52:14 +08:00
|
|
|
static void check_config (gint width, gint height);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2003-05-10 03:24:39 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
G_DEFINE_TYPE (Jigsaw, jigsaw, GIMP_TYPE_PLUG_IN)
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
GIMP_MAIN (JIGSAW_TYPE)
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
static config_t config =
|
|
|
|
{
|
|
|
|
5,
|
|
|
|
5,
|
|
|
|
BEZIER_1,
|
|
|
|
3,
|
2005-09-20 06:58:16 +08:00
|
|
|
0.5
|
1998-10-22 19:39:32 +08:00
|
|
|
};
|
|
|
|
|
2008-03-29 10:30:58 +08:00
|
|
|
static globals_t globals;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2019-08-30 22:21:42 +08:00
|
|
|
jigsaw_class_init (JigsawClass *klass)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
2019-08-30 22:21:42 +08:00
|
|
|
GimpPlugInClass *plug_in_class = GIMP_PLUG_IN_CLASS (klass);
|
|
|
|
|
|
|
|
plug_in_class->query_procedures = jigsaw_query_procedures;
|
|
|
|
plug_in_class->create_procedure = jigsaw_create_procedure;
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2019-08-30 22:21:42 +08:00
|
|
|
jigsaw_init (Jigsaw *jigsaw)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
2019-08-30 22:21:42 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
static GList *
|
|
|
|
jigsaw_query_procedures (GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
return g_list_append (NULL, g_strdup (PLUG_IN_PROC));
|
|
|
|
}
|
2003-03-26 00:38:19 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
static GimpProcedure *
|
|
|
|
jigsaw_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
GimpProcedure *procedure = NULL;
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
if (! strcmp (name, PLUG_IN_PROC))
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
2019-08-30 22:21:42 +08:00
|
|
|
procedure = gimp_image_procedure_new (plug_in, name,
|
|
|
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
|
|
|
jigsaw_run, NULL, NULL);
|
|
|
|
|
|
|
|
gimp_procedure_set_image_types (procedure, "RGB*");
|
|
|
|
|
|
|
|
gimp_procedure_set_menu_label (procedure, N_("_Jigsaw..."));
|
|
|
|
gimp_procedure_add_menu_path (procedure,
|
|
|
|
"<Image>/Filters/Render/Pattern");
|
|
|
|
|
|
|
|
gimp_procedure_set_documentation (procedure,
|
|
|
|
N_("Add a jigsaw-puzzle pattern "
|
|
|
|
"to the image"),
|
|
|
|
"Jigsaw puzzle look",
|
|
|
|
name);
|
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Nigel Wetten",
|
|
|
|
"Nigel Wetten",
|
|
|
|
"May 2000");
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_INT (procedure, "x",
|
|
|
|
"X",
|
|
|
|
"Number of tiles across",
|
|
|
|
1, GIMP_MAX_IMAGE_SIZE, 5,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_INT (procedure, "y",
|
|
|
|
"Y",
|
|
|
|
"Number of tiles down",
|
|
|
|
1, GIMP_MAX_IMAGE_SIZE, 5,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_INT (procedure, "style",
|
|
|
|
"Style",
|
|
|
|
"The style/shape of the jigsaw puzzle { 0, 1 }",
|
|
|
|
0, 1, BEZIER_1,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_INT (procedure, "blend-lines",
|
|
|
|
"Blend lines",
|
|
|
|
"Number of lines for shading bevels",
|
|
|
|
1, GIMP_MAX_IMAGE_SIZE, 3,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_DOUBLE (procedure, "blend-amount",
|
|
|
|
"Blend amount",
|
|
|
|
"The power of the light highlights",
|
|
|
|
0, 5, 0.5,
|
|
|
|
G_PARAM_READWRITE);
|
|
|
|
}
|
2004-10-12 04:39:20 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
return procedure;
|
|
|
|
}
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
static GimpValueArray *
|
|
|
|
jigsaw_run (GimpProcedure *procedure,
|
|
|
|
GimpRunMode run_mode,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
const GimpValueArray *args,
|
|
|
|
gpointer run_data)
|
|
|
|
{
|
|
|
|
INIT_I18N ();
|
|
|
|
gegl_init (NULL, NULL);
|
|
|
|
|
|
|
|
switch (run_mode)
|
|
|
|
{
|
2000-08-22 09:26:57 +08:00
|
|
|
case GIMP_RUN_INTERACTIVE:
|
2005-08-14 08:41:26 +08:00
|
|
|
gimp_get_data (PLUG_IN_PROC, &config);
|
2019-08-30 22:21:42 +08:00
|
|
|
|
2019-08-13 23:31:13 +08:00
|
|
|
if (! jigsaw_dialog (drawable))
|
2003-11-06 23:27:05 +08:00
|
|
|
{
|
2019-08-30 22:21:42 +08:00
|
|
|
return gimp_procedure_new_return_values (procedure,
|
|
|
|
GIMP_PDB_CANCEL,
|
|
|
|
NULL);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
2019-08-30 22:21:42 +08:00
|
|
|
break;
|
2004-10-12 04:39:20 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
case GIMP_RUN_NONINTERACTIVE:
|
|
|
|
config.x = GIMP_VALUES_GET_INT (args, 0);
|
|
|
|
config.y = GIMP_VALUES_GET_INT (args, 1);
|
|
|
|
config.style = GIMP_VALUES_GET_INT (args, 2);
|
|
|
|
config.blend_lines = GIMP_VALUES_GET_INT (args, 3);
|
|
|
|
config.blend_amount = GIMP_VALUES_GET_DOUBLE (args, 4);
|
1998-10-22 19:39:32 +08:00
|
|
|
break;
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2019-08-30 22:21:42 +08:00
|
|
|
case GIMP_RUN_WITH_LAST_VALS :
|
2005-08-14 08:41:26 +08:00
|
|
|
gimp_get_data (PLUG_IN_PROC, &config);
|
2019-08-30 22:21:42 +08:00
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
|
|
|
gimp_progress_init (_("Assembling jigsaw"));
|
|
|
|
|
|
|
|
jigsaw (drawable, NULL);
|
|
|
|
|
|
|
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
|
|
|
gimp_displays_flush ();
|
|
|
|
|
|
|
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
|
|
|
gimp_set_data (PLUG_IN_PROC, &config, sizeof (config));
|
|
|
|
|
|
|
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2004-10-12 04:39:20 +08:00
|
|
|
static void
|
2019-08-13 23:31:13 +08:00
|
|
|
jigsaw (GimpDrawable *drawable,
|
2004-10-12 04:39:20 +08:00
|
|
|
GimpPreview *preview)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
2019-06-26 23:26:53 +08:00
|
|
|
GeglBuffer *gegl_buffer = NULL;
|
|
|
|
const Babl *format = NULL;
|
|
|
|
guchar *buffer;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
gint bytes;
|
|
|
|
gint buffer_size;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2004-10-12 04:39:20 +08:00
|
|
|
if (preview)
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
2007-07-27 22:02:15 +08:00
|
|
|
gimp_preview_get_size (preview, &width, &height);
|
2019-08-13 23:31:13 +08:00
|
|
|
buffer = gimp_drawable_get_thumbnail_data (drawable,
|
2008-10-20 14:04:39 +08:00
|
|
|
&width, &height, &bytes);
|
2007-07-27 22:02:15 +08:00
|
|
|
buffer_size = bytes * width * height;
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
|
|
|
else
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
2019-08-13 23:31:13 +08:00
|
|
|
gegl_buffer = gimp_drawable_get_buffer (drawable);
|
2019-06-26 23:26:53 +08:00
|
|
|
|
2019-08-13 23:31:13 +08:00
|
|
|
width = gimp_drawable_width (drawable);
|
|
|
|
height = gimp_drawable_height (drawable);
|
2019-06-26 23:26:53 +08:00
|
|
|
|
2019-08-13 23:31:13 +08:00
|
|
|
if (gimp_drawable_has_alpha (drawable))
|
2019-06-26 23:26:53 +08:00
|
|
|
format = babl_format ("R'G'B'A u8");
|
|
|
|
else
|
|
|
|
format = babl_format ("R'G'B' u8");
|
|
|
|
|
|
|
|
bytes = babl_format_get_bytes_per_pixel (format);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2007-07-27 22:02:15 +08:00
|
|
|
/* setup image buffer */
|
|
|
|
buffer_size = bytes * width * height;
|
|
|
|
buffer = g_new (guchar, buffer_size);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2019-06-26 23:26:53 +08:00
|
|
|
gegl_buffer_get (gegl_buffer, GEGL_RECTANGLE (0, 0, width, height), 1.0,
|
|
|
|
format, buffer,
|
|
|
|
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
|
|
|
|
g_object_unref (gegl_buffer);
|
2000-05-23 21:00:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
check_config (width, height);
|
1998-10-22 19:39:32 +08:00
|
|
|
globals.steps[LEFT] = globals.steps[RIGHT] = globals.steps[UP]
|
|
|
|
= globals.steps[DOWN] = (config.x < config.y) ?
|
|
|
|
(width / config.x * 2) : (height / config.y * 2);
|
|
|
|
|
2000-05-23 21:00:40 +08:00
|
|
|
malloc_cache ();
|
2004-10-12 04:39:20 +08:00
|
|
|
draw_jigsaw (buffer, buffer_size, width, height, bytes, preview != NULL);
|
2000-05-23 21:00:40 +08:00
|
|
|
free_cache ();
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
/* cleanup */
|
2004-10-12 04:39:20 +08:00
|
|
|
if (preview)
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
2004-10-12 04:39:20 +08:00
|
|
|
gimp_preview_draw_buffer (preview, buffer, width * bytes);
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
|
|
|
else
|
2000-05-23 21:00:40 +08:00
|
|
|
{
|
2019-08-13 23:31:13 +08:00
|
|
|
gegl_buffer = gimp_drawable_get_shadow_buffer (drawable);
|
2007-07-27 22:02:15 +08:00
|
|
|
|
2019-06-26 23:26:53 +08:00
|
|
|
gegl_buffer_set (gegl_buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
|
|
|
|
format, buffer,
|
|
|
|
GEGL_AUTO_ROWSTRIDE);
|
|
|
|
g_object_unref (gegl_buffer);
|
|
|
|
|
2019-08-13 23:31:13 +08:00
|
|
|
gimp_drawable_merge_shadow (drawable, TRUE);
|
|
|
|
gimp_drawable_update (drawable, 0, 0, width, height);
|
2000-05-23 21:00:40 +08:00
|
|
|
}
|
|
|
|
|
2019-06-26 23:26:53 +08:00
|
|
|
g_free (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-08-13 23:31:13 +08:00
|
|
|
jigsaw_preview (GimpDrawable *drawable,
|
|
|
|
GimpPreview *preview)
|
2019-06-26 23:26:53 +08:00
|
|
|
{
|
2019-08-13 23:31:13 +08:00
|
|
|
jigsaw (drawable, preview);
|
2003-05-02 20:10:40 +08:00
|
|
|
}
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
generate_bezier (gint px[4],
|
2004-08-07 21:29:02 +08:00
|
|
|
gint py[4],
|
|
|
|
gint steps,
|
|
|
|
gint *cachex,
|
|
|
|
gint *cachey)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gdouble t = 0.0;
|
|
|
|
gdouble sigma = 1.0 / steps;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
gdouble t2, t3, x, y, t_1;
|
|
|
|
|
|
|
|
t += sigma;
|
|
|
|
t2 = t * t;
|
|
|
|
t3 = t2 * t;
|
|
|
|
t_1 = 1 - t;
|
|
|
|
x = t_1 * t_1 * t_1 * px[0]
|
2004-08-07 21:29:02 +08:00
|
|
|
+ 3 * t * t_1 * t_1 * px[1]
|
|
|
|
+ 3 * t2 * t_1 * px[2]
|
|
|
|
+ t3 * px[3];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = t_1 * t_1 * t_1 * py[0]
|
2004-08-07 21:29:02 +08:00
|
|
|
+ 3 * t * t_1 * t_1 * py[1]
|
|
|
|
+ 3 * t2 * t_1 * py[2]
|
|
|
|
+ t3 * py[3];
|
1998-10-22 19:39:32 +08:00
|
|
|
cachex[i] = (gint) (x + 0.2);
|
|
|
|
cachey[i] = (gint) (y + 0.2);
|
|
|
|
} /* for */
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-23 21:00:40 +08:00
|
|
|
draw_jigsaw (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bytes,
|
|
|
|
gboolean preview_mode)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint *x, *y;
|
|
|
|
gint xtiles = config.x;
|
|
|
|
gint ytiles = config.y;
|
|
|
|
gint xlines = xtiles - 1;
|
|
|
|
gint ylines = ytiles - 1;
|
|
|
|
gint blend_lines = config.blend_lines;
|
|
|
|
gdouble blend_amount = config.blend_amount;
|
|
|
|
gint steps = globals.steps[RIGHT];
|
|
|
|
style_t style = config.style;
|
|
|
|
gint progress_total = xlines + ylines - 1;
|
|
|
|
|
2003-05-02 20:10:40 +08:00
|
|
|
g_return_if_fail (buffer != NULL);
|
|
|
|
|
2000-05-24 02:52:14 +08:00
|
|
|
globals.gridx = g_new (gint, xtiles);
|
|
|
|
globals.gridy = g_new (gint, ytiles);
|
1998-10-22 19:39:32 +08:00
|
|
|
x = globals.gridx;
|
|
|
|
y = globals.gridy;
|
|
|
|
|
2000-05-24 02:52:14 +08:00
|
|
|
generate_grid (width, height, xtiles, ytiles, globals.gridx, globals.gridy);
|
2003-05-02 20:10:40 +08:00
|
|
|
|
2000-05-24 02:52:14 +08:00
|
|
|
init_right_bump (width, height);
|
|
|
|
init_left_bump (width, height);
|
|
|
|
init_up_bump (width, height);
|
|
|
|
init_down_bump (width, height);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
if (style == BEZIER_1)
|
|
|
|
{
|
|
|
|
for (i = 0; i < xlines; i++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_vertical_border (buffer, bufsize, width, height, bytes,
|
|
|
|
x[i], ytiles,
|
2004-08-07 21:29:02 +08:00
|
|
|
blend_lines, blend_amount);
|
|
|
|
if (!preview_mode)
|
|
|
|
gimp_progress_update ((gdouble) i / (gdouble) progress_total);
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < ylines; i++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_horizontal_border (buffer, bufsize, width, bytes, y[i], xtiles,
|
2004-08-07 21:29:02 +08:00
|
|
|
blend_lines, blend_amount);
|
|
|
|
if (!preview_mode)
|
|
|
|
gimp_progress_update ((gdouble) (i + xlines) / (gdouble) progress_total);
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
else if (style == BEZIER_2)
|
|
|
|
{
|
|
|
|
for (i = 0; i < xlines; i++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_bezier_vertical_border (buffer, bufsize, width, height, bytes,
|
|
|
|
x[i], xtiles, ytiles, blend_lines,
|
2004-08-07 21:29:02 +08:00
|
|
|
blend_amount, steps);
|
|
|
|
if (!preview_mode)
|
|
|
|
gimp_progress_update ((gdouble) i / (gdouble) progress_total);
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < ylines; i++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_bezier_horizontal_border (buffer, bufsize, width, height, bytes,
|
|
|
|
y[i], xtiles, ytiles, blend_lines,
|
2004-08-07 21:29:02 +08:00
|
|
|
blend_amount, steps);
|
|
|
|
if (!preview_mode)
|
|
|
|
gimp_progress_update ((gdouble) (i + xlines) / (gdouble) progress_total);
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-06-26 23:26:53 +08:00
|
|
|
g_printerr ("draw_jigsaw: bad style\n");
|
2005-03-04 23:12:29 +08:00
|
|
|
gimp_quit ();
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2011-04-11 01:05:08 +08:00
|
|
|
gimp_progress_update (1.0);
|
2000-05-23 21:00:40 +08:00
|
|
|
|
|
|
|
g_free (globals.gridx);
|
|
|
|
g_free (globals.gridy);
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_vertical_border (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint ytiles,
|
|
|
|
gint blend_lines,
|
|
|
|
gdouble blend_amount)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
gint tile_height = height / ytiles;
|
|
|
|
gint tile_height_eighth = tile_height / 8;
|
|
|
|
gint curve_start_offset = 3 * tile_height_eighth;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_height_eighth;
|
|
|
|
gint px[2], py[2];
|
|
|
|
gint ly[2], dy[2];
|
|
|
|
gint y_offset = 0;
|
|
|
|
gdouble delta;
|
|
|
|
gdouble sigma = blend_amount / blend_lines;
|
|
|
|
gint right;
|
2003-05-02 20:10:40 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < ytiles; i++)
|
|
|
|
{
|
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
|
|
|
right = g_random_int_range (0, 2);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
/* first straight line from top downwards */
|
|
|
|
px[0] = px[1] = x_offset;
|
|
|
|
py[0] = y_offset; py[1] = y_offset + curve_start_offset - 1;
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_vertical_line (buffer, bufsize, width, bytes, px, py);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
dy[0] = ly[0] = py[0]; dy[1] = ly[1] = py[1];
|
|
|
|
if (!right)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
ly[1] += blend_lines + 2;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
dy[0]++; dy[1]--; ly[0]++; ly[1]--;
|
|
|
|
px[0] = x_offset - j - 1;
|
|
|
|
darken_vertical_line (buffer, bufsize, width, bytes, px, dy, delta);
|
|
|
|
px[0] = x_offset + j + 1;
|
|
|
|
lighten_vertical_line (buffer, bufsize, width, bytes, px, ly, delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* top half of curve */
|
|
|
|
if (right)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_right_bump (buffer, bufsize, width, bytes, x_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
y_offset + curve_start_offset,
|
|
|
|
globals.steps[RIGHT]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_right_bump (buffer, bufsize, width, bytes, x_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
y_offset + curve_start_offset,
|
|
|
|
globals.steps[RIGHT], delta, j);
|
|
|
|
/* use to be +j + 1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_right_bump (buffer, bufsize, width, bytes, x_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
y_offset + curve_start_offset,
|
|
|
|
globals.steps[RIGHT], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
else
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_left_bump (buffer, bufsize, width, bytes, x_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
y_offset + curve_start_offset,
|
|
|
|
globals.steps[LEFT]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_left_bump (buffer, bufsize, width, bytes, x_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
y_offset + curve_start_offset,
|
|
|
|
globals.steps[LEFT], delta, j);
|
|
|
|
/* use to be -j - 1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_left_bump (buffer, bufsize, width, bytes, x_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
y_offset + curve_start_offset,
|
|
|
|
globals.steps[LEFT], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
/* bottom straight line of a tile wall */
|
|
|
|
px[0] = px[1] = x_offset;
|
|
|
|
py[0] = y_offset + curve_end_offset;
|
|
|
|
py[1] = globals.gridy[i];
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_vertical_line (buffer, bufsize, width, bytes, px, py);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
dy[0] = ly[0] = py[0]; dy[1] = ly[1] = py[1];
|
|
|
|
if (right)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
dy[0] -= blend_lines + 2;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
dy[0]++; dy[1]--; ly[0]++; ly[1]--;
|
|
|
|
px[0] = x_offset - j - 1;
|
|
|
|
darken_vertical_line (buffer, bufsize, width, bytes, px, dy, delta);
|
|
|
|
px[0] = x_offset + j + 1;
|
|
|
|
lighten_vertical_line (buffer, bufsize, width, bytes, px, ly, delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
y_offset = globals.gridy[i];
|
|
|
|
} /* for */
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* assumes RGB* */
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_horizontal_border (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint xtiles,
|
|
|
|
gint blend_lines,
|
|
|
|
gdouble blend_amount)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_width_eighth = tile_width / 8;
|
|
|
|
gint curve_start_offset = 3 * tile_width_eighth;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_width_eighth;
|
|
|
|
gint px[2], py[2];
|
|
|
|
gint dx[2], lx[2];
|
|
|
|
gint x_offset = 0;
|
|
|
|
gdouble delta;
|
|
|
|
gdouble sigma = blend_amount / blend_lines;
|
|
|
|
gint up;
|
|
|
|
|
|
|
|
for (i = 0; i < xtiles; i++)
|
|
|
|
{
|
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
|
|
|
up = g_random_int_range (0, 2);
|
2011-10-04 16:48:43 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
/* first horizontal line across */
|
|
|
|
px[0] = x_offset; px[1] = x_offset + curve_start_offset - 1;
|
|
|
|
py[0] = py[1] = y_offset;
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_horizontal_line (buffer, bufsize, width, bytes, px, py);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
dx[0] = lx[0] = px[0]; dx[1] = lx[1] = px[1];
|
|
|
|
if (up)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
lx[1] += blend_lines + 2;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
dx[0]++; dx[1]--; lx[0]++; lx[1]--;
|
|
|
|
py[0] = y_offset - j - 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_horizontal_line (buffer, bufsize, width, bytes, dx, py,
|
2004-08-07 21:29:02 +08:00
|
|
|
delta);
|
|
|
|
py[0] = y_offset + j + 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_horizontal_line (buffer, bufsize, width, bytes, lx, py,
|
2004-08-07 21:29:02 +08:00
|
|
|
delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
if (up)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_up_bump (buffer, bufsize, width, bytes, y_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
x_offset + curve_start_offset,
|
|
|
|
globals.steps[UP]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_up_bump (buffer, bufsize, width, bytes, y_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
x_offset + curve_start_offset,
|
|
|
|
globals.steps[UP], delta, j);
|
|
|
|
/* use to be +j + 1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_up_bump (buffer, bufsize, width, bytes, y_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
x_offset + curve_start_offset,
|
|
|
|
globals.steps[UP], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
else
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_down_bump (buffer, bufsize, width, bytes, y_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
x_offset + curve_start_offset,
|
|
|
|
globals.steps[DOWN]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be +j + 1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_down_bump (buffer, bufsize, width, bytes, y_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
x_offset + curve_start_offset,
|
|
|
|
globals.steps[DOWN], delta, j);
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_down_bump (buffer, bufsize, width, bytes, y_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
x_offset + curve_start_offset,
|
|
|
|
globals.steps[DOWN], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
/* right horizontal line of tile */
|
|
|
|
px[0] = x_offset + curve_end_offset;
|
|
|
|
px[1] = globals.gridx[i];
|
|
|
|
py[0] = py[1] = y_offset;
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_horizontal_line (buffer, bufsize, width, bytes, px, py);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
dx[0] = lx[0] = px[0]; dx[1] = lx[1] = px[1];
|
|
|
|
if (!up)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
dx[0] -= blend_lines + 2;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
for (j = 0;j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
dx[0]++; dx[1]--; lx[0]++; lx[1]--;
|
|
|
|
py[0] = y_offset - j - 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_horizontal_line (buffer, bufsize, width, bytes, dx, py,
|
2004-08-07 21:29:02 +08:00
|
|
|
delta);
|
|
|
|
py[0] = y_offset + j + 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_horizontal_line (buffer, bufsize, width, bytes, lx, py,
|
2004-08-07 21:29:02 +08:00
|
|
|
delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
x_offset = globals.gridx[i];
|
|
|
|
} /* for */
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* assumes going top to bottom */
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_vertical_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint px[2],
|
|
|
|
gint py[2])
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
gint index;
|
|
|
|
gint length;
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
index = px[0] * bytes + rowstride * py[0];
|
|
|
|
length = py[1] - py[0] + 1;
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
index += rowstride;
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* assumes going left to right */
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_horizontal_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint px[2],
|
|
|
|
gint py[2])
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
gint index;
|
|
|
|
gint length;
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
index = px[0] * bytes + rowstride * py[0];
|
|
|
|
length = px[1] - px[0] + 1;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
index += bytes;
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_right_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex1[RIGHT][i] + x_offset;
|
|
|
|
y = globals.cachey1[RIGHT][i] + curve_start_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex2[RIGHT][i] + x_offset;
|
|
|
|
y = globals.cachey2[RIGHT][i] + curve_start_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_left_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex1[LEFT][i] + x_offset;
|
|
|
|
y = globals.cachey1[LEFT][i] + curve_start_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex2[LEFT][i] + x_offset;
|
|
|
|
y = globals.cachey2[LEFT][i] + curve_start_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_up_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex1[UP][i] + curve_start_offset;
|
|
|
|
y = globals.cachey1[UP][i] + y_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex2[UP][i] + curve_start_offset;
|
|
|
|
y = globals.cachey2[UP][i] + y_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_down_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex1[DOWN][i] + curve_start_offset;
|
|
|
|
y = globals.cachey1[DOWN][i] + y_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2003-05-02 20:10:40 +08:00
|
|
|
x = globals.cachex2[DOWN][i] + curve_start_offset;
|
|
|
|
y = globals.cachey2[DOWN][i] + y_offset;
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
malloc_cache (void)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
gint blend_lines = config.blend_lines;
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
2003-05-02 20:10:40 +08:00
|
|
|
gint steps = globals.steps[i];
|
|
|
|
|
|
|
|
globals.cachex1[i] = g_new (gint, steps);
|
|
|
|
globals.cachex2[i] = g_new (gint, steps);
|
|
|
|
globals.cachey1[i] = g_new (gint, steps);
|
|
|
|
globals.cachey2[i] = g_new (gint, steps);
|
|
|
|
globals.blend_outer_cachex1[i] = g_new (gint *, blend_lines);
|
|
|
|
globals.blend_outer_cachex2[i] = g_new (gint *, blend_lines);
|
|
|
|
globals.blend_outer_cachey1[i] = g_new (gint *, blend_lines);
|
|
|
|
globals.blend_outer_cachey2[i] = g_new (gint *, blend_lines);
|
|
|
|
globals.blend_inner_cachex1[i] = g_new (gint *, blend_lines);
|
|
|
|
globals.blend_inner_cachex2[i] = g_new (gint *, blend_lines);
|
|
|
|
globals.blend_inner_cachey1[i] = g_new (gint *, blend_lines);
|
|
|
|
globals.blend_inner_cachey2[i] = g_new (gint *, blend_lines);
|
1998-10-22 19:39:32 +08:00
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
globals.blend_outer_cachex1[i][j] = g_new (gint, steps);
|
|
|
|
globals.blend_outer_cachex2[i][j] = g_new (gint, steps);
|
|
|
|
globals.blend_outer_cachey1[i][j] = g_new (gint, steps);
|
|
|
|
globals.blend_outer_cachey2[i][j] = g_new (gint, steps);
|
|
|
|
globals.blend_inner_cachex1[i][j] = g_new (gint, steps);
|
|
|
|
globals.blend_inner_cachex2[i][j] = g_new (gint, steps);
|
|
|
|
globals.blend_inner_cachey1[i][j] = g_new (gint, steps);
|
|
|
|
globals.blend_inner_cachey2[i][j] = g_new (gint, steps);
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
free_cache (void)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
gint blend_lines = config.blend_lines;
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i ++)
|
|
|
|
{
|
2000-01-16 23:38:38 +08:00
|
|
|
g_free (globals.cachex1[i]);
|
|
|
|
g_free (globals.cachex2[i]);
|
|
|
|
g_free (globals.cachey1[i]);
|
|
|
|
g_free (globals.cachey2[i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
g_free (globals.blend_outer_cachex1[i][j]);
|
|
|
|
g_free (globals.blend_outer_cachex2[i][j]);
|
|
|
|
g_free (globals.blend_outer_cachey1[i][j]);
|
|
|
|
g_free (globals.blend_outer_cachey2[i][j]);
|
|
|
|
g_free (globals.blend_inner_cachex1[i][j]);
|
|
|
|
g_free (globals.blend_inner_cachex2[i][j]);
|
|
|
|
g_free (globals.blend_inner_cachey1[i][j]);
|
|
|
|
g_free (globals.blend_inner_cachey2[i][j]);
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
g_free (globals.blend_outer_cachex1[i]);
|
|
|
|
g_free (globals.blend_outer_cachex2[i]);
|
|
|
|
g_free (globals.blend_outer_cachey1[i]);
|
|
|
|
g_free (globals.blend_outer_cachey2[i]);
|
|
|
|
g_free (globals.blend_inner_cachex1[i]);
|
|
|
|
g_free (globals.blend_inner_cachex2[i]);
|
|
|
|
g_free (globals.blend_inner_cachey1[i]);
|
|
|
|
g_free (globals.blend_inner_cachey2[i]);
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
init_right_bump (gint width,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint height)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint xtiles = config.x;
|
|
|
|
gint ytiles = config.y;
|
|
|
|
gint steps = globals.steps[RIGHT];
|
|
|
|
gint px[4], py[4];
|
|
|
|
gint x_offset = 0;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_height = height/ ytiles;
|
|
|
|
gint tile_height_eighth = tile_height / 8;
|
|
|
|
gint curve_start_offset = 0;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_height_eighth;
|
|
|
|
gint blend_lines = config.blend_lines;
|
|
|
|
|
|
|
|
px[0] = x_offset;
|
|
|
|
px[1] = x_offset + XFACTOR2 * tile_width;
|
|
|
|
px[2] = x_offset + XFACTOR3 * tile_width;
|
|
|
|
px[3] = x_offset + XFACTOR4 * tile_width;
|
|
|
|
py[0] = curve_start_offset;
|
|
|
|
py[1] = curve_start_offset + YFACTOR2 * tile_height;
|
|
|
|
py[2] = curve_start_offset - YFACTOR3 * tile_height;
|
|
|
|
py[3] = curve_start_offset + YFACTOR4 * tile_height;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex1[RIGHT],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey1[RIGHT]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outside right bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[0]--; py[1]--; py[2]--; px[3]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex1[RIGHT][i],
|
|
|
|
globals.blend_outer_cachey1[RIGHT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inside right bump */
|
|
|
|
py[0] += blend_lines; py[1] += blend_lines; py[2] += blend_lines;
|
|
|
|
px[3] -= blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[0]++; py[1]++; py[2]++; px[3]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex1[RIGHT][i],
|
|
|
|
globals.blend_inner_cachey1[RIGHT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* bottom half of bump */
|
|
|
|
px[0] = x_offset + XFACTOR5 * tile_width;
|
|
|
|
px[1] = x_offset + XFACTOR6 * tile_width;
|
|
|
|
px[2] = x_offset + XFACTOR7 * tile_width;
|
|
|
|
px[3] = x_offset;
|
|
|
|
py[0] = curve_start_offset + YFACTOR5 * tile_height;
|
|
|
|
py[1] = curve_start_offset + YFACTOR6 * tile_height;
|
|
|
|
py[2] = curve_start_offset + YFACTOR7 * tile_height;
|
|
|
|
py[3] = curve_end_offset;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex2[RIGHT],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey2[RIGHT]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outer right bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[1]++; py[2]++; py[3]++; px[0]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex2[RIGHT][i],
|
|
|
|
globals.blend_outer_cachey2[RIGHT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inner right bump */
|
|
|
|
py[1] -= blend_lines; py[2] -= blend_lines; py[3] -= blend_lines;
|
|
|
|
px[0] -= blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[1]--; py[2]--; py[3]--; px[0]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex2[RIGHT][i],
|
|
|
|
globals.blend_inner_cachey2[RIGHT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
init_left_bump (gint width,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint height)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint xtiles = config.x;
|
|
|
|
gint ytiles = config.y;
|
|
|
|
gint steps = globals.steps[LEFT];
|
|
|
|
gint px[4], py[4];
|
|
|
|
gint x_offset = 0;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_height = height / ytiles;
|
|
|
|
gint tile_height_eighth = tile_height / 8;
|
|
|
|
gint curve_start_offset = 0;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_height_eighth;
|
|
|
|
gint blend_lines = config.blend_lines;
|
|
|
|
|
|
|
|
px[0] = x_offset;
|
|
|
|
px[1] = x_offset - XFACTOR2 * tile_width;
|
|
|
|
px[2] = x_offset - XFACTOR3 * tile_width;
|
|
|
|
px[3] = x_offset - XFACTOR4 * tile_width;
|
|
|
|
py[0] = curve_start_offset;
|
|
|
|
py[1] = curve_start_offset + YFACTOR2 * tile_height;
|
|
|
|
py[2] = curve_start_offset - YFACTOR3 * tile_height;
|
|
|
|
py[3] = curve_start_offset + YFACTOR4 * tile_height;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex1[LEFT],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey1[LEFT]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outer left bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[0]--; py[1]--; py[2]--; px[3]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex1[LEFT][i],
|
|
|
|
globals.blend_outer_cachey1[LEFT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inner left bump */
|
|
|
|
py[0] += blend_lines; py[1] += blend_lines; py[2] += blend_lines;
|
|
|
|
px[3] += blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[0]++; py[1]++; py[2]++; px[3]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex1[LEFT][i],
|
|
|
|
globals.blend_inner_cachey1[LEFT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* bottom half of bump */
|
|
|
|
px[0] = x_offset - XFACTOR5 * tile_width;
|
|
|
|
px[1] = x_offset - XFACTOR6 * tile_width;
|
|
|
|
px[2] = x_offset - XFACTOR7 * tile_width;
|
|
|
|
px[3] = x_offset;
|
|
|
|
py[0] = curve_start_offset + YFACTOR5 * tile_height;
|
|
|
|
py[1] = curve_start_offset + YFACTOR6 * tile_height;
|
|
|
|
py[2] = curve_start_offset + YFACTOR7 * tile_height;
|
|
|
|
py[3] = curve_end_offset;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex2[LEFT],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey2[LEFT]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outer left bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[1]++; py[2]++; py[3]++; px[0]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex2[LEFT][i],
|
|
|
|
globals.blend_outer_cachey2[LEFT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inner left bump */
|
|
|
|
py[1] -= blend_lines; py[2] -= blend_lines; py[3] -= blend_lines;
|
|
|
|
px[0] += blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
py[1]--; py[2]--; py[3]--; px[0]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex2[LEFT][i],
|
|
|
|
globals.blend_inner_cachey2[LEFT][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
init_up_bump (gint width,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint height)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint xtiles = config.x;
|
|
|
|
gint ytiles = config.y;
|
|
|
|
gint steps = globals.steps[UP];
|
|
|
|
gint px[4], py[4];
|
|
|
|
gint y_offset = 0;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_height = height/ ytiles;
|
|
|
|
gint tile_width_eighth = tile_width / 8;
|
|
|
|
gint curve_start_offset = 0;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_width_eighth;
|
|
|
|
gint blend_lines = config.blend_lines;
|
|
|
|
|
|
|
|
px[0] = curve_start_offset;
|
|
|
|
px[1] = curve_start_offset + YFACTOR2 * tile_width;
|
|
|
|
px[2] = curve_start_offset - YFACTOR3 * tile_width;
|
|
|
|
px[3] = curve_start_offset + YFACTOR4 * tile_width;
|
|
|
|
py[0] = y_offset;
|
|
|
|
py[1] = y_offset - XFACTOR2 * tile_height;
|
|
|
|
py[2] = y_offset - XFACTOR3 * tile_height;
|
|
|
|
py[3] = y_offset - XFACTOR4 * tile_height;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex1[UP],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey1[UP]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outer up bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[0]--; px[1]--; px[2]--; py[3]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex1[UP][i],
|
|
|
|
globals.blend_outer_cachey1[UP][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inner up bump */
|
|
|
|
px[0] += blend_lines; px[1] += blend_lines; px[2] += blend_lines;
|
|
|
|
py[3] += blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[0]++; px[1]++; px[2]++; py[3]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex1[UP][i],
|
|
|
|
globals.blend_inner_cachey1[UP][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* bottom half of bump */
|
|
|
|
px[0] = curve_start_offset + YFACTOR5 * tile_width;
|
|
|
|
px[1] = curve_start_offset + YFACTOR6 * tile_width;
|
|
|
|
px[2] = curve_start_offset + YFACTOR7 * tile_width;
|
|
|
|
px[3] = curve_end_offset;
|
|
|
|
py[0] = y_offset - XFACTOR5 * tile_height;
|
|
|
|
py[1] = y_offset - XFACTOR6 * tile_height;
|
|
|
|
py[2] = y_offset - XFACTOR7 * tile_height;
|
|
|
|
py[3] = y_offset;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex2[UP],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey2[UP]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outer up bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[1]++; px[2]++; px[3]++; py[0]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex2[UP][i],
|
|
|
|
globals.blend_outer_cachey2[UP][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inner up bump */
|
|
|
|
px[1] -= blend_lines; px[2] -= blend_lines; px[3] -= blend_lines;
|
|
|
|
py[0] += blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[1]--; px[2]--; px[3]--; py[0]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex2[UP][i],
|
|
|
|
globals.blend_inner_cachey2[UP][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
init_down_bump (gint width,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint height)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint xtiles = config.x;
|
|
|
|
gint ytiles = config.y;
|
|
|
|
gint steps = globals.steps[DOWN];
|
|
|
|
gint px[4], py[4];
|
|
|
|
gint y_offset = 0;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_height = height/ ytiles;
|
|
|
|
gint tile_width_eighth = tile_width / 8;
|
|
|
|
gint curve_start_offset = 0;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_width_eighth;
|
|
|
|
gint blend_lines = config.blend_lines;
|
|
|
|
|
|
|
|
px[0] = curve_start_offset;
|
|
|
|
px[1] = curve_start_offset + YFACTOR2 * tile_width;
|
|
|
|
px[2] = curve_start_offset - YFACTOR3 * tile_width;
|
|
|
|
px[3] = curve_start_offset + YFACTOR4 * tile_width;
|
|
|
|
py[0] = y_offset;
|
|
|
|
py[1] = y_offset + XFACTOR2 * tile_height;
|
|
|
|
py[2] = y_offset + XFACTOR3 * tile_height;
|
|
|
|
py[3] = y_offset + XFACTOR4 * tile_height;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex1[DOWN],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey1[DOWN]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outer down bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[0]--; px[1]--; px[2]--; py[3]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex1[DOWN][i],
|
|
|
|
globals.blend_outer_cachey1[DOWN][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inner down bump */
|
|
|
|
px[0] += blend_lines; px[1] += blend_lines; px[2] += blend_lines;
|
|
|
|
py[3] -= blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[0]++; px[1]++; px[2]++; py[3]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex1[DOWN][i],
|
|
|
|
globals.blend_inner_cachey1[DOWN][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* bottom half of bump */
|
|
|
|
px[0] = curve_start_offset + YFACTOR5 * tile_width;
|
|
|
|
px[1] = curve_start_offset + YFACTOR6 * tile_width;
|
|
|
|
px[2] = curve_start_offset + YFACTOR7 * tile_width;
|
|
|
|
px[3] = curve_end_offset;
|
|
|
|
py[0] = y_offset + XFACTOR5 * tile_height;
|
|
|
|
py[1] = y_offset + XFACTOR6 * tile_height;
|
|
|
|
py[2] = y_offset + XFACTOR7 * tile_height;
|
|
|
|
py[3] = y_offset;
|
|
|
|
generate_bezier(px, py, steps, globals.cachex2[DOWN],
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.cachey2[DOWN]);
|
1998-10-22 19:39:32 +08:00
|
|
|
/* outer down bump */
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[1]++; px[2]++; px[3]++; py[0]++;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_outer_cachex2[DOWN][i],
|
|
|
|
globals.blend_outer_cachey2[DOWN][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
|
|
|
/* inner down bump */
|
|
|
|
px[1] -= blend_lines; px[2] -= blend_lines; px[3] -= blend_lines;
|
|
|
|
py[0] -= blend_lines;
|
|
|
|
for (i = 0; i < blend_lines; i++)
|
|
|
|
{
|
|
|
|
px[1]--; px[2]--; px[3]--; py[0]--;
|
|
|
|
generate_bezier(px, py, steps,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.blend_inner_cachex2[DOWN][i],
|
|
|
|
globals.blend_inner_cachey2[DOWN][i]);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
generate_grid (gint width,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint height,
|
|
|
|
gint xtiles,
|
|
|
|
gint ytiles,
|
|
|
|
gint *x,
|
|
|
|
gint *y)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint xlines = xtiles - 1;
|
|
|
|
gint ylines = ytiles - 1;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_height = height / ytiles;
|
|
|
|
gint tile_width_leftover = width % xtiles;
|
|
|
|
gint tile_height_leftover = height % ytiles;
|
|
|
|
gint x_offset = tile_width;
|
|
|
|
gint y_offset = tile_height;
|
|
|
|
gint carry;
|
|
|
|
|
|
|
|
for (i = 0; i < xlines; i++)
|
|
|
|
{
|
|
|
|
x[i] = x_offset;
|
|
|
|
x_offset += tile_width;
|
|
|
|
}
|
|
|
|
carry = 0;
|
|
|
|
while (tile_width_leftover)
|
|
|
|
{
|
|
|
|
for (i = carry; i < xlines; i++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
x[i] += 1;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
tile_width_leftover--;
|
|
|
|
carry++;
|
|
|
|
}
|
|
|
|
x[xlines] = width - 1; /* padding for draw_horizontal_border */
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < ytiles; i++)
|
|
|
|
{
|
|
|
|
y[i] = y_offset;
|
|
|
|
y_offset += tile_height;
|
|
|
|
}
|
|
|
|
carry = 0;
|
|
|
|
while (tile_height_leftover)
|
|
|
|
{
|
|
|
|
for (i = carry; i < ylines; i++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
y[i] += 1;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
tile_height_leftover--;
|
|
|
|
carry++;
|
|
|
|
}
|
|
|
|
y[ylines] = height - 1; /* padding for draw_vertical_border */
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* assumes RGB* */
|
|
|
|
/* assumes py[1] > py[0] and px[0] = px[1] */
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
darken_vertical_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint px[2],
|
|
|
|
gint py[2],
|
|
|
|
gdouble delta)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
gint index;
|
|
|
|
gint length;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
index = px[0] * bytes + py[0] * rowstride;
|
|
|
|
length = py[1] - py[0] + 1;
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
1998-10-22 19:39:32 +08:00
|
|
|
index += rowstride;
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* assumes RGB* */
|
|
|
|
/* assumes py[1] > py[0] and px[0] = px[1] */
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
lighten_vertical_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint px[2],
|
|
|
|
gint py[2],
|
|
|
|
gdouble delta)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
gint index;
|
|
|
|
gint length;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
index = px[0] * bytes + py[0] * rowstride;
|
|
|
|
length = py[1] - py[0] + 1;
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
1998-10-22 19:39:32 +08:00
|
|
|
index += rowstride;
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* assumes RGB* */
|
|
|
|
/* assumes px[1] > px[0] and py[0] = py[1] */
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
darken_horizontal_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint px[2],
|
|
|
|
gint py[2],
|
|
|
|
gdouble delta)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
gint index;
|
|
|
|
gint length;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
index = px[0] * bytes + py[0] * rowstride;
|
|
|
|
length = px[1] - px[0] + 1;
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
1998-10-22 19:39:32 +08:00
|
|
|
index += bytes;
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* assumes RGB* */
|
|
|
|
/* assumes px[1] > px[0] and py[0] = py[1] */
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
lighten_horizontal_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint px[2],
|
|
|
|
gint py[2],
|
|
|
|
gdouble delta)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
gint index;
|
|
|
|
gint length;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
index = px[0] * bytes + py[0] * rowstride;
|
|
|
|
length = px[1] - px[0] + 1;
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
1998-10-22 19:39:32 +08:00
|
|
|
index += bytes;
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
darken_right_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index1 = -1;
|
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex1[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey1[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 1.3)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index1 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex2[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey2[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
lighten_right_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index1 = -1;
|
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex1[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey1[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 1.3)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index1 = index;
|
|
|
|
}
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex2[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey2[RIGHT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
darken_left_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index1 = -1;
|
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex1[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey1[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index1 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex2[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey2[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 4)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
lighten_left_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
2003-11-06 23:27:05 +08:00
|
|
|
gint last_index1 = -1;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex1[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey1[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index1 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
x = x_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex2[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey2[LEFT][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 4)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
darken_up_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index1 = -1;
|
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex1[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey1[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index1 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex2[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey2[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 4)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
lighten_up_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index1 = -1;
|
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex1[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey1[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index1 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex2[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey2[UP][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 4)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
darken_down_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index1 = -1;
|
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex1[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey1[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 1.2)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index1 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachex2[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_inner_cachey2[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
lighten_down_bump (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint curve_start_offset,
|
|
|
|
gint steps,
|
|
|
|
gdouble delta,
|
|
|
|
gint counter)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index1 = -1;
|
|
|
|
gint last_index2 = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
gint j = counter;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex1[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey1[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index1)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
if (i < steps / 1.2)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
}
|
|
|
|
last_index1 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
x = curve_start_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachex2[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
y = y_offset
|
2004-08-07 21:29:02 +08:00
|
|
|
+ globals.blend_outer_cachey2[DOWN][j][i];
|
1998-10-22 19:39:32 +08:00
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index2)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index2 = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_bezier_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint steps,
|
|
|
|
gint *cx,
|
|
|
|
gint *cy)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = cx[i];
|
|
|
|
y = cy[i];
|
|
|
|
index = y * rowstride + x * bytes;
|
2003-05-10 03:24:39 +08:00
|
|
|
DRAW_POINT (buffer, bufsize, index);
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
darken_bezier_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint y_offset,
|
|
|
|
gint steps,
|
|
|
|
gint *cx,
|
|
|
|
gint *cy,
|
|
|
|
gdouble delta)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = cx[i] + x_offset;
|
|
|
|
y = cy[i] + y_offset;
|
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
DARKEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
lighten_bezier_line (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint y_offset,
|
|
|
|
gint steps,
|
|
|
|
gint *cx,
|
|
|
|
gint *cy,
|
|
|
|
gdouble delta)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint x, y;
|
|
|
|
gint index;
|
|
|
|
gint last_index = -1;
|
2000-05-24 02:52:14 +08:00
|
|
|
gint rowstride;
|
1998-10-22 19:39:32 +08:00
|
|
|
gint temp;
|
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
rowstride = bytes * width;
|
2000-05-24 02:52:14 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < steps; i++)
|
|
|
|
{
|
|
|
|
x = cx[i] + x_offset;
|
|
|
|
y = cy[i] + y_offset;
|
|
|
|
index = y * rowstride + x * bytes;
|
|
|
|
if (index != last_index)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
LIGHTEN_POINT (buffer, bufsize, index, delta, temp);
|
2004-08-07 21:29:02 +08:00
|
|
|
last_index = index;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_bezier_vertical_border (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bytes,
|
|
|
|
gint x_offset,
|
|
|
|
gint xtiles,
|
|
|
|
gint ytiles,
|
|
|
|
gint blend_lines,
|
|
|
|
gdouble blend_amount,
|
|
|
|
gint steps)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_height = height / ytiles;
|
|
|
|
gint tile_height_eighth = tile_height / 8;
|
|
|
|
gint curve_start_offset = 3 * tile_height_eighth;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_height_eighth;
|
|
|
|
gint px[4], py[4];
|
|
|
|
gint y_offset = 0;
|
|
|
|
gdouble delta;
|
|
|
|
gdouble sigma = blend_amount / blend_lines;
|
|
|
|
gint right;
|
|
|
|
gint *cachex, *cachey;
|
|
|
|
|
2000-05-24 02:52:14 +08:00
|
|
|
cachex = g_new (gint, steps);
|
|
|
|
cachey = g_new (gint, steps);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
for (i = 0; i < ytiles; i++)
|
|
|
|
{
|
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
|
|
|
right = g_random_int_range (0, 2);
|
2011-10-04 16:48:43 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
px[0] = px[3] = x_offset;
|
|
|
|
px[1] = x_offset + WALL_XFACTOR2 * tile_width * FUDGE;
|
|
|
|
px[2] = x_offset + WALL_XFACTOR3 * tile_width * FUDGE;
|
|
|
|
py[0] = y_offset;
|
|
|
|
py[1] = y_offset + WALL_YCONS2 * tile_height;
|
|
|
|
py[2] = y_offset + WALL_YCONS3 * tile_height;
|
|
|
|
py[3] = y_offset + curve_start_offset;
|
|
|
|
|
|
|
|
if (right)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
px[1] = x_offset - WALL_XFACTOR2 * tile_width;
|
|
|
|
px[2] = x_offset - WALL_XFACTOR3 * tile_width;
|
|
|
|
}
|
2000-05-24 02:52:14 +08:00
|
|
|
generate_bezier (px, py, steps, cachex, cachey);
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_bezier_line (buffer, bufsize, width, bytes, steps, cachex, cachey);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
px[0] = -j - 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_bezier_line (buffer, bufsize, width, bytes, px[0], 0,
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
px[0] = j + 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_bezier_line (buffer, bufsize, width, bytes, px[0], 0,
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
if (right)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_right_bump (buffer, bufsize, width, bytes, x_offset,
|
|
|
|
y_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[RIGHT]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_right_bump (buffer, bufsize, width, bytes, x_offset,
|
|
|
|
y_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[RIGHT], delta, j);
|
|
|
|
/* use to be +j + 1 */
|
|
|
|
lighten_right_bump (buffer, bufsize, width, bytes, x_offset,
|
2003-05-10 03:24:39 +08:00
|
|
|
y_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[RIGHT], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
else
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_left_bump (buffer, bufsize, width, bytes, x_offset,
|
|
|
|
y_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[LEFT]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_left_bump (buffer, bufsize, width, bytes, x_offset,
|
|
|
|
y_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[LEFT], delta, j);
|
|
|
|
/* use to be -j - 1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_left_bump (buffer, bufsize, width, bytes, x_offset,
|
|
|
|
y_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[LEFT], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
px[0] = px[3] = x_offset;
|
|
|
|
px[1] = x_offset + WALL_XFACTOR2 * tile_width * FUDGE;
|
|
|
|
px[2] = x_offset + WALL_XFACTOR3 * tile_width * FUDGE;
|
|
|
|
py[0] = y_offset + curve_end_offset;
|
|
|
|
py[1] = y_offset + curve_end_offset + WALL_YCONS2 * tile_height;
|
|
|
|
py[2] = y_offset + curve_end_offset + WALL_YCONS3 * tile_height;
|
|
|
|
py[3] = globals.gridy[i];
|
|
|
|
if (right)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
px[1] = x_offset - WALL_XFACTOR2 * tile_width;
|
|
|
|
px[2] = x_offset - WALL_XFACTOR3 * tile_width;
|
|
|
|
}
|
2003-05-10 03:24:39 +08:00
|
|
|
generate_bezier (px, py, steps, cachex, cachey);
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_bezier_line (buffer, bufsize, width, bytes, steps, cachex, cachey);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
px[0] = -j - 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_bezier_line (buffer, bufsize, width, bytes, px[0], 0,
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
px[0] = j + 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_bezier_line (buffer, bufsize, width, bytes, px[0], 0,
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
y_offset = globals.gridy[i];
|
|
|
|
} /* for */
|
|
|
|
g_free(cachex);
|
|
|
|
g_free(cachey);
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-05-24 02:52:14 +08:00
|
|
|
draw_bezier_horizontal_border (guchar *buffer,
|
2003-05-10 03:24:39 +08:00
|
|
|
gint bufsize,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint bytes,
|
|
|
|
gint y_offset,
|
|
|
|
gint xtiles,
|
|
|
|
gint ytiles,
|
|
|
|
gint blend_lines,
|
|
|
|
gdouble blend_amount,
|
|
|
|
gint steps)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
gint tile_width = width / xtiles;
|
|
|
|
gint tile_height = height / ytiles;
|
|
|
|
gint tile_width_eighth = tile_width / 8;
|
|
|
|
gint curve_start_offset = 3 * tile_width_eighth;
|
|
|
|
gint curve_end_offset = curve_start_offset + 2 * tile_width_eighth;
|
|
|
|
gint px[4], py[4];
|
|
|
|
gint x_offset = 0;
|
|
|
|
gdouble delta;
|
|
|
|
gdouble sigma = blend_amount / blend_lines;
|
|
|
|
gint up;
|
|
|
|
gint *cachex, *cachey;
|
|
|
|
|
2001-12-06 10:28:58 +08:00
|
|
|
cachex = g_new (gint, steps);
|
|
|
|
cachey = g_new (gint, steps);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
for (i = 0; i < xtiles; i++)
|
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
up = g_random_int_range (0, 2);
|
2011-10-04 16:48:43 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
px[0] = x_offset;
|
|
|
|
px[1] = x_offset + WALL_XCONS2 * tile_width;
|
|
|
|
px[2] = x_offset + WALL_XCONS3 * tile_width;
|
|
|
|
px[3] = x_offset + curve_start_offset;
|
|
|
|
py[0] = py[3] = y_offset;
|
|
|
|
py[1] = y_offset + WALL_YFACTOR2 * tile_height * FUDGE;
|
|
|
|
py[2] = y_offset + WALL_YFACTOR3 * tile_height * FUDGE;
|
|
|
|
if (!up)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
py[1] = y_offset - WALL_YFACTOR2 * tile_height;
|
|
|
|
py[2] = y_offset - WALL_YFACTOR3 * tile_height;
|
|
|
|
}
|
2003-05-10 03:24:39 +08:00
|
|
|
generate_bezier (px, py, steps, cachex, cachey);
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_bezier_line (buffer, bufsize, width, bytes, steps, cachex, cachey);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
py[0] = -j - 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_bezier_line (buffer, bufsize, width, bytes, 0, py[0],
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
py[0] = j + 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_bezier_line (buffer, bufsize, width, bytes, 0, py[0],
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
/* bumps */
|
|
|
|
if (up)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_up_bump (buffer, bufsize, width, bytes, y_offset,
|
|
|
|
x_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[UP]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_up_bump (buffer, bufsize, width, bytes, y_offset,
|
|
|
|
x_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[UP], delta, j);
|
|
|
|
/* use to be +j + 1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_up_bump (buffer, bufsize, width, bytes, y_offset,
|
|
|
|
x_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[UP], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
else
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
2003-05-10 03:24:39 +08:00
|
|
|
draw_down_bump (buffer, bufsize, width, bytes, y_offset,
|
|
|
|
x_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[DOWN]);
|
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
|
|
|
{
|
|
|
|
/* use to be +j + 1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_down_bump (buffer, bufsize, width, bytes, y_offset,
|
|
|
|
x_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[DOWN], delta, j);
|
|
|
|
/* use to be -j -1 */
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_down_bump (buffer, bufsize, width, bytes, y_offset,
|
|
|
|
x_offset + curve_start_offset,
|
2004-08-07 21:29:02 +08:00
|
|
|
globals.steps[DOWN], delta, j);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
/* ending side wall line */
|
|
|
|
px[0] = x_offset + curve_end_offset;
|
|
|
|
px[1] = x_offset + curve_end_offset + WALL_XCONS2 * tile_width;
|
|
|
|
px[2] = x_offset + curve_end_offset + WALL_XCONS3 * tile_width;
|
|
|
|
px[3] = globals.gridx[i];
|
|
|
|
py[0] = py[3] = y_offset;
|
|
|
|
py[1] = y_offset + WALL_YFACTOR2 * tile_height * FUDGE;
|
|
|
|
py[2] = y_offset + WALL_YFACTOR3 * tile_height * FUDGE;
|
|
|
|
if (!up)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
py[1] = y_offset - WALL_YFACTOR2 * tile_height;
|
|
|
|
py[2] = y_offset - WALL_YFACTOR3 * tile_height;
|
|
|
|
}
|
2003-05-10 03:24:39 +08:00
|
|
|
generate_bezier (px, py, steps, cachex, cachey);
|
2004-08-07 21:29:02 +08:00
|
|
|
draw_bezier_line (buffer, bufsize, width, bytes, steps, cachex, cachey);
|
1998-10-22 19:39:32 +08:00
|
|
|
delta = blend_amount;
|
|
|
|
for (j = 0; j < blend_lines; j++)
|
2004-08-07 21:29:02 +08:00
|
|
|
{
|
|
|
|
py[0] = -j - 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
darken_bezier_line (buffer, bufsize, width, bytes, 0, py[0],
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
py[0] = j + 1;
|
2003-05-10 03:24:39 +08:00
|
|
|
lighten_bezier_line (buffer, bufsize, width, bytes, 0, py[0],
|
2004-08-07 21:29:02 +08:00
|
|
|
steps, cachex, cachey, delta);
|
|
|
|
delta -= sigma;
|
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
x_offset = globals.gridx[i];
|
|
|
|
} /* for */
|
|
|
|
g_free(cachex);
|
|
|
|
g_free(cachey);
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
static void
|
2000-01-16 23:38:38 +08:00
|
|
|
check_config (gint width,
|
2004-08-07 21:29:02 +08:00
|
|
|
gint height)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
|
|
|
gint tile_width, tile_height;
|
|
|
|
gint tile_width_limit, tile_height_limit;
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
if (config.x < 1)
|
|
|
|
{
|
|
|
|
config.x = 1;
|
|
|
|
}
|
|
|
|
if (config.y < 1)
|
|
|
|
{
|
|
|
|
config.y = 1;
|
|
|
|
}
|
|
|
|
if (config.blend_amount < 0)
|
|
|
|
{
|
|
|
|
config.blend_amount = 0;
|
|
|
|
}
|
|
|
|
if (config.blend_amount > 5)
|
|
|
|
{
|
|
|
|
config.blend_amount = 5;
|
|
|
|
}
|
|
|
|
tile_width = width / config.x;
|
|
|
|
tile_height = height / config.y;
|
|
|
|
tile_width_limit = 0.4 * tile_width;
|
|
|
|
tile_height_limit = 0.4 * tile_height;
|
|
|
|
if ((config.blend_lines > tile_width_limit)
|
|
|
|
|| (config.blend_lines > tile_height_limit))
|
|
|
|
{
|
|
|
|
config.blend_lines = MIN(tile_width_limit, tile_height_limit);
|
|
|
|
}
|
2000-01-16 23:38:38 +08:00
|
|
|
}
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
/********************************************************
|
|
|
|
GUI
|
|
|
|
********************************************************/
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
static gboolean
|
2019-08-13 23:31:13 +08:00
|
|
|
jigsaw_dialog (GimpDrawable *drawable)
|
1998-10-22 19:39:32 +08:00
|
|
|
{
|
2010-10-25 07:26:00 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *main_vbox;
|
|
|
|
GtkWidget *preview;
|
|
|
|
GtkSizeGroup *group;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *rbutton1;
|
|
|
|
GtkWidget *rbutton2;
|
2018-05-11 18:41:48 +08:00
|
|
|
GtkWidget *grid;
|
2010-10-25 07:26:00 +08:00
|
|
|
GtkAdjustment *adj;
|
|
|
|
gboolean run;
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2019-09-21 01:39:00 +08:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2011-04-09 02:31:34 +08:00
|
|
|
dialog = gimp_dialog_new (_("Jigsaw"), PLUG_IN_ROLE,
|
2004-10-12 04:39:20 +08:00
|
|
|
NULL, 0,
|
2005-08-14 08:41:26 +08:00
|
|
|
gimp_standard_help_func, PLUG_IN_PROC,
|
2004-10-12 04:39:20 +08:00
|
|
|
|
2017-02-12 23:18:24 +08:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
2004-10-12 04:39:20 +08:00
|
|
|
|
|
|
|
NULL);
|
2004-05-19 01:06:06 +08:00
|
|
|
|
2018-05-10 23:04:37 +08:00
|
|
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
2005-08-14 08:41:26 +08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
2005-02-09 04:40:33 +08:00
|
|
|
|
2005-09-10 02:07:31 +08:00
|
|
|
gimp_window_set_transient (GTK_WINDOW (dialog));
|
2005-09-06 05:40:29 +08:00
|
|
|
|
2011-09-30 18:17:53 +08:00
|
|
|
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2004-10-12 04:39:20 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
2011-03-04 17:44:58 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
|
|
|
main_vbox, TRUE, TRUE, 0);
|
2004-10-12 04:39:20 +08:00
|
|
|
gtk_widget_show (main_vbox);
|
|
|
|
|
2019-08-13 23:31:13 +08:00
|
|
|
preview = gimp_aspect_preview_new_from_drawable (drawable);
|
2008-07-21 21:41:00 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), preview, TRUE, TRUE, 0);
|
2004-10-12 04:39:20 +08:00
|
|
|
gtk_widget_show (preview);
|
2008-07-21 21:41:00 +08:00
|
|
|
|
2004-10-12 04:39:20 +08:00
|
|
|
g_signal_connect_swapped (preview, "invalidated",
|
2019-06-26 23:26:53 +08:00
|
|
|
G_CALLBACK (jigsaw_preview),
|
2019-08-13 23:31:13 +08:00
|
|
|
drawable);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2004-05-19 01:06:06 +08:00
|
|
|
frame = gimp_frame_new (_("Number of Tiles"));
|
2004-10-12 04:39:20 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2018-05-11 18:41:48 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2004-05-19 01:06:06 +08:00
|
|
|
group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
/* xtiles */
|
2018-05-11 19:52:33 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
|
|
|
|
_("_Horizontal:"), SCALE_WIDTH, 0,
|
|
|
|
config.x, MIN_XTILES, MAX_XTILES, 1.0, 4.0, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Number of pieces going across"), NULL);
|
2004-05-19 01:06:06 +08:00
|
|
|
|
|
|
|
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
|
|
|
|
g_object_unref (group);
|
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&config.x);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect_swapped (adj, "value-changed",
|
2004-10-12 04:39:20 +08:00
|
|
|
G_CALLBACK (gimp_preview_invalidate),
|
|
|
|
preview);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* ytiles */
|
2018-05-11 19:52:33 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
|
|
|
|
_("_Vertical:"), SCALE_WIDTH, 0,
|
|
|
|
config.y, MIN_YTILES, MAX_YTILES, 1.0, 4.0, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Number of pieces going down"), NULL);
|
2004-05-19 01:06:06 +08:00
|
|
|
|
|
|
|
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
|
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&config.y);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect_swapped (adj, "value-changed",
|
2004-10-12 04:39:20 +08:00
|
|
|
G_CALLBACK (gimp_preview_invalidate),
|
|
|
|
preview);
|
2000-01-07 18:39:33 +08:00
|
|
|
|
2018-05-11 18:41:48 +08:00
|
|
|
gtk_widget_show (grid);
|
2000-01-07 18:39:33 +08:00
|
|
|
gtk_widget_show (frame);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2004-05-19 01:06:06 +08:00
|
|
|
frame = gimp_frame_new (_("Bevel Edges"));
|
2004-10-12 04:39:20 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
2018-05-11 18:41:48 +08:00
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* number of blending lines */
|
2018-05-11 19:52:33 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 0,
|
|
|
|
_("_Bevel width:"), SCALE_WIDTH, 4,
|
|
|
|
config.blend_lines,
|
|
|
|
MIN_BLEND_LINES, MAX_BLEND_LINES, 1.0, 2.0, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("Degree of slope of each piece's edge"), NULL);
|
2004-05-19 01:06:06 +08:00
|
|
|
|
|
|
|
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
|
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&config.blend_lines);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect_swapped (adj, "value-changed",
|
2004-10-12 04:39:20 +08:00
|
|
|
G_CALLBACK (gimp_preview_invalidate),
|
|
|
|
preview);
|
1998-10-22 19:39:32 +08:00
|
|
|
|
|
|
|
/* blending amount */
|
2018-05-11 19:52:33 +08:00
|
|
|
adj = gimp_scale_entry_new (GTK_GRID (grid), 0, 1,
|
|
|
|
_("H_ighlight:"), SCALE_WIDTH, 4,
|
|
|
|
config.blend_amount,
|
|
|
|
MIN_BLEND_AMOUNT, MAX_BLEND_AMOUNT, 0.05, 0.1, 2,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("The amount of highlighting on the edges "
|
|
|
|
"of each piece"), NULL);
|
2004-05-19 01:06:06 +08:00
|
|
|
|
|
|
|
gtk_size_group_add_widget (group, GIMP_SCALE_ENTRY_LABEL (adj));
|
|
|
|
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect (adj, "value-changed",
|
2001-12-29 21:26:29 +08:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
|
|
|
&config.blend_amount);
|
2005-07-01 00:03:24 +08:00
|
|
|
g_signal_connect_swapped (adj, "value-changed",
|
2004-10-12 04:39:20 +08:00
|
|
|
G_CALLBACK (gimp_preview_invalidate),
|
|
|
|
preview);
|
2000-01-07 18:39:33 +08:00
|
|
|
|
2018-05-11 18:41:48 +08:00
|
|
|
gtk_widget_show (grid);
|
2000-01-07 18:39:33 +08:00
|
|
|
gtk_widget_show (frame);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
1998-10-22 19:39:32 +08:00
|
|
|
/* frame for primitive radio buttons */
|
|
|
|
|
2003-11-15 02:05:39 +08:00
|
|
|
frame = gimp_int_radio_group_new (TRUE, _("Jigsaw Style"),
|
2004-10-12 04:39:20 +08:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
2020-01-15 20:51:55 +08:00
|
|
|
&config.style, NULL, config.style,
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
_("_Square"), BEZIER_1, &rbutton1,
|
|
|
|
_("C_urved"), BEZIER_2, &rbutton2,
|
2000-01-07 18:39:33 +08:00
|
|
|
|
2004-08-07 21:29:02 +08:00
|
|
|
NULL);
|
2000-01-07 18:39:33 +08:00
|
|
|
|
2000-01-16 23:38:38 +08:00
|
|
|
gimp_help_set_help_data (rbutton1, _("Each piece has straight sides"), NULL);
|
2004-03-20 19:54:03 +08:00
|
|
|
gimp_help_set_help_data (rbutton2, _("Each piece has curved sides"), NULL);
|
2004-10-12 04:39:20 +08:00
|
|
|
g_signal_connect_swapped (rbutton1, "toggled",
|
|
|
|
G_CALLBACK (gimp_preview_invalidate),
|
|
|
|
preview);
|
|
|
|
g_signal_connect_swapped (rbutton2, "toggled",
|
|
|
|
G_CALLBACK (gimp_preview_invalidate),
|
|
|
|
preview);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
2004-03-20 19:54:03 +08:00
|
|
|
gtk_widget_show (frame);
|
2000-01-16 23:38:38 +08:00
|
|
|
|
2004-10-12 04:39:20 +08:00
|
|
|
gtk_widget_show (dialog);
|
2004-08-07 21:29:02 +08:00
|
|
|
|
2004-10-12 04:39:20 +08:00
|
|
|
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
2004-10-12 04:39:20 +08:00
|
|
|
gtk_widget_destroy (dialog);
|
2003-11-06 23:27:05 +08:00
|
|
|
|
|
|
|
return run;
|
1998-10-22 19:39:32 +08:00
|
|
|
}
|