[cairo] Fwd: Re: Uniform Line Widths

Bill Spitzak spitzak at thefoundry.co.uk
Fri Feb 22 13:55:03 PST 2008



I am very glad to see that this proposal is still being considered. And
yes I do need to work on it. I suspect that interest in fltk is dying
off and I should concentrate on this instead if I want to do something
productive.

Behdad Esfahbod wrote:
>> 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.

Or I think it could be ignored, as that is what is done for font matrix,
right? In any case it should be the same as font matrix.

> 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...

I was thinking that the dash pattern is drawn in "pen space" and thus
when you pick a larger pen (using the new pen_matrix calls) you get
larger dashes as well. For back-compatability the set_line_width would
rescale the dash pattern.

I think there could be some advantage in having the stroking algorithim
work this way in a space where the pen can be assumed to be a 1-unit
circle, but am not sure. There is a problem in that if the pen is an
ellipse the dashes would also be unequal in length depending on the
direction, but I think this is compatible with current Cairo and may be
desirable if arbitrary end cap shapes are allowed. I suspect also things
like mitre limit will produce different size points when the pen is an
ellipse, but again compatible with the current version.

> 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...

I'm pretty certain it would be done at the time of the set_font_matrix.
I believe font_size should be a convinence wrapper over this, just as
you are proposing for the pen.



More information about the cairo mailing list