[cairo] Backend API composite_trapezoids question

Per Persson persquare at mac.com
Fri Apr 27 01:52:15 PDT 2007


Hi, 
I've been playing with creating a "toy" backend for a few days and I'm a little confused about the data I receive in the composite_trapezoids() case.
Now, this is most likely a misunderstanding on my part regarding what to expect. I'll show an example of what I mean.

Consider the following cairo snippet

  cairo_set_line_width(cr, 20.0);
  cairo_set_source_rgba (cr, 0.5, 0.5, 0.3, 0.5);
  cairo_move_to (cr, 100.0, 50.0);
  cairo_line_to(cr, 200.0, 250.0);
  cairo_line_to(cr, 150.0, 300.0);
  cairo_line_to(cr, 50.0, 150.0);
  cairo_close_path(cr);
  cairo_stroke(cr);

As far as I understand things, the tessellated path is passed to composite_trapezoids() where I intercept it.
In composite_trapezoids() I naively converted the trapezoids to polygons, but I find that some of the polygons overlap which means that when alpha is lee than one, I get artefacts in the "inner corners" of the rendered path. 

See 
http://homepage.mac.com/persquare/cairo/artefacts.png
for an example of the artefacts, and
http://homepage.mac.com/persquare/cairo/polygons.pdf
for a picture of the polygons derived from the original trapezoids.

Is this behaviour is expected? 
If so, some post-processing of the trapezoids is obviuosly required and I'd be happy if anyone could provide me with pointers to some reasoning how 
this is supposed to work.

Best regards,
Per




More information about the cairo mailing list