1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
int intcurve, i;
float ymax, ymin;
float * curvetoplot;
cairo_t * cr;
cr = gdk_cairo_create (grwdget -> window);
cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
cairo_set_line_width (cr, 1.0);
ymax = 600 / ymax;
for ( i=2 ; i < intcurve ; i++ )
{
cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.25);
cairo_rectangle (cr, (i-2.25)*800/(intcurve-1), 600-ymax*(curvetoplot[i]-ymin), 0.5*800/(intcurve-1), ymax*(curvetoplot[i]-ymin));
cairo_fill(cr);
cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 1.0);
cairo_move_to(cr, (i-2.25)*800/(intcurve-1), 600);
cairo_line_to(cr, (i-2.25)*800/(intcurve-1), 600-ymax*(curvetoplot[i]-ymin));
cairo_move_to(cr, (i-2.25)*800/(intcurve-1), 600-ymax*(curvetoplot[i]-ymin));
cairo_line_to(cr, (i-1.75)*800/(intcurve-1), 600-ymax*(curvetoplot[i]-ymin));
cairo_move_to(cr, (i-1.75)*800/(intcurve-1), 600-ymax*(curvetoplot[i]-ymin));
cairo_line_to(cr, (i-1.75)*800/(intcurve-1), 600);
cairo_stroke(cr);
}
cairo_stroke(cr);
cairo_destroy(cr); |