[cairo] multiple paths

control H control.h at gmail.com
Mon Nov 5 05:56:20 PST 2007


Hi,

I have a list of measured values and want to plot them. For every x_i
from the list I do cairo_line_to(i,x_i) and when I've processed the
whole list I stroke. Simple.

However, every x_i also has its own variance. And I want to plot a
variance band around the line connecting the x_i's. For the code to be
as efficient as possible I thought it's best when I iterate through
the list of x_i's only once.

I was thinking of a solution like this: make 3 cairo paths. For every
x_i, line_to in path1, line_to(i,x_i - variance_x_i) in path2 and
line_to (i,x_i + variance_x_i) in path three. At the end, stroke
path1, reverse path3, concat path3 to path2 and close path2, stroke
path2.

Now for the questions:
first: how to make these paths in cairo
second: is this the way to do it? Or is it really clumsy? I feel I'm
missing something.

thanks for your input,
CH


More information about the cairo mailing list