gimp r24845 - in trunk: . plug-ins/common
- From: weskaggs svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24845 - in trunk: . plug-ins/common
- Date: Sun, 10 Feb 2008 04:29:46 +0000 (GMT)
Author: weskaggs
Date: Sun Feb 10 04:29:46 2008
New Revision: 24845
URL: http://svn.gnome.org/viewvc/gimp?rev=24845&view=rev
Log:
Bill Skaggs <weskaggs primate ucdavis edu>
* plug-ins/common/ripple.c: add a "phase shift" control,
for interactive use only. Fixes bug #515144.
Modified:
trunk/ChangeLog
trunk/plug-ins/common/ripple.c
Modified: trunk/plug-ins/common/ripple.c
==============================================================================
--- trunk/plug-ins/common/ripple.c (original)
+++ trunk/plug-ins/common/ripple.c Sun Feb 10 04:29:46 2008
@@ -57,6 +57,7 @@
gint waveform;
gboolean antialias;
gboolean tile;
+ gint phase_shift;
} RippleValues;
@@ -99,7 +100,8 @@
WRAP, /* edges */
SINE, /* waveform */
TRUE, /* antialias */
- FALSE /* tile */
+ FALSE, /* tile */
+ 0 /* phase shift */
};
/***** Functions *****/
@@ -603,7 +605,7 @@
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_row_spacings (GTK_TABLE (table), 6);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
@@ -634,6 +636,19 @@
G_CALLBACK (gimp_preview_invalidate),
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 (table);
gtk_widget_show (dialog);
@@ -680,15 +695,20 @@
static gdouble
displace_amount (gint location)
{
+ gdouble phi = rvals.phase_shift / 360.0;
+ gdouble lambda;
+
switch (rvals.waveform)
{
case SINE:
return (rvals.amplitude *
- sin (location * (2 * G_PI) / (gdouble) rvals.period));
+ sin (2 * G_PI * (location / (gdouble) rvals.period - phi)));
+
case SAWTOOTH:
- return (rvals.amplitude *
- (fabs ((((location % rvals.period) /
- (gdouble) rvals.period) * 4) - 2) - 1));
+ lambda = location % rvals.period - phi * rvals.period;
+ if (lambda < 0)
+ lambda += rvals.period;
+ return (rvals.amplitude * (fabs (((lambda / rvals.period) * 4) - 2) - 1));
}
return 0.0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]