Forward: Bug in GtkCurve?



----- Forwarded message from Massimiliano Mirra <mmirra libero it> -----

From: Massimiliano Mirra <mmirra libero it>
To: gtk-list gnome org
Subject: Bug in GtkCurve?

The following code results in a straight line:

gfloat points[] = {0, 0, 0.5, 0.5, 1, 1};
gtk_curve_set_range (GTK_CURVE(curve) 0, 1, 0, 1);
gtk_curve_set_vector (GTK_CURVE(curve), 3, points);
gtk_curve_set_curve_type(GTK_CURVE(curve), GTK_CURVE_TYPE_SPLINE;

Which is what one would expect.  The following different code,
however, still results in a straight line:

gfloat points[] = {0, 0, 0.25, 0.25, 0.5, 0.5, 0.75, 0.5, 0.85, 0.55, 1, 1};
gtk_curve_set_range (GTK_CURVE(curve) 0, 1, 0, 1);
gtk_curve_set_vector (GTK_CURVE(curve), 6, points);
gtk_curve_set_curve_type(GTK_CURVE(curve), GTK_CURVE_TYPE_SPLINE;

Which one would not expect (unless I am missing something).  I cannot
seem to initialize a curve to anything different to a straight line.
Points in the middle seem to be ignored.

I am running GTK 1.2.10 on a Debian Woody.  A person running 1.2.8
reported it works there.  Here is the code that reproduces the problem
on my platform:

#include <gtk/gtk.h>

gint delete_event( GtkWidget *widget,
		   GdkEvent  *event,
		   gpointer   data )
{
 
  gtk_main_quit();
}

int main( int argc,
	  char *argv[] )
{
  GtkWidget *window;
  GtkWidget *curve;
  gfloat points[] = {0, 0, 0.25, 0.25, 0.5, 0.5, 0.75, 0.5, 0.85, 0.55, 1, 1};
  
  gtk_init(&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  curve = gtk_curve_new ();

  gtk_signal_connect (GTK_OBJECT (window), "delete_event",
		      GTK_SIGNAL_FUNC (delete_event), NULL);

  gtk_container_set_border_width (GTK_CONTAINER (window), 10);
  gtk_container_add (GTK_CONTAINER (window), curve); 

  gtk_widget_show (curve);
  gtk_widget_show (window);

  gtk_curve_set_range (GTK_CURVE(curve), 0, 1, 0, 1);
  gtk_curve_set_vector (GTK_CURVE(curve), 6, points);
  gtk_curve_set_curve_type(GTK_CURVE(curve), GTK_CURVE_TYPE_SPLINE);

  gtk_main ();

  return(0);
}

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list

----- End forwarded message -----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]