Bill Skaggs <weskaggs@primate.ucdavis.edu>
* plug-ins/common/ripple.c: add a "phase shift" control, for interactive use only. Fixes bug #515144. svn path=/trunk/; revision=24845
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2008-02-09 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||||
|
|
||||||
|
* plug-ins/common/ripple.c: add a "phase shift" control,
|
||||||
|
for interactive use only. Fixes bug #515144.
|
||||||
|
|
||||||
2008-02-09 Michael Natterer <mitch@gimp.org>
|
2008-02-09 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* tools/pdbgen/pdb/color.pdb: don't include <gegl.h>
|
* tools/pdbgen/pdb/color.pdb: don't include <gegl.h>
|
||||||
|
@ -57,6 +57,7 @@ typedef struct
|
|||||||
gint waveform;
|
gint waveform;
|
||||||
gboolean antialias;
|
gboolean antialias;
|
||||||
gboolean tile;
|
gboolean tile;
|
||||||
|
gint phase_shift;
|
||||||
} RippleValues;
|
} RippleValues;
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +100,8 @@ static RippleValues rvals =
|
|||||||
WRAP, /* edges */
|
WRAP, /* edges */
|
||||||
SINE, /* waveform */
|
SINE, /* waveform */
|
||||||
TRUE, /* antialias */
|
TRUE, /* antialias */
|
||||||
FALSE /* tile */
|
FALSE, /* tile */
|
||||||
|
0 /* phase shift */
|
||||||
};
|
};
|
||||||
|
|
||||||
/***** Functions *****/
|
/***** Functions *****/
|
||||||
@ -603,7 +605,7 @@ ripple_dialog (GimpDrawable *drawable)
|
|||||||
|
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
table = gtk_table_new (2, 3, FALSE);
|
table = gtk_table_new (3, 3, FALSE);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
||||||
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
|
||||||
@ -634,6 +636,19 @@ ripple_dialog (GimpDrawable *drawable)
|
|||||||
G_CALLBACK (gimp_preview_invalidate),
|
G_CALLBACK (gimp_preview_invalidate),
|
||||||
preview);
|
preview);
|
||||||
|
|
||||||
|
/* Phase Shift */
|
||||||
|
scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
||||||
|
_("Phase _shift:"), SCALE_WIDTH, 0,
|
||||||
|
rvals.phase_shift, 0, 360, 1, 15, 0,
|
||||||
|
TRUE, 0, 0,
|
||||||
|
NULL, NULL);
|
||||||
|
g_signal_connect (scale_data, "value-changed",
|
||||||
|
G_CALLBACK (gimp_int_adjustment_update),
|
||||||
|
&rvals.phase_shift);
|
||||||
|
g_signal_connect_swapped (scale_data, "value-changed",
|
||||||
|
G_CALLBACK (gimp_preview_invalidate),
|
||||||
|
preview);
|
||||||
|
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
@ -680,15 +695,20 @@ average_two_pixels (guchar *dest,
|
|||||||
static gdouble
|
static gdouble
|
||||||
displace_amount (gint location)
|
displace_amount (gint location)
|
||||||
{
|
{
|
||||||
|
gdouble phi = rvals.phase_shift / 360.0;
|
||||||
|
gdouble lambda;
|
||||||
|
|
||||||
switch (rvals.waveform)
|
switch (rvals.waveform)
|
||||||
{
|
{
|
||||||
case SINE:
|
case SINE:
|
||||||
return (rvals.amplitude *
|
return (rvals.amplitude *
|
||||||
sin (location * (2 * G_PI) / (gdouble) rvals.period));
|
sin (2 * G_PI * (location / (gdouble) rvals.period - phi)));
|
||||||
|
|
||||||
case SAWTOOTH:
|
case SAWTOOTH:
|
||||||
return (rvals.amplitude *
|
lambda = location % rvals.period - phi * rvals.period;
|
||||||
(fabs ((((location % rvals.period) /
|
if (lambda < 0)
|
||||||
(gdouble) rvals.period) * 4) - 2) - 1));
|
lambda += rvals.period;
|
||||||
|
return (rvals.amplitude * (fabs (((lambda / rvals.period) * 4) - 2) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
Reference in New Issue
Block a user