77void show_curve (GtkDrawingArea * area, cairo_t * cr,
int width,
int height, gpointer curve)
92 cairo_surface_t * surface;
96 where = this_proj -> curves[rid][cid] -> format;
99 this_proj -> curves[rid][cid] -> format = 0;
104 this_proj -> curves[rid][cid] -> wsize[0] = gtk_widget_get_allocated_width (grwdget);
105 this_proj -> curves[rid][cid] -> wsize[1] = gtk_widget_get_allocated_height (grwdget);
107 this_proj -> curves[rid][cid] -> wsize[0] = width;
108 this_proj -> curves[rid][cid] -> wsize[1] = height;
112 resol[j] = this_proj -> curves[rid][cid] -> wsize[j];
122 surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
resol[0],
resol[1]);
138 cr = cairo_create (surface);
141 cairo_set_source_rgba (cr, this_proj -> curves[rid][cid] -> backcolor.red,
142 this_proj -> curves[rid][cid] -> backcolor.green,
143 this_proj -> curves[rid][cid] -> backcolor.blue, alp);
145 cairo_set_source_rgba (cr, this_proj -> curves[rid][cid] -> backcolor.red,
146 this_proj -> curves[rid][cid] -> backcolor.green,
147 this_proj -> curves[rid][cid] -> backcolor.blue, 1.0);
150 layout = pango_cairo_create_layout (cr);
156 if (this_proj -> curves[rid][cid] ->
autoscale[j])
160 this_proj -> curves[rid][cid] ->
autoscale[j] = FALSE;
162 this_proj -> curves[rid][cid] ->
majt[j] =
scale (this_proj -> curves[rid][cid] -> axmax[j] - this_proj -> curves[rid][cid] -> axmin[j]);
163 this_proj -> curves[rid][cid] -> mint[j] = 2;
166 cxy[j] = this_proj -> curves[rid][cid] -> axmin[j];
168 xmax = this_proj -> curves[rid][cid] -> axmax[0] -
cxy[0];
169 ymax = this_proj -> curves[rid][cid] -> axmax[1] -
cxy[1];
171 if (this_proj -> curves[rid][cid] ->
scale[0])
setup_xaxis_log (cr, this_proj, rid, cid, FALSE);
172 if (this_proj -> curves[rid][cid] ->
scale[1])
setup_yaxis_log (cr, this_proj, rid, cid, FALSE);
178 j = gtk_combo_box_get_active (GTK_COMBO_BOX(
axischoice));
191 CurveExtra * ctmp = this_proj -> curves[rid][cid] -> extrac -> last;
192 for ( j=0 ; j < this_proj -> curves[rid][cid] -> extrac -> extras + 1; j++ )
194 if (this_proj -> curves[rid][cid] -> draw_id == j)
196 if (this_proj -> curves[rid][cid] -> bshift && this_proj -> curves[rid][cid] ->
layout -> aspect && this_proj -> curves[rid][cid] -> extrac -> extras) i ++;
197 k = (this_proj -> curves[rid][cid] ->
layout -> aspect) ? i : 0;
202 this_proj -> curves[rid][cid] -> ndata,
203 this_proj -> curves[rid][cid] ->
layout -> datacolor,
204 this_proj -> curves[rid][cid] ->
scale[0],
205 this_proj -> curves[rid][cid] ->
scale[1],
206 this_proj -> curves[rid][cid] ->
layout -> aspect,
207 this_proj -> curves[rid][cid] ->
layout -> dash,
208 this_proj -> curves[rid][cid] ->
layout -> thickness,
209 this_proj -> curves[rid][cid] ->
layout -> glyph,
210 this_proj -> curves[rid][cid] ->
layout -> gsize,
211 this_proj -> curves[rid][cid] ->
layout -> gfreq,
212 this_proj -> curves[rid][cid] ->
layout -> hwidth,
213 this_proj -> curves[rid][cid] ->
layout -> hopac,
214 this_proj -> curves[rid][cid] ->
layout -> hpos,
215 this_proj -> curves[rid][cid] -> extrac -> extras,
221 if (this_proj -> curves[rid][cid] -> bshift && ctmp ->
layout -> aspect) i++;
222 k = (ctmp ->
layout -> aspect) ? i : 0;
228 ctmp ->
layout -> datacolor,
229 this_proj -> curves[rid][cid] ->
scale[0],
230 this_proj -> curves[rid][cid] ->
scale[1],
233 ctmp ->
layout -> thickness,
240 this_proj -> curves[rid][cid] -> extrac -> extras,
242 if (ctmp -> prev != NULL) ctmp = ctmp -> prev;
247 if (this_proj -> curves[rid][cid] ->
show_axis[1])
249 if (this_proj -> curves[rid][cid] -> axmin[0] < 0.0 && this_proj -> curves[rid][cid] -> axmax[0] > 0.0)
251 cairo_set_line_width (cr, 1.0);
253 cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
254 cairo_move_to (cr,
x_min - this_proj -> curves[rid][cid] -> axmin[0] *
XDRAW /
xmax,
y_min);
255 cairo_line_to (cr,
x_min - this_proj -> curves[rid][cid] -> axmin[0] *
XDRAW /
xmax,
y_max);
260 if (this_proj -> curves[rid][cid] ->
show_axis[0])
262 if (this_proj -> curves[rid][cid] -> axmin[1] < 0.0 && this_proj -> curves[rid][cid] -> axmax[1] > 0.0)
264 cairo_set_line_width (cr, 1.0);
266 cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
267 cairo_move_to (cr,
x_min,
y_min - this_proj -> curves[rid][cid] -> axmin[1] *
YDRAW /
ymax);
268 cairo_line_to (cr,
x_max,
y_min - this_proj -> curves[rid][cid] -> axmin[1] *
YDRAW /
ymax);
282 this_proj -> curves[rid][cid] -> surface = cairo_surface_reference (cairo_get_target (cr));
287 cairo_surface_destroy (surface);
289 else if (where == 2 || where == 4)
291 cairo_show_page (cr);
292 cairo_surface_destroy (surface);
296 cairo_surface_destroy (surface);
298 if (where > 0) cairo_destroy (cr);
299 this_proj -> curves[rid][cid] -> displayed = TRUE;
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