107 double x1, x2, y1, y2;
108 double dx1, dx2, dy1, dy2;
116 for ( i=0 ; i < points; i++ )
120 plotdata[i][0] =
x_min +
XDRAW * (this_proj -> curves[rid][cid] -> data[0][i] -
cxy[0])/
xmax;
124 x = (i+1) * this_proj -> num_delta[rid] * this_proj -> delta[rid] * pow(10,
dxlog);
125 x = log(
x) / log(pow(10,
xlog));
130 plotdata[i][1] =
y_min +
YDRAW * (this_proj -> curves[rid][cid] -> data[1][i] -
cxy[1]) /
ymax;
134 y = this_proj -> curves[rid][cid] -> data[1][i] * pow(10,
dylog);
135 y = log(
y) / log(pow(10,
ylog));
145 cairo_set_dash(cr, dasht ->
a, dasht ->
b, 0.0);
146 cairo_set_line_width (cr, thick);
151 cairo_set_line_width (cr, 0.0);
153 cairo_set_source_rgba (cr, withcolor.
red,
155 withcolor.
blue, 1.0);
161 if (rid ==
RI) j = 2;
162 for ( i = j ; i < points - k ; i ++)
166 slope = (plotdata[i+k][1] - plotdata[i][1])/ (plotdata[i+k][0] - plotdata[i][0]);
167 bval = plotdata[i][1] - slope*plotdata[i][0];
168 dy1 = slope*
x_min + bval;
169 dy2 = slope*
x_max + bval;
172 dx1 = (
y_min - bval) / slope;
173 dx2 = (
y_max - bval) / slope;
177 dx1 = (
y_max - bval) / slope;
178 dx2 = (
y_min - bval) / slope;
180 if (plotdata[i][0] <
x_min && plotdata[i+k][0] <
x_min)
184 else if (plotdata[i][0] >
x_max && plotdata[i+k][0] >
x_max)
188 if (plotdata[i][1] <
y_max && plotdata[i+k][1] <
y_max)
192 else if (plotdata[i][1] >
y_min && plotdata[i+k][1] >
y_min)
198 if (plotdata[i][0] >=
x_min && plotdata[i][0] <=
x_max)
200 if(plotdata[i][1] >=
y_max && plotdata[i][1] <=
y_min)
217 if (plotdata[i+k][0] >=
x_min && plotdata[i+k][0] <=
x_max)
219 if (plotdata[i+k][1] >=
y_max && plotdata[i+k][1] <=
y_min)
221 x2 = plotdata[i+k][0];
222 y2 = plotdata[i+k][1];
235 cairo_move_to (cr, x1, y1);
236 cairo_line_to (cr, x2, y2);
238 if (i % freq == 0 && dglyp)
draw_glyph (cr, glyp, x1, y1, withcolor, gize);
239 if (i == points - 2 && (i+k) % freq == 0 && dglyp)
241 draw_glyph (cr, glyp, x2, y2, withcolor, gize);
250 if (rid ==
RI) j = 2;
252 for ( i = j ; i < points ; i ++)
254 if (this_proj -> curves[rid][cid] -> data[1][i] != 0.0)
256 if (plotdata[i][0] >=
x_min && plotdata[i][0] <=
x_max)
258 if (plotdata[i][1] <=
y_min || (
cxy[1] <= 0.0 && plotdata[i][1] >
y_min))
260 x1 = plotdata[i][0] - hwidth * 0.5 *
XDRAW /
xmax;
261 if (pid) x1 -= hwidth * 0.5 * ((float)pid / (
float)
extra) *
XDRAW /
xmax;
273 if (plotdata[i][1] >
y_min)
277 else if (plotdata[i][1] <
y_max)
288 cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0);
289 cairo_rectangle (cr, x1, y1, x2, y2);
292 cairo_set_source_rgba (cr, withcolor.
red,
294 withcolor.
blue, hopac);
295 cairo_rectangle (cr, x1, y1, x2, y2);
297 cairo_set_source_rgba (cr, withcolor.
red,
299 withcolor.
blue, 1.0);
305 cairo_move_to (cr, x1, y2);
306 cairo_line_to (cr, x1, y1);
307 cairo_move_to (cr, x1, y1);
308 x2 = plotdata[i][0] + hwidth * 0.5 *
XDRAW /
xmax;
309 if (pid) x2 -= hwidth * 0.5 * ((float)pid / (
float)
extra) *
XDRAW /
xmax;
313 cairo_line_to(cr, x2, y1);
314 cairo_move_to(cr, x2, y1);
318 cairo_line_to(cr, x2, y1);
319 cairo_move_to(cr, x2, y1);
320 cairo_line_to(cr, x2, y2);
void draw_curve(cairo_t *cr, int cid, int rid, project *this_proj, int points, ColRGBA withcolor, int xscale, int yscale, int asp, int vdash, double thick, int glyp, double gize, int freq, double hwidth, double hopac, int hpos, int extra, int pid)
draw target curve to the cairo drawing context