[cairo] Line widths and coordinate system transformations
simon at budig.de
Thu Jun 5 06:27:41 PDT 2008
Holger Berndt (berndth at gmx.de) wrote:
> I am aware that I could achieve that by using the same scale in x and y
> direction. However, that would make drawing much harder, as I would
> have to do the transformations for each point individually and
> manually, which is something that I'd really, really like to avoid.
> In particular, this very same effect seems to imply that it is not
> possible to draw an ellipse outline with constant line width with
> Cairo. Is that correct?
No, You can change the transformation between the path-creating commands
and the cairo_stroke(). That way the geometry of the pen for the stroke
can be changed without changing its placement. We do this in gimp to
achieve constant-width strokes even in images with different X- and
Y-DPI (and a stroke width specified in a real-world-unit).
Getting it right might need a bit fiddeling, but if you want to have
pixel based measurement cairo_device_to_user_distance() comes in handy
at that point.
I hope this helps,
simon at budig.de http://simon.budig.de/
More information about the cairo