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

Behdad Esfahbod behdad at behdad.org
Fri Feb 22 12:55:50 PST 2008

On Fri, 2008-02-22 at 15:44 -0500, Carl Worth wrote:
> And this is API that needs a concrete proposal, (though we may have
> gotten pretty close in the discussions long ago).
> I like the naming idea of using "set/get_pen" for the new API and that
> "set/get_line_width" would be convenience functions on top of those.

cairo_[sg]et_pen_matrix (cairo_t        *cr,
			 cairo_matrix_t *pen_matrix);

The translation component of matrix will simply shift the pen, like it
does for font_matrix and pattern matrix.

cairo_get_line_width() then will be changed to return
sqrt(det(pen_matrix)).  That's a direction-netural variant of what a
imaginary cairo_get_font_size() would return too...

Trickier would be dash offsets.  Would be cool to be able to have dash
matrix separate from pen matrix, eh?  Not sure, maybe we should lock
dash matrix at time of cairo_set_dash() too...  Who knows...

Fixing this for text is even trickier.  When do you lock the ctm?!  At
cairo_set_font_size(), sure.  At cairo_set_font_matrix() too?!  That
kinda doesn't sound right, but makes some sense...  I'll discuss that
more when we consider this change...


> -Carl
> > Advantages:
> ...
> Another big advantage would be that "locking" the pen like this would
> be semantically similar to the locking we already do for
> cairo_set_source.
> So I do agree that this is something we want to do.
> -Carl

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list