[cairo] [RFC] Add device_extents api

Bill Spitzak spitzak at thefoundry.co.uk
Thu Mar 26 17:52:14 PDT 2009


Behdad Esfahbod wrote:
> On 03/26/2009 04:30 PM, Robert O'Callahan wrote:
>> On Fri, Mar 27, 2009 at 8:12 AM, Behdad Esfahbod <behdad at behdad.org
>> <mailto:behdad at behdad.org>> wrote:
>>
>>     What I like to see is Mozilla come up with a proposed patch that
>>     makes you happy and is in line with cairo's API guidelines.  Carl
>>     and I have said numerous times that making stroke width locking is
>>     how we'd like to see this solved, and there have been patches for it
>>     before.  So all needed is for someone to sit down and finish them.
>>       Makes sense?
>>
>> That makes sense. It wasn't clear to me that there was a decision that
>> stroke width locking is the right way to go.
>>
>> Is this the latest word on desired API?
>> http://lists.cairographics.org/archives/cairo/2006-May/006985.html
>> That proposal changes cairo_set_line_width to lock to the current CTM.
>> Is that behaviour change still acceptable to you and Carl at this point?
> 
> Yes, that is my impression.  Last time someone gave this a shot, the remaining 
> problem was how to handle dash offsets in a backward compatible way.  One way 
> to deal with that is to lock a separate dash matrix at the time of 
> cairo_set_dash().  In that case, cairo_[sg]et_dash_matrix() may also be 
> desirable.  cairo_get_pen_width() also needs adjustment to return an 
> approximation of the pen matrix in the current CTM.

I think actually there only needs to be a pen matrix, and the dash 
pattern is always defined to be in pen space. This should eliminate a 
lot of complexity as the line ends, joins, and dash pattern are all in 
the same space. You could do stroke by inverse transforming the path by 
the pen matrix, drawing everything including the dash pattern and line 
joins and ends as though the pen is a 1 unit circle, then transforming 
the result back to get the outline.

For back-compatibility there probably needs to be a "dash scale" which 
scales the current dash pattern. Setting the pen width would change dash 
scale to 1/width.

-- 
Bill Spitzak, Senior Software Engineer
The Foundry, 618 Hampton Drive, Venice, CA, 90291, USA
Tel: +1 310 399-4555 * Fax: +1 310 450-4516 * Web: www.thefoundry.co.uk
The Foundry Visionmongers Ltd * Registered in England and Wales No: 4642027


More information about the cairo mailing list