[cairo] Cairo and ISO C++

Ray Gardener rayg at daylongraphics.com
Tue Jan 14 23:51:52 PST 2014


On 1/14/2014 3:10 PM, Bill Spitzak wrote:
>
> PRESERVE PATH
>
> I would have filling/stroking a path not clear the path, but instead 
> put cairo in a state so the next moveto/lineto will clear the path. 
> This will allow fill, stroke to work like users expect, and by 
> removing the "preserve" calls reduce the size of the api.
>
As a general design rule, it's nice if functions have minimal or no side 
effects. There is an explicit way to clear the path: newpath.

You could add a new function: setpostpaintbehavior(enum { 
clearcurrentpath, preservecurrentpath });

By default, the post-paint behavior does what it currently does, which 
is to clear the current path after fill/stroke. But the user can change 
it to preserve the path. The "preserve" APIs could then be dropped. The 
arg is an enum so a CLEAR_PATH_ON_NEXT_MOVETO could be added too, if you 
want that behavior.

Ray



More information about the cairo mailing list