[cairo] Is there a function that is similar with the LineDDAfunction of GDI in cairo?

Bill Spitzak spitzak at d2.com
Mon Feb 13 13:03:55 PST 2006



Dirk Schönberger wrote:
>>I've  been working on an application referring to cairographic.
>>I am hoping to using a function that is similar with the LineDDA
>>of the GDI(which provide by microsoft) in cariographics, the
>>function can draw segment of line, and it can replace the simple
>>line with some other line styles(in other words, the line drawn by the
>>function can assemble some line patterns).
> 
> 
> Do you mean something like cairo_set_dash
>  http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-dash
> resp. http://www.cairographics.org/samples/xxx_dash.html )

No, what he wants it to draw arbitrary stuff repeatedly along a path.
This is certainly useful but can be done with a user-space function,
that maybe somebody should write and provide with Cairo.

This function would have to use cairo_copy_path_flat and then iterate
through the segments and call a user-provided callback that would draw
the glyph at the correct position and rotation.

Arguments to the function would be the callback, arbitrary data to pass
to the callback, and a length which determines how long each segment
should be. The implementation would not be trivial, as the segments
returned by path_flat might be smaller or larger than the desired length
so they don't correspond 1:1.

There is also a huge amount of interest in putting text along a path, in
this case the length depends on the letter. Also in knowing the total
length of a path so that the text or glyphs can be spread evenly along
it. Not sure if this should be done with more complex arguments to the
above function, or with different implementations.


More information about the cairo mailing list