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