[cairo] How to simulate a LineDDA of Windows GDI?

Dirk Schönberger dirk.schoenberger at sz-online.de
Mon Feb 13 04:22:11 PST 2006


> How to simulate a LineDDA of Windows GDI?
>
> The LineDDA function determines which pixels should be highlighted for a
> line defined by the specified starting and ending points.
>
> The LineDDA function passes the coordinates for each point along the line,
> except for the line's ending point, to the application-defined callback
> function. In addition to passing the coordinates of a point, this function
> passes any existing application-defined data.
>
> The coordinates passed to the callback function match pixels on a video
> display only if the default transformations and mapping modes are used.

I found an example for LineDDA at
http://www.codeguru.com/Cpp/G-M/gdi/article.php/c135/

Seems like the function works on linesegments (of a polygon, or
polygonized vector path) and executes a callback at each point of of this
polygon.
I assume, that in Cairo, you could flatten your vector path
(http://www.cairographics.org/manual/cairo-Paths.html#cairo-copy-path-flat)
and iterate over the resulting lineto segments (see the sample code at
http://www.cairographics.org/manual/cairo-Paths.html#cairo-copy-path-flat )

I assume this could be refactored into a utility function, if really needed.

Regards
Dirk


More information about the cairo mailing list