mirror of https://github.com/GNOME/gimp.git
plug-ins: port fractal-explorer to gimp_image_procedure_new2()
...and to GimpProcedureDialog. Note that there are still some unnecessary global variables that could be refactored out.
This commit is contained in:
parent
9a2d9991e5
commit
5765240f6b
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,13 @@
|
||||||
#ifndef __FRACTALEXPLORER_DIALOGS_H__
|
#ifndef __FRACTALEXPLORER_DIALOGS_H__
|
||||||
#define __FRACTALEXPLORER_DIALOGS_H__
|
#define __FRACTALEXPLORER_DIALOGS_H__
|
||||||
|
|
||||||
gint explorer_dialog (void);
|
gint explorer_dialog (GimpProcedure *procedure,
|
||||||
void dialog_update_preview (void);
|
GimpProcedureConfig *config);
|
||||||
|
void dialog_update_preview (GimpProcedureConfig *config);
|
||||||
|
|
||||||
void set_cmap_preview (void);
|
void set_cmap_preview (GimpProcedureConfig *config);
|
||||||
void make_color_map (void);
|
void make_color_map (GimpProcedureConfig *config);
|
||||||
|
|
||||||
void dialog_change_scale (void);
|
|
||||||
gchar * get_line (gchar *buf,
|
gchar * get_line (gchar *buf,
|
||||||
gint s,
|
gint s,
|
||||||
FILE *from,
|
FILE *from,
|
||||||
|
|
|
@ -98,10 +98,11 @@ static GimpValueArray * explorer_run (GimpProcedure *procedu
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
gint n_drawables,
|
gint n_drawables,
|
||||||
GimpDrawable **drawables,
|
GimpDrawable **drawables,
|
||||||
const GimpValueArray *args,
|
GimpProcedureConfig *config,
|
||||||
gpointer run_data);
|
gpointer run_data);
|
||||||
|
|
||||||
static void explorer (GimpDrawable *drawable);
|
static void explorer (GimpDrawable *drawable,
|
||||||
|
GimpProcedureConfig *config);
|
||||||
|
|
||||||
static void delete_dialog_callback (GtkWidget *widget,
|
static void delete_dialog_callback (GtkWidget *widget,
|
||||||
gboolean value,
|
gboolean value,
|
||||||
|
@ -230,7 +231,7 @@ explorer_create_procedure (GimpPlugIn *plug_in,
|
||||||
|
|
||||||
if (! strcmp (name, PLUG_IN_PROC))
|
if (! strcmp (name, PLUG_IN_PROC))
|
||||||
{
|
{
|
||||||
procedure = gimp_image_procedure_new (plug_in, name,
|
procedure = gimp_image_procedure_new2 (plug_in, name,
|
||||||
GIMP_PDB_PROC_TYPE_PLUGIN,
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
||||||
explorer_run, NULL, NULL);
|
explorer_run, NULL, NULL);
|
||||||
|
|
||||||
|
@ -252,122 +253,149 @@ explorer_create_procedure (GimpPlugIn *plug_in,
|
||||||
"www.multimania.com/cotting)",
|
"www.multimania.com/cotting)",
|
||||||
"December, 1998");
|
"December, 1998");
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "fractal-type",
|
GIMP_PROC_ARG_CHOICE (procedure, "fractal-type",
|
||||||
"Fractal type",
|
_("Fr_actal Type"),
|
||||||
"0: Mandelbrot; 1: Julia; 2: Barnsley 1; "
|
_("Type of Fractal Pattern"),
|
||||||
"3: Barnsley 2; 4: Barnsley 3; 5: Spider; "
|
gimp_choice_new_with_values ("mandelbrot", 0, _("Mandelbrot"), NULL,
|
||||||
"6: ManOWar; 7: Lambda; 8: Sierpinski",
|
"julia", 1, _("Julia"), NULL,
|
||||||
0, 8, 0,
|
"barnsley-1", 2, _("Barnsley 1"), NULL,
|
||||||
|
"barnsley-2", 3, _("Barnsley 2"), NULL,
|
||||||
|
"barnsley-3", 4, _("Barnsley 3"), NULL,
|
||||||
|
"spider", 5, _("Spider"), NULL,
|
||||||
|
"man-o-war", 6, _("Man-o-War"), NULL,
|
||||||
|
"lambda", 7, _("Lambda"), NULL,
|
||||||
|
"sierpinski", 8, _("Sierpinski"), NULL,
|
||||||
|
NULL),
|
||||||
|
"mandelbrot",
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "xmin",
|
GIMP_PROC_ARG_DOUBLE (procedure, "xmin",
|
||||||
"X min",
|
_("Lef_t"),
|
||||||
"xmin fractal image delimiter",
|
_("X min fractal image delimiter"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
-3.000, 3.000, -2.000,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "xmax",
|
GIMP_PROC_ARG_DOUBLE (procedure, "xmax",
|
||||||
"X max",
|
_("Ri_ght"),
|
||||||
"xmax fractal image delimiter",
|
_("X max fractal image delimiter"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
-3.000, 3.000, 2.000,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "ymin",
|
GIMP_PROC_ARG_DOUBLE (procedure, "ymin",
|
||||||
"Y min",
|
_("To_p"),
|
||||||
"ymin fractal image delimiter",
|
_("y min fractal image delimiter"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
-3.000, 3.000, -1.500,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "ymax",
|
GIMP_PROC_ARG_DOUBLE (procedure, "ymax",
|
||||||
"Y max",
|
_("_Bottom"),
|
||||||
"ymax fractal image delimiter",
|
_("ymax fractal image delimiter"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
-3.000, 3.000, 1.500,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "iter",
|
GIMP_PROC_ARG_DOUBLE (procedure, "iter",
|
||||||
"Iter",
|
_("Iteratio_ns"),
|
||||||
"Iteration value",
|
_("Iteration value"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
1, 1000, 50,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "cx",
|
GIMP_PROC_ARG_DOUBLE (procedure, "cx",
|
||||||
"CX",
|
_("C_X"),
|
||||||
"cx value (only Julia)",
|
_("cx value"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
-2.5000, 2.5000, -0.75,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "cy",
|
GIMP_PROC_ARG_DOUBLE (procedure, "cy",
|
||||||
"CY",
|
_("C_Y"),
|
||||||
"cy value (only Julia)",
|
_("cy value"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
-2.5000, 2.5000, -0.2,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "color-mode",
|
GIMP_PROC_ARG_INT (procedure, "color-mode",
|
||||||
"Color mode",
|
_("Color mode"),
|
||||||
"0: Apply colormap as specified by the parameters "
|
_("0: Apply colormap as specified by the parameters "
|
||||||
"below; 1: Apply active gradient to final image",
|
"below; 1: Apply active gradient to final image"),
|
||||||
0, 1, 0,
|
0, 1, 0,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "red-stretch",
|
GIMP_PROC_ARG_DOUBLE (procedure, "red-stretch",
|
||||||
"Red stretch",
|
_("Red stretch"),
|
||||||
"Red stretching factor",
|
_("Red stretching factor"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
0, 1, 1,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "green-stretch",
|
GIMP_PROC_ARG_DOUBLE (procedure, "green-stretch",
|
||||||
"Green stretch",
|
_("Green stretch"),
|
||||||
"Green stretching factor",
|
_("Green stretching factor"),
|
||||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
|
0, 1, 1,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_DOUBLE (procedure, "blues-tretch",
|
GIMP_PROC_ARG_DOUBLE (procedure, "blue-stretch",
|
||||||
"Blue stretch",
|
_("Blue stretch"),
|
||||||
"Blue stretching factor",
|
_("Blue stretching factor"),
|
||||||
-G_MAXDOUBLE,G_MAXDOUBLE, 0,
|
0, 1, 1,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "red-mode",
|
GIMP_PROC_ARG_CHOICE (procedure, "red-mode",
|
||||||
"Red mode",
|
_("_Red"),
|
||||||
"Red application mode (0:SIN; 1:COS; 2:NONE)",
|
_("Red application mode"),
|
||||||
0, 2, 0,
|
gimp_choice_new_with_values ("red-sin", 0, _("Sine"), NULL,
|
||||||
|
"red-cos", 1, _("Cosine"), NULL,
|
||||||
|
"red-none", 2, _("None"), NULL,
|
||||||
|
NULL),
|
||||||
|
"red-cos",
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "green-mode",
|
GIMP_PROC_ARG_CHOICE (procedure, "green-mode",
|
||||||
"Green mode",
|
_("_Green"),
|
||||||
"Green application mode (0:SIN; 1:COS; 2:NONE)",
|
_("Green application mode"),
|
||||||
0, 2, 0,
|
gimp_choice_new_with_values ("green-sin", 0, _("Sine"), NULL,
|
||||||
|
"green-cos", 1, _("Cosine"), NULL,
|
||||||
|
"green-none", 2, _("None"), NULL,
|
||||||
|
NULL),
|
||||||
|
"green-cos",
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "blue-mode",
|
GIMP_PROC_ARG_CHOICE (procedure, "blue-mode",
|
||||||
"Blue mode",
|
_("_Blue"),
|
||||||
"Blue application mode (0:SIN; 1:COS; 2:NONE)",
|
_("Blue application mode"),
|
||||||
0, 2, 0,
|
gimp_choice_new_with_values ("blue-sin", 0, _("Sine"), NULL,
|
||||||
|
"blue-cos", 1, _("Cosine"), NULL,
|
||||||
|
"blue-none", 2, _("None"), NULL,
|
||||||
|
NULL),
|
||||||
|
"blue-sin",
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_BOOLEAN (procedure, "red-invert",
|
GIMP_PROC_ARG_BOOLEAN (procedure, "red-invert",
|
||||||
"Red invert",
|
_("In_version"),
|
||||||
"Red inversion mode",
|
"Red inversion mode",
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_BOOLEAN (procedure, "green-invert",
|
GIMP_PROC_ARG_BOOLEAN (procedure, "green-invert",
|
||||||
"Green invert",
|
"I_nversion",
|
||||||
"Green inversion mode",
|
"Green inversion mode",
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_BOOLEAN (procedure, "blue-invert",
|
GIMP_PROC_ARG_BOOLEAN (procedure, "blue-invert",
|
||||||
"Blue invert",
|
"_Inversion",
|
||||||
"Blue inversion mode",
|
"Blue inversion mode",
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
GIMP_PROC_ARG_INT (procedure, "n-colors",
|
GIMP_PROC_ARG_INT (procedure, "n-colors",
|
||||||
"N volors",
|
_("_Number of colors"),
|
||||||
"Number of Colors for mapping",
|
_("Number of Colors for mapping"),
|
||||||
2, 8192, 512,
|
2, 8192, 512,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
|
GIMP_PROC_ARG_BOOLEAN (procedure, "use-loglog-smoothing",
|
||||||
|
"_Use log log smoothing",
|
||||||
|
"Use log log smoothing to eliminate "
|
||||||
|
"\"banding\" in the result",
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READWRITE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return procedure;
|
return procedure;
|
||||||
|
@ -379,7 +407,7 @@ explorer_run (GimpProcedure *procedure,
|
||||||
GimpImage *image,
|
GimpImage *image,
|
||||||
gint n_drawables,
|
gint n_drawables,
|
||||||
GimpDrawable **drawables,
|
GimpDrawable **drawables,
|
||||||
const GimpValueArray *args,
|
GimpProcedureConfig *config,
|
||||||
gpointer run_data)
|
gpointer run_data)
|
||||||
{
|
{
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
|
@ -430,73 +458,44 @@ explorer_run (GimpProcedure *procedure,
|
||||||
preview_width = MAX (pwidth, 2);
|
preview_width = MAX (pwidth, 2);
|
||||||
preview_height = MAX (pheight, 2);
|
preview_height = MAX (pheight, 2);
|
||||||
|
|
||||||
|
wvals.config = config;
|
||||||
|
|
||||||
/* See how we will run */
|
/* See how we will run */
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
/* Possibly retrieve data */
|
|
||||||
gimp_get_data ("plug-in-fractalexplorer", &wvals);
|
|
||||||
|
|
||||||
/* Get information from the dialog */
|
/* Get information from the dialog */
|
||||||
if (! explorer_dialog ())
|
if (! explorer_dialog (procedure, config))
|
||||||
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL,
|
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL,
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_RUN_NONINTERACTIVE:
|
case GIMP_RUN_NONINTERACTIVE:
|
||||||
wvals.fractaltype = GIMP_VALUES_GET_INT (args, 0);
|
|
||||||
wvals.xmin = GIMP_VALUES_GET_DOUBLE (args, 1);
|
|
||||||
wvals.xmax = GIMP_VALUES_GET_DOUBLE (args, 2);
|
|
||||||
wvals.ymin = GIMP_VALUES_GET_DOUBLE (args, 4);
|
|
||||||
wvals.ymax = GIMP_VALUES_GET_DOUBLE (args, 4);
|
|
||||||
wvals.iter = GIMP_VALUES_GET_DOUBLE (args, 5);
|
|
||||||
wvals.cx = GIMP_VALUES_GET_DOUBLE (args, 6);
|
|
||||||
wvals.cy = GIMP_VALUES_GET_DOUBLE (args, 7);
|
|
||||||
wvals.colormode = GIMP_VALUES_GET_INT (args, 8);
|
|
||||||
wvals.redstretch = GIMP_VALUES_GET_DOUBLE (args, 9);
|
|
||||||
wvals.greenstretch = GIMP_VALUES_GET_DOUBLE (args, 10);
|
|
||||||
wvals.bluestretch = GIMP_VALUES_GET_DOUBLE (args, 11);
|
|
||||||
wvals.redmode = GIMP_VALUES_GET_INT (args, 12);
|
|
||||||
wvals.greenmode = GIMP_VALUES_GET_INT (args, 13);
|
|
||||||
wvals.bluemode = GIMP_VALUES_GET_INT (args, 14);
|
|
||||||
wvals.redinvert = GIMP_VALUES_GET_INT (args, 15);
|
|
||||||
wvals.greeninvert = GIMP_VALUES_GET_INT (args, 16);
|
|
||||||
wvals.blueinvert = GIMP_VALUES_GET_INT (args, 17);
|
|
||||||
wvals.ncolors = GIMP_VALUES_GET_INT (args, 18);
|
|
||||||
|
|
||||||
make_color_map ();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
/* Possibly retrieve data */
|
make_color_map (config);
|
||||||
gimp_get_data ("plug-in-fractalexplorer", &wvals);
|
|
||||||
make_color_map ();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmin = wvals.xmin;
|
g_object_get (config,
|
||||||
xmax = wvals.xmax;
|
"xmin", &xmin,
|
||||||
ymin = wvals.ymin;
|
"xmax", &xmax,
|
||||||
ymax = wvals.ymax;
|
"ymin", &ymin,
|
||||||
cx = wvals.cx;
|
"ymax", &ymax,
|
||||||
cy = wvals.cy;
|
"cx", &cx,
|
||||||
|
"cy", &cy,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (status == GIMP_PDB_SUCCESS)
|
if (status == GIMP_PDB_SUCCESS)
|
||||||
{
|
{
|
||||||
gimp_progress_init (_("Rendering fractal"));
|
gimp_progress_init (_("Rendering fractal"));
|
||||||
|
|
||||||
explorer (drawable);
|
explorer (drawable, config);
|
||||||
|
|
||||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
|
|
||||||
/* Store data */
|
|
||||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
|
||||||
gimp_set_data ("plug-in-fractalexplorer",
|
|
||||||
&wvals, sizeof (explorer_vals_t));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gimp_procedure_new_return_values (procedure, status, NULL);
|
return gimp_procedure_new_return_values (procedure, status, NULL);
|
||||||
|
@ -507,7 +506,8 @@ explorer_run (GimpProcedure *procedure,
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
explorer (GimpDrawable *drawable)
|
explorer (GimpDrawable *drawable,
|
||||||
|
GimpProcedureConfig *config)
|
||||||
{
|
{
|
||||||
GeglBuffer *src_buffer;
|
GeglBuffer *src_buffer;
|
||||||
GeglBuffer *dest_buffer;
|
GeglBuffer *dest_buffer;
|
||||||
|
@ -567,7 +567,8 @@ explorer (GimpDrawable *drawable)
|
||||||
dest_row,
|
dest_row,
|
||||||
row,
|
row,
|
||||||
w,
|
w,
|
||||||
bpp);
|
bpp,
|
||||||
|
config);
|
||||||
|
|
||||||
gegl_buffer_set (dest_buffer, GEGL_RECTANGLE (x, row, w, 1), 0,
|
gegl_buffer_set (dest_buffer, GEGL_RECTANGLE (x, row, w, 1), 0,
|
||||||
format, dest_row,
|
format, dest_row,
|
||||||
|
@ -599,7 +600,8 @@ explorer_render_row (const guchar *src_row,
|
||||||
guchar *dest_row,
|
guchar *dest_row,
|
||||||
gint row,
|
gint row,
|
||||||
gint row_width,
|
gint row_width,
|
||||||
gint bpp)
|
gint bpp,
|
||||||
|
GimpProcedureConfig *config)
|
||||||
{
|
{
|
||||||
gint col;
|
gint col;
|
||||||
gdouble a;
|
gdouble a;
|
||||||
|
@ -622,21 +624,31 @@ explorer_render_row (const guchar *src_row,
|
||||||
gdouble cy;
|
gdouble cy;
|
||||||
gint counter;
|
gint counter;
|
||||||
gint color;
|
gint color;
|
||||||
|
gdouble iter;
|
||||||
gint iteration;
|
gint iteration;
|
||||||
gint useloglog;
|
gint useloglog;
|
||||||
|
gint n_colors;
|
||||||
|
gint fractal_type;
|
||||||
gdouble log2;
|
gdouble log2;
|
||||||
|
|
||||||
cx = wvals.cx;
|
g_object_get (config,
|
||||||
cy = wvals.cy;
|
"cx", &cx,
|
||||||
useloglog = wvals.useloglog;
|
"cy", &cy,
|
||||||
iteration = wvals.iter;
|
"iter", &iter,
|
||||||
|
"use-loglog-smoothing", &useloglog,
|
||||||
|
"n-colors", &n_colors,
|
||||||
|
NULL);
|
||||||
|
fractal_type =
|
||||||
|
gimp_procedure_config_get_choice_id (wvals.config, "fractal-type");
|
||||||
|
|
||||||
|
iteration = (gint) iter;
|
||||||
log2 = log (2.0);
|
log2 = log (2.0);
|
||||||
|
|
||||||
for (col = 0; col < row_width; col++)
|
for (col = 0; col < row_width; col++)
|
||||||
{
|
{
|
||||||
a = xmin + (double) col * xdiff;
|
a = xmin + (double) col * xdiff;
|
||||||
b = ymin + (double) row * ydiff;
|
b = ymin + (double) row * ydiff;
|
||||||
if (wvals.fractaltype != 0)
|
if (fractal_type != 0)
|
||||||
{
|
{
|
||||||
tmpx = x = a;
|
tmpx = x = a;
|
||||||
tmpy = y = b;
|
tmpy = y = b;
|
||||||
|
@ -652,7 +664,7 @@ explorer_render_row (const guchar *src_row,
|
||||||
oldx=x;
|
oldx=x;
|
||||||
oldy=y;
|
oldy=y;
|
||||||
|
|
||||||
switch (wvals.fractaltype)
|
switch (fractal_type)
|
||||||
{
|
{
|
||||||
case TYPE_MANDELBROT:
|
case TYPE_MANDELBROT:
|
||||||
xx = x * x - y * y + a;
|
xx = x * x - y * y + a;
|
||||||
|
@ -776,7 +788,7 @@ explorer_render_row (const guchar *src_row,
|
||||||
adjust = 0.0;
|
adjust = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = (int) (((counter - adjust) * (wvals.ncolors - 1)) / iteration);
|
color = (int) (((counter - adjust) * (n_colors - 1)) / iteration);
|
||||||
if (bpp >= 3)
|
if (bpp >= 3)
|
||||||
{
|
{
|
||||||
dest_row[col * bpp + 0] = colormap[color].r;
|
dest_row[col * bpp + 0] = colormap[color].r;
|
||||||
|
@ -947,10 +959,119 @@ static void
|
||||||
activate_fractal (fractalexplorerOBJ *sel_obj)
|
activate_fractal (fractalexplorerOBJ *sel_obj)
|
||||||
{
|
{
|
||||||
current_obj = sel_obj;
|
current_obj = sel_obj;
|
||||||
wvals = current_obj->opts;
|
|
||||||
dialog_change_scale ();
|
g_object_set (wvals.config,
|
||||||
set_cmap_preview ();
|
"xmin", current_obj->opts.xmin,
|
||||||
dialog_update_preview ();
|
"xmax", current_obj->opts.xmax,
|
||||||
|
"ymin", current_obj->opts.ymin,
|
||||||
|
"ymax", current_obj->opts.ymax,
|
||||||
|
"iter", current_obj->opts.iter,
|
||||||
|
"cx", current_obj->opts.cx,
|
||||||
|
"cy", current_obj->opts.cy,
|
||||||
|
"red-stretch", current_obj->opts.redstretch,
|
||||||
|
"green-stretch", current_obj->opts.greenstretch,
|
||||||
|
"blue-stretch", current_obj->opts.bluestretch,
|
||||||
|
"color-mode", current_obj->opts.colormode,
|
||||||
|
"red-invert", current_obj->opts.redinvert,
|
||||||
|
"green-invert", current_obj->opts.greeninvert,
|
||||||
|
"blue-invert", current_obj->opts.blueinvert,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
switch (current_obj->opts.fractaltype)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "mandelbrot", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "julia", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "barnsley-1", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "barnsley-2", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "barnsley-3", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "spider", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "man-o-war", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "lambda", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
g_object_set (wvals.config, "fractal-type", "sierpinski", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (current_obj->opts.redmode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
g_object_set (wvals.config, "red-mode", "red-sin", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
g_object_set (wvals.config, "red-mode", "red-cos", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
g_object_set (wvals.config, "red-mode", "red-none", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (current_obj->opts.greenmode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
g_object_set (wvals.config, "green-mode", "green-sin", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
g_object_set (wvals.config, "green-mode", "green-cos", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
g_object_set (wvals.config, "green-mode", "green-none", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (current_obj->opts.bluemode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
g_object_set (wvals.config, "blue-mode", "blue-sin", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
g_object_set (wvals.config, "blue-mode", "blue-cos", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
g_object_set (wvals.config, "blue-mode", "blue-none", NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_cmap_preview (wvals.config);
|
||||||
|
dialog_update_preview (wvals.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -70,6 +70,7 @@ typedef struct
|
||||||
gint ncolors;
|
gint ncolors;
|
||||||
gboolean gradinvert;
|
gboolean gradinvert;
|
||||||
gboolean useloglog;
|
gboolean useloglog;
|
||||||
|
GimpProcedureConfig *config;
|
||||||
} explorer_vals_t;
|
} explorer_vals_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -95,39 +96,6 @@ typedef struct
|
||||||
GtkAdjustment *data;
|
GtkAdjustment *data;
|
||||||
} scaledata;
|
} scaledata;
|
||||||
|
|
||||||
typedef struct _DialogElements DialogElements;
|
|
||||||
|
|
||||||
struct _DialogElements
|
|
||||||
{
|
|
||||||
GtkWidget *type[NUM_TYPES];
|
|
||||||
GtkWidget *xmin;
|
|
||||||
GtkWidget *xmax;
|
|
||||||
GtkWidget *ymin;
|
|
||||||
GtkWidget *ymax;
|
|
||||||
GtkWidget *iter;
|
|
||||||
GtkWidget *cx;
|
|
||||||
GtkWidget *cy;
|
|
||||||
|
|
||||||
GtkWidget *ncol;
|
|
||||||
GtkWidget *useloglog;
|
|
||||||
|
|
||||||
GtkWidget *red;
|
|
||||||
GtkWidget *green;
|
|
||||||
GtkWidget *blue;
|
|
||||||
|
|
||||||
GtkWidget *redmode[3];
|
|
||||||
GtkWidget *redinvert;
|
|
||||||
|
|
||||||
GtkWidget *greenmode[3];
|
|
||||||
GtkWidget *greeninvert;
|
|
||||||
|
|
||||||
GtkWidget *bluemode[3];
|
|
||||||
GtkWidget *blueinvert;
|
|
||||||
|
|
||||||
GtkWidget *colormode[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct DFigObj
|
typedef struct DFigObj
|
||||||
{
|
{
|
||||||
gchar *name; /* Trailing name of file */
|
gchar *name; /* Trailing name of file */
|
||||||
|
@ -210,5 +178,6 @@ void explorer_render_row (const guchar *src_row,
|
||||||
guchar *dest_row,
|
guchar *dest_row,
|
||||||
gint row,
|
gint row,
|
||||||
gint row_width,
|
gint row_width,
|
||||||
gint bpp);
|
gint bpp,
|
||||||
|
GimpProcedureConfig *config);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue