[cairo] Getting started

Mike Emmel mike.emmel at gmail.com
Mon Jul 25 08:33:10 PDT 2005


On 7/25/05, Vladimir Vukicevic <vladimirv at gmail.com> wrote:
> On 7/25/05, Behdad Esfahbod <behdad at cs.toronto.edu> wrote:
> >   - Do not translate.
> >
> >   - For drawing lines, set width to 1 and add +0.5,+0.5 to all
> > points.
> 
> You don't want +0.5,+0.5 to all points though, especially not for
> horizontal/vertical lines.  (See my original reply.)  However, in
> thinking about it, if you use CAIRO_LINE_CAP_SQUARE (instead of the
> default BUTT), then adding +0.5,+0.5 should give you correct (and
> still fast) results.
> 
> >   - When drawing filled stroked rectangles, do not use the same
> > path for both fill and stroke.  Use integer coordinates for the
> > fill, and half-off coordinates for the stroke.  This is the only
> > way to avoid alpha-blending.
> >
> > I wish there was a way to have a fill+stroke to use the same path
> > and still be fast, but I that's only an issue with axis-aligned
> > rectangles.
> 
> Yeah, this is a bit of a pain.  To be more accurate, you want integer
> coordinates for fill or for even line widths, and you want offset
> coordinates for odd line widths.  I don't think there's a good way
> around this though, unfortunately.
> 

It looks to me that for cairo a header with some static inline
functions for setting up  simple fast path drawing may help ?

At least and example of how to setup to ensure the simple/fast paths are run ?

I think it would really help people porting to cairo get there simple
code ported rapidly without experiencing a lot of slowdown. There is a
lot of experience here thats generally useful.

Mike



More information about the cairo mailing list