For my application, I am writing a custom xy-plot widget into which I can draw some lines and curves using Cairo. To get rid of permanent manual coordinate transformations, it is very handy to translate and scale the drawing coordinate system into alignment with the plot axis. This works very well. I have, however, an problem with the resulting line width. Usually, x and y axis are not equally scaled which results in the pen having different widths depending on the direction of the line. I have attached a sample screenshot to illustrate the problem (I hope that's okay with the list -- it's really tiny). In this example, the horizontal axis goes from 0 to 9, whereas the vertical axis goes from 0 to 1. Consequently, lines that are drawn horizontally are much thicker than vertical lines (the requested line width with Cairo::Context::set_line_width() remained unchanged). What I would like to have constant user-visible line widths in all directions. As a bonus, it would also be nice to specify a constant line width in pixels, completely independant of the scaling. But that'd really be a bonus -- for now, I'd already be happy with scale-dependant but direction-independant line widths. 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. Thanks in advance for any comments, Holger
Attachment:
line_width.png
Description: PNG image