mirror of https://github.com/GNOME/gimp.git
Finished the addition of "gboolean reverse" to the gradient API:
2003-08-18 Michael Natterer <mitch@gimp.org> Finished the addition of "gboolean reverse" to the gradient API: * tools/pdbgen/pdb/gradients.pdb: added "reverse" params to gimp_gradients_sample_uniform(), sample_custom() and get_gradient_data(). * app/pdb/gradients_cmds.c * libgimp/gimpgradients_pdb.[ch]: regenerated. * libgimp/gimpgradientmenu.c: changed accordingly. Made everything compile with the new API: * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.[ch]: got lost in "reverse" adding, whitespace removal and general code cleanup. I better commit this now before continuing, even though "reverse" adding is not finished. * plug-ins/common/sample_colorize.c: removed own gradient reversing code, use "reverse" instead. * plug-ins/common/gradmap.c * plug-ins/flame/flame.c * plug-ins/gflare/gflare.c * plug-ins/pagecurl/pagecurl.c: simply pass reverse == FALSE and added #warnings that more work needs to be done. Some whitespace removal and minor cleanup.
This commit is contained in:
parent
e5be1ae62c
commit
cd9f65cb87
31
ChangeLog
31
ChangeLog
|
@ -1,3 +1,34 @@
|
||||||
|
2003-08-18 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
Finished the addition of "gboolean reverse" to the gradient API:
|
||||||
|
|
||||||
|
* tools/pdbgen/pdb/gradients.pdb: added "reverse" params to
|
||||||
|
gimp_gradients_sample_uniform(), sample_custom() and
|
||||||
|
get_gradient_data().
|
||||||
|
|
||||||
|
* app/pdb/gradients_cmds.c
|
||||||
|
* libgimp/gimpgradients_pdb.[ch]: regenerated.
|
||||||
|
|
||||||
|
* libgimp/gimpgradientmenu.c: changed accordingly.
|
||||||
|
|
||||||
|
Made everything compile with the new API:
|
||||||
|
|
||||||
|
* plug-ins/FractalExplorer/Dialogs.c
|
||||||
|
* plug-ins/FractalExplorer/FractalExplorer.[ch]: got lost in
|
||||||
|
"reverse" adding, whitespace removal and general code cleanup.
|
||||||
|
I better commit this now before continuing, even though "reverse"
|
||||||
|
adding is not finished.
|
||||||
|
|
||||||
|
* plug-ins/common/sample_colorize.c: removed own gradient
|
||||||
|
reversing code, use "reverse" instead.
|
||||||
|
|
||||||
|
* plug-ins/common/gradmap.c
|
||||||
|
* plug-ins/flame/flame.c
|
||||||
|
* plug-ins/gflare/gflare.c
|
||||||
|
* plug-ins/pagecurl/pagecurl.c: simply pass reverse == FALSE and
|
||||||
|
added #warnings that more work needs to be done. Some whitespace
|
||||||
|
removal and minor cleanup.
|
||||||
|
|
||||||
2003-08-18 Sven Neumann <sven@gimp.org>
|
2003-08-18 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/composite/Makefile.am: cleaned up whitespace.
|
* app/composite/Makefile.am: cleaned up whitespace.
|
||||||
|
|
|
@ -247,6 +247,7 @@ gradients_sample_uniform_invoker (Gimp *gimp,
|
||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
Argument *return_args;
|
Argument *return_args;
|
||||||
gint32 i;
|
gint32 i;
|
||||||
|
gboolean reverse;
|
||||||
gint32 array_length = 0;
|
gint32 array_length = 0;
|
||||||
gdouble *color_samples = NULL;
|
gdouble *color_samples = NULL;
|
||||||
GimpGradient *gradient;
|
GimpGradient *gradient;
|
||||||
|
@ -258,6 +259,8 @@ gradients_sample_uniform_invoker (Gimp *gimp,
|
||||||
if (i < 2)
|
if (i < 2)
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
|
||||||
|
reverse = args[1].value.pdb_int ? TRUE : FALSE;
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
pos = 0.0;
|
pos = 0.0;
|
||||||
|
@ -271,7 +274,7 @@ gradients_sample_uniform_invoker (Gimp *gimp,
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
{
|
{
|
||||||
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
|
gimp_gradient_get_color_at (gradient, pos, reverse, &color);
|
||||||
|
|
||||||
*pv++ = color.r;
|
*pv++ = color.r;
|
||||||
*pv++ = color.g;
|
*pv++ = color.g;
|
||||||
|
@ -299,6 +302,11 @@ static ProcArg gradients_sample_uniform_inargs[] =
|
||||||
GIMP_PDB_INT32,
|
GIMP_PDB_INT32,
|
||||||
"num_samples",
|
"num_samples",
|
||||||
"The number of samples to take"
|
"The number of samples to take"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"reverse",
|
||||||
|
"Use the reverse gradient (TRUE or FALSE)"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -325,7 +333,7 @@ static ProcRecord gradients_sample_uniform_proc =
|
||||||
"Federico Mena Quintero",
|
"Federico Mena Quintero",
|
||||||
"1997",
|
"1997",
|
||||||
GIMP_INTERNAL,
|
GIMP_INTERNAL,
|
||||||
1,
|
2,
|
||||||
gradients_sample_uniform_inargs,
|
gradients_sample_uniform_inargs,
|
||||||
2,
|
2,
|
||||||
gradients_sample_uniform_outargs,
|
gradients_sample_uniform_outargs,
|
||||||
|
@ -340,6 +348,7 @@ gradients_sample_custom_invoker (Gimp *gimp,
|
||||||
Argument *return_args;
|
Argument *return_args;
|
||||||
gint32 i;
|
gint32 i;
|
||||||
gdouble *pos;
|
gdouble *pos;
|
||||||
|
gboolean reverse;
|
||||||
gint32 array_length = 0;
|
gint32 array_length = 0;
|
||||||
gdouble *color_samples = NULL;
|
gdouble *color_samples = NULL;
|
||||||
GimpGradient *gradient;
|
GimpGradient *gradient;
|
||||||
|
@ -352,6 +361,8 @@ gradients_sample_custom_invoker (Gimp *gimp,
|
||||||
|
|
||||||
pos = (gdouble *) args[1].value.pdb_pointer;
|
pos = (gdouble *) args[1].value.pdb_pointer;
|
||||||
|
|
||||||
|
reverse = args[2].value.pdb_int ? TRUE : FALSE;
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
array_length = i * 4;
|
array_length = i * 4;
|
||||||
|
@ -362,7 +373,7 @@ gradients_sample_custom_invoker (Gimp *gimp,
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
{
|
{
|
||||||
gimp_gradient_get_color_at (gradient, *pos, FALSE, &color);
|
gimp_gradient_get_color_at (gradient, *pos, reverse, &color);
|
||||||
|
|
||||||
*pv++ = color.r;
|
*pv++ = color.r;
|
||||||
*pv++ = color.g;
|
*pv++ = color.g;
|
||||||
|
@ -395,6 +406,11 @@ static ProcArg gradients_sample_custom_inargs[] =
|
||||||
GIMP_PDB_FLOATARRAY,
|
GIMP_PDB_FLOATARRAY,
|
||||||
"positions",
|
"positions",
|
||||||
"The list of positions to sample along the gradient"
|
"The list of positions to sample along the gradient"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"reverse",
|
||||||
|
"Use the reverse gradient (TRUE or FALSE)"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -421,7 +437,7 @@ static ProcRecord gradients_sample_custom_proc =
|
||||||
"Federico Mena Quintero",
|
"Federico Mena Quintero",
|
||||||
"1997",
|
"1997",
|
||||||
GIMP_INTERNAL,
|
GIMP_INTERNAL,
|
||||||
2,
|
3,
|
||||||
gradients_sample_custom_inargs,
|
gradients_sample_custom_inargs,
|
||||||
2,
|
2,
|
||||||
gradients_sample_custom_outargs,
|
gradients_sample_custom_outargs,
|
||||||
|
@ -436,6 +452,7 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
|
||||||
Argument *return_args;
|
Argument *return_args;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gint32 sample_size;
|
gint32 sample_size;
|
||||||
|
gboolean reverse;
|
||||||
gdouble *values = NULL;
|
gdouble *values = NULL;
|
||||||
GimpGradient *gradient = NULL;
|
GimpGradient *gradient = NULL;
|
||||||
|
|
||||||
|
@ -447,6 +464,8 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
|
||||||
if (sample_size <= 0 || sample_size > 10000)
|
if (sample_size <= 0 || sample_size > 10000)
|
||||||
sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
|
sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
|
||||||
|
|
||||||
|
reverse = args[2].value.pdb_int ? TRUE : FALSE;
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (strlen (name))
|
if (strlen (name))
|
||||||
|
@ -480,7 +499,7 @@ gradients_get_gradient_data_invoker (Gimp *gimp,
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
{
|
{
|
||||||
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
|
gimp_gradient_get_color_at (gradient, pos, reverse, &color);
|
||||||
|
|
||||||
*pv++ = color.r;
|
*pv++ = color.r;
|
||||||
*pv++ = color.g;
|
*pv++ = color.g;
|
||||||
|
@ -515,6 +534,11 @@ static ProcArg gradients_get_gradient_data_inargs[] =
|
||||||
GIMP_PDB_INT32,
|
GIMP_PDB_INT32,
|
||||||
"sample_size",
|
"sample_size",
|
||||||
"Size of the sample to return when the gradient is changed (0 < sample_size <= 10000)"
|
"Size of the sample to return when the gradient is changed (0 < sample_size <= 10000)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
GIMP_PDB_INT32,
|
||||||
|
"reverse",
|
||||||
|
"Use the reverse gradient (TRUE or FALSE)"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -546,7 +570,7 @@ static ProcRecord gradients_get_gradient_data_proc =
|
||||||
"Federico Mena Quintero",
|
"Federico Mena Quintero",
|
||||||
"1997",
|
"1997",
|
||||||
GIMP_INTERNAL,
|
GIMP_INTERNAL,
|
||||||
2,
|
3,
|
||||||
gradients_get_gradient_data_inargs,
|
gradients_get_gradient_data_inargs,
|
||||||
3,
|
3,
|
||||||
gradients_get_gradient_data_outargs,
|
gradients_get_gradient_data_outargs,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||||
*
|
*
|
||||||
* gimpgradientmenu.c
|
* gimpgradientmenu.c
|
||||||
* Copyright (C) 1998 Andy Thomas
|
* Copyright (C) 1998 Andy Thomas
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -51,9 +51,10 @@ struct _GradientSelect
|
||||||
|
|
||||||
gchar *gradient_name; /* Local copy */
|
gchar *gradient_name; /* Local copy */
|
||||||
gint sample_size;
|
gint sample_size;
|
||||||
|
gboolean reverse;
|
||||||
|
|
||||||
const gchar *temp_gradient_callback;
|
const gchar *temp_gradient_callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
|
@ -75,7 +76,7 @@ static void gimp_gradient_select_preview_update (GtkWidget *preview,
|
||||||
/**
|
/**
|
||||||
* gimp_gradient_select_widget_new:
|
* gimp_gradient_select_widget_new:
|
||||||
* @title: Title of the dialog to use or %NULL to use the default title.
|
* @title: Title of the dialog to use or %NULL to use the default title.
|
||||||
* @gradient_name: Initial gradient name or %NULL to use current selection.
|
* @gradient_name: Initial gradient name or %NULL to use current selection.
|
||||||
* @callback: A function to call when the selected gradient changes.
|
* @callback: A function to call when the selected gradient changes.
|
||||||
* @data: A pointer to arbitary data to be used in the call to
|
* @data: A pointer to arbitary data to be used in the call to
|
||||||
* @callback.
|
* @callback.
|
||||||
|
@ -86,9 +87,9 @@ static void gimp_gradient_select_preview_update (GtkWidget *preview,
|
||||||
*
|
*
|
||||||
* Returns: A #GtkWidget that you can use in your UI.
|
* Returns: A #GtkWidget that you can use in your UI.
|
||||||
*/
|
*/
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_gradient_select_widget_new (const gchar *title,
|
gimp_gradient_select_widget_new (const gchar *title,
|
||||||
const gchar *gradient_name,
|
const gchar *gradient_name,
|
||||||
GimpRunGradientCallback callback,
|
GimpRunGradientCallback callback,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -108,6 +109,7 @@ gimp_gradient_select_widget_new (const gchar *title,
|
||||||
gradient_sel->data = data;
|
gradient_sel->data = data;
|
||||||
|
|
||||||
gradient_sel->sample_size = CELL_WIDTH;
|
gradient_sel->sample_size = CELL_WIDTH;
|
||||||
|
gradient_sel->reverse = FALSE;
|
||||||
|
|
||||||
gradient_sel->button = gtk_button_new ();
|
gradient_sel->button = gtk_button_new ();
|
||||||
|
|
||||||
|
@ -120,15 +122,16 @@ gimp_gradient_select_widget_new (const gchar *title,
|
||||||
|
|
||||||
gradient_sel->preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
gradient_sel->preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||||
gtk_preview_size (GTK_PREVIEW (gradient_sel->preview),
|
gtk_preview_size (GTK_PREVIEW (gradient_sel->preview),
|
||||||
CELL_WIDTH, CELL_HEIGHT);
|
CELL_WIDTH, CELL_HEIGHT);
|
||||||
gtk_container_add (GTK_CONTAINER (gradient_sel->button),
|
gtk_container_add (GTK_CONTAINER (gradient_sel->button),
|
||||||
gradient_sel->preview);
|
gradient_sel->preview);
|
||||||
gtk_widget_show (gradient_sel->preview);
|
gtk_widget_show (gradient_sel->preview);
|
||||||
|
|
||||||
/* Do initial gradient setup */
|
/* Do initial gradient setup */
|
||||||
gradient_sel->gradient_name =
|
gradient_sel->gradient_name =
|
||||||
gimp_gradients_get_gradient_data (gradient_name,
|
gimp_gradients_get_gradient_data (gradient_name,
|
||||||
gradient_sel->sample_size,
|
gradient_sel->sample_size,
|
||||||
|
gradient_sel->reverse,
|
||||||
&width,
|
&width,
|
||||||
&grad_data);
|
&grad_data);
|
||||||
|
|
||||||
|
@ -201,8 +204,9 @@ gimp_gradient_select_widget_set (GtkWidget *widget,
|
||||||
gint width;
|
gint width;
|
||||||
gdouble *grad_data;
|
gdouble *grad_data;
|
||||||
|
|
||||||
name = gimp_gradients_get_gradient_data (gradient_name,
|
name = gimp_gradients_get_gradient_data (gradient_name,
|
||||||
gradient_sel->sample_size,
|
gradient_sel->sample_size,
|
||||||
|
gradient_sel->reverse,
|
||||||
&width,
|
&width,
|
||||||
&grad_data);
|
&grad_data);
|
||||||
|
|
||||||
|
@ -301,19 +305,19 @@ gimp_gradient_select_preview_update (GtkWidget *preview,
|
||||||
p0 = even = g_malloc (width * 3);
|
p0 = even = g_malloc (width * 3);
|
||||||
p1 = odd = g_malloc (width * 3);
|
p1 = odd = g_malloc (width * 3);
|
||||||
|
|
||||||
for (x = 0; x < width; x++)
|
for (x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
r = src[x * 4 + 0];
|
r = src[x * 4 + 0];
|
||||||
g = src[x * 4 + 1];
|
g = src[x * 4 + 1];
|
||||||
b = src[x * 4 + 2];
|
b = src[x * 4 + 2];
|
||||||
a = src[x * 4 + 3];
|
a = src[x * 4 + 3];
|
||||||
|
|
||||||
if ((x / GIMP_CHECK_SIZE_SM) & 1)
|
if ((x / GIMP_CHECK_SIZE_SM) & 1)
|
||||||
{
|
{
|
||||||
c0 = GIMP_CHECK_LIGHT;
|
c0 = GIMP_CHECK_LIGHT;
|
||||||
c1 = GIMP_CHECK_DARK;
|
c1 = GIMP_CHECK_DARK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c0 = GIMP_CHECK_DARK;
|
c0 = GIMP_CHECK_DARK;
|
||||||
c1 = GIMP_CHECK_LIGHT;
|
c1 = GIMP_CHECK_LIGHT;
|
||||||
|
@ -327,14 +331,14 @@ gimp_gradient_select_preview_update (GtkWidget *preview,
|
||||||
*p1++ = (c1 + (g - c1) * a) * 255.0;
|
*p1++ = (c1 + (g - c1) * a) * 255.0;
|
||||||
*p1++ = (c1 + (b - c1) * a) * 255.0;
|
*p1++ = (c1 + (b - c1) * a) * 255.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y = 0; y < CELL_HEIGHT; y++)
|
for (y = 0; y < CELL_HEIGHT; y++)
|
||||||
{
|
{
|
||||||
if ((y / GIMP_CHECK_SIZE_SM) & 1)
|
if ((y / GIMP_CHECK_SIZE_SM) & 1)
|
||||||
gtk_preview_draw_row (GTK_PREVIEW (preview),
|
gtk_preview_draw_row (GTK_PREVIEW (preview),
|
||||||
odd, 0, y, width);
|
odd, 0, y, width);
|
||||||
else
|
else
|
||||||
gtk_preview_draw_row (GTK_PREVIEW (preview),
|
gtk_preview_draw_row (GTK_PREVIEW (preview),
|
||||||
even, 0, y, width);
|
even, 0, y, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ gimp_gradients_set_gradient (const gchar *name)
|
||||||
/**
|
/**
|
||||||
* gimp_gradients_sample_uniform:
|
* gimp_gradients_sample_uniform:
|
||||||
* @num_samples: The number of samples to take.
|
* @num_samples: The number of samples to take.
|
||||||
|
* @reverse: Use the reverse gradient.
|
||||||
*
|
*
|
||||||
* Sample the active gradient in uniform parts.
|
* Sample the active gradient in uniform parts.
|
||||||
*
|
*
|
||||||
|
@ -174,7 +175,8 @@ gimp_gradients_set_gradient (const gchar *name)
|
||||||
* Returns: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
|
* Returns: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
|
||||||
*/
|
*/
|
||||||
gdouble *
|
gdouble *
|
||||||
gimp_gradients_sample_uniform (gint num_samples)
|
gimp_gradients_sample_uniform (gint num_samples,
|
||||||
|
gboolean reverse)
|
||||||
{
|
{
|
||||||
GimpParam *return_vals;
|
GimpParam *return_vals;
|
||||||
gint nreturn_vals;
|
gint nreturn_vals;
|
||||||
|
@ -184,6 +186,7 @@ gimp_gradients_sample_uniform (gint num_samples)
|
||||||
return_vals = gimp_run_procedure ("gimp_gradients_sample_uniform",
|
return_vals = gimp_run_procedure ("gimp_gradients_sample_uniform",
|
||||||
&nreturn_vals,
|
&nreturn_vals,
|
||||||
GIMP_PDB_INT32, num_samples,
|
GIMP_PDB_INT32, num_samples,
|
||||||
|
GIMP_PDB_INT32, reverse,
|
||||||
GIMP_PDB_END);
|
GIMP_PDB_END);
|
||||||
|
|
||||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
@ -203,6 +206,7 @@ gimp_gradients_sample_uniform (gint num_samples)
|
||||||
* gimp_gradients_sample_custom:
|
* gimp_gradients_sample_custom:
|
||||||
* @num_samples: The number of samples to take.
|
* @num_samples: The number of samples to take.
|
||||||
* @positions: The list of positions to sample along the gradient.
|
* @positions: The list of positions to sample along the gradient.
|
||||||
|
* @reverse: Use the reverse gradient.
|
||||||
*
|
*
|
||||||
* Sample the active gradient in custom positions.
|
* Sample the active gradient in custom positions.
|
||||||
*
|
*
|
||||||
|
@ -217,7 +221,8 @@ gimp_gradients_sample_uniform (gint num_samples)
|
||||||
*/
|
*/
|
||||||
gdouble *
|
gdouble *
|
||||||
gimp_gradients_sample_custom (gint num_samples,
|
gimp_gradients_sample_custom (gint num_samples,
|
||||||
const gdouble *positions)
|
const gdouble *positions,
|
||||||
|
gboolean reverse)
|
||||||
{
|
{
|
||||||
GimpParam *return_vals;
|
GimpParam *return_vals;
|
||||||
gint nreturn_vals;
|
gint nreturn_vals;
|
||||||
|
@ -228,6 +233,7 @@ gimp_gradients_sample_custom (gint num_samples,
|
||||||
&nreturn_vals,
|
&nreturn_vals,
|
||||||
GIMP_PDB_INT32, num_samples,
|
GIMP_PDB_INT32, num_samples,
|
||||||
GIMP_PDB_FLOATARRAY, positions,
|
GIMP_PDB_FLOATARRAY, positions,
|
||||||
|
GIMP_PDB_INT32, reverse,
|
||||||
GIMP_PDB_END);
|
GIMP_PDB_END);
|
||||||
|
|
||||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
@ -247,6 +253,7 @@ gimp_gradients_sample_custom (gint num_samples,
|
||||||
* gimp_gradients_get_gradient_data:
|
* gimp_gradients_get_gradient_data:
|
||||||
* @name: The gradient name (\"\" means current active gradient).
|
* @name: The gradient name (\"\" means current active gradient).
|
||||||
* @sample_size: Size of the sample to return when the gradient is changed.
|
* @sample_size: Size of the sample to return when the gradient is changed.
|
||||||
|
* @reverse: Use the reverse gradient.
|
||||||
* @width: The gradient sample width (r,g,b,a).
|
* @width: The gradient sample width (r,g,b,a).
|
||||||
* @grad_data: The gradient sample data.
|
* @grad_data: The gradient sample data.
|
||||||
*
|
*
|
||||||
|
@ -260,6 +267,7 @@ gimp_gradients_sample_custom (gint num_samples,
|
||||||
gchar *
|
gchar *
|
||||||
gimp_gradients_get_gradient_data (const gchar *name,
|
gimp_gradients_get_gradient_data (const gchar *name,
|
||||||
gint sample_size,
|
gint sample_size,
|
||||||
|
gboolean reverse,
|
||||||
gint *width,
|
gint *width,
|
||||||
gdouble **grad_data)
|
gdouble **grad_data)
|
||||||
{
|
{
|
||||||
|
@ -271,6 +279,7 @@ gimp_gradients_get_gradient_data (const gchar *name,
|
||||||
&nreturn_vals,
|
&nreturn_vals,
|
||||||
GIMP_PDB_STRING, name,
|
GIMP_PDB_STRING, name,
|
||||||
GIMP_PDB_INT32, sample_size,
|
GIMP_PDB_INT32, sample_size,
|
||||||
|
GIMP_PDB_INT32, reverse,
|
||||||
GIMP_PDB_END);
|
GIMP_PDB_END);
|
||||||
|
|
||||||
*width = 0;
|
*width = 0;
|
||||||
|
|
|
@ -33,11 +33,14 @@ gboolean gimp_gradients_refresh (void);
|
||||||
gchar** gimp_gradients_get_list (gint *num_gradients);
|
gchar** gimp_gradients_get_list (gint *num_gradients);
|
||||||
gchar* gimp_gradients_get_gradient (void);
|
gchar* gimp_gradients_get_gradient (void);
|
||||||
gboolean gimp_gradients_set_gradient (const gchar *name);
|
gboolean gimp_gradients_set_gradient (const gchar *name);
|
||||||
gdouble* gimp_gradients_sample_uniform (gint num_samples);
|
gdouble* gimp_gradients_sample_uniform (gint num_samples,
|
||||||
|
gboolean reverse);
|
||||||
gdouble* gimp_gradients_sample_custom (gint num_samples,
|
gdouble* gimp_gradients_sample_custom (gint num_samples,
|
||||||
const gdouble *positions);
|
const gdouble *positions,
|
||||||
|
gboolean reverse);
|
||||||
gchar* gimp_gradients_get_gradient_data (const gchar *name,
|
gchar* gimp_gradients_get_gradient_data (const gchar *name,
|
||||||
gint sample_size,
|
gint sample_size,
|
||||||
|
gboolean reverse,
|
||||||
gint *width,
|
gint *width,
|
||||||
gdouble **grad_data);
|
gdouble **grad_data);
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,7 @@ explorer_number_of_colors_callback (GtkAdjustment *adjustment,
|
||||||
|
|
||||||
gimp_gradients_get_gradient_data (gradient_name,
|
gimp_gradients_get_gradient_data (gradient_name,
|
||||||
wvals.ncolors,
|
wvals.ncolors,
|
||||||
|
wvals.gradinvert,
|
||||||
&dummy,
|
&dummy,
|
||||||
&gradient_samples);
|
&gradient_samples);
|
||||||
|
|
||||||
|
@ -235,13 +236,14 @@ explorer_gradient_select_callback (const gchar *name,
|
||||||
|
|
||||||
gimp_gradients_get_gradient_data (gradient_name,
|
gimp_gradients_get_gradient_data (gradient_name,
|
||||||
wvals.ncolors,
|
wvals.ncolors,
|
||||||
|
wvals.gradinvert,
|
||||||
&dummy,
|
&dummy,
|
||||||
&gradient_samples);
|
&gradient_samples);
|
||||||
|
|
||||||
if (wvals.colormode == 1)
|
if (wvals.colormode == 1)
|
||||||
{
|
{
|
||||||
set_cmap_preview ();
|
set_cmap_preview ();
|
||||||
dialog_update_preview ();
|
dialog_update_preview ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +561,7 @@ explorer_dialog (void)
|
||||||
dialog);
|
dialog);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gimp_help_set_help_data (button, _("Save active fractal to file"), NULL);
|
gimp_help_set_help_data (button, _("Save active fractal to file"), NULL);
|
||||||
|
|
||||||
/* Fractal type toggle box */
|
/* Fractal type toggle box */
|
||||||
frame = gtk_frame_new (_("Fractal Type"));
|
frame = gtk_frame_new (_("Fractal Type"));
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||||
|
@ -904,7 +906,8 @@ explorer_dialog (void)
|
||||||
"the gradient editor"), NULL);
|
"the gradient editor"), NULL);
|
||||||
|
|
||||||
gradient_name = gimp_gradients_get_gradient ();
|
gradient_name = gimp_gradients_get_gradient ();
|
||||||
gradient_samples = gimp_gradients_sample_uniform (wvals.ncolors);
|
gradient_samples = gimp_gradients_sample_uniform (wvals.ncolors,
|
||||||
|
wvals.gradinvert);
|
||||||
gradient = gimp_gradient_select_widget_new (_("FractalExplorer Gradient"),
|
gradient = gimp_gradient_select_widget_new (_("FractalExplorer Gradient"),
|
||||||
gradient_name,
|
gradient_name,
|
||||||
explorer_gradient_select_callback,
|
explorer_gradient_select_callback,
|
||||||
|
@ -936,7 +939,7 @@ explorer_dialog (void)
|
||||||
gtk_widget_show (cmap_preview);
|
gtk_widget_show (cmap_preview);
|
||||||
|
|
||||||
frame = add_objects_list ();
|
frame = add_objects_list ();
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame,
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame,
|
||||||
gtk_label_new (_("Fractals")));
|
gtk_label_new (_("Fractals")));
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
|
@ -1009,7 +1012,7 @@ dialog_update_preview (void)
|
||||||
gint zaehler;
|
gint zaehler;
|
||||||
gint color;
|
gint color;
|
||||||
gint useloglog;
|
gint useloglog;
|
||||||
|
|
||||||
if (NULL == wint.preview)
|
if (NULL == wint.preview)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1073,7 +1076,7 @@ dialog_update_preview (void)
|
||||||
|
|
||||||
case TYPE_JULIA:
|
case TYPE_JULIA:
|
||||||
xx = x * x - y * y + cx;
|
xx = x * x - y * y + cx;
|
||||||
y = 2.0 * x * y + cy;
|
y = 2.0 * x * y + cy;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_BARNSLEY_1:
|
case TYPE_BARNSLEY_1:
|
||||||
|
@ -1231,7 +1234,7 @@ set_cmap_preview (void)
|
||||||
|
|
||||||
gtk_preview_size (GTK_PREVIEW (cmap_preview), xsize, ysize * 4);
|
gtk_preview_size (GTK_PREVIEW (cmap_preview), xsize, ysize * 4);
|
||||||
gtk_widget_set_size_request (GTK_WIDGET (cmap_preview), xsize, ysize * 4);
|
gtk_widget_set_size_request (GTK_WIDGET (cmap_preview), xsize, ysize * 4);
|
||||||
|
|
||||||
for (y = 0; y < ysize*4; y += 4)
|
for (y = 0; y < ysize*4; y += 4)
|
||||||
{
|
{
|
||||||
for (x = 0; x < xsize; x++)
|
for (x = 0; x < xsize; x++)
|
||||||
|
@ -1239,7 +1242,7 @@ set_cmap_preview (void)
|
||||||
i = x + (y / 4) * xsize;
|
i = x + (y / 4) * xsize;
|
||||||
if (i > wvals.ncolors)
|
if (i > wvals.ncolors)
|
||||||
{
|
{
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
b[x * 3 + j] = 0;
|
b[x * 3 + j] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1287,7 +1290,8 @@ make_color_map (void)
|
||||||
* mode for noninteractive use (bug #103470).
|
* mode for noninteractive use (bug #103470).
|
||||||
*/
|
*/
|
||||||
if (gradient_samples == NULL)
|
if (gradient_samples == NULL)
|
||||||
gradient_samples = gimp_gradients_sample_uniform (wvals.ncolors);
|
gradient_samples = gimp_gradients_sample_uniform (wvals.ncolors,
|
||||||
|
wvals.gradinvert);
|
||||||
|
|
||||||
redstretch = wvals.redstretch * 127.5;
|
redstretch = wvals.redstretch * 127.5;
|
||||||
greenstretch = wvals.greenstretch * 127.5;
|
greenstretch = wvals.greenstretch * 127.5;
|
||||||
|
@ -1552,7 +1556,7 @@ void
|
||||||
save_options (FILE * fp)
|
save_options (FILE * fp)
|
||||||
{
|
{
|
||||||
/* Save options */
|
/* Save options */
|
||||||
|
|
||||||
fprintf (fp, "fractaltype: %i\n", wvals.fractaltype);
|
fprintf (fp, "fractaltype: %i\n", wvals.fractaltype);
|
||||||
fprintf (fp, "xmin: %0.15f\n", wvals.xmin);
|
fprintf (fp, "xmin: %0.15f\n", wvals.xmin);
|
||||||
fprintf (fp, "xmax: %0.15f\n", wvals.xmax);
|
fprintf (fp, "xmax: %0.15f\n", wvals.xmax);
|
||||||
|
@ -1590,7 +1594,7 @@ save_callback (void)
|
||||||
|
|
||||||
fp = fopen (savename, "wt+");
|
fp = fopen (savename, "wt+");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||||
savename, g_strerror (errno));
|
savename, g_strerror (errno));
|
||||||
|
@ -1654,7 +1658,7 @@ load_file_selection_ok (GtkWidget *w,
|
||||||
GtkFileSelection *fs,
|
GtkFileSelection *fs,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
filename =
|
filename =
|
||||||
g_strdup (gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
g_strdup (gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||||
|
|
||||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||||
|
@ -1842,6 +1846,7 @@ load_options (fractalexplorerOBJ *xxx,
|
||||||
xxx->opts.blueinvert = 0;
|
xxx->opts.blueinvert = 0;
|
||||||
xxx->opts.alwayspreview = 1;
|
xxx->opts.alwayspreview = 1;
|
||||||
xxx->opts.ncolors = 256; /* not saved */
|
xxx->opts.ncolors = 256; /* not saved */
|
||||||
|
xxx->opts.gradinvert = FALSE;
|
||||||
|
|
||||||
get_line (load_buf, MAX_LOAD_LINE, fp, 0);
|
get_line (load_buf, MAX_LOAD_LINE, fp, 0);
|
||||||
|
|
||||||
|
@ -1995,7 +2000,7 @@ explorer_load (void)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gchar load_buf[MAX_LOAD_LINE];
|
gchar load_buf[MAX_LOAD_LINE];
|
||||||
|
|
||||||
g_assert (filename != NULL);
|
g_assert (filename != NULL);
|
||||||
fp = fopen (filename, "rt");
|
fp = fopen (filename, "rt");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
|
@ -2012,7 +2017,7 @@ explorer_load (void)
|
||||||
}
|
}
|
||||||
if (load_options (current_obj,fp))
|
if (load_options (current_obj,fp))
|
||||||
{
|
{
|
||||||
g_message (_("'%s' is corrupt.\nLine %d Option section incorrect"),
|
g_message (_("'%s' is corrupt.\nLine %d Option section incorrect"),
|
||||||
filename, line_no);
|
filename, line_no);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,17 @@
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
The GIMP -- an image manipulation program
|
The GIMP -- an image manipulation program
|
||||||
Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Include necessary files
|
Include necessary files
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -156,13 +156,13 @@ GimpPlugInInfo PLUG_IN_INFO =
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
MAIN()
|
MAIN()
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
MAIN()
|
MAIN()
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
FUNCTION: query
|
FUNCTION: query
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -510,7 +510,7 @@ explorer_render_row (const guchar *src_row,
|
||||||
{
|
{
|
||||||
/* Julia */
|
/* Julia */
|
||||||
xx = x * x - y * y + cx;
|
xx = x * x - y * y + cx;
|
||||||
y = 2.0 * x * y + cy;
|
y = 2.0 * x * y + cy;
|
||||||
}
|
}
|
||||||
else if (wvals.fractaltype == 2)
|
else if (wvals.fractaltype == 2)
|
||||||
{
|
{
|
||||||
|
@ -648,10 +648,10 @@ delete_dialog_callback (GtkWidget *widget,
|
||||||
/* Get the list and which item is selected */
|
/* Get the list and which item is selected */
|
||||||
/* Only allow single selections */
|
/* Only allow single selections */
|
||||||
|
|
||||||
sellist = GTK_LIST(list)->selection;
|
sellist = GTK_LIST(list)->selection;
|
||||||
|
|
||||||
/* g_print ("list: %i\n", g_list_length (sellist)); */
|
/* g_print ("list: %i\n", g_list_length (sellist)); */
|
||||||
|
|
||||||
sel_obj = (fractalexplorerOBJ *)
|
sel_obj = (fractalexplorerOBJ *)
|
||||||
g_object_get_data (G_OBJECT (sellist->data), "fractalexplorer");
|
g_object_get_data (G_OBJECT (sellist->data), "fractalexplorer");
|
||||||
|
|
||||||
|
@ -667,14 +667,14 @@ delete_dialog_callback (GtkWidget *widget,
|
||||||
{
|
{
|
||||||
clear_undo();
|
clear_undo();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/* Free current obj */
|
/* Free current obj */
|
||||||
fractalexplorer_free_everything (sel_obj);
|
fractalexplorer_free_everything (sel_obj);
|
||||||
|
|
||||||
/* Select previous one */
|
/* Select previous one */
|
||||||
if (pos > 0)
|
if (pos > 0)
|
||||||
pos--;
|
pos--;
|
||||||
|
|
||||||
if ((pos == 0) && (g_list_length (fractalexplorer_list) == 0))
|
if ((pos == 0) && (g_list_length (fractalexplorer_list) == 0))
|
||||||
{
|
{
|
||||||
/*gtk_widget_sed_sensitive ();*/
|
/*gtk_widget_sed_sensitive ();*/
|
||||||
|
@ -713,20 +713,20 @@ delete_fractal_callback (GtkWidget *widget,
|
||||||
if (delete_dialog)
|
if (delete_dialog)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sellist = GTK_LIST(list)->selection;
|
sellist = GTK_LIST(list)->selection;
|
||||||
|
|
||||||
sel_obj = (fractalexplorerOBJ *)
|
sel_obj = (fractalexplorerOBJ *)
|
||||||
g_object_get_data (G_OBJECT (sellist->data), "fractalexplorer");
|
g_object_get_data (G_OBJECT (sellist->data), "fractalexplorer");
|
||||||
|
|
||||||
str = g_strdup_printf (_("Are you sure you want to delete\n"
|
str = g_strdup_printf (_("Are you sure you want to delete\n"
|
||||||
"\"%s\" from the list and from disk?"),
|
"\"%s\" from the list and from disk?"),
|
||||||
sel_obj->draw_name);
|
sel_obj->draw_name);
|
||||||
|
|
||||||
delete_dialog = gimp_query_boolean_box (_("Delete Fractal"),
|
delete_dialog = gimp_query_boolean_box (_("Delete Fractal"),
|
||||||
gimp_standard_help_func,
|
gimp_standard_help_func,
|
||||||
"filters/fractalexplorer.html",
|
"filters/fractalexplorer.html",
|
||||||
GTK_STOCK_DIALOG_QUESTION,
|
GTK_STOCK_DIALOG_QUESTION,
|
||||||
str,
|
str,
|
||||||
GTK_STOCK_DELETE, GTK_STOCK_CANCEL,
|
GTK_STOCK_DELETE, GTK_STOCK_CANCEL,
|
||||||
G_OBJECT (widget), "destroy",
|
G_OBJECT (widget), "destroy",
|
||||||
delete_dialog_callback,
|
delete_dialog_callback,
|
||||||
|
@ -737,7 +737,7 @@ delete_fractal_callback (GtkWidget *widget,
|
||||||
gtk_widget_show (delete_dialog);
|
gtk_widget_show (delete_dialog);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fractalexplorer_list_ok_callback (GtkWidget *widget,
|
fractalexplorer_list_ok_callback (GtkWidget *widget,
|
||||||
|
@ -825,7 +825,7 @@ fractalexplorer_dialog_edit_list (GtkWidget *lwidget,
|
||||||
options->name_entry = gtk_entry_new ();
|
options->name_entry = gtk_entry_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), options->name_entry, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), options->name_entry, TRUE, TRUE, 0);
|
||||||
gtk_entry_set_text (GTK_ENTRY (options->name_entry),obj->draw_name);
|
gtk_entry_set_text (GTK_ENTRY (options->name_entry),obj->draw_name);
|
||||||
|
|
||||||
gtk_widget_show (options->name_entry);
|
gtk_widget_show (options->name_entry);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
|
@ -866,7 +866,7 @@ new_fractalexplorer_obj (gchar *name)
|
||||||
|
|
||||||
/* Leave options as before */
|
/* Leave options as before */
|
||||||
pic_obj = current_obj = fractalexplorer;
|
pic_obj = current_obj = fractalexplorer;
|
||||||
|
|
||||||
new_list_item = fractalexplorer_list_add(fractalexplorer);
|
new_list_item = fractalexplorer_list_add(fractalexplorer);
|
||||||
|
|
||||||
/* obj_creating = tmp_line = NULL; */
|
/* obj_creating = tmp_line = NULL; */
|
||||||
|
@ -883,7 +883,7 @@ new_button_press (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget * new_list_item;
|
GtkWidget * new_list_item;
|
||||||
|
|
||||||
new_list_item = new_fractalexplorer_obj((gchar*)data);
|
new_list_item = new_fractalexplorer_obj((gchar*)data);
|
||||||
fractalexplorer_dialog_edit_list(new_list_item,current_obj,TRUE);
|
fractalexplorer_dialog_edit_list(new_list_item,current_obj,TRUE);
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ new_button_press (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load all fractalexplorer, which are founded in fractalexplorer-path-list,
|
* Load all fractalexplorer, which are founded in fractalexplorer-path-list,
|
||||||
* into fractalexplorer_list.
|
* into fractalexplorer_list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -904,10 +904,10 @@ fractalexplorer_list_pos (fractalexplorerOBJ *fractalexplorer)
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
for (tmp = fractalexplorer_list; tmp; tmp = g_list_next (tmp))
|
for (tmp = fractalexplorer_list; tmp; tmp = g_list_next (tmp))
|
||||||
{
|
{
|
||||||
g = tmp->data;
|
g = tmp->data;
|
||||||
|
|
||||||
if (strcmp (fractalexplorer->draw_name, g->draw_name) <= 0)
|
if (strcmp (fractalexplorer->draw_name, g->draw_name) <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -983,7 +983,7 @@ fractalexplorer_new_pixmap (GtkWidget *list,
|
||||||
pixdata);
|
pixdata);
|
||||||
|
|
||||||
pixmap_widget = gtk_pixmap_new (pixmap, mask);
|
pixmap_widget = gtk_pixmap_new (pixmap, mask);
|
||||||
gtk_widget_show (pixmap_widget);
|
gtk_widget_show (pixmap_widget);
|
||||||
|
|
||||||
return pixmap_widget;
|
return pixmap_widget;
|
||||||
}
|
}
|
||||||
|
@ -1000,7 +1000,7 @@ fractalexplorer_list_add (fractalexplorerOBJ *obj)
|
||||||
list_item =
|
list_item =
|
||||||
fractalexplorer_list_item_new_with_label_and_pixmap (obj,
|
fractalexplorer_list_item_new_with_label_and_pixmap (obj,
|
||||||
obj->draw_name,
|
obj->draw_name,
|
||||||
list_pix);
|
list_pix);
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (list_item), "fractalexplorer",
|
g_object_set_data (G_OBJECT (list_item), "fractalexplorer",
|
||||||
obj);
|
obj);
|
||||||
|
@ -1010,7 +1010,7 @@ fractalexplorer_list_add (fractalexplorerOBJ *obj)
|
||||||
list = g_list_append (NULL, list_item);
|
list = g_list_append (NULL, list_item);
|
||||||
gtk_list_insert_items (GTK_LIST (fractalexplorer_gtk_list), list, pos);
|
gtk_list_insert_items (GTK_LIST (fractalexplorer_gtk_list), list, pos);
|
||||||
gtk_widget_show (list_item);
|
gtk_widget_show (list_item);
|
||||||
gtk_list_select_item (GTK_LIST (fractalexplorer_gtk_list), pos);
|
gtk_list_select_item (GTK_LIST (fractalexplorer_gtk_list), pos);
|
||||||
|
|
||||||
g_signal_connect (list_item, "button_press_event",
|
g_signal_connect (list_item, "button_press_event",
|
||||||
G_CALLBACK (list_button_press),
|
G_CALLBACK (list_button_press),
|
||||||
|
@ -1051,7 +1051,7 @@ build_list_items (GtkWidget *list)
|
||||||
|
|
||||||
list_item =
|
list_item =
|
||||||
fractalexplorer_list_item_new_with_label_and_pixmap
|
fractalexplorer_list_item_new_with_label_and_pixmap
|
||||||
(g, g->draw_name,list_pix);
|
(g, g->draw_name,list_pix);
|
||||||
g_object_set_data (G_OBJECT (list_item), "factralexplorer",
|
g_object_set_data (G_OBJECT (list_item), "factralexplorer",
|
||||||
g);
|
g);
|
||||||
gtk_list_append_items (GTK_LIST (list), g_list_append(NULL,list_item));
|
gtk_list_append_items (GTK_LIST (list), g_list_append(NULL,list_item));
|
||||||
|
@ -1072,7 +1072,7 @@ list_button_press (GtkWidget *widget,
|
||||||
{
|
{
|
||||||
|
|
||||||
fractalexplorerOBJ * sel_obj;
|
fractalexplorerOBJ * sel_obj;
|
||||||
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
|
@ -1279,7 +1279,7 @@ add_objects_list (void)
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
|
||||||
gimp_help_set_help_data (button,
|
gimp_help_set_help_data (button,
|
||||||
_("Select folder and rescan collection"), NULL);
|
_("Select folder and rescan collection"), NULL);
|
||||||
|
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
G_CALLBACK (fractalexplorer_rescan_list),
|
G_CALLBACK (fractalexplorer_rescan_list),
|
||||||
|
@ -1291,7 +1291,7 @@ add_objects_list (void)
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
|
||||||
gimp_help_set_help_data (button,
|
gimp_help_set_help_data (button,
|
||||||
_("Delete currently selected fractal"), NULL);
|
_("Delete currently selected fractal"), NULL);
|
||||||
|
|
||||||
g_signal_connect (button, "clicked",
|
g_signal_connect (button, "clicked",
|
||||||
G_CALLBACK (delete_fractal_callback),
|
G_CALLBACK (delete_fractal_callback),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Magic numbers
|
Magic numbers
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#define PREVIEW_SIZE 128
|
#define PREVIEW_SIZE 128
|
||||||
|
@ -40,7 +40,7 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Types
|
Types
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -60,12 +60,13 @@ typedef struct
|
||||||
gint redmode;
|
gint redmode;
|
||||||
gint greenmode;
|
gint greenmode;
|
||||||
gint bluemode;
|
gint bluemode;
|
||||||
gint redinvert;
|
gboolean redinvert;
|
||||||
gint greeninvert;
|
gboolean greeninvert;
|
||||||
gint blueinvert;
|
gboolean blueinvert;
|
||||||
gint alwayspreview;
|
gboolean alwayspreview;
|
||||||
gint ncolors;
|
gint ncolors;
|
||||||
gint useloglog;
|
gboolean gradinvert;
|
||||||
|
gboolean useloglog;
|
||||||
} explorer_vals_t;
|
} explorer_vals_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -128,7 +129,7 @@ typedef struct DFigObj
|
||||||
GtkWidget *label_widget;
|
GtkWidget *label_widget;
|
||||||
GtkWidget *pixmap_widget;
|
GtkWidget *pixmap_widget;
|
||||||
gint obj_status;
|
gint obj_status;
|
||||||
} fractalexplorerOBJ;
|
} fractalexplorerOBJ;
|
||||||
|
|
||||||
|
|
||||||
typedef struct GigObj
|
typedef struct GigObj
|
||||||
|
@ -141,7 +142,7 @@ typedef struct GigObj
|
||||||
GtkWidget *label_widget;
|
GtkWidget *label_widget;
|
||||||
GtkWidget *pixmap_widget;
|
GtkWidget *pixmap_widget;
|
||||||
gint obj_status;
|
gint obj_status;
|
||||||
} gradientOBJ;
|
} gradientOBJ;
|
||||||
|
|
||||||
typedef struct _fractalexplorerListOptions
|
typedef struct _fractalexplorerListOptions
|
||||||
{
|
{
|
||||||
|
@ -166,7 +167,7 @@ extern GtkWidget *delete_dialog;
|
||||||
GtkWidget * add_objects_list (void);
|
GtkWidget * add_objects_list (void);
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Global variables
|
Global variables
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
extern gdouble xmin;
|
extern gdouble xmin;
|
||||||
|
@ -213,7 +214,7 @@ extern GtkWidget *save_menu_item;
|
||||||
extern GtkWidget *fractalexplorer_op_menu;
|
extern GtkWidget *fractalexplorer_op_menu;
|
||||||
extern GdkCursor *MyCursor;
|
extern GdkCursor *MyCursor;
|
||||||
extern int ready_now;
|
extern int ready_now;
|
||||||
extern explorer_vals_t
|
extern explorer_vals_t
|
||||||
zooms[100];
|
zooms[100];
|
||||||
extern DialogElements
|
extern DialogElements
|
||||||
*elements;
|
*elements;
|
||||||
|
@ -227,7 +228,7 @@ extern gchar *fractalexplorer_path;
|
||||||
extern GList *fractalexplorer_list;
|
extern GList *fractalexplorer_list;
|
||||||
extern GList *gradient_list;
|
extern GList *gradient_list;
|
||||||
extern gchar *tpath;
|
extern gchar *tpath;
|
||||||
extern fractalexplorerOBJ
|
extern fractalexplorerOBJ
|
||||||
*fractalexplorer_obj_for_menu;
|
*fractalexplorer_obj_for_menu;
|
||||||
extern GList *rescan_list;
|
extern GList *rescan_list;
|
||||||
extern int lng;
|
extern int lng;
|
||||||
|
|
|
@ -229,7 +229,10 @@ get_samples (GimpDrawable *drawable)
|
||||||
gint bpp, color, has_alpha, alpha;
|
gint bpp, color, has_alpha, alpha;
|
||||||
gint i, j;
|
gint i, j;
|
||||||
|
|
||||||
f_samples = gimp_gradients_sample_uniform (NSAMPLES);
|
#ifdef __GNUC__
|
||||||
|
#warning FIXME: "reverse" hardcoded to FALSE.
|
||||||
|
#endif
|
||||||
|
f_samples = gimp_gradients_sample_uniform (NSAMPLES, FALSE);
|
||||||
|
|
||||||
bpp = gimp_drawable_bpp (drawable->drawable_id);
|
bpp = gimp_drawable_bpp (drawable->drawable_id);
|
||||||
color = gimp_drawable_is_rgb (drawable->drawable_id);
|
color = gimp_drawable_is_rgb (drawable->drawable_id);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -122,13 +122,13 @@ static frame_spec f = { 0.0, &config.cp, 1, 0.0 };
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query (void)
|
query (void)
|
||||||
{
|
{
|
||||||
static GimpParamDef args[] =
|
static GimpParamDef args[] =
|
||||||
{
|
{
|
||||||
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
{ GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
|
||||||
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -145,38 +145,40 @@ query (void)
|
||||||
args, NULL);
|
args, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maybe_init_cp (void)
|
maybe_init_cp (void)
|
||||||
{
|
{
|
||||||
if (0 == config.cp.spatial_oversample)
|
if (0 == config.cp.spatial_oversample)
|
||||||
{
|
{
|
||||||
config.randomize = 0;
|
config.randomize = 0;
|
||||||
config.variation = VARIATION_SAME;
|
config.variation = VARIATION_SAME;
|
||||||
config.cmap_drawable = GRADIENT_DRAWABLE;
|
config.cmap_drawable = GRADIENT_DRAWABLE;
|
||||||
random_control_point(&config.cp, variation_random);
|
|
||||||
config.cp.center[0] = 0.0;
|
random_control_point (&config.cp, variation_random);
|
||||||
config.cp.center[1] = 0.0;
|
|
||||||
config.cp.pixels_per_unit = 100;
|
config.cp.center[0] = 0.0;
|
||||||
config.cp.spatial_oversample = 2;
|
config.cp.center[1] = 0.0;
|
||||||
config.cp.gamma = 2.0;
|
config.cp.pixels_per_unit = 100;
|
||||||
config.cp.contrast = 1.0;
|
config.cp.spatial_oversample = 2;
|
||||||
config.cp.brightness = 1.0;
|
config.cp.gamma = 2.0;
|
||||||
|
config.cp.contrast = 1.0;
|
||||||
|
config.cp.brightness = 1.0;
|
||||||
config.cp.spatial_filter_radius = 0.75;
|
config.cp.spatial_filter_radius = 0.75;
|
||||||
config.cp.sample_density = 5.0;
|
config.cp.sample_density = 5.0;
|
||||||
config.cp.zoom = 0.0;
|
config.cp.zoom = 0.0;
|
||||||
config.cp.nbatches = 1;
|
config.cp.nbatches = 1;
|
||||||
config.cp.white_level = 200;
|
config.cp.white_level = 200;
|
||||||
config.cp.cmap_index = 72;
|
config.cp.cmap_index = 72;
|
||||||
/* cheating */
|
/* cheating */
|
||||||
config.cp.width = 256;
|
config.cp.width = 256;
|
||||||
config.cp.height = 256;
|
config.cp.height = 256;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run (const gchar *name,
|
run (const gchar *name,
|
||||||
gint n_params,
|
gint n_params,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals)
|
GimpParam **return_vals)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +191,7 @@ run (const gchar *name,
|
||||||
*return_vals = values;
|
*return_vals = values;
|
||||||
|
|
||||||
run_mode = param[0].data.d_int32;
|
run_mode = param[0].data.d_int32;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
|
||||||
if (run_mode == GIMP_RUN_NONINTERACTIVE)
|
if (run_mode == GIMP_RUN_NONINTERACTIVE)
|
||||||
|
@ -245,7 +247,7 @@ run (const gchar *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawable_to_cmap (control_point *cp)
|
drawable_to_cmap (control_point *cp)
|
||||||
{
|
{
|
||||||
gint i, j;
|
gint i, j;
|
||||||
GimpPixelRgn pr;
|
GimpPixelRgn pr;
|
||||||
|
@ -265,7 +267,10 @@ drawable_to_cmap (control_point *cp)
|
||||||
}
|
}
|
||||||
else if (GRADIENT_DRAWABLE == config.cmap_drawable)
|
else if (GRADIENT_DRAWABLE == config.cmap_drawable)
|
||||||
{
|
{
|
||||||
gdouble *g = gimp_gradients_sample_uniform (256);
|
#ifdef __GNUC__
|
||||||
|
#warning FIXME: "reverse" hardcoded to FALSE.
|
||||||
|
#endif
|
||||||
|
gdouble *g = gimp_gradients_sample_uniform (256, FALSE);
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
cp->cmap[i][j] = g[i*4 + j];
|
cp->cmap[i][j] = g[i*4 + j];
|
||||||
|
@ -289,7 +294,7 @@ drawable_to_cmap (control_point *cp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
doit (GimpDrawable *drawable)
|
doit (GimpDrawable *drawable)
|
||||||
{
|
{
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
@ -369,8 +374,8 @@ doit (GimpDrawable *drawable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ok_callback (GtkWidget *widget,
|
ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
run_flag = TRUE;
|
run_flag = TRUE;
|
||||||
|
@ -395,9 +400,9 @@ file_cancel_callback (GtkWidget *widget,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_ok_callback (GtkWidget *widget,
|
file_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkFileSelection *fs;
|
GtkFileSelection *fs;
|
||||||
const gchar *filename;
|
const gchar *filename;
|
||||||
|
@ -463,7 +468,7 @@ file_ok_callback (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_file_dlg (void)
|
make_file_dlg (void)
|
||||||
{
|
{
|
||||||
file_dlg = gtk_file_selection_new (NULL);
|
file_dlg = gtk_file_selection_new (NULL);
|
||||||
gtk_quit_add_destroy (1, GTK_OBJECT (file_dlg));
|
gtk_quit_add_destroy (1, GTK_OBJECT (file_dlg));
|
||||||
|
@ -485,8 +490,8 @@ make_file_dlg (void)
|
||||||
gimp_help_connect (file_dlg, gimp_standard_help_func, "filters/flame.html");
|
gimp_help_connect (file_dlg, gimp_standard_help_func, "filters/flame.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
randomize_callback (GtkWidget *widget,
|
randomize_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
random_control_point (&edit_cp, config.variation);
|
random_control_point (&edit_cp, config.variation);
|
||||||
|
@ -494,16 +499,16 @@ randomize_callback (GtkWidget *widget,
|
||||||
set_edit_preview ();
|
set_edit_preview ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_ok_callback (GtkWidget *widget,
|
edit_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gtk_widget_hide (edit_dlg);
|
gtk_widget_hide (edit_dlg);
|
||||||
config.cp = edit_cp;
|
config.cp = edit_cp;
|
||||||
set_flame_preview ();
|
set_flame_preview ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_mutants (void)
|
init_mutants (void)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -517,8 +522,8 @@ init_mutants (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_edit_preview (void)
|
set_edit_preview (void)
|
||||||
{
|
{
|
||||||
gint y, i, j;
|
gint y, i, j;
|
||||||
guchar *b;
|
guchar *b;
|
||||||
|
@ -574,9 +579,9 @@ set_edit_preview (void)
|
||||||
g_free (b);
|
g_free (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
preview_clicked (GtkWidget *widget,
|
preview_clicked (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gint mut = GPOINTER_TO_INT (data);
|
gint mut = GPOINTER_TO_INT (data);
|
||||||
|
|
||||||
|
@ -599,8 +604,8 @@ preview_clicked (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_callback (GtkWidget *widget,
|
edit_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
edit_cp = config.cp;
|
edit_cp = config.cp;
|
||||||
|
|
||||||
|
@ -743,9 +748,9 @@ edit_callback (GtkWidget *widget,
|
||||||
gtk_window_present (GTK_WINDOW (edit_dlg));
|
gtk_window_present (GTK_WINDOW (edit_dlg));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_callback (GtkWidget *widget,
|
load_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
if (! file_dlg)
|
if (! file_dlg)
|
||||||
{
|
{
|
||||||
|
@ -765,9 +770,9 @@ load_callback (GtkWidget *widget,
|
||||||
gtk_widget_show (file_dlg);
|
gtk_widget_show (file_dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_callback (GtkWidget *widget,
|
save_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
if (!file_dlg)
|
if (!file_dlg)
|
||||||
{
|
{
|
||||||
|
@ -787,9 +792,9 @@ save_callback (GtkWidget *widget,
|
||||||
gtk_widget_show (file_dlg);
|
gtk_widget_show (file_dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_cb (GtkWidget *widget,
|
menu_cb (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
gimp_menu_item_update (widget, data);
|
gimp_menu_item_update (widget, data);
|
||||||
|
|
||||||
|
@ -799,8 +804,8 @@ menu_cb (GtkWidget *widget,
|
||||||
set_edit_preview ();
|
set_edit_preview ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_flame_preview (void)
|
set_flame_preview (void)
|
||||||
{
|
{
|
||||||
gint y;
|
gint y;
|
||||||
guchar *b;
|
guchar *b;
|
||||||
|
@ -835,8 +840,8 @@ set_flame_preview (void)
|
||||||
gtk_widget_queue_draw (flame_preview);
|
gtk_widget_queue_draw (flame_preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_cmap_preview (void)
|
set_cmap_preview (void)
|
||||||
{
|
{
|
||||||
gint i, x, y;
|
gint i, x, y;
|
||||||
guchar b[96];
|
guchar b[96];
|
||||||
|
@ -865,9 +870,9 @@ set_cmap_preview (void)
|
||||||
gtk_widget_queue_draw (cmap_preview);
|
gtk_widget_queue_draw (cmap_preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gradient_cb (GtkWidget *widget,
|
gradient_cb (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
config.cmap_drawable = GPOINTER_TO_INT (data);
|
config.cmap_drawable = GPOINTER_TO_INT (data);
|
||||||
set_cmap_preview();
|
set_cmap_preview();
|
||||||
|
@ -875,9 +880,9 @@ gradient_cb (GtkWidget *widget,
|
||||||
/* set_edit_preview(); */
|
/* set_edit_preview(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cmap_callback (gint32 id,
|
cmap_callback (gint32 id,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
config.cmap_drawable = id;
|
config.cmap_drawable = id;
|
||||||
set_cmap_preview();
|
set_cmap_preview();
|
||||||
|
@ -886,16 +891,16 @@ cmap_callback (gint32 id,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
cmap_constrain (gint32 image_id,
|
cmap_constrain (gint32 image_id,
|
||||||
gint32 drawable_id,
|
gint32 drawable_id,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
return ! gimp_drawable_is_indexed (drawable_id);
|
return ! gimp_drawable_is_indexed (drawable_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
dialog (void)
|
dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
@ -968,7 +973,7 @@ dialog (void)
|
||||||
gtk_box_set_spacing (GTK_BOX (vbbox), 4);
|
gtk_box_set_spacing (GTK_BOX (vbbox), 4);
|
||||||
gtk_box_pack_start (GTK_BOX (box), vbbox, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (box), vbbox, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (vbbox);
|
gtk_widget_show (vbbox);
|
||||||
|
|
||||||
button = gtk_button_new_from_stock (GIMP_STOCK_EDIT);
|
button = gtk_button_new_from_stock (GIMP_STOCK_EDIT);
|
||||||
gtk_box_pack_start (GTK_BOX (vbbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbbox), button, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
@ -1122,7 +1127,7 @@ dialog (void)
|
||||||
gtk_menu_prepend (GTK_MENU (menu), menuitem);
|
gtk_menu_prepend (GTK_MENU (menu), menuitem);
|
||||||
if (BLACK_DRAWABLE == save_drawable)
|
if (BLACK_DRAWABLE == save_drawable)
|
||||||
gtk_menu_set_active (GTK_MENU (menu), 0);
|
gtk_menu_set_active (GTK_MENU (menu), 0);
|
||||||
gtk_widget_show (menuitem);
|
gtk_widget_show (menuitem);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
static gchar *names[] =
|
static gchar *names[] =
|
||||||
|
|
|
@ -780,10 +780,13 @@ static void gradient_get_default (gchar *name, guchar *values,
|
||||||
gint nvalues);
|
gint nvalues);
|
||||||
static void gradient_get_values_external (gchar *gradient_name,
|
static void gradient_get_values_external (gchar *gradient_name,
|
||||||
guchar *values, gint nvalues);
|
guchar *values, gint nvalues);
|
||||||
static void gradient_get_values_real_external (gchar *gradient_name,
|
static void gradient_get_values_real_external (gchar *gradient_name,
|
||||||
guchar *values, gint nvalues);
|
guchar *values,
|
||||||
static GradientCacheItem *gradient_cache_lookup (gchar *name, gint *found);
|
gint nvalues,
|
||||||
static void gradient_cache_zorch (void);
|
gboolean reverse);
|
||||||
|
static GradientCacheItem *gradient_cache_lookup (gchar *name,
|
||||||
|
gint *found);
|
||||||
|
static void gradient_cache_zorch (void);
|
||||||
|
|
||||||
/* *** INSERT-FILE-END *** */
|
/* *** INSERT-FILE-END *** */
|
||||||
|
|
||||||
|
@ -4870,7 +4873,11 @@ gradient_get_values_external (gchar *gradient_name,
|
||||||
ci = gradient_cache_lookup (gradient_name, &found);
|
ci = gradient_cache_lookup (gradient_name, &found);
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
gradient_get_values_real_external (gradient_name, ci->values, GRADIENT_RESOLUTION);
|
#ifdef __GNUC__
|
||||||
|
#warning FIXME: "reverse" hardcoded to FALSE.
|
||||||
|
#endif
|
||||||
|
gradient_get_values_real_external (gradient_name, ci->values,
|
||||||
|
GRADIENT_RESOLUTION, FALSE);
|
||||||
}
|
}
|
||||||
if (nvalues == GRADIENT_RESOLUTION)
|
if (nvalues == GRADIENT_RESOLUTION)
|
||||||
{
|
{
|
||||||
|
@ -4906,9 +4913,10 @@ gradient_get_values_external (gchar *gradient_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gradient_get_values_real_external (gchar *gradient_name,
|
gradient_get_values_real_external (gchar *gradient_name,
|
||||||
guchar *values,
|
guchar *values,
|
||||||
gint nvalues)
|
gint nvalues,
|
||||||
|
gboolean reverse)
|
||||||
{
|
{
|
||||||
gchar *old_name;
|
gchar *old_name;
|
||||||
gdouble *tmp_values;
|
gdouble *tmp_values;
|
||||||
|
@ -4919,7 +4927,7 @@ gradient_get_values_real_external (gchar *gradient_name,
|
||||||
|
|
||||||
gimp_gradients_set_gradient (gradient_name);
|
gimp_gradients_set_gradient (gradient_name);
|
||||||
|
|
||||||
tmp_values = gimp_gradients_sample_uniform (nvalues);
|
tmp_values = gimp_gradients_sample_uniform (nvalues, reverse);
|
||||||
for (i = 0; i < nvalues; i++)
|
for (i = 0; i < nvalues; i++)
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
values[4*i+j] = (guchar) (tmp_values[4*i+j] * 255);
|
values[4*i+j] = (guchar) (tmp_values[4*i+j] * 255);
|
||||||
|
|
|
@ -1028,7 +1028,10 @@ get_samples (GimpDrawable *drawable)
|
||||||
gint bpp, color, has_alpha, alpha;
|
gint bpp, color, has_alpha, alpha;
|
||||||
gint i, j;
|
gint i, j;
|
||||||
|
|
||||||
f_samples = gimp_gradients_sample_uniform (NGRADSAMPLES);
|
#ifdef __GNUC__
|
||||||
|
#warning FIXME: "reverse" hardcoded to FALSE.
|
||||||
|
#endif
|
||||||
|
f_samples = gimp_gradients_sample_uniform (NGRADSAMPLES, FALSE);
|
||||||
|
|
||||||
bpp = gimp_drawable_bpp (drawable->drawable_id);
|
bpp = gimp_drawable_bpp (drawable->drawable_id);
|
||||||
color = gimp_drawable_is_rgb (drawable->drawable_id);
|
color = gimp_drawable_is_rgb (drawable->drawable_id);
|
||||||
|
|
|
@ -146,6 +146,11 @@ sub sample_num_arg {
|
||||||
desc => 'The number of samples to take', alias => 'i' }
|
desc => 'The number of samples to take', alias => 'i' }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub reverse_arg {
|
||||||
|
{ name => 'reverse', type => 'boolean',
|
||||||
|
desc => 'Use the reverse gradient (%%desc%%)' }
|
||||||
|
}
|
||||||
|
|
||||||
sub sample_outargs {
|
sub sample_outargs {
|
||||||
@outargs = (
|
@outargs = (
|
||||||
{ name => 'color_samples', type => 'floatarray', init => 1,
|
{ name => 'color_samples', type => 'floatarray', init => 1,
|
||||||
|
@ -170,7 +175,10 @@ HELP
|
||||||
|
|
||||||
&pdb_misc;
|
&pdb_misc;
|
||||||
|
|
||||||
@inargs = ( &sample_num_arg('2 <= ') );
|
@inargs = (
|
||||||
|
&sample_num_arg('2 <= '),
|
||||||
|
&reverse_arg
|
||||||
|
);
|
||||||
&sample_outargs;
|
&sample_outargs;
|
||||||
|
|
||||||
%invoke = (
|
%invoke = (
|
||||||
|
@ -188,7 +196,7 @@ HELP
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
{
|
{
|
||||||
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
|
gimp_gradient_get_color_at (gradient, pos, reverse, &color);
|
||||||
|
|
||||||
*pv++ = color.r;
|
*pv++ = color.r;
|
||||||
*pv++ = color.g;
|
*pv++ = color.g;
|
||||||
|
@ -217,13 +225,12 @@ HELP
|
||||||
&pdb_misc;
|
&pdb_misc;
|
||||||
|
|
||||||
@inargs = (
|
@inargs = (
|
||||||
{
|
{ name => 'positions',
|
||||||
name => 'positions',
|
type => 'floatarray',
|
||||||
type => 'floatarray',
|
desc => 'The list of positions to sample along the gradient',
|
||||||
desc => 'The list of positions to sample along the gradient',
|
alias => 'pos',
|
||||||
alias => 'pos',
|
array => &sample_num_arg("") },
|
||||||
array => &sample_num_arg("")
|
&reverse_arg
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
&sample_outargs;
|
&sample_outargs;
|
||||||
|
@ -240,7 +247,7 @@ HELP
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
{
|
{
|
||||||
gimp_gradient_get_color_at (gradient, *pos, FALSE, &color);
|
gimp_gradient_get_color_at (gradient, *pos, reverse, &color);
|
||||||
|
|
||||||
*pv++ = color.r;
|
*pv++ = color.r;
|
||||||
*pv++ = color.g;
|
*pv++ = color.g;
|
||||||
|
@ -254,14 +261,14 @@ CODE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub sample_size_arg {{
|
sub sample_size_arg {
|
||||||
name => 'sample_size',
|
{ name => 'sample_size',
|
||||||
type => '0 < int32 <= 10000',
|
type => '0 < int32 <= 10000',
|
||||||
desc => 'Size of the sample to return when the gradient is changed
|
desc => 'Size of the sample to return when the gradient is changed
|
||||||
(%%desc%%)',
|
(%%desc%%)',
|
||||||
on_fail => 'sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;',
|
on_fail => 'sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;',
|
||||||
no_success => 1
|
no_success => 1 }
|
||||||
}}
|
}
|
||||||
|
|
||||||
sub gradients_get_gradient_data {
|
sub gradients_get_gradient_data {
|
||||||
$blurb = <<'BLURB';
|
$blurb = <<'BLURB';
|
||||||
|
@ -278,7 +285,8 @@ HELP
|
||||||
@inargs = (
|
@inargs = (
|
||||||
{ name => 'name', type => 'string',
|
{ name => 'name', type => 'string',
|
||||||
desc => 'The gradient name ("" means current active gradient)' },
|
desc => 'The gradient name ("" means current active gradient)' },
|
||||||
&sample_size_arg
|
&sample_size_arg,
|
||||||
|
&reverse_arg
|
||||||
);
|
);
|
||||||
|
|
||||||
@outargs = (
|
@outargs = (
|
||||||
|
@ -327,7 +335,7 @@ HELP
|
||||||
|
|
||||||
while (i--)
|
while (i--)
|
||||||
{
|
{
|
||||||
gimp_gradient_get_color_at (gradient, pos, FALSE, &color);
|
gimp_gradient_get_color_at (gradient, pos, reverse, &color);
|
||||||
|
|
||||||
*pv++ = color.r;
|
*pv++ = color.r;
|
||||||
*pv++ = color.g;
|
*pv++ = color.g;
|
||||||
|
|
Loading…
Reference in New Issue