[cairo] [Fwd: Re: Uniform Line Widths]

Bill Spitzak spitzak at thefoundry.co.uk
Fri Feb 22 10:38:00 PST 2008



I think what is being requested here is that the pen not change when the
ctm changes. Instead the pen is transformed by the ctm at the moment it
is specified and remains constant size after that. Currently the pen is
transformed by the ctm each time it is used.

I would also like to see this (along with a matching fix for fonts,
which I consider a good deal more important as it is currently
impossible to use the Cairo ctm to position labels without also
transforming the text). Carl certainly discussed it too and was thinking
of making this change but this was dropped?

Problems:

1. It does not match PostScript/PDF. This would require the CTM to be
applied by the cairo PDF/PostScript backend rather than transforms being
sent unchanged through.

2. It is not compatable with the current Cairo (however it is possible
that the set of things it is incompatable with is very small or that
they are producing the wrong output now and the users have not noticed).
Or a switch can be provided as part of the graphics state.

3. Need an api to query and set the line width using a 2x2 matrix.

Advantages:

1. It matches almost every other graphics api that is not based on
PostScript, such as GDI+

2. It is a lot more useful, as it allows the CTM to be used for other
purposes than just scaling a page to fit in a window. For instance an
illustrator type program can use the cairo transforms.

3. It may be more efficient to implement as things can be turned into
device resolution immediately and stored that way.

4. It is pretty much a requirement if the CTM is ever expanded to allow
3D or other non-affine transforms.

Bobby Salazar wrote:
> Ok, that is much simpler than I thought, and works good too.
> 
> However, my code is written so that the pre-set line width is correct for the currently applied transformation matrix. If I then set the transformation matrix to be the identity matrix, the line width is not correct. Is there an equally simple method of mapping a certain line width from any arbitrary transformation matrix into the same pixel sized width it would if the identity matrix were used? I hope that last sentenced makes sense...



More information about the cairo mailing list