[cairo] Problems with cairo_get_line_width and "new" semantics

Behdad Esfahbod behdad at cs.toronto.edu
Tue May 16 15:35:03 PDT 2006


On Tue, 16 May 2006, Bill Spitzak wrote:

> Better proposal for dashes to make pens only be a matrix:
>
> The gstate has a "pen space" where the pen is a 1-unit diameter circle
> or square. The "penCTM" transforms from pen space to the device. There
> is also a current dash pattern, measured in pen diameters (and thus in
> 1-unit lengths in pen space). There is also a number called "dashscale"
> which does not effect drawing and is provided for back-compatability.
>
> Stoking a path is done by transforming the path to pen space. The line
> cap and dash pattern are used to figure out the border paths in pen
> space. These paths are then transformed to device space and filled.

All very well.  Except for:

> cairo_set_pen(cairo_t*, const cairo_matrix_t*) multiplies the matrix by
> the CTM and changes the penCTM to that. The dash pattern and dashscale
> are unchanged.
>
> cairo_get_pen(cairo_t*, cairo_matrix_t*) returns the penCTM divided by
> the current CTM.

I prefer cairo_[gs]et_pen_matrix instead.  That is more
consistent with font_matrix functions, and is more extensible.
(say we may want to add cairo_set_pen_path in the future...)


--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
	-- Dan Bern, "New American Language"


More information about the cairo mailing list