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

gtk_curve problem



Hello all,
 
I sent his question to gtk_list but didn't get a response so maybe this list is more appropriate.  I sent it to gtk_devel_list too by mistake (missed the "app_" out); I hope I haven't pissed anyone off too much.
 
Right here goes:
 
>I wonder if you could help me with a problem I'm having with the gtk_curve widget.
 
>I want to use a curve to control and edit the animation of a character in an avatar customisation application.  Editing the spline curve and getting points from the >curve using  gtk_curve_get_vector  works fine.  However it is important to be able to save and reload the curves.  To test reloading I have defined an array of gfloats

>gfloat start[]={0.0, 10.0, 50.0, 100.0, 180.0};

>and I would like to set up a spline curve using these points.  I realise that gtk_curve_set_vector sets the curve type to GTK_CURVE_TYPE_FREE so I then set the curve type to GTK_CURVE_TYPE_SPLINE.
 
>Here's the code:
 
>    curveY = gtk_curve_new ();

>    gtk_box_pack_start(GTK_BOX(box1), curveY, TRUE, TRUE, 2);

>    gtk_curve_set_range(GTK_CURVE (curveY), 0.0, 200.0, -180.0, 180.0);

>    gtk_curve_set_vector (GTK_CURVE (curveY), 5, start);

>    gtk_curve_set_curve_type(GTK_CURVE (curveY), GTK_CURVE_TYPE_SPLINE);

>    gtk_widget_show(curveY);

>Unfortunately this doesn't work...  The line is completely messed up, with approximately a 3rd of it as a straight line right at the bottom, two thirds right at the top and a couple of control points somewhere in the middle.

>If I miss out the gtk_curve_set_curve_type then I get five straight lines at the right height for the five values in the array, so I assume the problem is in the conversion form free to spline curve type.

I'd really appreciate any help you can give me as my 3rd year project may well depend on it...

Cheers,

Alex



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